Skip to content

Commit

Permalink
allow basic auth to be provided via secret
Browse files Browse the repository at this point in the history
  • Loading branch information
t83714 committed Nov 8, 2021
1 parent dad1777 commit 5434fda
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 28 deletions.
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ Kubernetes: `>= 1.14.0-0`

## Values

| Key | Type | Default | Description |
| ---------------------------------- | ------ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| basicAuthSecretName | string | `nil` | You can set this value to supply basic auth username & password. The secret must have two keys: `username` & `password`. When this field is set, `config.basicAuthEnabled` will be auto-set to `true`. |
| config.basicAuthEnabled | bool | `false` | Whether or not to send basic auth header. When you set `basicAuthSecretName`, the value of this option will be auto-set to `true`. |
| config.basicAuthPassword | string | `""` | basic auth password. You can also passing this value via secret. To do so, set `basicAuthSecretName` to the secret name. |
| config.basicAuthUsername | string | `""` | basic auth username. You can also passing this value via secret. To do so, set `basicAuthSecretName` to the secret name. |
| config.id | string | `"default-csw-connector"` | |
| config.usePostRequest | bool | `false` | |
| defaultImage.imagePullSecret | bool | `false` | |
| defaultImage.pullPolicy | string | `"IfNotPresent"` | |
| defaultImage.repository | string | `"docker.io/data61"` | |
| defaultSettings.includeCronJobs | bool | `true` | |
| defaultSettings.includeInitialJobs | bool | `false` | |
| defaultTenantId | int | `0` | |
| global.connectors.image | object | `{}` | |
| global.image | object | `{}` | |
| image.name | string | `"magda-csw-connector"` | |
| resources.limits.cpu | string | `"100m"` | |
| resources.requests.cpu | string | `"50m"` | |
| resources.requests.memory | string | `"30Mi"` | |
| Key | Type | Default | Description |
| ---------------------------------- | ------ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| config.basicAuthEnabled | bool | `false` | Whether or not to send basic auth header. |
| config.basicAuthPassword | string | `nil` | basic auth password. You can also passing this value via secret. To do so, set `basicAuthSecretName` to the secret name. |
| config.basicAuthSecretName | string | `nil` | You can set this value to supply basic auth username & password. The secret must have two keys: `username` & `password`. |
| config.basicAuthUsername | string | `nil` | basic auth username. You can also passing this value via secret. To do so, set `basicAuthSecretName` to the secret name. |
| config.id | string | `"default-csw-connector"` | |
| config.usePostRequest | bool | `false` | |
| defaultImage.imagePullSecret | bool | `false` | |
| defaultImage.pullPolicy | string | `"IfNotPresent"` | |
| defaultImage.repository | string | `"docker.io/data61"` | |
| defaultSettings.includeCronJobs | bool | `true` | |
| defaultSettings.includeInitialJobs | bool | `false` | |
| defaultTenantId | int | `0` | |
| global.connectors.image | object | `{}` | |
| global.image | object | `{}` | |
| image.name | string | `"magda-csw-connector"` | |
| resources.limits.cpu | string | `"100m"` | |
| resources.requests.cpu | string | `"50m"` | |
| resources.requests.memory | string | `"30Mi"` | |
12 changes: 12 additions & 0 deletions deploy/magda-csw-connector/templates/cronjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ spec:
secretKeyRef:
name: auth-secrets
key: jwt-secret
{{- if .Values.config.basicAuthSecretName }}
- name: BASIC_AUTH_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Values.config.basicAuthSecretName | quote }}
key: username
- name: BASIC_AUTH_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.config.basicAuthSecretName | quote }}
key: password
{{- end }}
restartPolicy: "OnFailure"
volumes:
- name: config
Expand Down
12 changes: 12 additions & 0 deletions deploy/magda-csw-connector/templates/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ spec:
secretKeyRef:
name: auth-secrets
key: jwt-secret
{{- if .Values.config.basicAuthSecretName }}
- name: BASIC_AUTH_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Values.config.basicAuthSecretName | quote }}
key: username
- name: BASIC_AUTH_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.config.basicAuthSecretName | quote }}
key: password
{{- end }}
restartPolicy: "OnFailure"
volumes:
- name: config
Expand Down
14 changes: 6 additions & 8 deletions deploy/magda-csw-connector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ defaultSettings:

defaultTenantId: 0

# -- You can set this value to supply basic auth username & password.
# The secret must have two keys: `username` & `password`.
# When this field is set, `config.basicAuthEnabled` will be auto-set to `true`.
basicAuthSecretName:

config:
## Unique id to identify this connector and records that are harvested from it
id: default-csw-connector
Expand All @@ -73,13 +68,16 @@ config:
usePostRequest: false

# -- Whether or not to send basic auth header.
# When you set `basicAuthSecretName`, the value of this option will be auto-set to `true`.
basicAuthEnabled: false

# -- basic auth username. You can also passing this value via secret.
# To do so, set `basicAuthSecretName` to the secret name.
basicAuthUsername: ""
basicAuthUsername:

# -- basic auth password. You can also passing this value via secret.
# To do so, set `basicAuthSecretName` to the secret name.
basicAuthPassword: ""
basicAuthPassword:

# -- You can set this value to supply basic auth username & password.
# The secret must have two keys: `username` & `password`.
basicAuthSecretName:

0 comments on commit 5434fda

Please sign in to comment.