Skip to content

Commit

Permalink
Add support for preStartCommand and customVolumeMounts (jfrog#641)
Browse files Browse the repository at this point in the history
* jfrog#637 - Add support for `preStartCommand` and `customVolumeMounts`

* Fix changelog dates

* Fix changelog date

* Fix distribution preStartCommand comment

* Fix entrypoint scripts path
  • Loading branch information
danielezer authored Feb 13, 2020
1 parent 6b1a6e5 commit 0b52485
Show file tree
Hide file tree
Showing 16 changed files with 164 additions and 13 deletions.
3 changes: 3 additions & 0 deletions stable/distribution/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# JFrog Distribution Chart Changelog
All changes to this project chart be documented in this file.

## [3.5.3] - Feb 11, 2020
* Add support for `preStartCommand`, `customVolumes` and `customVolumeMounts`

## [3.5.2] - Feb 2, 2020
* Add a comment stating that it is recommended to use an external PostgreSQL with a static password for production installations

Expand Down
2 changes: 1 addition & 1 deletion stable/distribution/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: distribution
description: A Helm chart for JFrog Distribution
version: 3.5.2
version: 3.5.3
appVersion: 1.8.0
home: https://jfrog.com/platform/
icon: https://raw.githubusercontent.com/jfrog/charts/master/stable/distribution/logo/distribution-logo.png
Expand Down
22 changes: 22 additions & 0 deletions stable/distribution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,24 @@ distribution:
## Init containers template goes here ##
```

### Custom volumes
There are cases where you'd like custom files mounted onto your container's file system.

For this, there is a section for defining custom volumes in the [vaules.yaml](values.yaml). By default they are left empty.
```
distribution:
## Add custom volumes
customVolumes: |
# - name: custom-script
# configMap:
# name: custom-script
## Add custom volumeMounts
customVolumeMounts: |
# - name: custom-script
# mountPath: "/scripts/script.sh"
# subPath: script.sh
```

## Configuration
The following table lists the configurable parameters of the distribution chart and their default values.
Expand Down Expand Up @@ -227,6 +245,8 @@ The following table lists the configurable parameters of the distribution chart
| `distribution.service.type` | Distribution service type | `LoadBalancer` |
| `distribution.service.loadBalancerSourceRanges` | Distribution service whitelist | `[]` |
| `distribution.customInitContainers` | Custom init containers for Distribution | |
| `distribution.customVolumeMounts` | Custom Volumes for Distribution | see [values.yaml](values.yaml) |
| `distribution.customVolumes` | Custom Volume Mounts for Distribution | see [values.yaml](values.yaml) |
| `distribution.externalPort` | Distribution service external port | `80` |
| `distribution.internalPort` | Distribution service internal port | `8080` |
| `distribution.masterKey` | Distribution Master Key (can be generated with `openssl rand -hex 32`) | `BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB` |
Expand All @@ -238,6 +258,7 @@ The following table lists the configurable parameters of the distribution chart
| `distribution.persistence.existingClaim` | Provide an existing PersistentVolumeClaim | `nil` |
| `distribution.persistence.accessMode` | Distribution persistence volume access mode | `ReadWriteOnce` |
| `distribution.persistence.size` | Distribution persistence volume size | `50Gi` |
| `distribution.preStartCommand` | Distribution Command to run before the startup | |
| `distribution.nodeSelector` | Distribution node selector | `{}` |
| `distribution.affinity` | Distribution node affinity | `{}` |
| `distribution.tolerations` | Distribution node tolerations | `[]` |
Expand All @@ -256,6 +277,7 @@ The following table lists the configurable parameters of the distribution chart
| `distributor.persistence.enabled` | Distributor persistence volume enabled | `true` |
| `distributor.persistence.accessMode` | Distributor persistence volume access mode | `ReadWriteOnce` |
| `distributor.persistence.size` | Distributor persistence volume size | `50Gi` |
| `distributor.preStartCommand` | Distributor Command to run before the startup | |
| `distributor.nodeSelector` | Distributor node selector | `{}` |
| `distributor.affinity` | Distributor node affinity | `{}` |
| `distributor.tolerations` | Distributor node tolerations | `[]` |
Expand Down
24 changes: 24 additions & 0 deletions stable/distribution/templates/distribution-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ spec:
ports:
- name: distribution
containerPort: {{ .Values.distribution.internalPort }}
command:
- '/bin/sh'
- '-c'
- >
{{- with .Values.distribution.preStartCommand }}
echo "Running custom Distribution preStartCommand command";
{{ tpl . $ }};
{{- end }}
/opt/jfrog/distribution-{{ .Values.distribution.name }}/wrapper.sh;
env:
- name: DEFAULT_JAVA_OPTS
value: '-Ddistribution.home={{ .Values.distribution.persistence.mountPath }}
Expand Down Expand Up @@ -155,6 +164,9 @@ spec:
volumeMounts:
- name: distribution-data
mountPath: {{ .Values.distribution.persistence.mountPath | quote }}
{{- with .Values.distribution.customVolumeMounts }}
{{ tpl . $ | indent 8 }}
{{- end }}
resources:
{{ toYaml .Values.distribution.resources | indent 10 }}
readinessProbe:
Expand All @@ -175,6 +187,15 @@ spec:
imagePullPolicy: {{ .Values.distributor.image.imagePullPolicy }}
securityContext:
allowPrivilegeEscalation: false
command:
- '/bin/sh'
- '-c'
- >
{{- with .Values.distributor.preStartCommand }}
echo "Running Distributor custom preStartCommand command";
{{ tpl . $ }};
{{- end }}
/opt/jfrog/distribution-{{ .Values.distributor.name }}/wrapper.sh;
env:
- name: DEFAULT_JAVA_OPTS
value: '-Ddistribution.home={{ .Values.distributor.persistence.mountPath }}
Expand Down Expand Up @@ -284,6 +305,9 @@ spec:
{{ toYaml . | indent 8 }}
{{- end }}
volumes:
{{- with .Values.distribution.customVolumes }}
{{ tpl . $ | indent 6 }}
{{- end }}
{{- if not .Values.distribution.persistence.enabled }}
- name: distribution-data
emptyDir: {}
Expand Down
22 changes: 22 additions & 0 deletions stable/distribution/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,18 @@ distribution:
# - mountPath: "{{ .Values.distribution.persistence.mountPath }}"
# name: distribution-data

## Add custom volumes
customVolumes: |
# - name: custom-script
# configMap:
# name: custom-script

## Add custom volumeMounts
customVolumeMounts: |
# - name: custom-script
# mountPath: "/scripts/script.sh"
# subPath: script.sh

resources: {}
# requests:
# memory: "2Gi"
Expand Down Expand Up @@ -251,6 +263,11 @@ distribution:
##
# storageClass: "-"

## Custom command to run before Distribution startup.
preStartCommand:
## For example, to import trusted keystore ( Need to mount the certificates first )
# preStartCommand: "/java/jdk-11.0.2+9/bin/keytool -importcert -keystore /java/jdk-11.0.2+9/lib/security/cacerts -storepass changeit -file /tmp/trusted-certificates/root.crt -alias 'newcerts'"

# Add any of the loggers to a sidecar if you want to be able to see them with kubectl logs or a log collector in your k8s cluster
loggers: []
# - access.log
Expand Down Expand Up @@ -308,6 +325,11 @@ distributor:
##
# storageClass: "-"

## Custom command to run before Distribution startup.
preStartCommand:
## For example, to import trusted keystore ( Need to mount the certificates first )
# preStartCommand: "/java/jdk-11.0.2+9/bin/keytool -importcert -keystore /java/jdk-11.0.2+9/lib/security/cacerts -storepass changeit -file /tmp/trusted-certificates/root.crt -alias 'newcerts'"

# Add any of the loggers to a sidecar if you want to be able to see them with kubectl logs or a log collector in your k8s cluster
loggers: []
# - distributor.log
Expand Down
3 changes: 3 additions & 0 deletions stable/mission-control/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# JFrog Mission-Control Chart Changelog
All changes to this chart will be documented in this file.

## [1.1.16] - Feb 11, 2020
* Use a with clause for `preStartCommand`, `customVolumes` and `customVolumeMounts`

## [1.1.15] - Feb 6, 2020
* Fix init containers resources

Expand Down
2 changes: 1 addition & 1 deletion stable/mission-control/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: mission-control
description: A Helm chart for JFrog Mission Control
version: 1.1.15
version: 1.1.16
appVersion: 3.5.6
home: https://jfrog.com/mission-control/
icon: https://raw.githubusercontent.com/jfrog/charts/master/stable/mission-control/logo/jfmc-logo.png
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,15 @@ spec:
- name: {{ .Values.missionControl.name }}
image: {{ .Values.missionControl.image }}:{{ default .Chart.AppVersion .Values.missionControl.version }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
{{- if .Values.missionControl.preStartCommand }}
command:
- '/bin/sh'
- '-c'
- >
{{- with .Values.missionControl.preStartCommand }}
echo "Running custom preStartCommand command";
{{ tpl .Values.missionControl.preStartCommand . }};
/opt/entrypoint-mc.sh;
{{ tpl . $ }};
{{- end }}
/opt/entrypoint-mc.sh;
env:
{{- if .Values.postgresql.enabled }}
- name: DB_TYPE
Expand Down Expand Up @@ -466,8 +466,8 @@ spec:
volumeMounts:
- name: mission-control-data
mountPath: {{ .Values.missionControl.persistence.mountPath | quote }}
{{- if .Values.missionControl.customVolumeMounts }}
{{ tpl .Values.missionControl.customVolumeMounts . | indent 8 }}
{{- with .Values.missionControl.customVolumeMounts }}
{{ tpl . $ | indent 8 }}
{{- end }}
resources:
{{ toYaml .Values.missionControl.resources | indent 10 }}
Expand Down Expand Up @@ -751,8 +751,8 @@ spec:
configMap:
name: {{ template "mission-control.fullname" . }}-elasticsearch-scripts
{{- end }}
{{- if .Values.missionControl.customVolumes }}
{{ tpl .Values.missionControl.customVolumes . | indent 6 }}
{{- with .Values.missionControl.customVolumes }}
{{ tpl . $ | indent 6 }}
{{- end }}
{{- if not .Values.missionControl.persistence.enabled }}
- name: mission-control-data
Expand Down
7 changes: 5 additions & 2 deletions stable/xray/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# JFrog Xray Chart Changelog
All changes to this chart will be documented in this file.

## [1.3.5] - Feb 2, 2019
## [1.3.6] - Feb 11, 2020
* Add support for `preStartCommand`

## [1.3.5] - Feb 2, 2020
* Add a comment stating that it is recommended to use external databases with a static password for production installations

## [1.3.4] - Jan 30, 2019
## [1.3.4] - Jan 30, 2020
* Add the option to configure resources for the logger containers

## [1.3.3] - Dec 31, 2019
Expand Down
2 changes: 1 addition & 1 deletion stable/xray/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: xray
version: 1.3.5
version: 1.3.6
appVersion: 2.11.3
home: https://www.jfrog.com/xray/
description: Universal component scan for security and license inventory and impact analysis
Expand Down
7 changes: 6 additions & 1 deletion stable/xray/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ The following table lists the configurable parameters of the xray chart and thei
| `logger.image.repository` | Repository for logger image | `busybox` |
| `logger.image.tag` | Tag for logger image | `1.30` |
| `common.xrayVersion` | Xray image tag | `.Chart.AppVersion` |
| `common.xrayConfigPath` | Xray config path | `/var/opt/jfrog/xray/data` |
| `common.xrayConfigPath` | Xray config path | `/var/opt/jfrog/xray/data` |
| `common.preStartCommand` | Xray Custom command to run before startup. Runs BEFORE any microservice-specific preStartCommand | |
| `common.xrayUserId` | Xray User Id | `1035` |
| `common.xrayGroupId` | Xray Group Id | `1035` |
| `common.masterKey` | Xray Master Key Can be generated with `openssl rand -hex 32` | `FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF` |
Expand Down Expand Up @@ -353,6 +354,7 @@ The following table lists the configurable parameters of the xray chart and thei
| `analysis.readinessProbe.successThreshold` | Xray Analysis minimum consecutive successes for the probe to be considered successful after having failed | `1` |
| `analysis.persistence.size` | Xray Analysis storage size limit | `10Gi` |
| `analysis.resources` | Xray Analysis resources | `{}` |
| `analysis.preStartCommand` | Xray Analysis Custom command to run before startup. Runs AFTER the `common.preStartCommand` | |
| `analysis.loggers` | Xray Analysis loggers (see values.yaml for possible values) | ` ` |
| `analysis.loggersResources.requests.memory` | Xray Analysis loggers initial memory request | |
| `analysis.loggersResources.requests.cpu` | Xray Analysis loggers initial cpu request | |
Expand Down Expand Up @@ -393,6 +395,7 @@ The following table lists the configurable parameters of the xray chart and thei
| `indexer.persistence.accessMode` | Xray Indexer persistence volume access mode | `ReadWriteOnce` |
| `indexer.persistence.size` | Xray Indexer persistence volume size | `50Gi` |
| `indexer.resources` | Xray Indexer resources | `{}` |
| `indexer.preStartCommand` | Xray Indexer Custom command to run before startup. Runs AFTER the `common.preStartCommand` | |
| `indexer.loggers` | Xray Indexer loggers (see values.yaml for possible values) | ` ` |
| `indexer.loggersResources.requests.memory` | Xray Indexer loggers initial memory request | |
| `indexer.loggersResources.requests.cpu` | Xray Indexer loggers initial cpu request | |
Expand Down Expand Up @@ -425,6 +428,7 @@ The following table lists the configurable parameters of the xray chart and thei
| `persist.readinessProbe.failureThreshold` | Xray Persist minimum consecutive failures for the probe to be considered failed after having succeeded | `3` |
| `persist.readinessProbe.successThreshold` | Xray Persist minimum consecutive successes for the probe to be considered successful after having failed | `1` |
| `persist.persistence.size` | Xray Persist storage size limit | `10Gi` |
| `persist.preStartCommand` | Xray Persist Custom command to run before startup. Runs AFTER the `common.preStartCommand` | |
| `persist.loggers` | Xray Persist loggers (see values.yaml for possible values) | ` ` |
| `persist.loggersResources.requests.memory` | Xray Persist loggers initial memory request | |
| `persist.loggersResources.requests.cpu` | Xray Persist loggers initial cpu request | |
Expand Down Expand Up @@ -466,6 +470,7 @@ The following table lists the configurable parameters of the xray chart and thei
| `server.persistence.enabled` | Xray server persistence volume enabled | `true` |
| `server.persistence.accessMode` | Xray server persistence volume access mode | `ReadWriteOnce` |
| `server.persistence.size` | Xray server persistence volume size | `50Gi` |
| `server.preStartCommand` | Xray server Custom command to run before startup. Runs AFTER the `common.preStartCommand` | |
| `server.loggers` | Xray server loggers (see values.yaml for possible values) | ` ` |
| `server.loggersResources.requests.memory` | Xray server loggers initial memory request | |
| `server.loggersResources.requests.cpu` | Xray server loggers initial cpu request | |
Expand Down
13 changes: 13 additions & 0 deletions stable/xray/templates/xray-analysis-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,19 @@ spec:
- name: {{ .Values.analysis.name }}
image: {{ .Values.analysis.image }}:{{ default .Chart.AppVersion .Values.common.xrayVersion }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
command:
- '/bin/sh'
- '-c'
- >
{{- with .Values.common.preStartCommand }}
echo "Running custom common preStartCommand command";
{{ tpl . $ }};
{{- end }}
{{- with .Values.analysis.preStartCommand }}
echo "Running custom Analysis preStartCommand command";
{{ tpl . $ }};
{{- end }}
/opt/jfrog/{{ .Values.analysis.name }}/wrapper.sh;
env:
- name: XRAY_K8S_ENV
value: "true"
Expand Down
13 changes: 13 additions & 0 deletions stable/xray/templates/xray-indexer-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,19 @@ spec:
- name: {{ .Values.indexer.name }}
image: {{ .Values.indexer.image }}:{{ default .Chart.AppVersion .Values.common.xrayVersion }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
command:
- '/bin/sh'
- '-c'
- >
{{- with .Values.common.preStartCommand }}
echo "Running custom common preStartCommand command";
{{ tpl . $ }};
{{- end }}
{{- with .Values.indexer.preStartCommand }}
echo "Running custom Indexer preStartCommand command";
{{ tpl . $ }};
{{- end }}
/opt/jfrog/{{ .Values.indexer.name }}/wrapper.sh;
env:
- name: XRAY_K8S_ENV
value: "true"
Expand Down
Loading

0 comments on commit 0b52485

Please sign in to comment.