-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[chart] Refactor chart to only use cert-manager #4592
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
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4d675e2
7b246f7
2a0f82a
Refactor generation of self-signed certificates to use cert-manager
aledbf f7b2694
Create Job to ensure database gitpod-session exists
aledbf c64946b
Remove priorityClassName workaround
aledbf 82a739b
Mount self-signed SSL certificate for in cluster docker registry access
aledbf 0861494
Update default values
aledbf 5e8805c
f607e50
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright (c) 2021 Gitpod GmbH. All rights reserved. | ||
# Licensed under the MIT License. See License-MIT.txt in the project root for license information. | ||
|
||
{{ $comp := .Values.components.proxy -}} | ||
{{ $certManager := (index .Values "cert-manager") }} | ||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: proxy-config-certificates | ||
spec: | ||
secretName: proxy-config-certificates | ||
commonName: {{ .Values.hostname | quote }} | ||
dnsNames: | ||
- {{ .Values.hostname | quote }} | ||
- "*.{{ .Values.hostname }}" | ||
- "*.ws{{- if .Values.installation.shortname -}}-{{ .Values.installation.shortname }}{{- end -}}.{{ .Values.hostname }}" | ||
{{- range $index, $dnsName := $certManager.certificate.additionalNames }} | ||
- {{ $dnsName | quote }} | ||
{{ end -}} | ||
{{- if $comp.certManager }} {{/* custom proxy certificate issuer */}} | ||
{{ if $comp.certManager.issuerRef }} {{/* use custom issuer */}} | ||
issuerRef: {{ $comp.certManager.issuerRef }} | ||
{{ else }} | ||
issuerRef: | ||
name: {{ if $comp.certManager.issuerName }}{{$comp.certManager.issuerName}}{{ else }}gitpod{{ end }} | ||
kind: {{ if $comp.certManager.issuerKind }}{{$comp.certManager.issuerKind}}{{ else }}Issuer{{ end }} | ||
group: cert-manager.io | ||
{{ end }} | ||
{{ else }} | ||
issuerRef: | ||
name: gitpod | ||
kind: Issuer | ||
group: cert-manager.io | ||
{{ end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,36 @@ | ||
# Copyright (c) 2020 Gitpod GmbH. All rights reserved. | ||
# Licensed under the MIT License. See License-MIT.txt in the project root for license information. | ||
|
||
{{ $cm := (index .Values "cert-manager") }} | ||
{{- if $cm.enabled }} | ||
{{- if $cm.ca.certificate.selfSigned }} | ||
{{ $tls := genCA "gitpod-ca" 365 }} | ||
kind: Secret | ||
apiVersion: v1 | ||
{{ $certManager := (index .Values "cert-manager") }} | ||
apiVersion: cert-manager.io/v1 | ||
kind: Issuer | ||
metadata: | ||
name: {{ $cm.ca.certificate.secretName }} | ||
name: gitpod-selfsigned-issuer | ||
spec: | ||
selfSigned: {} | ||
--- | ||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: {{ $certManager.ca.secretName }} | ||
namespace: {{ .Release.Namespace }} | ||
data: | ||
tls.crt: {{ $tls.Cert | b64enc }} | ||
tls.key: {{ $tls.Key | b64enc }} | ||
type: kubernetes.io/tls | ||
spec: | ||
isCA: true | ||
commonName: {{ $certManager.ca.issuerName }} | ||
secretName: {{ $certManager.ca.secretName }} | ||
privateKey: | ||
algorithm: ECDSA | ||
size: 256 | ||
issuerRef: | ||
name: gitpod-selfsigned-issuer | ||
kind: Issuer | ||
group: cert-manager.io | ||
--- | ||
{{- end }} | ||
apiVersion: cert-manager.io/v1 | ||
kind: Issuer | ||
metadata: | ||
name: {{ $cm.ca.issuerName }} | ||
name: {{ $certManager.ca.issuerName }} | ||
namespace: {{ .Release.Namespace }} | ||
spec: | ||
ca: | ||
secretName: {{ $cm.ca.certificate.secretName }} | ||
{{- end }} | ||
secretName: {{ $certManager.ca.secretName }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Copyright (c) 2020 Gitpod GmbH. All rights reserved. | ||
# Licensed under the MIT License. See License-MIT.txt in the project root for license information. | ||
|
||
{{ $comp := .Values.components.db }} | ||
{{- $this := dict "root" . "gp" $.Values "comp" $comp -}} | ||
|
||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: database-sessions | ||
labels: | ||
app: {{ template "gitpod.fullname" . }} | ||
component: database-sessions | ||
kind: job | ||
stage: {{ .Values.installation.stage }} | ||
annotations: | ||
# This is what defines this resource as a hook. Without this line, the | ||
# job is considered part of the release. | ||
# see https://github.com/helm/helm/blob/master/docs/charts_hooks.md | ||
"helm.sh/hook": post-install,post-upgrade | ||
"helm.sh/hook-weight": "5" | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed | ||
"helm.sh/hook-delete-timeout": "0" | ||
spec: | ||
template: | ||
metadata: | ||
name: database-sessions | ||
labels: | ||
app: {{ template "gitpod.fullname" . }} | ||
component: database-sessions | ||
kind: job | ||
stage: {{ .Values.installation.stage }} | ||
spec: | ||
{{ include "gitpod.pod.affinity" $this | indent 6 }} | ||
restartPolicy: Never | ||
serviceAccountName: db | ||
imagePullSecrets: | ||
enableServiceLinks: false | ||
containers: | ||
- name: database-sessions | ||
image: mysql:5.7.34 | ||
env: | ||
- name: "MYSQL_PWD" | ||
value: "{{ $.Values.db.password }}" | ||
- name: "DB_PORT" | ||
value: "{{ $.Values.db.port }}" | ||
- name: "DB_HOST" | ||
value: "{{ $.Values.db.host }}" | ||
command: ["sh","-c","mysql -h $DB_HOST --port $DB_PORT -u gitpod < /db-init-scripts/init.sql"] | ||
volumeMounts: | ||
- name: db-init-scripts | ||
mountPath: "/db-init-scripts" | ||
readOnly: true | ||
volumes: | ||
- name: db-init-scripts | ||
configMap: | ||
name: db-init-scripts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could you elaborate on this change? Why not are the other scripts not needed anymore?
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.
@geropl
03-recreate-gitpod-db
drops the db. Does it seem the scripts expect the chart will be used for testing?If you provide a connection to MySQL we should only assume the user, password, and database are valid. Everything else should be done by typeorm (even the creation of the sessions db)
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.
They are used for both use cases: initialization (because it's straight-forward to mount into any DB container) and testing.
That's certainly another way to do it. What would be the advantage over the current approach?