Skip to content

helm: add job validating configuration on deploy#19333

Merged
hugoShaka merged 4 commits intohugo/chart-split-proxy-authfrom
hugo/chart-validate-conf-job
Dec 19, 2022
Merged

helm: add job validating configuration on deploy#19333
hugoShaka merged 4 commits intohugo/chart-split-proxy-authfrom
hugo/chart-validate-conf-job

Conversation

@hugoShaka
Copy link
Copy Markdown
Contributor

@hugoShaka hugoShaka commented Dec 13, 2022

Part of RFD-0096

This PR adds helm hooks deploying a test configuration job and running teleport configure --test to validate the teleport.yaml configuration is sane.

Note: merge only once the #18857 has been merged

@webvictim
Copy link
Copy Markdown
Contributor

webvictim commented Dec 14, 2022

I wish Github supported stacked diffs...

Maybe change the base of your PR to your custom branch temporarily so it only shows the relevant changes?

@hugoShaka
Copy link
Copy Markdown
Contributor Author

I wish Github supported stacked diffs...

Maybe change the base of your PR to your custom branch temporarily so it only shows the relevant changes?

My bad, I forgot to change the base

@hugoShaka hugoShaka changed the base branch from master to hugo/chart-split-proxy-auth December 14, 2022 15:24
@hugoShaka hugoShaka force-pushed the hugo/chart-split-proxy-auth branch from f844519 to 620b06f Compare December 15, 2022 14:08
@hugoShaka hugoShaka changed the title Hugo/chart validate conf job helm: add job validating configuration on deploy Dec 15, 2022
@hugoShaka hugoShaka requested a review from tigrato December 15, 2022 19:57
Copy link
Copy Markdown
Contributor

@webvictim webvictim left a comment

Choose a reason for hiding this comment

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

Looks good, I skimmed most of the stuff that I'd already reviewed because Github isn't smart enough to show me a merged view I guess?!

@@ -0,0 +1,7 @@
# This setup is not safe for production because the proxy will self-sign its certificate.
# Use those values for testing only
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Use those values for testing only
# Use these values for testing only

{{- end -}}

{{- define "teleport-cluster.auth.config.custom" -}}
{{ fail "'custom' mode has been depreacted with chart v12 because of the proxy/auth split, see http://link" }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reminder to update this one when we know what the link will be :D

{{- end }}
teleport.yaml: |2
{{- mustMergeOverwrite (include $configTemplate . | fromYaml) $auth.teleportConfig | toYaml | nindent 4 -}}
{{- end }} No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: No trailing line break


{{- define "teleport-cluster.proxy.config.custom" -}}
{{ fail "'custom' mode has been depreacted with chart v12 because of the proxy/auth split, see http://link" }}
{{- end -}} No newline at end of file
Copy link
Copy Markdown
Contributor

@webvictim webvictim Dec 15, 2022

Choose a reason for hiding this comment

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

nit: No trailing line break

Also missing link ofc

data:
teleport.yaml: |2
{{- mustMergeOverwrite (include $configTemplate . | fromYaml) $proxy.teleportConfig | toYaml | nindent 4 -}}
{{- end }} No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: No trailing line break

Comment thread examples/chart/teleport-cluster/values.yaml Outdated
validateConfigOnDeploy: false
asserts:
- hasDocuments:
count: 0 No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: No trailing line break

@@ -0,0 +1 @@
{}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure why this is blank? I guess there's no snapshotting needed, so rather than have no file it just has an empty object?

{{- end -}}

{{- define "teleport-cluster.auth.config.custom" -}}
{{ fail "'custom' mode has been depreacted with chart v12 because of the proxy/auth split, see http://link" }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{ fail "'custom' mode has been depreacted with chart v12 because of the proxy/auth split, see http://link" }}
{{ fail "'custom' mode has been deprecated with chart v12 because of the proxy/auth split, see http://link" }}

{{- end -}}

{{- define "teleport-cluster.proxy.config.custom" -}}
{{ fail "'custom' mode has been depreacted with chart v12 because of the proxy/auth split, see http://link" }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{ fail "'custom' mode has been depreacted with chart v12 because of the proxy/auth split, see http://link" }}
{{ fail "'custom' mode has been deprecated with chart v12 because of the proxy/auth split, see http://link" }}

@hugoShaka
Copy link
Copy Markdown
Contributor Author

Looks good, I skimmed most of the stuff that I'd already reviewed because Github isn't smart enough to show me a merged view I guess?!

Ugh, I rebased the base branch and now it's lost.I'll rebase again all the satellite branches.

Copy link
Copy Markdown
Contributor

@marcoandredinis marcoandredinis left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Just one question:

Do we have to recreate everything in order to run the teleport configure test?
Things can get out of sync between
examples/chart/teleport-cluster/templates/auth/predeploy_job.yaml and
examples/chart/teleport-cluster/templates/auth/statefulset.yaml

It seems we even create another token for the proxy to join, even though is not used (or is it?)

@hugoShaka
Copy link
Copy Markdown
Contributor Author

hugoShaka commented Dec 16, 2022

Do we have to recreate everything to run the teleport configure test? Things can get out of sync between examples/chart/teleport-cluster/templates/auth/predeploy_job.yaml and examples/chart/teleport-cluster/templates/auth/statefulset.yaml

In its current state, we need the config and whatever is mounted (because it can contain parts of the config). So we have to duplicate at least the podSpec and the configMap. Ideally, the teleport configure --test would also test backend connectivity in auth, so it would require cloud credential mounts as well. This is why I left all those mounts and env vars.

I don't know if putting some parts of the podSpec in a template would improve maintainability. This becomes a challenge, especially as we don't want to deploy additional containers like the operator.

@webvictim
Copy link
Copy Markdown
Contributor

Ideally, the teleport configure --test would also test backend connectivity in auth,

JFYI it doesn't (but it should 😁)

@hugoShaka hugoShaka force-pushed the hugo/chart-validate-conf-job branch from 402b5d1 to 8be205d Compare December 19, 2022 17:22
@hugoShaka hugoShaka merged commit c83b7d1 into hugo/chart-split-proxy-auth Dec 19, 2022
@hugoShaka hugoShaka deleted the hugo/chart-validate-conf-job branch December 19, 2022 17:30
hugoShaka added a commit that referenced this pull request Jan 5, 2023
Part of [RFD-0096](#18274)

This PR adds helm hooks deploying a test configuration job and running `teleport configure --test` to validate the `teleport.yaml` configuration is sane.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants