Skip to content

Commit

Permalink
Merge pull request #11 from chatwork/refactor-secret
Browse files Browse the repository at this point in the history
Refactor secret values
  • Loading branch information
ada-u authored Jan 13, 2021
2 parents 69f7e58 + bd1df7d commit 8b091f7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
6 changes: 3 additions & 3 deletions charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A Helm chart for [chatwork/sendgrid-stats-exporter](https://github.com/chatwork/
## Installing the Chart

```
$ helm install --set 'deployment.secret.apiKey=secret' --set 'deployment.secret.username=username' sendgrid-stats-exporter ./
$ helm install --set 'secret.apiKey=secret' --set 'secret.username=username' sendgrid-stats-exporter ./
```

```
Expand Down Expand Up @@ -39,8 +39,8 @@ The following table lists the configurable parameters of the Sendgrid-stats-expo
| `podSecurityContext` | Security context for the pod | `{}` |
| `securityContext` | Security context for container | `{}` |
| `envFrom` | Extra custom environment variables from ConfigMaps | `[]` |
| `deployment.secret.apiKey` | SendGrid api token | `{}` |
| `deployment.secret.username` | SendGrid username | `[]` |
| `secret.apiKey` | SendGrid api token | `{}` |
| `secret.username` | SendGrid username | `[]` |
| `service.type` | Service Type | `"ClusterIP"` |
| `service.port` | Service port | `9154` |
| `ingress.enabled` | If true, enable Ingress | `false` |
Expand Down
4 changes: 2 additions & 2 deletions charts/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ Create the name of the service account to use
Return secret name to be used based on provided values.
*/}}
{{- define "sendgrid-stats-exporter.secretName" -}}
{{- if not .Values.deployment.secret.existingSecretName -}}
{{- if not .Values.secret.existingSecretName -}}
{{ default (printf "%s-secret" (include "sendgrid-stats-exporter.fullname" . )) }}
{{- else -}}
{{ .Values.deployment.secret.existingSecretName }}
{{ .Values.secret.existingSecretName }}
{{- end -}}
{{- end -}}
4 changes: 2 additions & 2 deletions charts/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ metadata:
{{- include "sendgrid-stats-exporter.labels" . | nindent 4 }}
type: Opaque
data:
username: {{ .Values.deployment.secret.username | b64enc | quote }}
apiKey: {{ .Values.deployment.secret.apiKey | b64enc | quote }}
username: {{ .Values.secret.username | b64enc | quote }}
apiKey: {{ .Values.secret.apiKey | b64enc | quote }}
9 changes: 4 additions & 5 deletions charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ securityContext: {}

envFrom: []

deployment:
secret:
existingSecretName:
username: ""
apiKey: ""
secret:
existingSecretName:
username: ""
apiKey: ""

service:
type: ClusterIP
Expand Down

0 comments on commit 8b091f7

Please sign in to comment.