-
-
Notifications
You must be signed in to change notification settings - Fork 117
Move st2tests to a job #399
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
Conversation
cognifloyd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's hard to see what you've added in the github interface, so I'm highlighting the new sections in my review to help myself see them.
It looks like you want to use the helm tests as a canary script that you run after install or upgrade. Is that right? Are you already using something like this? How well does it work for you?
| imagePullPolicy: {{ $.Values.image.pullPolicy }} | ||
| {{- with .Values.securityContext }} | ||
| securityContext: {{- toYaml . | nindent 12 }} | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is new.
| imagePullPolicy: {{ $.Values.image.pullPolicy }} | ||
| {{- with .Values.securityContext }} | ||
| securityContext: {{- toYaml . | nindent 12 }} | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is new.
| {{- with .Values.securityContext }} | ||
| securityContext: {{- toYaml . | nindent 12 }} | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is new. (imagePullPolicy was already present)
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: "{{ .Release.Name }}-job-st2-tests" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name changed from {{ .Release.Name }}-st2tests
| annotations: | ||
| "helm.sh/hook": test-success | ||
| "helm.sh/hook-delete-policy": hook-succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the pod needs these helm annotations, just the top-level Job. Is that right?
| configMap: | ||
| name: {{ .Release.Name }}-job-st2-tests | ||
| restartPolicy: Never | ||
| backoffLimit: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The backoffLimit is new.
| kind: ConfigMap | ||
| metadata: | ||
| name: {{ .Release.Name }}-st2tests | ||
| name: {{ .Release.Name }}-job-st2-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might need the helm annotations if you are planning to run this on a real st2 cluster instead of only running it in CI.
I'm not sure the st2tests.sh is designed to run on a real instance of st2--there might be some unintended side effects.
| "helm.sh/hook-delete-policy": hook-succeeded | ||
| spec: | ||
| initContainers: | ||
| {{- include "stackstorm-ha.init-containers-wait-for-auth" . | nindent 6 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a new templated init container you've added to ensure the tests wait until st2 is up and running.
| - 'sh' | ||
| - '-c' | ||
| - > | ||
| until curl -skSL --fail -w '\n' -X POST -u {{ .Values.st2.username }}:{{ .Values.st2.password }} "https://{{ required ".Values.ingress.fqdn is required if .Values.ingress.class is non-empty" .Values.ingress.fqdn | printf (ternary "canary-%s" "%s" .Values.phaseCanary)}}/auth/tokens"; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see these vars in our values file:
ingress.fqdningress.classphaseCanary
Lines 298 to 321 in 17e5fca
| ## | |
| ## StackStorm HA Ingress | |
| ## | |
| ingress: | |
| # As recommended, ingress is disabled by default. | |
| enabled: false | |
| # Annotations are used to configure the ingress controller | |
| annotations: {} | |
| # kubernetes.io/ingress.class: nginx | |
| # kubernetes.io/tls-acme: "true" | |
| # Map hosts to paths | |
| hosts: [] | |
| # - host: hostname.domain.tld | |
| # # Map paths to services | |
| # paths: | |
| # - path: / | |
| # serviceName: service | |
| # servicePort: port | |
| # Secure the Ingress by specifying a secret that contains a TLS private key and certificate | |
| tls: [] | |
| # - secretName: chart-example-tls | |
| # hosts: | |
| # - chart-example.test | |
| # ingressClassName: nginx-ingress |
I also do not use the ingress, so these would never be defined for me.
user/pass is also only available in my cluster(s) during initial bootstrap. Once I switch to ldap, I exclusively use api tokens within helm.
Do you have any ideas on how to make this more generic?
|
I think we can just drop this PR, I've made a misunderstanding on how these Internally we use Please let me know if I've yet again misunderstood how this is meant to work... |
Yeah. So far, I've added one stackstorm-k8s/templates/jobs.yaml Lines 491 to 604 in 93e3f26
Any ideas on potential
Ah yes. That's a common gotcha (at least where I work). I've been encouraging my coworkers to use That said, I wonder if there is a way to exclude the helm test hooks when running
😄 You've got it now. The idea of canary jobs is very intriguing though... |
Instead of running
st2testsas apod, this runs it as ajob.To ensure the job only runs once, and fails if a test fails, I've added:
Which means it'll never Back off / or retry.