-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
096c5ce
commit 6789fe9
Showing
14 changed files
with
292 additions
and
6 deletions.
There are no files selected for viewing
Binary file not shown.
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
62 changes: 62 additions & 0 deletions
62
charts/metal3/0.3.0/charts/ironic/templates/secrets-basic-auth.yaml
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,62 @@ | ||
{{- if .Values.global.enable_basicAuth }} | ||
|
||
{{- $ironicUsername := "" -}} | ||
{{- $ironicPassword := "" -}} | ||
{{- $ironicSecretName := "ironic-basic-auth" -}} | ||
|
||
# Check if the secret is deployed and has a password | ||
{{- $oldIronicSecret := lookup "v1" "Secret" .Release.Namespace $ironicSecretName }} | ||
{{- if and $oldIronicSecret (index $oldIronicSecret.data "username") (index $oldIronicSecret.data "password") }} | ||
{{- $ironicUsername = index $oldIronicSecret.data "username" -}} | ||
{{- $ironicPassword = index $oldIronicSecret.data "password" -}} | ||
# If not, check if a username and password are provided in values.yaml | ||
{{- else if and (.Values.global.auth.ironicUsername) (.Values.global.auth.ironicPassword) }} | ||
{{- $ironicUsername = .Values.global.auth.ironicUsername -}} | ||
{{- $ironicPassword = .Values.global.auth.ironicPassword -}} | ||
{{- else }} | ||
# If no username and password are provided in values.yaml, generate new ones | ||
{{- $ironicUsername = "ironic" -}} | ||
{{- $ironicPassword = (randAlphaNum 20) -}} | ||
{{- end }} | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ $ironicSecretName }} | ||
type: Opaque | ||
data: | ||
username: {{ $ironicUsername | b64enc }} | ||
password: {{ $ironicPassword | b64enc }} | ||
htpasswd: {{ b64enc (htpasswd $ironicUsername $ironicPassword) }} | ||
auth-config: | | ||
{{- printf "[ironic]\nauth_type=http_basic\nusername: %s\npassword: %s" $ironicUsername $ironicPassword | b64enc | nindent 4 }} | ||
--- | ||
{{- $ironicInspectorUsername := "" -}} | ||
{{- $ironicInspectorPassword := "" -}} | ||
{{- $inspectorSecretName := "ironic-inspector-basic-auth" -}} | ||
|
||
# Check if the secret is deployed and has a password | ||
{{- $oldInspectorSecret := lookup "v1" "Secret" .Release.Namespace $inspectorSecretName }} | ||
{{- if and $oldInspectorSecret (index $oldInspectorSecret.data "username") (index $oldInspectorSecret.data "password") }} | ||
{{- $ironicInspectorUsername = index $oldInspectorSecret.data "username" -}} | ||
{{- $ironicInspectorPassword = index $oldInspectorSecret.data "password" -}} | ||
# If not, check if a username and password are provided in values.yaml | ||
{{- else if and (.Values.global.auth.ironicInspectorUsername) (.Values.global.auth.ironicInspectorPassword) }} | ||
{{- $ironicInspectorUsername = .Values.global.auth.ironicInspectorUsername -}} | ||
{{- $ironicInspectorPassword = .Values.global.auth.ironicInspectorPassword -}} | ||
{{- else }} | ||
# If no username and password are provided in values.yaml, generate new ones | ||
{{- $ironicInspectorUsername = "ironic" -}} | ||
{{- $ironicInspectorPassword = (randAlphaNum 20) -}} | ||
{{- end }} | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ $inspectorSecretName }} | ||
type: Opaque | ||
data: | ||
username: {{ $ironicInspectorUsername | b64enc }} | ||
password: {{ $ironicInspectorPassword | b64enc }} | ||
htpasswd: {{ b64enc (htpasswd $ironicInspectorUsername $ironicInspectorPassword) }} | ||
auth-config: | | ||
{{- printf "[inspector]\nauth_type=http_basic\nusername: %s\npassword: %s" $ironicInspectorUsername $ironicInspectorPassword | b64enc | nindent 4 }} | ||
{{- 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
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
Oops, something went wrong.