[stable/artifactory] Postgresql requirement / ingress support / nginx optional (#3242)

* Removed Postgresql own deployment and created dependency to stable/Postgresql.
Updated artifactory version number to 5.8.0.
Updated notes and added ingress documentation.
Added Ingress support to artifactory.
Made the NGINX deployment optional by adding an enabled flag.
Fixed naming of components.

* bump chart version

* Fixed wrong Chart number for artifactory

* Add documentation for Ingress, set Postgresql chart version, set persistence default on true

* Refresh requirements.lock

* Set version to 7.0.0, cecause the API to the chart changed
This commit is contained in:
Joost Hofman
2018-01-30 09:28:10 -08:00
committed by k8s-ci-robot
parent d31e2725b8
commit 5a47997e12
18 changed files with 139 additions and 264 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
apiVersion: v1
name: artifactory
home: https://www.jfrog.com/artifactory/
version: 6.2.5
version: 7.0.0
appVersion: 5.8.3
description: Universal Repository Manager supporting all major packaging formats,
build tools and CI servers.
+41 -29
View File
@@ -9,8 +9,9 @@
This chart will do the following:
* Deploy Artifactory-Pro (or OSS if set custom image)
* Deploy a PostgreSQL database
* Deploy an Nginx server
* Deploy a PostgreSQL database using the stable/postgresql chart
* Deploy an optional Nginx server
* Optionally expose Artifactory with Ingress [Ingress documentation](https://kubernetes.io/docs/concepts/services-networking/ingress/)
## Installing the Chart
@@ -51,10 +52,6 @@ $ helm install --name artifactory \
--set artifactory.resources.limits.memory="4Gi" \
--set artifactory.javaOpts.xms="1g" \
--set artifactory.javaOpts.xmx="4g" \
--set database.resources.requests.cpu="200m" \
--set database.resources.limits.cpu="1" \
--set database.resources.requests.memory="500Mi" \
--set database.resources.limits.memory="1Gi" \
--set nginx.resources.requests.cpu="100m" \
--set nginx.resources.limits.cpu="250m" \
--set nginx.resources.requests.memory="250Mi" \
@@ -66,7 +63,7 @@ Get more details on configuring Artifactory in the [official documentation](http
### Customizing Database password
You can override the specified database password (set in [values.yaml](values.yaml)), by passing it as a parameter in the install command line
```bash
$ helm install --name artifactory --namespace artifactory --set database.env.pass=12_hX34qwerQ2 stable/artifactory
$ helm install --name artifactory --namespace artifactory --set postgresql.postgresPassword=12_hX34qwerQ2 stable/artifactory
```
You can customise other parameters in the same way, by passing them on `helm install` command line.
@@ -80,7 +77,7 @@ This will completely delete your Artifactory Pro deployment.
### Custom Docker registry for your images
If you need to pull your Docker images from a private registry, you need to create a
If you need to pull your Docker images from a private registry, you need to create a
[Kubernetes Docker registry secret](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) and pass it to helm
```bash
# Create a Docker registry secret called 'regsecret'
@@ -98,26 +95,6 @@ The following tables lists the configurable parameters of the artifactory chart
| Parameter | Description | Default |
|---------------------------|-----------------------------------|----------------------------------------------------------|
| `imagePullSecrets` | Docker registry pull secret | |
| `database.name` | Database name | `postgresql` |
| `database.replicaCount` | Database replica count | `1` |
| `database.env.type` | Database type | `postgresql` |
| `database.env.name` | Database name | `artifactory` |
| `database.env.user` | Database username | `artifactory` |
| `database.env.pass` | Database password | `Randomly generated` |
| `database.image.repository` | Database container image | `docker.bintray.io/postgres` |
| `database.image.version` | Database container image tag | `9.5.2` |
| `database.image.pullPolicy` | Container pull policy | `IfNotPresent` |
| `database.service.type` | Database service type | `ClusterIP` |
| `database.externalPort` | Database service external port | `5432` |
| `database.internalPort` | Database service internal port | `5432` |
| `database.persistence.mountPath` | Database persistence volume mount path | `"/var/lib/postgresql/data"` |
| `database.persistence.enabled` | Database persistence volume enabled | `true` |
| `database.persistence.accessMode` | Database persistence volume access mode | `ReadWriteOnce` |
| `database.persistence.size` | Database persistence volume size | `10Gi` |
| `database.resources.requests.memory` | Database initial memory request | |
| `database.resources.requests.cpu` | Database initial cpu request | |
| `database.resources.limits.memory` | Database memory limit | |
| `database.resources.limits.cpu` | Database cpu limit | |
| `artifactory.name` | Artifactory name | `artifactory` |
| `artifactory.replicaCount` | Replica count for Artifactory deployment| `1` |
| `artifactory.image.pullPolicy` | Container pull policy | `IfNotPresent` |
@@ -138,7 +115,12 @@ The following tables lists the configurable parameters of the artifactory chart
| `artifactory.javaOpts.xms` | Artifactory java Xms size | |
| `artifactory.javaOpts.xmx` | Artifactory java Xms size | |
| `artifactory.javaOpts.other` | Artifactory additional java options | |
| `ingress.enabled` | If true, Artifactory Ingress will be created | `false` |
| `ingress.annotations` | Artifactory Ingress annotations | `{}` |
| `ingress.hosts` | Artifactory Ingress hostnames | `[]` |
| `ingress.tls` | Artifactory Ingress TLS configuration (YAML) | `[]` |
| `nginx.name` | Nginx name | `nginx` |
| `nginx.enabled` | Deploy nginx server | `false` |
| `nginx.replicaCount` | Nginx replica count | `1` |
| `nginx.image.repository` | Container image | `docker.bintray.io/jfrog/nginx-artifactory-pro` |
| `nginx.image.version` | Container tag | `5.8.3` |
@@ -162,8 +144,38 @@ The following tables lists the configurable parameters of the artifactory chart
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
### Ingress TLS
If your cluster allows automatic creation/retrieval of TLS certificates (e.g. [kube-lego](https://github.com/jetstack/kube-lego)), please refer to the documentation for that mechanism.
To manually configure TLS, first create/retrieve a key & certificate pair for the address(es) you wish to protect. Then create a TLS secret in the namespace:
```console
kubectl create secret tls artifactory-tls --cert=path/to/tls.cert --key=path/to/tls.key
```
Include the secret's name, along with the desired hostnames, in the Artifactory Ingress TLS section of your custom `values.yaml` file:
```
ingress:
## If true, Artifactory Ingress will be created
##
enabled: true
## Artifactory Ingress hostnames
## Must be provided if Ingress is enabled
##
hosts:
- artifactory.domain.com
## Artifactory Ingress TLS configuration
## Secrets must be manually created in the namespace
##
tls:
- secretName: artifactory-tls
hosts:
- artifactory.domain.com
```
## Useful links
https://www.jfrog.com
https://www.jfrog.com/confluence/
+6
View File
@@ -0,0 +1,6 @@
dependencies:
- name: postgresql
repository: https://kubernetes-charts.storage.googleapis.com/
version: 0.8.7
digest: sha256:491a82b45453cd4601610de0b39d0e6366874ea5b47a2caeaed0c3b05a9dbe90
generated: 2018-01-17T13:04:06.543766+01:00
+4
View File
@@ -0,0 +1,4 @@
dependencies:
- name: postgresql
version: 0.8.7
repository: https://kubernetes-charts.storage.googleapis.com/
+6 -1
View File
@@ -2,7 +2,12 @@ Congratulations. You have just deployed JFrog Artifactory Pro!
1. Get the Artifactory URL by running these commands:
{{- if contains "NodePort" .Values.nginx.service.type }}
{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
http://{{ . }}
{{- end }}
{{- else if contains "NodePort" .Values.nginx.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "artifactory.nginx.name" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT/
+2 -35
View File
@@ -6,28 +6,13 @@ Expand the name of the chart.
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Expand the name artifactory service.
*/}}
{{- define "artifactory.artifactory.name" -}}
{{- default .Values.artifactory.name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Expand the name database service.
*/}}
{{- define "artifactory.database.name" -}}
{{- default .Values.database.name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Expand the name nginx service.
*/}}
{{- define "artifactory.nginx.name" -}}
{{- default .Values.nginx.name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- default .Chart.Name .Values.nginx.name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
@@ -37,24 +22,6 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified application name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "artifactory.artifactory.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s-%s" .Release.Name $name .Values.artifactory.name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified database name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "artifactory.database.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s-%s" .Release.Name $name .Values.database.name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified nginx name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
@@ -62,4 +29,4 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- define "artifactory.nginx.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s-%s" .Release.Name $name .Values.nginx.name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
@@ -1,7 +1,7 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "artifactory.artifactory.fullname" . }}
name: {{ template "artifactory.fullname" . }}
labels:
app: {{ template "artifactory.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
@@ -37,23 +37,23 @@ spec:
command:
- 'sh'
- '-c'
- 'until nc -z -w 2 {{ template "artifactory.database.name" . }} {{ .Values.database.externalPort }} && echo database ok; do sleep 2; done'
- 'until nc -z -w 2 {{ .Release.Name }}-postgresql {{ .Values.postgresql.service.port }} && echo database ok; do sleep 2; done'
containers:
- name: {{ .Values.artifactory.name }}
image: "{{ .Values.artifactory.image.repository }}:{{ .Values.artifactory.image.version }}"
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
env:
- name: DB_TYPE
value: {{ .Values.database.env.type }}
value: 'postgresql'
- name: DB_USER
value: {{ .Values.database.env.user }}
value: {{.Values.postgresql.postgresUser | quote }}
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "artifactory.fullname" . }}
key: artifactory-database-password
name: {{ .Release.Name }}-postgresql
key: postgres-password
- name: DB_HOST
value: {{ template "artifactory.database.name" . }}
value: {{ .Release.Name }}-postgresql
- name: EXTRA_JAVA_OPTIONS
value: "
{{- if .Values.artifactory.javaOpts.other }}
@@ -90,7 +90,7 @@ spec:
- name: artifactory-volume
{{- if .Values.artifactory.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "artifactory.artifactory.fullname" . }}
claimName: {{ .Values.artifactory.persistence.ExistingClaim | default (include "artifactory.fullname" .) }}
{{- else }}
emptyDir: {}
{{- end -}}
@@ -1,8 +1,8 @@
{{- if .Values.artifactory.persistence.enabled }}
{{- if and .Values.artifactory.persistence.enabled (not .Values.artifactory.persistence.ExistingClaim) -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "artifactory.artifactory.fullname" . }}
name: {{ template "artifactory.fullname" . }}
labels:
app: {{ template "artifactory.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.artifactory.service.name }}
name: {{ template "artifactory.fullname" . }}
labels:
app: {{ template "artifactory.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
@@ -22,4 +22,4 @@ spec:
selector:
app: {{ template "artifactory.name" . }}
component: "{{ .Values.artifactory.name }}"
release: {{ .Release.Name }}
release: {{ .Release.Name }}
+32
View File
@@ -0,0 +1,32 @@
{{- if .Values.ingress.enabled -}}
{{- $serviceName := include "artifactory.fullname" . -}}
{{- $servicePort := .Values.artifactory.externalPort -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "artifactory.fullname" . }}
labels:
app: {{ template "artifactory.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
{{- range $key, $value := .Values.ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
rules:
{{- range $host := .Values.ingress.hosts }}
- host: {{ $host }}
http:
paths:
- path: /
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end -}}
{{- if .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
@@ -1,3 +1,4 @@
{{- if .Values.nginx.enabled -}}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
@@ -44,13 +45,13 @@ spec:
- '-c'
- >
until [ -f /etc/nginx/conf.d/artifactory.conf ]; do sleep 1; done;
sed -i -e 's,proxy_pass .*,proxy_pass {{ .Values.nginx.env.artUrl }}/;,g' \
-e 's,server_name .*,server_name ~(?<repo>.+)\\.{{ .Values.artifactory.service.name }} {{ .Values.artifactory.service.name }};,g' \
sed -i -e 's,proxy_pass .*,proxy_pass http://{{ template "artifactory.fullname" . }}:{{ .Values.artifactory.externalPort }}/artifactory/;,g' \
-e 's,server_name .*,server_name ~(?<repo>.+)\\.{{ template "artifactory.fullname" . }} {{ template "artifactory.fullname" . }};,g' \
/etc/nginx/conf.d/artifactory.conf;
sleep 5; nginx -s reload; touch /var/log/nginx/conf.done
env:
- name: ART_BASE_URL
value: "{{ .Values.nginx.env.artUrl }}"
value: "http://{{ template "artifactory.fullname" . }}:{{ .Values.artifactory.externalPort }}/artifactory"
- name: SSL
value: "{{ .Values.nginx.env.ssl }}"
ports:
@@ -69,3 +70,4 @@ spec:
{{- else }}
emptyDir: {}
{{- end -}}
{{- end }}
+1 -1
View File
@@ -1,4 +1,4 @@
{{- if .Values.nginx.persistence.enabled }}
{{- if and .Values.nginx.persistence.enabled (.Values.nginx.enabled ) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
@@ -1,7 +1,8 @@
{{- if .Values.nginx.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ template "artifactory.nginx.name" . }}
name: {{ template "artifactory.nginx.fullname" . }}
labels:
app: {{ template "artifactory.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
@@ -33,4 +34,5 @@ spec:
selector:
app: {{ template "artifactory.name" . }}
component: "{{ .Values.nginx.name }}"
release: {{ .Release.Name }}
release: {{ .Release.Name }}
{{- end }}
@@ -1,77 +0,0 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "artifactory.database.fullname" . }}
labels:
app: {{ template "artifactory.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.database.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
replicas: 1
template:
metadata:
labels:
app: {{ template "artifactory.name" . }}
component: "{{ .Values.database.name }}"
release: {{ .Release.Name }}
spec:
initContainers:
- name: "remove-lost-found"
image: "{{ .Values.initContainerImage }}"
imagePullPolicy: "{{ .Values.database.image.pullPolicy }}"
command:
- 'sh'
- '-c'
- 'rm -rf {{ .Values.database.persistence.mountPath }}/lost+found'
volumeMounts:
- mountPath: {{ .Values.database.persistence.mountPath | quote }}
name: postgresql-volume
containers:
- name: {{ .Values.database.name }}
image: "{{ .Values.database.image.repository }}:{{ .Values.database.image.version }}"
imagePullPolicy: {{ .Values.database.image.pullPolicy }}
env:
- name: POSTGRES_DB
value: {{ .Values.database.env.name }}
- name: POSTGRES_USER
value: {{ .Values.database.env.user }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "artifactory.fullname" . }}
key: artifactory-database-password
ports:
- containerPort: {{ .Values.database.internalPort }}
volumeMounts:
- mountPath: {{ .Values.database.persistence.mountPath | quote }}
name: postgresql-volume
resources:
{{ toYaml .Values.database.resources | indent 10 }}
livenessProbe:
exec:
command:
- sh
- -c
- exec pg_isready
initialDelaySeconds: 60
timeoutSeconds: 5
failureThreshold: 6
readinessProbe:
exec:
command:
- sh
- -c
- exec pg_isready
initialDelaySeconds: 30
timeoutSeconds: 3
periodSeconds: 5
volumes:
- name: postgresql-volume
{{- if .Values.database.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "artifactory.database.fullname" . }}
{{- else }}
emptyDir: {}
{{- end -}}
@@ -1,24 +0,0 @@
{{- if .Values.database.persistence.enabled }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "artifactory.database.fullname" . }}
labels:
app: {{ template "artifactory.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
accessModes:
- {{ .Values.database.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.database.persistence.size | quote }}
{{- if .Values.database.persistence.storageClass }}
{{- if (eq "-" .Values.database.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.database.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
@@ -1,16 +0,0 @@
apiVersion: v1
kind: Secret
metadata:
labels:
app: {{ template "artifactory.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "artifactory.fullname" . }}
type: Opaque
data:
{{- if .Values.database.env.pass }}
artifactory-database-password: {{ .Values.database.env.pass | b64enc | quote }}
{{- else }}
artifactory-database-password: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
@@ -1,25 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "artifactory.database.name" . }}
labels:
app: {{ template "artifactory.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.database.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- if .Values.database.service.annotations }}
annotations:
{{ toYaml .Values.database.service.annotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.database.service.type }}
ports:
- port: {{ .Values.database.externalPort }}
targetPort: {{ .Values.database.internalPort }}
protocol: TCP
name: {{ .Release.Name }}
selector:
app: {{ template "artifactory.name" . }}
component: "{{ .Values.database.name }}"
release: {{ .Release.Name }}
+25 -38
View File
@@ -10,43 +10,19 @@ initContainerImage: "alpine:3.6"
# For supporting pulling from private registries
imagePullSecrets:
# Database
database:
name: postgresql
env:
type: postgresql
name: artifactory
user: artifactory
# pass: artXifactory1973
image:
repository: docker.bintray.io/postgres
version: 9.5.2
pullPolicy: IfNotPresent
service:
type: ClusterIP
annotations: {}
externalPort: 5432
internalPort: 5432
persistence:
mountPath: "/var/lib/postgresql/data"
enabled: true
accessMode: ReadWriteOnce
size: 10Gi
## database data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
# storageClass: "-"
resources: {}
# requests:
# memory: "512Mi"
# cpu: "100m"
# limits:
# memory: "1Gi"
# cpu: "500m"
ingress:
enabled: false
# Used to create an Ingress record.
hosts:
- artifactory.domain.example
annotations:
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
tls:
# Secrets must be manually created in the namespace.
# - secretName: chart-example-tls
# hosts:
# - artifactory.domain.example
# Artifactory
artifactory:
@@ -94,6 +70,7 @@ artifactory:
# Nginx
nginx:
enabled: true
name: nginx
replicaCount: 1
image:
@@ -119,7 +96,7 @@ nginx:
ssl: true
persistence:
mountPath: "/var/opt/jfrog/nginx"
enabled: true
enabled: false
accessMode: ReadWriteOnce
size: 5Gi
## nginx data Persistent Volume Storage Class
@@ -137,3 +114,13 @@ nginx:
# limits:
# memory: "250Mi"
# cpu: "500m"
## Configuration values for the postgresql dependency
## ref: https://github.com/kubernetes/charts/blob/master/stable/postgressql/README.md
##
postgresql:
postgresUser: "artifactory"
postgresPassword: "artifactory"
postgresDatabase: "artifactory"
persistence:
enabled: true