Change wildfly

This commit is contained in:
tompizmor
2019-07-22 13:50:56 +02:00
parent cbc2d88dcf
commit 6b82a23433
5 changed files with 108 additions and 33 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: wildfly
version: 3.0.0
version: 3.1.0
appVersion: 17.0.1
description: Chart for Wildfly
keywords:
+43 -28
View File
@@ -45,34 +45,40 @@ The command removes all the Kubernetes components associated with the chart and
The following tables lists the configurable parameters of the WildFly chart and their default values.
| Parameter | Description | Default |
|---------------------------------|----------------------------------------|------------------------------------------------------------|
| `global.imageRegistry` | Global Docker image registry | `nil` |
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
| `image.registry` | WildFly image registry | `docker.io` |
| `image.repository` | WildFly Image name | `bitnami/wildfly` |
| `image.tag` | WildFly Image tag | `{TAG_NAME}` |
| `image.pullPolicy` | WildFly image pull policy | `IfNotPresent` |
| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
| `nameOverride` | String to partially override wildfly.fullname template with a string (will prepend the release name) | `nil` |
| `fullnameOverride` | String to fully override wildfly.fullname template with a string | `nil` |
| `wildflyUsername` | WildFly admin user | `user` |
| `wildflyPassword` | WildFly admin password | _random 10 character alphanumeric string_ |
| `securityContext.enabled` | Enable security context | `true` |
| `securityContext.fsGroup` | Group ID for the container | `1001` |
| `securityContext.runAsUser` | User ID for the container | `1001` |
| `service.type` | Kubernetes Service type | `LoadBalancer` |
| `service.port` | Service HTTP port | `80` |
| `service.mgmtPort` | Service Management port | `9990` |
| `service.nodePorts.http` | Kubernetes http node port | `""` |
| `service.nodePorts.mgmt` | Kubernetes management node port | `""` |
| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` |
| `service.loadBalancerIP` | LoadBalancer service IP address | `""` |
| `persistence.enabled` | Enable persistence using PVC | `true` |
| `persistence.storageClass` | PVC Storage Class for WildFly volume | `nil` (uses alpha storage class annotation) |
| `persistence.accessMode` | PVC Access Mode for WildFly volume | `ReadWriteOnce` |
| `persistence.size` | PVC Storage Request for WildFly volume | `8Gi` |
| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` |
| Parameter | Description | Default |
| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| `global.imageRegistry` | Global Docker image registry | `nil` |
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
| `image.registry` | WildFly image registry | `docker.io` |
| `image.repository` | WildFly Image name | `bitnami/wildfly` |
| `image.tag` | WildFly Image tag | `{TAG_NAME}` |
| `image.pullPolicy` | WildFly image pull policy | `IfNotPresent` |
| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
| `nameOverride` | String to partially override wildfly.fullname template with a string (will prepend the release name) | `nil` |
| `fullnameOverride` | String to fully override wildfly.fullname template with a string | `nil` |
| `volumePermissions.enabled` | Enable init container that changes volume permissions in the data directory (for cases where the default k8s `runAsUser` and `fsUser` values do not work) | `false` |
| `volumePermissions.image.registry` | Init container volume-permissions image registry | `docker.io` |
| `volumePermissions.image.repository` | Init container volume-permissions image name | `bitnami/minideb` |
| `volumePermissions.image.tag` | Init container volume-permissions image tag | `latest` |
| `volumePermissions.image.pullPolicy` | Init container volume-permissions image pull policy | `Always` |
| `volumePermissions.resources` | Init container resource requests/limit | `nil` |
| `wildflyUsername` | WildFly admin user | `user` |
| `wildflyPassword` | WildFly admin password | _random 10 character alphanumeric string_ |
| `securityContext.enabled` | Enable security context | `true` |
| `securityContext.fsGroup` | Group ID for the container | `1001` |
| `securityContext.runAsUser` | User ID for the container | `1001` |
| `service.type` | Kubernetes Service type | `LoadBalancer` |
| `service.port` | Service HTTP port | `80` |
| `service.mgmtPort` | Service Management port | `9990` |
| `service.nodePorts.http` | Kubernetes http node port | `""` |
| `service.nodePorts.mgmt` | Kubernetes management node port | `""` |
| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` |
| `service.loadBalancerIP` | LoadBalancer service IP address | `""` |
| `persistence.enabled` | Enable persistence using PVC | `true` |
| `persistence.storageClass` | PVC Storage Class for WildFly volume | `nil` (uses alpha storage class annotation) |
| `persistence.accessMode` | PVC Access Mode for WildFly volume | `ReadWriteOnce` |
| `persistence.size` | PVC Storage Request for WildFly volume | `8Gi` |
| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` |
The above parameters map to the env variables defined in [bitnami/wildfly](http://github.com/bitnami/bitnami-docker-wildfly). For more information please refer to the [bitnami/wildfly](http://github.com/bitnami/bitnami-docker-wildfly) image documentation.
@@ -107,6 +113,15 @@ The [Bitnami WildFly](https://github.com/bitnami/bitnami-docker-wildfly) image s
Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube.
See the [Configuration](#configuration) section to configure the PVC or to disable persistence.
### Adjust permissions of persistent volume mountpoint
As the image run as non-root by default, it is necessary to adjust the ownership of the persistent volume so that the container can write data into it.
By default, the chart is configured to use Kubernetes Security Context to automatically change the ownership of the volume. However, this feature does not work in all Kubernetes distributions.
As an alternative, this chart supports using an initContainer to change the ownership of the volume before mounting it in the final destination.
You can enable this initContainer by setting `volumePermissions.enabled` to `true`.
## Upgrading
### To 2.1.0
+31 -2
View File
@@ -61,16 +61,45 @@ imagePullSecrets:
{{- range .Values.global.imagePullSecrets }}
- name: {{ . }}
{{- end }}
{{- else if .Values.image.pullSecrets }}
{{- else if or .Values.image.pullSecrets .Values.volumePermissions.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- range .Values.volumePermissions.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end -}}
{{- else if .Values.image.pullSecrets }}
{{- else if or .Values.image.pullSecrets .Values.volumePermissions.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- range .Values.volumePermissions.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end -}}
{{- end -}}
{{/*
Return the proper image name (for the init container volume-permissions image)
*/}}
{{- define "wildfly.volumePermissions.image" -}}
{{- $registryName := .Values.volumePermissions.image.registry -}}
{{- $repositoryName := .Values.volumePermissions.image.repository -}}
{{- $tag := .Values.volumePermissions.image.tag | toString -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
Also, we can't use a single if because lazy evaluation is not an option
*/}}
{{- if .Values.global }}
{{- if .Values.global.imageRegistry }}
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- end -}}
+15 -2
View File
@@ -25,6 +25,19 @@ spec:
runAsUser: {{ .Values.securityContext.runAsUser }}
{{- end }}
{{- include "wildfly.imagePullSecrets" . | indent 6 }}
{{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
initContainers:
- name: volume-permissions
image: "{{ template "wildfly.volumePermissions.image" . }}"
imagePullPolicy: {{ default "" .Values.volumePermissions.image.pullPolicy | quote }}
command: ["chown", "-R", "{{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}", "/bitnami/wildfly"]
securityContext:
runAsUser: 0
resources: {{ toYaml .Values.volumePermissions.resources | nindent 10 -}}
volumeMounts:
- name: data
mountPath: /bitnami/wildfly
{{- end }}
containers:
- name: wildlfy
image: "{{ template "wildfly.image" . }}"
@@ -59,10 +72,10 @@ spec:
resources:
{{ toYaml .Values.resources | indent 10 }}
volumeMounts:
- name: wildfly-data
- name: data
mountPath: /bitnami/wildfly
volumes:
- name: wildfly-data
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "wildfly.fullname" . }}
+18
View File
@@ -34,6 +34,24 @@ image:
##
# fullnameOverride:
## Init containers parameters:
## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section.
##
volumePermissions:
enabled: false
image:
registry: docker.io
repository: bitnami/minideb
tag: latest
pullPolicy: Always
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
##
# pullSecrets:
# - myRegistryKeySecretName
resources: {}
## Specify a imagePullPolicy
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##