Skip to content

role secret labels and lookups ignored cluster type - #688

Open
magic-peach wants to merge 1 commit into
projectsveltos:mainfrom
magic-peach:fix/role-secret-cluster-type-label
Open

magic-peach wants to merge 1 commit into
projectsveltos:mainfrom
magic-peach:fix/role-secret-cluster-type-label

Conversation

@magic-peach

Copy link
Copy Markdown
Contributor

CreateSecret, GetSecret, DeleteSecret and GetKubeconfig in lib/roles all take a clusterType argument but never used it, so the Secret storing a RoleRequest kubeconfig was never labeled with its cluster type and lookups matched on cluster name and service account alone. A Cluster and a SveltosCluster sharing the same name and namespace could end up reading or deleting each other's secret.

Adds a role-cluster-type label, sets it when the secret is created, and includes it in the label selector used everywhere secrets are looked up.

Tested with go build, go vet and go test ./lib/roles/..., all passing.

CreateSecret, GetSecret, DeleteSecret and GetKubeconfig in lib/roles all
took a clusterType argument but never used it, so the Secret storing a
RoleRequest kubeconfig was never labeled with its cluster type and
lookups matched on cluster name and service account alone. A Cluster
and a SveltosCluster sharing the same name and namespace could end up
reading or deleting each other's secret.

Add a role-cluster-type label, set it when the secret is created, and
include it in the label selector used everywhere secrets are looked up.

Signed-off-by: Akanksha Trehun <akankshatrehun@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant