Skip to content

Add common helpers for slug generation, labels, naming - #18

Merged
dcmcand merged 1 commit into
mainfrom
task-3/common-helpers
Mar 26, 2026
Merged

dcmcand merged 1 commit into
mainfrom
task-3/common-helpers

Conversation

@dcmcand

@dcmcand dcmcand commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Slugify function for generating DNS-safe subdomains from model names (lowercase, sanitize, truncate with hash suffix)
  • StandardLabels for consistent K8s labeling across all operator-created resources
  • SetOwnerReference wrapper for controller-runtime
  • Naming helpers: APIKeySecretName, APIKeyMetadataConfigMapName, ExternalHostname

All functions have table-driven tests (93.3% coverage).

Test plan

  • cd operator && go test ./internal/controller/reconcilers/ -v - all 8 tests pass
  • cd operator && make test - full suite passes

Implements Slugify, StandardLabels, SetOwnerReference, APIKeySecretName,
APIKeyMetadataConfigMapName, and ExternalHostname used by all reconcilers.
Slugify truncates long names to 48-char prefix + 8-char SHA-256 hash suffix.
@dcmcand
dcmcand merged commit 0f57367 into main Mar 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant