-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
[bitnami/thanos] Add support for HTTPS and basic auth experimental settings #12404
Merged
migruiz4
merged 8 commits into
bitnami:master
from
migruiz4:thanos-auth-https-experimental
Sep 14, 2022
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
dac1ec7
[bitnami/thanos] Add support for HTTPS and basic auth experimental se…
migruiz4 7c911de
Update README.md with readme-generator-for-helm
bitnami-bot 1091cd6
Add Readme section for https and basic authentication
migruiz4 22a50c7
Fix minor issue
migruiz4 cdb9bd0
Fix typo
migruiz4 996a577
Use tcpSocket instead of httpGet when basic auth enabled
migruiz4 7a0d83a
Fix typo
migruiz4 7777b18
Merge branch 'master' into thanos-auth-https-experimental
migruiz4 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 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 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 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 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 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 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,32 @@ | ||
{{- if and .Values.https.enabled (not .Values.https.existingSecret) }} | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ printf "%s-http-certs-secret" (include "common.names.fullname" .) }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: {{- include "common.labels.standard" . | nindent 4 }} | ||
{{- if .Values.commonLabels }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- if .Values.commonAnnotations }} | ||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
type: Opaque | ||
data: | ||
{{- if .Values.https.autoGenerated }} | ||
{{- $ca := genCA "thanos-ca" 365 }} | ||
{{- $hostname := printf "%s" (include "common.names.fullname" .) }} | ||
{{- $cert := genSignedCert $hostname nil (list $hostname) 365 $ca }} | ||
{{ .Values.https.certFilename }}: {{ $cert.Cert | b64enc | quote }} | ||
{{ .Values.https.keyFilename }}: {{ $cert.Key | b64enc | quote }} | ||
{{- if .Values.https.clientAuthType }} | ||
{{ .Values.https.caFilename }}: {{ $ca.Cert | b64enc | quote }} | ||
{{- end }} | ||
{{- else }} | ||
{{ .Values.https.certFilename }}: {{ required "'https.cert' is required when 'https.enabled=true'" .Values.https.cert | b64enc | quote }} | ||
{{ .Values.https.keyFilename }}: {{ required "'https.key' is required when 'https.enabled=true'" .Values.https.key | b64enc | quote }} | ||
{{- if .Values.https.clientAuthType }} | ||
{{ .Values.https.caFilename }}: {{ required "'https.ca' is required when 'https.clientAuthType' is provided" .Values.https.ca | b64enc | quote }} | ||
{{- end }} | ||
{{- end }} | ||
{{ end }} |
This file contains 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,33 @@ | ||
{{- if (include "thanos.createHttpConfigSecret" .) }} | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ include "common.names.fullname" . }}-http-config-secret | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: {{- include "common.labels.standard" . | nindent 4 }} | ||
{{- if .Values.commonLabels }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
stringData: | ||
http-config.yml: |- | ||
{{- if .Values.httpConfig }} | ||
{{- include "common.tplvalues.render" (dict "value" .Values.httpConfig "context" $) | b64enc | nindent 4 }} | ||
{{- else }} | ||
{{- if .Values.https.enabled }} | ||
tls_server_config: | ||
cert_file: /certs/{{ .Values.https.certFilename }} | ||
key_file: /certs/{{ .Values.https.keyFilename }} | ||
{{- if .Values.https.clientAuthType }} | ||
client_auth_type: {{ .Values.https.clientAuthType }} | ||
# CA certificate for client certificate authentication to the server. | ||
client_ca_file: /certs/{{ .Values.https.caFilename }} | ||
{{- end }} | ||
{{- end }} | ||
{{- if .Values.auth.basicAuthUsers }} | ||
basic_auth_users: | ||
{{- range $user, $password := .Values.auth.basicAuthUsers }} | ||
{{ $user }}: {{ (split ":" (htpasswd $user $password))._1 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
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.
As this is containing passwords, I think we should use a secret, or at least, provide the option to use a secret instead.
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 configuration file is stored in a Secret instead of a configmap because of that reason.
User can provide its configuration file using
existingHttpConfigSecret
.The main issue is that, if the basic authentication is enabled, the password is also needed for the Probes to succeed, and Thanos uses a scratch container, so no logic can be added to handle the password using env variables.
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.
Please refer to the README.md section below, where I tried to depict this same situation and the alternatives to that.