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

fix: add missing labels to resources #2519

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions charts/openstack-cloud-controller-manager/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
apiVersion: v1
apiVersion: v2
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's not something we want to change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is needed for dependencies

And, why not? 🤔🤷

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, I thought it's a dependency upgrade then no need to update the api version ..

appVersion: v1.29.0
description: Openstack Cloud Controller Manager Helm Chart
icon: https://object-storage-ca-ymq-1.vexxhost.net/swift/v1/6e4619c416ff4bd19e1c087f27a43eea/www-images-prod/openstack-logo/OpenStack-Logo-Vertical.png
home: https://github.com/kubernetes/cloud-provider-openstack
name: openstack-cloud-controller-manager
version: 2.29.0
version: 2.29.1
maintainers:
- name: eumel8
cwrau marked this conversation as resolved.
Show resolved Hide resolved
email: f.kloeker@telekom.de
url: https://www.telekom.com
dependencies:
- name: common
version: 2.14.1
repository: https://charts.bitnami.com/bitnami
Comment on lines +12 to +15
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'd rather prefer to just copy this single function here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Uff, I'm highly against copying code, that's the whole point of using a central, standard library for this; to remove code duplication.

Then you'd have to keep track of the upstream changes and copy them as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, but how "standard" is this standard library? I see it's used extensively in charts around GitHub, but it still seems to be from a third party?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe it's not a "standard" by definition, but as you said it's extremely widely used across helm charts and bitnami, even though they're a third party, has made themselves a recognizable helm chart writer and supporter known for their quality, at least in my knowledge circle.

13 changes: 0 additions & 13 deletions charts/openstack-cloud-controller-manager/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,6 @@ Create chart name and version as used by the chart label.
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels and app labels
*/}}
{{- define "occm.labels" -}}
app.kubernetes.io/name: {{ include "occm.name" . }}
helm.sh/chart: {{ include "occm.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{- define "occm.common.matchLabels" -}}
app: {{ template "occm.name" . }}
release: {{ .Release.Name }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Values.clusterRoleName }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: system:{{ include "occm.name" . }}:auth-delegate
labels: {{- include "common.labels.standard" . | nindent 4 }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Values.clusterRoleName }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ include "occm.name" . }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "occm.labels" . | nindent 4 }}
Comment on lines -6 to -7
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this give use the same labels here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this will result in the same labels

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm looking at CI results and I only see this label added to the DaemonSet:

Labels:         k8s-app=openstack-cloud-controller-manager

See for yourself in the "Describe failed openstack-cloud-controller-manager" step: https://storage.googleapis.com/kubernetes-jenkins/pr-logs/pull/cloud-provider-openstack/2519/openstack-cloud-controller-manager-e2e-test/1749846521752326144/build-log.txt

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know how CI comes up with that, but I would say it's technically impossible for this label to exist, neither in the old version nor my new one 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.secret.name | default "cloud-config" }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
annotations:
{{- with .Values.commonAnnotations }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
apiVersion: v1
kind: Service
metadata:
labels:
{{- include "occm.labels" . | nindent 4 }}
name: {{ include "occm.name" . }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
annotations:
{{- with .Values.commonAnnotations }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.serviceAccountName }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
annotations:
{{- with .Values.commonAnnotations }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
{{- include "occm.labels" . | nindent 4 }}
name: {{ include "occm.name" . }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
annotations:
{{- with .Values.commonAnnotations }}
Expand Down