diff --git a/charts/archiva/Chart.yaml b/charts/archiva/Chart.yaml new file mode 100644 index 0000000..9eb6a44 --- /dev/null +++ b/charts/archiva/Chart.yaml @@ -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: valentin.fedoskin@gmail.com diff --git a/charts/archiva/README.md b/charts/archiva/README.md new file mode 100644 index 0000000..ab8687d --- /dev/null +++ b/charts/archiva/README.md @@ -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 | diff --git a/charts/archiva/templates/NOTES.txt b/charts/archiva/templates/NOTES.txt new file mode 100644 index 0000000..3961e30 --- /dev/null +++ b/charts/archiva/templates/NOTES.txt @@ -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 }} diff --git a/charts/archiva/templates/_helpers.tpl b/charts/archiva/templates/_helpers.tpl new file mode 100644 index 0000000..6f4d59f --- /dev/null +++ b/charts/archiva/templates/_helpers.tpl @@ -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 -}} diff --git a/charts/archiva/templates/configmap.yaml b/charts/archiva/templates/configmap.yaml new file mode 100644 index 0000000..5eefd27 --- /dev/null +++ b/charts/archiva/templates/configmap.yaml @@ -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 }} diff --git a/charts/archiva/templates/deployment.yaml b/charts/archiva/templates/deployment.yaml new file mode 100644 index 0000000..5f7406b --- /dev/null +++ b/charts/archiva/templates/deployment.yaml @@ -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 "" > /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 }} diff --git a/charts/archiva/templates/ingress.yaml b/charts/archiva/templates/ingress.yaml new file mode 100644 index 0000000..30566e7 --- /dev/null +++ b/charts/archiva/templates/ingress.yaml @@ -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 }} diff --git a/charts/archiva/templates/service.yaml b/charts/archiva/templates/service.yaml new file mode 100644 index 0000000..c3d305c --- /dev/null +++ b/charts/archiva/templates/service.yaml @@ -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 }} diff --git a/charts/archiva/templates/serviceaccount.yaml b/charts/archiva/templates/serviceaccount.yaml new file mode 100644 index 0000000..8999513 --- /dev/null +++ b/charts/archiva/templates/serviceaccount.yaml @@ -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 -}} diff --git a/charts/archiva/templates/tests/test-connection.yaml b/charts/archiva/templates/tests/test-connection.yaml new file mode 100644 index 0000000..f7fc0b1 --- /dev/null +++ b/charts/archiva/templates/tests/test-connection.yaml @@ -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 diff --git a/charts/archiva/values.yaml b/charts/archiva/values.yaml new file mode 100644 index 0000000..5711cf8 --- /dev/null +++ b/charts/archiva/values.yaml @@ -0,0 +1,158 @@ +image: + # image.repository -- image repository + repository: xetusoss/archiva + # image.tag -- image tag (chart's appVersion value will be used if not set) + tag: "" + # image.pullPolicy -- image pull policy + pullPolicy: IfNotPresent + +# imagePullSecrets -- image pull secret for private images +imagePullSecrets: [] +# nameOverride -- override name of the chart +nameOverride: "" +# fullnameOverride -- full name of the chart. +fullnameOverride: "" + +serviceAccount: + # serviceAccount.create -- specifies whether a service account should be created + create: false + # serviceAccount.annotations -- annotations to add to the service account + annotations: {} + # serviceAccount.name -- the name of the service account to use; if not set and create is true, a name is generated using the fullname template + name: + +# podSecurityContext -- specifies security settings for a pod +podSecurityContext: {} +# fsGroup: 2000 + +# securityContext -- specifies security settings for a container +securityContext: {} +# capabilities: +# drop: +# - ALL +# readOnlyRootFilesystem: true +# runAsNonRoot: true +# runAsUser: 1000 + +service: + # service.type -- service type + type: ClusterIP + # service.port -- service port + port: 80 + +ingress: + # ingress.enabled -- enables Ingress for archiva + enabled: false + # ingress.annotations -- ingress annotations + annotations: {} + # kubernetes.io/ingress.class: archiva + # kubernetes.io/tls-acme: "true" + # ingress.hosts -- ingress accepted hostnames + hosts: [] + # - host: chart-example.local + # paths: [] + # ingress.tls -- ingress TLS configuration + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +# resources -- custom resource configuration +resources: {} +# limits: +# cpu: 100m +# memory: 128Mi +# requests: +# cpu: 100m +# memory: 128Mi + +# nodeSelector -- node for scheduler pod assignment +nodeSelector: {} + +# tolerations -- tolerations for scheduler pod assignment +tolerations: [] + +# affinity -- affinity for scheduler pod assignment +affinity: {} + +# volumeMounts -- volume mounts +volumeMounts: + - name: data + mountPath: /archiva-data + +# volumes -- volumes +volumes: + - name: data + emptyDir: {} + +livenessProbe: + exec: + # livenessProbe.exec.command -- command for liveness probe + command: + - /healthcheck.sh + +readinessProbe: + exec: + # readinessProbe.exec.command -- command for readiness probe + command: + - /healthcheck.sh + +# env -- environment variables for the deployment +env: + - name: DB_TYPE + value: derby + +# archivaConf -- archiva config to provision inside of the container +archivaConf: |- + + + + https://repo.maven.apache.org/maven2 + false + false + central + Central Repository + + + https://plugins.gradle.org/m2 + false + false + gradle + Gradle Plugins Repository + + + + + 1 + internal + central + + + **/* + + + once + fix + never + yes + + false + + + 2 + internal + gradle + + + **/* + + + once + fix + never + yes + + false + + +