Skip to content

Commit

Permalink
add archiva chart
Browse files Browse the repository at this point in the history
  • Loading branch information
slamdev committed Mar 29, 2020
1 parent 5c33c5f commit 4a81354
Show file tree
Hide file tree
Showing 11 changed files with 493 additions and 0 deletions.
12 changes: 12 additions & 0 deletions charts/archiva/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v2
name: archiva
description: |-
Helm chart to deploy [archiva](https://hub.docker.com/r/xetusoss/archiva/).
type: application
version: 0.0.1
appVersion: "v2.2.4-1"
home: https://github.com/slamdev/helm-charts/tree/master/charts/archiva
icon: http://archiva.apache.org/images/archiva.png
maintainers:
- name: slamdev
email: [email protected]
41 changes: 41 additions & 0 deletions charts/archiva/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
archiva
=======
Helm chart to deploy [archiva](https://hub.docker.com/r/xetusoss/archiva/).

Current chart version is `0.0.1`

Source code can be found [here](https://github.com/slamdev/helm-charts/tree/master/charts/archiva)



## Chart Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | affinity for scheduler pod assignment |
| archivaConf | string | `"\u003cconfiguration\u003e\n \u003cremoteRepositories\u003e\n \u003cremoteRepository\u003e\n \u003curl\u003ehttps://repo.maven.apache.org/maven2\u003c/url\u003e\n \u003cdownloadRemoteIndex\u003efalse\u003c/downloadRemoteIndex\u003e\n \u003cdownloadRemoteIndexOnStartup\u003efalse\u003c/downloadRemoteIndexOnStartup\u003e\n \u003cid\u003ecentral\u003c/id\u003e\n \u003cname\u003eCentral Repository\u003c/name\u003e\n \u003c/remoteRepository\u003e\n \u003cremoteRepository\u003e\n \u003curl\u003ehttps://plugins.gradle.org/m2\u003c/url\u003e\n \u003cdownloadRemoteIndex\u003efalse\u003c/downloadRemoteIndex\u003e\n \u003cdownloadRemoteIndexOnStartup\u003efalse\u003c/downloadRemoteIndexOnStartup\u003e\n \u003cid\u003egradle\u003c/id\u003e\n \u003cname\u003eGradle Plugins Repository\u003c/name\u003e\n \u003c/remoteRepository\u003e\n \u003c/remoteRepositories\u003e\n \u003cproxyConnectors\u003e\n \u003cproxyConnector\u003e\n \u003corder\u003e1\u003c/order\u003e\n \u003csourceRepoId\u003einternal\u003c/sourceRepoId\u003e\n \u003ctargetRepoId\u003ecentral\u003c/targetRepoId\u003e\n \u003cproxyId/\u003e\n \u003cwhiteListPatterns\u003e\n \u003cwhiteListPattern\u003e**/*\u003c/whiteListPattern\u003e\n \u003c/whiteListPatterns\u003e\n \u003cpolicies\u003e\n \u003creleases\u003eonce\u003c/releases\u003e\n \u003cchecksum\u003efix\u003c/checksum\u003e\n \u003csnapshots\u003enever\u003c/snapshots\u003e\n \u003ccache-failures\u003eyes\u003c/cache-failures\u003e\n \u003c/policies\u003e\n \u003cdisabled\u003efalse\u003c/disabled\u003e\n \u003c/proxyConnector\u003e\n \u003cproxyConnector\u003e\n \u003corder\u003e2\u003c/order\u003e\n \u003csourceRepoId\u003einternal\u003c/sourceRepoId\u003e\n \u003ctargetRepoId\u003egradle\u003c/targetRepoId\u003e\n \u003cproxyId/\u003e\n \u003cwhiteListPatterns\u003e\n \u003cwhiteListPattern\u003e**/*\u003c/whiteListPattern\u003e\n \u003c/whiteListPatterns\u003e\n \u003cpolicies\u003e\n \u003creleases\u003eonce\u003c/releases\u003e\n \u003cchecksum\u003efix\u003c/checksum\u003e\n \u003csnapshots\u003enever\u003c/snapshots\u003e\n \u003ccache-failures\u003eyes\u003c/cache-failures\u003e\n \u003c/policies\u003e\n \u003cdisabled\u003efalse\u003c/disabled\u003e\n \u003c/proxyConnector\u003e\n \u003c/proxyConnectors\u003e\n\u003c/configuration\u003e"` | archiva config to provision inside of the container |
| env | list | `[{"name":"DB_TYPE","value":"derby"}]` | environment variables for the deployment |
| fullnameOverride | string | `""` | full name of the chart. |
| image.pullPolicy | string | `"IfNotPresent"` | image pull policy |
| image.repository | string | `"xetusoss/archiva"` | image repository |
| image.tag | string | `""` | image tag (chart's appVersion value will be used if not set) |
| imagePullSecrets | list | `[]` | image pull secret for private images |
| ingress.annotations | object | `{}` | ingress annotations |
| ingress.enabled | bool | `false` | enables Ingress for archiva |
| ingress.hosts | list | `[]` | ingress accepted hostnames |
| ingress.tls | list | `[]` | ingress TLS configuration |
| livenessProbe.exec.command | list | `["/healthcheck.sh"]` | command for liveness probe |
| nameOverride | string | `""` | override name of the chart |
| nodeSelector | object | `{}` | node for scheduler pod assignment |
| podSecurityContext | object | `{}` | specifies security settings for a pod |
| readinessProbe.exec.command | list | `["/healthcheck.sh"]` | command for readiness probe |
| resources | object | `{}` | custom resource configuration |
| securityContext | object | `{}` | specifies security settings for a container |
| service.port | int | `80` | service port |
| service.type | string | `"ClusterIP"` | service type |
| serviceAccount.annotations | object | `{}` | annotations to add to the service account |
| serviceAccount.create | bool | `false` | specifies whether a service account should be created |
| serviceAccount.name | string | `nil` | the name of the service account to use; if not set and create is true, a name is generated using the fullname template |
| tolerations | list | `[]` | tolerations for scheduler pod assignment |
| volumeMounts | list | `[{"mountPath":"/archiva-data","name":"data"}]` | volume mounts |
| volumes | list | `[{"emptyDir":{},"name":"data"}]` | volumes |
21 changes: 21 additions & 0 deletions charts/archiva/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "archiva.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "archiva.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "archiva.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "archiva.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
{{- end }}
70 changes: 70 additions & 0 deletions charts/archiva/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "archiva.name" -}}
{{- default .Chart.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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "archiva.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "archiva.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "archiva.labels" -}}
helm.sh/chart: {{ include "archiva.chart" . }}
{{ include "archiva.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Selector labels
*/}}
{{- define "archiva.selectorLabels" -}}
app.kubernetes.io/name: {{ include "archiva.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "archiva.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "archiva.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Create the tag for the docker image to use
*/}}
{{- define "archiva.tag" -}}
{{- .Values.image.tag | default .Chart.AppVersion -}}
{{- end -}}
10 changes: 10 additions & 0 deletions charts/archiva/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "archiva.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "archiva.labels" . | nindent 4 }}
data:
archiva.xml: |-
{{ .Values.archivaConf | nindent 4 }}
94 changes: 94 additions & 0 deletions charts/archiva/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "archiva.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "archiva.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "archiva.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "archiva.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "archiva.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: init
image: busybox
command:
- sh
- -c
args:
- cp /tmp-conf/archiva.xml /archiva-templates/conf/archiva.xml;
echo "<configuration />" > /archiva-templates/conf/shared.xml;
chown -R 1000:1000 /archiva-templates;
chown -R 1000:1000 /archiva-data;
volumeMounts:
- name: {{ include "archiva.fullname" . }}
mountPath: /tmp-conf/archiva.xml
subPath: archiva.xml
- name: {{ include "archiva.fullname" . }}-shared
mountPath: /archiva-templates/conf/
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ include "archiva.tag" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.env }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: {{ include "archiva.fullname" . }}-shared
mountPath: /archiva-templates/conf/
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: {{ include "archiva.fullname" . }}-shared
emptyDir: {}
- name: {{ include "archiva.fullname" . }}
configMap:
name: {{ include "archiva.fullname" . }}
items:
- key: archiva.xml
path: archiva.xml
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
42 changes: 42 additions & 0 deletions charts/archiva/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "archiva.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "archiva.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
backend:
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
16 changes: 16 additions & 0 deletions charts/archiva/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "archiva.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "archiva.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "archiva.selectorLabels" . | nindent 4 }}
13 changes: 13 additions & 0 deletions charts/archiva/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "archiva.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "archiva.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end -}}
16 changes: 16 additions & 0 deletions charts/archiva/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "archiva.fullname" . }}-test-connection"
namespace: {{ .Release.Namespace }}
labels:
{{- include "archiva.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test-success
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "archiva.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
Loading

0 comments on commit 4a81354

Please sign in to comment.