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

Remove rand suffix in test job name #417

Merged
merged 3 commits into from
Oct 4, 2023
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
2 changes: 1 addition & 1 deletion charts/mattermost-team-edition/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
description: Mattermost Team Edition server.
type: application
name: mattermost-team-edition
version: 6.6.37
version: 6.6.38
appVersion: 9.0.0
keywords:
- mattermost
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "mattermost-team-edition.fullname" . }}-test-{{ randAlphaNum 5 | lower }}"
name: "{{ include "mattermost-team-edition.fullname" . }}-test"
labels:
app.kubernetes.io/name: {{ include "mattermost-team-edition.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "mattermost-team-edition.chart" . }}
annotations:
"helm.sh/hook": test-success
{{- with .Values.testJob.annotations }}
{{- . | toYaml | nindent 4 }}
{{- end }}
spec:
containers:
- name: {{ .Release.Name }}-test
Expand Down
5 changes: 5 additions & 0 deletions charts/mattermost-team-edition/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,8 @@ readinessProbe:
failureThreshold: 3
timeoutSeconds: 5
periodSeconds: 10

## Additional annotations for test job

testJob:
Copy link
Member

Choose a reason for hiding this comment

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

I am wondering if we need to this as an extra option. Why not just use the same value we already have extraPodAnnotations

Copy link
Contributor Author

@mustdiechik mustdiechik Sep 6, 2023

Choose a reason for hiding this comment

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

yes, we need. Because to manage job with ArgoCD for example, we need its own job annotations. Helm`s hook annotations will not work.
https://argo-cd.readthedocs.io/en/stable/user-guide/resource_hooks/

Also if we need to redeploy job for each "apply", we may to add some annotation with {{ rand }} value. (The same behavior as with rand suffix in name.)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I am aware for the argo resource hooks etc. Though we already have extraPodAnnotations in values.yaml what if we just use this in the test helm template so we have one value vs creating test only values.

Copy link
Member

@spirosoik spirosoik Sep 6, 2023

Choose a reason for hiding this comment

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

In practice we could do this:

{{- with .Values.extraPodAnnotations}}

Copy link
Contributor Author

@mustdiechik mustdiechik Sep 6, 2023

Choose a reason for hiding this comment

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

I think, nobody will want to add hook`s annotations that are necessary for JOB to POD.

Copy link
Member

Choose a reason for hiding this comment

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

Could you elaborate a bit more? I think having one value for annotations and just re-use will help us to be DRY.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The job should be run after POD was created or updated. When to run job I can managed via it`s annotation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

annotations: {}