Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add common labels to etcd services #537

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

subnix
Copy link
Contributor

@subnix subnix commented Mar 6, 2024

Any vtop object contains common labels (component, cluster) except etcd services, but the labels may be necessary for other k8s components (e.g. ServiceMonitor).

Before the patch:

$ kubectl get svc -l 'etcd.planetscale.com/lockserver' -o 'custom-columns=name:.metadata.name,labels:.metadata.labels'
name                        labels
test-etcd-ea36c7ce-client   map[etcd.planetscale.com/lockserver:test-etcd-ea36c7ce]
test-etcd-ea36c7ce-peer     map[etcd.planetscale.com/lockserver:test-etcd-ea36c7ce]

After the patch:

$ kubectl get svc -l 'etcd.planetscale.com/lockserver' -o 'custom-columns=name:.metadata.name,labels:.metadata.labels'
name                        labels
test-etcd-ea36c7ce-client   map[etcd.planetscale.com/lockserver:test-etcd-ea36c7ce planetscale.com/cluster:test planetscale.com/component:etcd]
test-etcd-ea36c7ce-peer     map[etcd.planetscale.com/lockserver:test-etcd-ea36c7ce planetscale.com/cluster:test planetscale.com/component:etcd]

Copy link
Collaborator

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

Thank you, @subnix ! This seems like a safe and reasonable addition.

We don't have any tests here though... in lieu of that, could you please add something in the description that clearly demonstrates what the labels looked like (an example is fine) before and when they now look like in the PR branch? That's my only request -- doesn't have to be much.

@subnix
Copy link
Contributor Author

subnix commented Mar 7, 2024

@mattlord I've built a docker image, so you can reproduce it.

$ kubectl apply -f ./test/endtoend/operator/operator.yaml
$ kubectl apply -f ./test/endtoend/operator/101_initial_cluster.yaml
$ sleep 1m
$ kubectl get svc -l 'etcd.planetscale.com/lockserver' -o 'custom-columns=name:.metadata.name,labels:.metadata.labels'
name                           labels
example-etcd-faf13de3-client   map[etcd.planetscale.com/lockserver:example-etcd-faf13de3]
example-etcd-faf13de3-peer     map[etcd.planetscale.com/lockserver:example-etcd-faf13de3]
$ sed -E -i '' 's|planetscale/vitess-operator:.*|ghcr.io/subnix/vitess-operator:etcd-service-labels|g' ./test/endtoend/operator/operator.yaml
$ kubectl apply -f ./test/endtoend/operator/operator.yaml
$ sleep 1m
$ kubectl get svc -l 'etcd.planetscale.com/lockserver' -o 'custom-columns=name:.metadata.name,labels:.metadata.labels'
name                           labels
example-etcd-faf13de3-client   map[etcd.planetscale.com/lockserver:example-etcd-faf13de3 planetscale.com/cluster:example planetscale.com/component:etcd]
example-etcd-faf13de3-peer     map[etcd.planetscale.com/lockserver:example-etcd-faf13de3 planetscale.com/cluster:example planetscale.com/component:etcd]

Copy link
Collaborator

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution, @subnix !

@frouioui
Copy link
Member

Thank you for this nice contribution @subnix 🥳

@frouioui frouioui merged commit adbd328 into planetscale:main Mar 14, 2024
9 checks passed
@subnix subnix deleted the fix/etcd-setvices-labels branch March 22, 2024 07:40
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.

3 participants