Skip to content

Commit

Permalink
Merge pull request #93 from srl-labs/chore/k8s-app-label
Browse files Browse the repository at this point in the history
chore: add app.kubernetes.io/name label to manager and launcher deployments
  • Loading branch information
carlmontanari authored Jan 8, 2024
2 parents 10d52dc + f9e1051 commit c9e0955
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions charts/clabernetes/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
revision: "{{ .Release.Revision }}"
app.kubernetes.io/name: "{{ .Values.appName }}-manager"
clabernetes/app: {{ .Values.appName }}
clabernetes/name: "{{ .Values.appName }}-manager"
clabernetes/component: manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
release: release-name
heritage: Helm
revision: "1"
app.kubernetes.io/name: "clabernetes-plus-clicker-manager"
clabernetes/app: clabernetes-plus-clicker
clabernetes/name: "clabernetes-plus-clicker-manager"
clabernetes/component: manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
release: release-name
heritage: Helm
revision: "1"
app.kubernetes.io/name: "clabernetes-manager"
clabernetes/app: clabernetes
clabernetes/name: "clabernetes-manager"
clabernetes/component: manager
Expand Down
4 changes: 4 additions & 0 deletions constants/labels.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package constants

const (
// LabelKubernetesName is the key for the standard kubernetes app.kubernetes.io/name label --
// some tools use this label so we want to put it on all the deployments we spawn.
LabelKubernetesName = "app.kubernetes.io/name"

// LabelApp is the label key for the simple app name.
LabelApp = "clabernetes/app"

Expand Down
9 changes: 5 additions & 4 deletions controllers/topology/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ func (r *DeploymentReconciler) renderDeploymentBase(
deploymentName := fmt.Sprintf("%s-%s", owningTopologyName, nodeName)

selectorLabels := map[string]string{
clabernetesconstants.LabelApp: clabernetesconstants.Clabernetes,
clabernetesconstants.LabelName: deploymentName,
clabernetesconstants.LabelTopologyOwner: owningTopologyName,
clabernetesconstants.LabelTopologyNode: nodeName,
clabernetesconstants.LabelKubernetesName: deploymentName,
clabernetesconstants.LabelApp: clabernetesconstants.Clabernetes,
clabernetesconstants.LabelName: deploymentName,
clabernetesconstants.LabelTopologyOwner: owningTopologyName,
clabernetesconstants.LabelTopologyNode: nodeName,
}

labels := map[string]string{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"namespace": "clabernetes",
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand All @@ -17,6 +18,7 @@
"replicas": 1,
"selector": {
"matchLabels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand All @@ -27,6 +29,7 @@
"metadata": {
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"namespace": "clabernetes",
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand All @@ -17,6 +18,7 @@
"replicas": 1,
"selector": {
"matchLabels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand All @@ -27,6 +29,7 @@
"metadata": {
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"namespace": "clabernetes",
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand All @@ -17,6 +18,7 @@
"replicas": 1,
"selector": {
"matchLabels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand All @@ -27,6 +29,7 @@
"metadata": {
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"namespace": "clabernetes",
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand All @@ -17,6 +18,7 @@
"replicas": 1,
"selector": {
"matchLabels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand All @@ -27,6 +29,7 @@
"metadata": {
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"namespace": "clabernetes",
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand All @@ -14,6 +15,7 @@
"replicas": 1,
"selector": {
"matchLabels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand All @@ -24,6 +26,7 @@
"metadata": {
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"namespace": "clabernetes",
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand All @@ -17,6 +18,7 @@
"replicas": 1,
"selector": {
"matchLabels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand All @@ -27,6 +29,7 @@
"metadata": {
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/name": "render-deployment-test-srl1",
"clabernetes/app": "clabernetes",
"clabernetes/name": "render-deployment-test-srl1",
"clabernetes/topologyNode": "srl1",
Expand Down

0 comments on commit c9e0955

Please sign in to comment.