-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add a Helm chart for deploying host-check as a Job #11
Conversation
.github/workflows/tests.yml
Outdated
@@ -36,3 +36,7 @@ jobs: | |||
- name: "Run vRouter unit tests" | |||
run: | | |||
docker run -v "$PWD/:/charts" helm-tests bats tests/ut/xrd-vrouter | |||
|
|||
- name: "Run host-check unit 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.
Does this need to be merged with #10?
charts/host-check/values.yaml
Outdated
# There are required fields which must be specified for all installations: | ||
# - image.repository | ||
# - image.tag | ||
# - platforms |
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.
# - platforms | |
# - targetPlatforms |
tests/ut/host-check/job.bats
Outdated
} | ||
|
||
@test "host-check: Image tag must be specified" { | ||
template_failure_no_set --set 'image.repository=local'\ |
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.
template_failure_no_set --set 'image.repository=local'\ | |
template_failure_no_set --set 'image.repository=local' \ |
tests/ut/host-check/job.bats
Outdated
} | ||
|
||
@test "host-check Job: Name consists of the release name and chart name" { | ||
template --set 'targetPlatforms[0]=xrd-vrouter' |
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 a shame that the targetPlatforms has to be set for each success test case.
I wonder if it would be better to move template
into a per-chart ./utils.bash
. This can use a template_no_set
from ../utils.bash
, which templates without setting, checks success, yamllint, kubeconform, etc.
Each per-chart MUT loads ./utils.bash
instead.
The chart_dir
functions can then be moved into the per-chart ./utils.bash
s.
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.
implemented this suggestion
charts/host-check/values.schema.json
Outdated
"additionalProperties": false | ||
}, | ||
"targetPlatforms": { | ||
"description": "List of platforms to run the host-check on", |
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.
"description": "List of platforms to run the host-check on", | |
"description": "List of platforms to run host-check on", |
or "the host-check application"
charts/host-check/values.schema.json
Outdated
"items": { | ||
"type": "string", | ||
"enum": [ | ||
"xrd-control-plane", |
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.
What's the error message if you try and use an unsupported target platform?
We do some logic in the Helm template, rather than in the JSON Schema, so that error messages are sufficiently descriptive.
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.
Replaced with helm template logic with error message: targetPlatforms must be xrd-control-plane and/or xrd-vrouter
, see test platforms must be xrd-vrouter or xrd-control-plane
{{- define "hostCheck.args" -}} | ||
{{- $arg := "" }} | ||
{{- if and (has "xrd-control-plane" .Values.targetPlatforms) (has "xrd-vrouter" .Values.targetPlatforms) }} | ||
{{- $arg = "" }} | ||
{{- else }} | ||
{{- $arg = printf "-p, %s" (.Values.targetPlatforms | first) }} | ||
{{- end }} | ||
{{- $arg }} | ||
{{- 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.
{{- define "hostCheck.args" -}} | |
{{- $arg := "" }} | |
{{- if and (has "xrd-control-plane" .Values.targetPlatforms) (has "xrd-vrouter" .Values.targetPlatforms) }} | |
{{- $arg = "" }} | |
{{- else }} | |
{{- $arg = printf "-p, %s" (.Values.targetPlatforms | first) }} | |
{{- end }} | |
{{- $arg }} | |
{{- end }} | |
{{- define "hostCheck.args" -}} | |
{{- $args := "" }} | |
{{- if and (has "xrd-control-plane" .Values.targetPlatforms) (has "xrd-vrouter" .Values.targetPlatforms) }} | |
{{- $args = "" }} | |
{{- else }} | |
{{- $args = printf "-p, %s" (.Values.targetPlatforms | first) }} | |
{{- end }} | |
{{- $args }} | |
{{- end }} |
|
||
{{/* | ||
Runtime arguments. If both xrd-control-plane and xrd-vrouter are specified, | ||
the argument is not set. |
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 argument is not set. | |
no arguments are set. |
It may also be worth explicitly stating this is because the default behavior of host-check is to perform the checks for both platforms.
Co-authored-by: tjohnes <[email protected]>
Pull in commit-check script changes from main
Create a Helm chart for deploying host-check as a Job.
Testing: manual testing of mainline flows, UT written for each field in the resultant manifest.
Note to reviewer: charts/host-check/.helmignore is copied from the xrd-vrouter chart.