Skip to content

Commit

Permalink
Allow the user to specify container securityContext. Fixes #97 #99
Browse files Browse the repository at this point in the history
  • Loading branch information
rigazilla committed Nov 21, 2023
1 parent 682a515 commit d1a03e3
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ Configure your Infinispan cluster by specifying values in the `deploy.*` section
| `deploy.makeDataDirWritable` | Allows write access to the `data` directory for each Infinispan Server node. | false | Setting the value to `true` creates an initContainer that runs `chmod -R` on the `/opt/infinispan/server/data` directory and changes its permissions. |
| `deploy.monitoring.enabled` | Enable or disable `ServiceMonitor` functionality. | false | Users must have `monitoring-edit` role assigned by the admin to deploy the Helm chart with `ServiceMonitor` enabled. |
| `deploy.nameOverride` | Specifies a name for all Infinispan cluster resources. | Helm Chart release name | Configure a name for the created resources only if you need it to be different to the Helm Chart release name. |
| `deploy.securityContext` | Defines the securityContext settings used by the cluster's StatefulSet | `{}` | - |
| `deploy.infinispan` | Infinispan Server configuration. | - | You should not change the default socket bindings or the security realm and endpoints named "metrics". Modifying these default properties can result in unexpected behavior and loss of service. |
1 change: 1 addition & 0 deletions README.md.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ Configure your {brandname} cluster by specifying values in the `deploy.*` sectio
| `deploy.makeDataDirWritable` | Allows write access to the `data` directory for each {brandname} Server node. | false | Setting the value to `true` creates an initContainer that runs `chmod -R` on the `/opt/infinispan/server/data` directory and changes its permissions. |
| `deploy.monitoring.enabled` | Enable or disable `ServiceMonitor` functionality. | false | Users must have `monitoring-edit` role assigned by the admin to deploy the Helm chart with `ServiceMonitor` enabled. |
| `deploy.nameOverride` | Specifies a name for all {brandname} cluster resources. | Helm Chart release name | Configure a name for the created resources only if you need it to be different to the Helm Chart release name. |
| `deploy.securityContext` | Defines the securityContext settings used by the cluster's StatefulSet | `{}` | - |
| `deploy.infinispan` | {brandname} Server configuration. | - | You should not change the default socket bindings or the security realm and endpoints named "metrics". Modifying these default properties can result in unexpected behavior and loss of service. |
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You can also find field and value descriptions in the link:{helm_chart_readme}[{
|No default value.

|`deploy.container.libraries`
| Libraries to be downloaded before server startup. Specify multiple, space-separated artifacts represented as URLs or as Maven coordinates. Archive artifacts in .tar, .tar.gz or .zip formats will be extracted.
| Libraries to be downloaded before server startup. Specify multiple, space-separated artifacts represented as URLs or as Maven coordinates. Archive artifacts in .tar, .tar.gz or .zip formats will be extracted.
|No default value.

|`deploy.container.storage.ephemeral`
Expand Down Expand Up @@ -102,6 +102,10 @@ If you do not specify a port, the platform selects an available one.
|Allows write access to the `data` directory for each {brandname} Server node. |`false`
If you set the value to `true`, {brandname} creates an initContainer that runs `chmod -R` on the `/opt/infinispan/server/data` directory to change permissions.

|`deploy.securityContext`
|Allow to set securityContext for cluster's statefulSet |`{}`
This can be used to change the group of mounted file systems. Set `securityContext.fsGroup` to `185` if you need to explicitly match the group owner for `/opt/infinispan/server/data` to the default {brandname}'s group

|`deploy.monitoring.enabled`
|Enable or disable monitoring using `ServiceMonitor`.
| `false` Users must have `monitoring-edit` role assigned by the admin to deploy the Helm chart with `ServiceMonitor` enabled.
Expand Down
8 changes: 7 additions & 1 deletion templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.deploy.securityContext }}
securityContext:
{{- with .Values.deploy.securityContext }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand Down Expand Up @@ -163,4 +169,4 @@ spec:
resources:
requests:
storage: {{ .Values.deploy.container.storage.size }}
{{- end }}
{{- end }}
7 changes: 7 additions & 0 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@
"null"
]
},
"securityContext: {
"description": "Defines the securityContext policy used by the cluster's StatefulSet.",
"type": [
"object",
"null"
]
},
"expose": {
"description": "Controls network access to Infinispan Server endpoints.",
"properties": {
Expand Down
7 changes: 7 additions & 0 deletions values.schema.json.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@
"null"
]
},
"securityContext: {
"description": "Defines the securityContext policy used by the cluster's StatefulSet.",
"type": [
"object",
"null"
]
},
"expose": {
"description": "Controls network access to {brandname} Server endpoints.",
"properties": {
Expand Down
5 changes: 4 additions & 1 deletion values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,12 @@ deploy:
tolerations: []

nodeAffinity: {}

nodeSelector: {}

securityContext:
fsGroup: 185

infinispan:
cacheContainer:
# [USER] Add cache, template, and counter configuration.
Expand Down

0 comments on commit d1a03e3

Please sign in to comment.