Skip to content

Commit 0401733

Browse files
authored
[artifactory-search] add chart
2 parents e22e9d3 + cc1ff92 commit 0401733

File tree

7 files changed

+283
-0
lines changed

7 files changed

+283
-0
lines changed

charts/artifactory-search/Chart.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: artifactory-search
3+
description: Artifactory Search helm chart
4+
type: application
5+
version: 1.0.0
6+
appVersion: "0.0.1"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "artifactory-search.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "artifactory-search.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "artifactory-search.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "artifactory-search.labels" -}}
37+
helm.sh/chart: {{ include "artifactory-search.chart" . }}
38+
{{ include "artifactory-search.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "artifactory-search.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "artifactory-search.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "artifactory-search.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "artifactory-search.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ include "artifactory-search.fullname" . }}
5+
labels:
6+
{{- include "artifactory-search.labels" . | nindent 4 }}
7+
data:
8+
application.yml: |- {{ toYaml (required "A valid application.yaml config is required (nested in the value .Values.artifactorySearch.config)!" .Values.artifactorySearch.config) | nindent 4 }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "artifactory-search.fullname" . }}
5+
labels:
6+
{{- include "artifactory-search.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
selector:
10+
matchLabels:
11+
{{- include "artifactory-search.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
annotations:
15+
"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"
16+
{{- with .Values.podAnnotations }}
17+
{{- toYaml . | nindent 8 }}
18+
{{- end }}
19+
labels:
20+
{{- include "artifactory-search.selectorLabels" . | nindent 8 }}
21+
spec:
22+
{{- with .Values.imagePullSecrets }}
23+
imagePullSecrets:
24+
{{- toYaml . | nindent 8 }}
25+
{{- end }}
26+
serviceAccountName: {{ include "artifactory-search.serviceAccountName" . }}
27+
securityContext:
28+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
29+
restartPolicy: Always
30+
containers:
31+
- name: {{ .Chart.Name }}
32+
securityContext:
33+
{{- toYaml .Values.securityContext | nindent 12 }}
34+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
35+
imagePullPolicy: {{ .Values.image.pullPolicy }}
36+
volumeMounts:
37+
- name: config
38+
mountPath: "/application.yml"
39+
subPath: "application.yml"
40+
env:
41+
- name: artifactorysearch.username
42+
valueFrom:
43+
secretKeyRef:
44+
key: username
45+
name: {{ required "A valid secret name must be provided in .Values.artifactorySearch.artifactoryCredentialsSecretName" .Values.artifactorySearch.artifactoryCredentialsSecretName | quote }}
46+
- name: artifactorysearch.password
47+
valueFrom:
48+
secretKeyRef:
49+
key: password
50+
name: {{ required "A valid secret name must be provided in .Values.artifactorySearch.artifactoryCredentialsSecretName" .Values.artifactorySearch.artifactoryCredentialsSecretName | quote }}
51+
ports:
52+
- name: http
53+
containerPort: 8080
54+
protocol: TCP
55+
livenessProbe:
56+
httpGet:
57+
path: /
58+
port: http
59+
readinessProbe:
60+
httpGet:
61+
path: /
62+
port: http
63+
resources:
64+
{{- toYaml .Values.resources | nindent 12 }}
65+
volumes:
66+
- name: config
67+
configMap:
68+
name: {{ include "artifactory-search.fullname" . }}
69+
{{- with .Values.nodeSelector }}
70+
nodeSelector:
71+
{{- toYaml . | nindent 8 }}
72+
{{- end }}
73+
{{- with .Values.affinity }}
74+
affinity:
75+
{{- toYaml . | nindent 8 }}
76+
{{- end }}
77+
{{- with .Values.tolerations }}
78+
tolerations:
79+
{{- toYaml . | nindent 8 }}
80+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "artifactory-search.fullname" . -}}
3+
{{- $svcPort := .Values.service.port -}}
4+
apiVersion: networking.k8s.io/v1
5+
kind: Ingress
6+
metadata:
7+
name: {{ $fullName }}
8+
labels:
9+
{{- include "artifactory-search.labels" . | nindent 4 }}
10+
{{- with .Values.ingress.annotations }}
11+
annotations:
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}
14+
spec:
15+
{{- if .Values.ingress.ingressClassName }}
16+
ingressClassName: {{ .Values.ingress.ingressClassName }}
17+
{{- end -}}
18+
{{- if .Values.ingress.tls }}
19+
tls:
20+
{{- range .Values.ingress.tls }}
21+
- hosts:
22+
{{- range .hosts }}
23+
- {{ . | quote }}
24+
{{- end }}
25+
secretName: {{ .secretName }}
26+
{{- end }}
27+
{{- end }}
28+
rules:
29+
{{- range .Values.ingress.hosts }}
30+
- host: {{ .host | quote }}
31+
http:
32+
paths:
33+
- path: /
34+
pathType: Prefix
35+
backend:
36+
service:
37+
name: {{ $fullName }}
38+
port:
39+
number: {{ $svcPort }}
40+
{{- end }}
41+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "artifactory-search.fullname" . }}
5+
labels:
6+
{{- include "artifactory-search.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: http
12+
protocol: TCP
13+
name: http
14+
selector:
15+
{{- include "artifactory-search.selectorLabels" . | nindent 4 }}

charts/artifactory-search/values.yaml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
replicaCount: 1
2+
3+
image:
4+
repository: docker.subshell.com/labday/artifactory_search_native
5+
pullPolicy: Always
6+
# Overrides the image tag whose default is the chart appVersion.
7+
tag: "latest"
8+
9+
imagePullSecrets: []
10+
nameOverride: ""
11+
fullnameOverride: ""
12+
13+
serviceAccount:
14+
# Specifies whether a service account should be created
15+
create: false
16+
# Annotations to add to the service account
17+
annotations: {}
18+
# The name of the service account to use.
19+
# If not set and create is true, a name is generated using the fullname template
20+
name: ""
21+
22+
podAnnotations: {}
23+
24+
podSecurityContext:
25+
{}
26+
# fsGroup: 2000
27+
28+
securityContext:
29+
{}
30+
# capabilities:
31+
# drop:
32+
# - ALL
33+
# readOnlyRootFilesystem: true
34+
# runAsNonRoot: true
35+
# runAsUser: 1000
36+
37+
service:
38+
type: ClusterIP
39+
port: 80
40+
41+
ingress:
42+
enabled: false
43+
annotations:
44+
{}
45+
# kubernetes.io/ingress.class: nginx
46+
# kubernetes.io/tls-acme: "true"
47+
hosts:
48+
# - host: chart-example.local
49+
tls: []
50+
# - secretName: chart-example-tls
51+
# hosts:
52+
# - chart-example.local
53+
54+
resources:
55+
requests:
56+
cpu: 100m
57+
memory: 512Mi
58+
limits:
59+
cpu: 500m
60+
memory: 1024Mi
61+
62+
nodeSelector: {}
63+
64+
tolerations: []
65+
66+
affinity: {}
67+
68+
artifactorySearch:
69+
artifactoryCredentialsSecretName: ""
70+
# config for the application.yaml file
71+
config:

0 commit comments

Comments
 (0)