Skip to content

feat(gcpnfsbackup): change AccessibleFrom to discriminated union struct#1723

Open
dushanpantic wants to merge 3 commits intokyma-project:mainfrom
dushanpantic:gcp-backup-refactor
Open

feat(gcpnfsbackup): change AccessibleFrom to discriminated union struct#1723
dushanpantic wants to merge 3 commits intokyma-project:mainfrom
dushanpantic:gcp-backup-refactor

Conversation

@dushanpantic
Copy link
Contributor

Description

Refactors accessibleFrom field in GcpNfsVolumeBackup and GcpNfsBackupSchedule from []string with magic "all" value to a discriminated union struct with type and targets fields.

Motivation
The previous API used a magic string "all" mixed with regular shoot IDs, which had several issues:

  • Poor discoverability: Users had to know the magic value exists
  • Complex validation: CEL rules needed to check "all" isn't combined with other values
  • No IDE support: No autocompletion or type hints for valid options
  • Ambiguous semantics: Is "all" a shoot name or a special keyword?

The new design follows established Kubernetes API patterns where a type field discriminates behavior:

K8s Resource Type Field Pattern
Service type: ClusterIP|NodePort|LoadBalancer Type determines which fields are valid
Ingress pathType: Exact|Prefix|ImplementationSpecific Type changes path interpretation
HPA metrics[].type: Resource|Pods|Object|External Type selects metric source struct

Changes proposed in this pull request:

  • API: New AccessibleFrom struct with Type enum (All/Specific) and Targets slice
  • CEL validation ensures targets required when Specific, empty when All
  • Updated SKR reconcilers (v1/v2), backup schedule, test DSL, and controller tests
  • Updated user documentation

Migration
Before:

accessibleFrom: ["all"]

After:

accessibleFrom:
  type: All

Before:

accessibleFrom: ["shoot-1", "shoot-2"]

After:

accessibleFrom:
  type: Specific
  targets:
    - shoot-1
    - shoot-2

Related issue(s)

@dushanpantic dushanpantic requested review from a team as code owners February 26, 2026 13:49
@hyperspace-insights
Copy link
Contributor

Control Panel

Hi, I'm an AI-powered Review Bot that helps you with summarizing and reviewing pull requests.
To interact with me, just use the following actions:

  • 📝 Summarize PR
  • 🔍 Agentic Review
  • 🗑️ Delete all bot comments and reviews

💌 Have ideas or want to contribute? Create an issue and share your thoughts with us!
📑 Check out the documentation for more information.
📬 Subscribe to the Hyperspace PR Bot DL to get the latest announcements and pilot features!

Made with ❤️ by Hyperspace.

stekik
stekik previously approved these changes Feb 27, 2026
@dushanpantic dushanpantic added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants