Skip to content

Conversation

@cbarbian-sap
Copy link
Contributor

Add the following types:

type ConfigMapReference struct {
	// +required
	Name string            `json:"name"`
}

type ConfigMapKeyReference struct {
	// +required
	Name string `json:"name"`
	// +optional
	Key   string `json:"key,omitempty"`
}

type SecretReference struct {
	// +required
	Name string            `json:"name"`
}

type SecretKeyReference struct {
	// +required
	Name string `json:"name"`
	// +optional
	Key   string `json:"key,omitempty"`
}

that may be used in component spec definitions. References configmaps/secrets (resp. keys) will be auto-loaded in the post-read hook phase of each reconcile pass; loaded content can be retrieved by the Data() resp. Value() methods of the ref types.

Notes:

  • component specs must use pointers to the above reference types
  • absence of referenced configmaps/secrets (resp. keys) will lead to a reconcile error (leading to reconcile backoff)
  • fallback keys can be specified as struct tag on the according field, such as
    type KubeConfigSpec struct {
      SecretRef SecretKeyReference `json:"secretRef" fallbackKeys:"value,value.yaml,value.yml"`
    }

@TheBigElmo TheBigElmo self-assigned this Jan 3, 2024
Copy link

@TheBigElmo TheBigElmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@cbarbian-sap cbarbian-sap merged commit a3b2215 into main Jan 3, 2024
@cbarbian-sap cbarbian-sap deleted the resolvable-refs branch January 3, 2024 10:35
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.

3 participants