Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

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

Merged
merged 7 commits into from
Jan 30, 2018
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
2 changes: 1 addition & 1 deletion stable/artifactory/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: artifactory
home: https://www.jfrog.com/artifactory/
version: 6.2.5
version: 6.3.5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should start 6.3.0.

appVersion: 5.8.3
description: Universal Repository Manager supporting all major packaging formats,
build tools and CI servers.
Expand Down
33 changes: 5 additions & 28 deletions stable/artifactory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the optional ingress.
Also, add a documentation section on the ingress and its supported parameters.

  • What it does
  • Using the TLS secret
  • Whitelisting IPs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added information about TLS secrets and how to use.
For the Ingress and whitelisting part I added a link to the kubernetes documentation.


## Installing the Chart

Expand Down Expand Up @@ -51,10 +51,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" \
Expand All @@ -66,7 +62,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.
Expand All @@ -80,7 +76,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'
Expand All @@ -98,26 +94,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` |
Expand All @@ -139,6 +115,7 @@ The following tables lists the configurable parameters of the artifactory chart
| `artifactory.javaOpts.xmx` | Artifactory java Xms size | |
| `artifactory.javaOpts.other` | Artifactory additional java options | |
| `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` |
Expand Down
6 changes: 6 additions & 0 deletions stable/artifactory/requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: postgresql
repository: https://kubernetes-charts.storage.googleapis.com/
version: 0.8.3
digest: sha256:b67c843d95aa0a2e7684abb787b22913e54baa92f45a450a3c3bcb7f3e068748
generated: 2018-01-03T16:38:11.350683+01:00
4 changes: 4 additions & 0 deletions stable/artifactory/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies:
- name: postgresql
version: 0.8.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can update to a later version

repository: https://kubernetes-charts.storage.googleapis.com/
7 changes: 6 additions & 1 deletion stable/artifactory/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
37 changes: 2 additions & 35 deletions stable/artifactory/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -37,29 +22,11 @@ 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).
*/}}
{{- 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 -}}
16 changes: 8 additions & 8 deletions stable/artifactory/templates/artifactory-deployment.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 -}}
4 changes: 2 additions & 2 deletions stable/artifactory/templates/artifactory-pvc.yaml
Original file line number Diff line number Diff line change
@@ -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 }}"
Expand Down
4 changes: 2 additions & 2 deletions stable/artifactory/templates/artifactory-service.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
Expand All @@ -22,4 +22,4 @@ spec:
selector:
app: {{ template "artifactory.name" . }}
component: "{{ .Values.artifactory.name }}"
release: {{ .Release.Name }}
release: {{ .Release.Name }}
32 changes: 32 additions & 0 deletions stable/artifactory/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -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 -}}
8 changes: 5 additions & 3 deletions stable/artifactory/templates/nginx-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.nginx.enabled -}}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
Expand Down Expand Up @@ -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:
Expand All @@ -69,3 +70,4 @@ spec:
{{- else }}
emptyDir: {}
{{- end -}}
{{- end }}
2 changes: 1 addition & 1 deletion stable/artifactory/templates/nginx-pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.nginx.persistence.enabled }}
{{- if and .Values.nginx.persistence.enabled (.Values.nginx.enabled ) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
Expand Down
6 changes: 4 additions & 2 deletions stable/artifactory/templates/nginx-service.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down Expand Up @@ -33,4 +34,5 @@ spec:
selector:
app: {{ template "artifactory.name" . }}
component: "{{ .Values.nginx.name }}"
release: {{ .Release.Name }}
release: {{ .Release.Name }}
{{- end }}
Loading