Skip to content

Commit

Permalink
Implement youtrack chart (#2)
Browse files Browse the repository at this point in the history
* Add github actions workflow

* Update input arguments for chart-releaser workflow

* Switch workflow to master bracnh

* Chang notify email

* Update hcloud-controlle-manager and mark as Deprecated

* Add gitignore

* Implement youtrack chart
  • Loading branch information
targs08 authored Apr 25, 2021
1 parent 7f12fa4 commit 074f290
Show file tree
Hide file tree
Showing 18 changed files with 418 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
10 changes: 10 additions & 0 deletions stable/fleetlock/templates/serviceAccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "fleetlock.serviceAccountName" . }}
labels: {{- include "fleetlock.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
4 changes: 3 additions & 1 deletion stable/hcloud-cloud-controller-manager/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: v2
name: hcloud-cloud-controller-manager
description: A Helm chart for Kubernetes

deprecated: true

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
Expand All @@ -11,7 +13,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.1
version: 0.1.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Expand the name of the chart.
*/}}
{{- define "hcloud-cloud-controller-manager.name" -}}
aws-cloud-controller-manager
hcloud-cloud-controller-manager
{{- end }}

{{/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "hcloud-cloud-controller-manager.serviceAccountName" . }}
name: {{ printf "system:%s" (include "hcloud-cloud-controller-manager.serviceAccountName" .) }}
labels: {{- include "hcloud-cloud-controller-manager.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "hcloud-cloud-controller-manager.serviceAccountName" . }}
name: cluster-admin
# name: {{ include "hcloud-cloud-controller-manager.serviceAccountName" . }}
subjects:
- apiGroup: ""
kind: ServiceAccount
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
apiVersion: apps/v1
kind: Deployment
kind: DaemonSet
metadata:
name: {{ include "hcloud-cloud-controller-manager.fullname" . }}
labels: {{- include "hcloud-cloud-controller-manager.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicas }}
updateStrategy:
type: {{ .Values.updateStrategy.type }}
selector:
matchLabels: {{- include "hcloud-cloud-controller-manager.selectorLabels" . | nindent 6 }}
template:
Expand Down Expand Up @@ -36,7 +37,7 @@ spec:
args:
- --leader-elect=true
{{- if .Values.networkSupport.enabled }}
- --allocate-node-cidrs=true"
- --allocate-node-cidrs=true
- --cluster-cidr={{ .Values.networkSupport.cluserCIDR }}
{{- end }}
{{- with .Values.args }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kind: Secret
apiVersion: v1
metadata:
name: {{ include "hcloud-cloud-controller-manager.serviceAccountName" . }}
name: {{ include "hcloud-cloud-controller-manager.fullname" . }}
labels: {{- include "hcloud-cloud-controller-manager.labels" . | nindent 4 }}
type: Opaque
data:
Expand Down
2 changes: 2 additions & 0 deletions stable/hcloud-cloud-controller-manager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ networkSupport:
networkId: ""
cluserCIDR: 10.244.0.0/16

updateStrategy:
type: RollingUpdate

# isClusterService specifies whether chart should be deployed as cluster-service or normal k8s app.
isClusterService: true
Expand Down
23 changes: 23 additions & 0 deletions stable/youtrack/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions stable/youtrack/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: youtrack
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "2021.1.11513"
22 changes: 22 additions & 0 deletions stable/youtrack/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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 }}{{ .path }}
{{- 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 "youtrack.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 "youtrack.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "youtrack.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 "youtrack.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
62 changes: 62 additions & 0 deletions stable/youtrack/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "youtrack.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 "youtrack.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 "youtrack.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "youtrack.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "youtrack.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
44 changes: 44 additions & 0 deletions stable/youtrack/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "youtrack.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "youtrack.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: {{ .path }}
pathType: Prefix
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
13 changes: 13 additions & 0 deletions stable/youtrack/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "youtrack.fullname" . }}
labels: {{- include "youtrack.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector: {{- include "youtrack.selectorLabels" . | nindent 4 }}
10 changes: 10 additions & 0 deletions stable/youtrack/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "youtrack.serviceAccountName" . }}
labels: {{- include "youtrack.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
87 changes: 87 additions & 0 deletions stable/youtrack/templates/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "youtrack.fullname" . }}
labels: {{- include "youtrack.labels" . | nindent 4 }}
spec:
replicas: 1
serviceName: {{ include "youtrack.fullname" . }}
updateStrategy:
type: RollingUpdate
selector:
matchLabels: {{- include "youtrack.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations: {{- toYaml . | nindent 8 }}
{{- end }}
labels: {{- include "youtrack.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets: {{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "youtrack.serviceAccountName" . }}
securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext: {{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
tcpSocket:
port: 8080
readinessProbe:
tcpSocket:
port: 8080
volumeMounts:
- name: data
mountPath: /opt/youtrack/data
subPath: data
- name: data
mountPath: /opt/youtrack/conf
subPath: conf
- name: data
mountPath: /opt/youtrack/backups
subPath: backups
{{- if .Values.config.logPersistence }}
- name: data
mountPath: /opt/youtrack/logs
subPath: logs
{{- else }}
- name: logs
mountPath: /opt/youtrack/logs
{{- end }}
resources: {{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations: {{- toYaml . | nindent 8 }}
{{- end }}
volumes:
{{- if not .Values.persistence.enabled }}
- name: data
emptyDir: {}
{{- end }}
{{- if not .Values.config.logPersistence }}
- name: logs
emptyDir: {}
{{- end }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: {{- toYaml (list .Values.persistence.accessMode) | nindent 10 }}
storageClassName: {{ .Values.persistence.storageClass }}
resources:
requests:
storage: {{ .Values.persistence.size }}
{{- end }}
Loading

0 comments on commit 074f290

Please sign in to comment.