From 0d1c22a506d6d3d61155dc145453eb4b2d3b3bbb Mon Sep 17 00:00:00 2001 From: Marcin Owsiany Date: Mon, 7 Sep 2026 11:56:08 +0200 Subject: [PATCH 1/2] feat: support overriding metadata.annotations --- internal/deployer/config.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/deployer/config.go b/internal/deployer/config.go index a8d5df2..19e8ddf 100644 --- a/internal/deployer/config.go +++ b/internal/deployer/config.go @@ -187,6 +187,7 @@ type CentralConfig struct { DeployTimeout time.Duration `yaml:"deployTimeout,omitempty"` PortForwarding *bool `yaml:"portForwarding,omitempty"` EarlyReadiness *bool `yaml:"earlyReadiness,omitempty"` + MetadataAnnotations map[string]string `yaml:"metadataAnnotations,omitempty"` Spec map[string]interface{} `yaml:"spec,omitempty"` AddOns map[string]bool `yaml:"addOns,omitempty"` @@ -321,9 +322,12 @@ func (c *CentralConfig) CustomResource() (map[string]interface{}, error) { } } if err := helpers.DeepMerge(cr, map[string]interface{}{ + "metadata": map[string]interface{}{ + "annotations": c.MetadataAnnotations, + }, "spec": c.Spec, }); err != nil { - return nil, fmt.Errorf("merging spec into Central CR: %w", err) + return nil, fmt.Errorf("merging metadata annotations and spec into Central CR: %w", err) } return cr, nil } @@ -337,6 +341,7 @@ type SecuredClusterConfig struct { PauseReconciliation *bool `yaml:"pauseReconciliation,omitempty"` DeployTimeout time.Duration `yaml:"deployTimeout,omitempty"` EarlyReadiness *bool `yaml:"earlyReadiness,omitempty"` + MetadataAnnotations map[string]string `yaml:"metadataAnnotations,omitempty"` Spec map[string]interface{} `yaml:"spec,omitempty"` } @@ -421,9 +426,12 @@ func (s *SecuredClusterConfig) CustomResource() (map[string]interface{}, error) } if err := helpers.DeepMerge(cr, map[string]interface{}{ + "metadata": map[string]interface{}{ + "annotations": s.MetadataAnnotations, + }, "spec": s.Spec, }); err != nil { - return nil, fmt.Errorf("merging spec into SecuredCluster CR: %w", err) + return nil, fmt.Errorf("merging metadata annotations and spec into SecuredCluster CR: %w", err) } return cr, nil } From 3706a9d416e1170b8982ff7f252fa5ca4fca9d01 Mon Sep 17 00:00:00 2001 From: Marcin Owsiany Date: Tue, 8 Sep 2026 07:43:34 +0200 Subject: [PATCH 2/2] Nest annotations in metadata. --- internal/deployer/config.go | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/internal/deployer/config.go b/internal/deployer/config.go index 19e8ddf..1946de0 100644 --- a/internal/deployer/config.go +++ b/internal/deployer/config.go @@ -187,13 +187,18 @@ type CentralConfig struct { DeployTimeout time.Duration `yaml:"deployTimeout,omitempty"` PortForwarding *bool `yaml:"portForwarding,omitempty"` EarlyReadiness *bool `yaml:"earlyReadiness,omitempty"` - MetadataAnnotations map[string]string `yaml:"metadataAnnotations,omitempty"` + Metadata CRMetadata `yaml:"metadata,omitempty"` Spec map[string]interface{} `yaml:"spec,omitempty"` AddOns map[string]bool `yaml:"addOns,omitempty"` AvailableAddOns map[string]CentralAddOnDefinition `yaml:"availableAddOns,omitempty"` } +// CRMetadata holds overridable metadata settings for a CR. +type CRMetadata struct { + Annotations map[string]string `yaml:"annotations,omitempty"` +} + func (c *CentralConfig) EarlyReadinessEnabled() bool { return c.EarlyReadiness != nil && *c.EarlyReadiness } @@ -322,12 +327,10 @@ func (c *CentralConfig) CustomResource() (map[string]interface{}, error) { } } if err := helpers.DeepMerge(cr, map[string]interface{}{ - "metadata": map[string]interface{}{ - "annotations": c.MetadataAnnotations, - }, - "spec": c.Spec, + "metadata": c.Metadata, + "spec": c.Spec, }); err != nil { - return nil, fmt.Errorf("merging metadata annotations and spec into Central CR: %w", err) + return nil, fmt.Errorf("merging metadata and spec into Central CR: %w", err) } return cr, nil } @@ -341,7 +344,7 @@ type SecuredClusterConfig struct { PauseReconciliation *bool `yaml:"pauseReconciliation,omitempty"` DeployTimeout time.Duration `yaml:"deployTimeout,omitempty"` EarlyReadiness *bool `yaml:"earlyReadiness,omitempty"` - MetadataAnnotations map[string]string `yaml:"metadataAnnotations,omitempty"` + Metadata CRMetadata `yaml:"metadata,omitempty"` Spec map[string]interface{} `yaml:"spec,omitempty"` } @@ -426,12 +429,10 @@ func (s *SecuredClusterConfig) CustomResource() (map[string]interface{}, error) } if err := helpers.DeepMerge(cr, map[string]interface{}{ - "metadata": map[string]interface{}{ - "annotations": s.MetadataAnnotations, - }, - "spec": s.Spec, + "metadata": s.Metadata, + "spec": s.Spec, }); err != nil { - return nil, fmt.Errorf("merging metadata annotations and spec into SecuredCluster CR: %w", err) + return nil, fmt.Errorf("merging metadata and spec into SecuredCluster CR: %w", err) } return cr, nil }