Skip to content

Commit

Permalink
Merge pull request #16 from nicolastakashi/refactory-chart-secret
Browse files Browse the repository at this point in the history
[REFACTORY] chart auth secret
  • Loading branch information
nicolastakashi committed Dec 26, 2021
2 parents 3c47cf9 + e33fac7 commit bdc2c6b
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 59 deletions.
2 changes: 1 addition & 1 deletion charts/gitana/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.2.0
version: 1.2.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
72 changes: 39 additions & 33 deletions charts/gitana/README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions charts/gitana/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ Create the name of the service account to use
{{- end }}

{{- define "gitana.authSecretName" -}}
{{- if .Values.authSecret.secretname }}
{{- .Values.authSecret.secretname }}
{{- if .Values.flags.repository.auth.secret.name }}
{{- .Values.flags.repository.auth.secret.name }}
{{- else }}
{{- printf "%s-auth-secret" (include "gitana.fullname" .) }}
{{- end }}
Expand Down
11 changes: 7 additions & 4 deletions charts/gitana/templates/authsecret.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
{{- if and .Values.authSecret.enabled .Values.authSecret.create }}
{{- if and .Values.flags.repository.auth.enabled .Values.flags.repository.auth.secret.create }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "gitana.authSecretName" . }}
labels:
{{- include "gitana.labels" . | nindent 4 }}
{{- with .Values.authSecret.annotations }}
{{- with .Values.flags.repository.auth.secret.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.flags.repository.auth.secret.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
stringData:
auth.yaml: |-
username: {{ .Values.authSecret.username | quote }}
password: {{ .Values.authSecret.password | quote }}
username: {{ .Values.flags.repository.auth.username | quote }}
password: {{ .Values.flags.repository.auth.password | quote }}
type: Opaque
{{- end }}
6 changes: 1 addition & 5 deletions charts/gitana/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ spec:
{{- end }}
- --dashboard.labels={{- include "dashboard.labels" . | trimSuffix "," }}
- --namespace={{ .Values.flags.namespace }}
{{- if .Values.flags.repository.auth }}
- --repository.auth.user={{ .Values.flags.repository.auth }}
- --repository.auth.user={{ .Values.flags.repository.password }}
{{- end }}
{{- if .Values.authSecret.enabled }}
{{- if .Values.flags.repository.auth.enabled }}
- --repository.auth.secretname={{ include "gitana.authSecretName" . }}
{{- end }}
{{- if .Values.flags.repository.dashboardPath }}
Expand Down
5 changes: 5 additions & 0 deletions charts/gitana/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ rules:
- get
- list
- update
- apiGroups: [""]
resources:
- secrets
verbs:
- get
25 changes: 11 additions & 14 deletions charts/gitana/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ image:
repository: ntakashi/gitana
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: 0.1.0
tag: 1.2.0

imagePullSecrets: []
nameOverride: ""
Expand Down Expand Up @@ -61,14 +61,6 @@ serviceMonitor:
# ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#endpoint
scrapeTimeout: ""

authSecret:
enabled: true
create: true
secretname: ""
annotations: {}
username: "cenas"
password: "123"

flags:
# (optional) absolute path to the kubeconfig file
kubeconfig: ""
Expand Down Expand Up @@ -107,8 +99,13 @@ flags:
# repository url
url: ""

auth: {}
# username to perform authentication
# user: ""
# password to perform authentication
# password:
# auth secret configuration
auth:
enabled: false
username: ""
password: ""
secret:
create: true
name: ""
annotations: {}
labels: {}

0 comments on commit bdc2c6b

Please sign in to comment.