Skip to content

Namespace references should default to the current namespace #1699

@james-callahan

Description

@james-callahan

Is your feature request related to a problem?

Currently if you don't specify a namespace then you get the default namespace.
This is rarely desired and means there's a easy place to forget changing a namespace as you deploy resources to a different namespace
e.g. in a rds.services.k8s.aws/v1alpha1 DBInstance the masterUserPassword is a reference to a Secret

apiVersion: rds.services.k8s.aws/v1alpha1
kind: DBInstance
metadata:
  name: mydb
  namespace: foo
spec:
  dbInstanceIdentifier: mydb
  dbSubnetGroupName: mysubnet
  engine: postgres
  engineVersion: "14.6"
  masterUsername: root
  masterUserPassword:
    namespace: foo # if not provided, uses the `default` namespace
    name: mysecret
    key: PGPASS

Describe the solution you'd like
When there is a namespace field in a reference and it is not set, use the namespace of the current resource.

Describe alternatives you've considered

  • Make the namespace field required instead of optional.

Metadata

Metadata

Assignees

Labels

area/code-generationIssues or PRs as related to controllers or docs code generationarea/runtimeIssues or PRs as related to controller runtime, common reconciliation logic, etcgood first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions