zalando / zalando/postgres-operator

Feature request: Read CronJob secrets from different namespace than the cluster's

Open
#3,067 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.