zalando / zalando/postgres-operator
Feature request: Read CronJob secrets from different namespace than the cluster's
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 5.2k
- Forks
- 1.1k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 3
Description
The CronJobEnvironmentSecretVariables are being read from the cluster namespace by default: https://github.com/zalando/postgres-operator/blob/master/pkg/cluster/k8sres.go#L1205
Should it be possible to define a namespace override for this secret, to prevent secret duplication if multiple clusters to multiple namespace haven been deployed?
Proposal:
type LogicalBackup struct {
LogicalBackupCronjobEnvironmentSecret string `name:"logical_backup_cronjob_environment_secret" default:""`
LogicalBackupCronjobEnvironmentSecretNamespace string `name:"logical_backup_cronjob_environment_secret_namespace" default:""`
}
func (c *Cluster) getCronjobEnvironmentSecretVariables() ([]v1.EnvVar, error) {
// [..]
var secretNamespace string
if c.OpConfig.LogicalBackupCronjobEnvironmentSecretNamespace == "" {
secretNamespace = c.OpConfig.LogicalBackupCronjobEnvironmentSecretNamespace
} else {
secretNamespace = c.Namespace
}
secret, err := c.KubeClient.Secrets(secretNamespace).Get(
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pkg/cluster/k8sres.go around the getCronjobEnvironmentSecretVariables implementation at line 1205, then locate the LogicalBackup configuration definition. Add support for an optional secret namespace override while preserving the cluster namespace default, and verify that CronJobs read the environment secret from the selected namespace.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- devops, infrastructure
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100