Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions internal/deployer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

wondering about potential related use-cases in the future -- should we maybe
make this a nested central.metadata.annotations?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It crossed my mind, but I'm wondering if existence of central.metadata might make people incorrectly think anything in there is settable? 🤔

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not saying that we have to do it this way, but I believe that this is something that should be coverable by docs and if people make wrong assumptions based on that... well. 🤷

Spec map[string]interface{} `yaml:"spec,omitempty"`

AddOns map[string]bool `yaml:"addOns,omitempty"`
Expand Down Expand Up @@ -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
}
Expand All @@ -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"`
}

Expand Down Expand Up @@ -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
}
Expand Down
Loading