Skip to content
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

feat(auth): allow optional basic authentication #95

Merged
merged 4 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions charts/cryostat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ A Helm chart for deploying [Cryostat](https://cryostat.io/) on Kubernetes and Op
| `datasource.resources` | Resource requests/limits for the JFR Data Source container. See: [ResourceRequirements](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#resources) | `{}` |
| `datasource.securityContext` | Security Context for the JFR Data Source container. Defaults to meet "restricted" [Pod Security Standard](https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted). See: [SecurityContext](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context-1) | `{}` |

### Authentication

| Name | Description | Value |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `authentication.basicAuth.enabled` | Whether Cryostat should use basic authentication for users | `false` |
andrewazores marked this conversation as resolved.
Show resolved Hide resolved
| `authentication.basicAuth.secretName` | Name of the Secret that contains the credentials within Cryostat's namespace **(Required if basicAuth is enabled)** | `""` |
| `authentication.basicAuth.filename` | Key within Secret containing the properties file. The properties file should contain one user per line, with the syntax "user=passHex", where "user" is the username and "passHex" is the SHA-256 hash of the desired password **(Required if basicAuth is enabled)** | `""` |

### Other Parameters

| Name | Description | Value |
Expand Down
22 changes: 20 additions & 2 deletions charts/cryostat/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ spec:
value: "{{ if .Values.core.ingress.enabled }}{{ with index .Values.core.ingress.hosts 0 }}{{ .host }}{{ end }}{{ end }}"
- name: CRYOSTAT_PLATFORM
value: io.cryostat.platform.internal.KubeApiPlatformStrategy
- name: CRYOSTAT_AUTH_MANAGER
value: io.cryostat.net.NoopAuthManager
{{- if not .Values.minimal }}
- name: GRAFANA_DATASOURCE_URL
value: http://127.0.0.1:8080
Expand Down Expand Up @@ -94,6 +92,12 @@ spec:
name: {{ default (printf "%s-jmx-credentials-db" .Release.Name) .Values.core.databaseSecretName }}
key: CRYOSTAT_JMX_CREDENTIALS_DB_PASSWORD
optional: false
- name: CRYOSTAT_AUTH_MANAGER
{{- if (.Values.authentication).basicAuth.enabled }}
value: io.cryostat.net.BasicAuthManager
{{- else }}
value: io.cryostat.net.NoopAuthManager
{{- end }}
ports:
- containerPort: 8181
protocol: TCP
Expand Down Expand Up @@ -128,6 +132,12 @@ spec:
- mountPath: /opt/cryostat.d/probes.d
name: {{ .Chart.Name }}
subPath: probes
{{- if (.Values.authentication).basicAuth.enabled }}
- mountPath: /opt/cryostat.d/conf.d/cryostat-users.properties
name: basic-auth-properties
subPath: cryostat-users.properties
readOnly: true
{{- end }}
{{- if not .Values.minimal }}
- name: {{ printf "%s-%s" .Chart.Name "grafana" }}
securityContext:
Expand Down Expand Up @@ -190,3 +200,11 @@ spec:
- name: {{ .Chart.Name }}
emptyDir: {}
{{- end }}
{{- if (.Values.authentication).basicAuth.enabled }}
- name: basic-auth-properties
secret:
secretName: {{ .Values.authentication.basicAuth.secretName }}
items:
- key: {{ .Values.authentication.basicAuth.filename }}
path: cryostat-users.properties
{{- end }}
25 changes: 25 additions & 0 deletions charts/cryostat/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,31 @@
}
}
},
"authentication": {
"type": "object",
"properties": {
"basicAuth": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean",
"description": "Whether Cryostat should use basic authentication for users",
"default": false
},
"secretName": {
"type": "string",
"description": "Name of the Secret that contains the credentials within Cryostat's namespace **(Required if basicAuth is enabled)**",
"default": ""
},
"filename": {
"type": "string",
"description": "Key within Secret containing the properties file. The properties file should contain one user per line, with the syntax \"user=passHex\", where \"user\" is the username and \"passHex\" is the SHA-256 hash of the desired password **(Required if basicAuth is enabled)**",
"default": ""
}
}
}
}
},
"podSecurityContext": {
"type": "object",
"properties": {
Expand Down
11 changes: 11 additions & 0 deletions charts/cryostat/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,17 @@ datasource:
drop:
- ALL

## @section Authentication

authentication:
basicAuth:
## @param authentication.basicAuth.enabled Whether Cryostat should use basic authentication for users
enabled: false
## @param authentication.basicAuth.secretName Name of the Secret that contains the credentials within Cryostat's namespace **(Required if basicAuth is enabled)**
secretName: ""
## @param authentication.basicAuth.filename Key within Secret containing the properties file. The properties file should contain one user per line, with the syntax "user=passHex", where "user" is the username and "passHex" is the SHA-256 hash of the desired password **(Required if basicAuth is enabled)**
filename: ""

## @section Other Parameters

## @param minimal Specify whether to deploy a Cryostat instance with no Grafana Dashboard or JFR Data Source
Expand Down
Loading