-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Helm chart creation #58
base: master
Are you sure you want to change the base?
Changes from all commits
0f8cde8
64294ac
2a208c2
40d11c4
f7cddef
a1b43a3
4ae0895
b53cb80
7afaa35
f7f9551
5b8cc0d
146b366
21be5a1
d6394f5
d6ef497
271c6b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
apiVersion: v2 | ||
name: xampp-app | ||
description: A Helm chart for deploying xampp to Kubernetes | ||
icon: https://www.apachefriends.org/images/xampp-logo-ac950edf.svg | ||
# 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. | ||
appVersion: 1.0.1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
For Linting Helm Chart Use: | ||
helm lint |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "xampp.name" -}} | ||
{{- default .Chart.Name .Values.xamppnameOverride | 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 "xampp.fullname" -}} | ||
{{- if .Values.xamppfullnameOverride }} | ||
{{- .Values.xamppfullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.xamppnameOverride }} | ||
{{- 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 "xampp.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "xampp.labels" -}} | ||
helm.sh/chart: {{ include "xampp.chart" . }} | ||
{{ include "xampp.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/part-of: {{ .Values.projectScope }} | ||
{{- end }} | ||
|
||
{{/* | ||
Additional labels | ||
*/}} | ||
{{- define "xampp.additionalLabels" -}} | ||
{{- if .Values.deployment.additionalLabels }} | ||
{{- range $key, $val := .Values.deployment.additionalLabels }} | ||
{{ $key }}: {{ $val | quote }} | ||
{{- end}} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "xampp.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "xampp.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "xampp.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "xampp.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for Ingress. | ||
*/}} | ||
{{- define "ingress.apiVersion" -}} | ||
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}} | ||
{{- print "networking.k8s.io/v1" -}} | ||
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress" -}} | ||
{{- print "networking.k8s.io/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "extensions/v1beta1" -}} | ||
{{- end -}} | ||
{{- end -}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{{- if .Values.xampp.enabled -}} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "xampp.fullname" . }}-{{.Values.environment }}-deploy | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
labels: | ||
# include Gitlab CI canary label for integration with CI canary deployment | ||
track: canary | ||
{{- include "xampp.labels" . | nindent 4 }} | ||
{{- include "xampp.additionalLabels" . | nindent 4 }} | ||
spec: | ||
{{- if not .Values.autoscaling.enabled }} | ||
replicas: {{ .Values.xampp.containers.replicaCount }} | ||
{{- end }} | ||
selector: | ||
matchLabels: | ||
{{- include "xampp.selectorLabels" . | nindent 6 }} | ||
revisionHistoryLimit: 1 # Default to 10 if not specified | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
# include Gitlab CI canary label for integration with CI canary deployment | ||
track: canary | ||
{{- include "xampp.selectorLabels" . | nindent 8 }} | ||
{{- include "xampp.additionalLabels" . | nindent 8 }} | ||
# include timestamp from the pipeline: | ||
pipeline-deployed: "{{ .Values.xampp.pipelinedeployed }}" | ||
spec: | ||
{{- if ne .Values.xampp.containers.imagePullSecretName "" }} | ||
imagePullSecrets: | ||
- name: regcred-{{.Values.environment }}-sct | ||
{{- end }} | ||
serviceAccountName: {{ include "xampp.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 12 }} | ||
image: "{{ .Values.xampp.containers.image.repository }}:{{ .Values.xampp.containers.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.xampp.containers.image.pullPolicy }} | ||
{{- if ne .Values.xampp.containers.command "" }} | ||
# command: ["dumb-init", "npm", "run", "start:demo"] | ||
command: ["/bin/sh", "-c", {{ .Values.xampp.containers.command | quote }}] | ||
{{- end }} | ||
ports: | ||
- name: http | ||
containerPort: {{ .Values.xampp.containers.containerPort }} | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: / | ||
port: http | ||
initialDelaySeconds: 90 | ||
periodSeconds: 120 | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: http | ||
initialDelaySeconds: 90 | ||
periodSeconds: 120 | ||
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 }} | ||
{{- end }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{{- if .Values.xampp.enabled -}} | ||
{{- if .Values.xampp.ingress.enabled -}} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: xampp-{{.Values.environment }}-ing | ||
annotations: | ||
meta.helm.sh/release-name: traefik | ||
meta.helm.sh/release-namespace: kube-system | ||
labels: | ||
app.kubernetes.io/instance: traefik-kube-system | ||
app.kubernetes.io/name: traefik | ||
spec: | ||
rules: | ||
- host: "{{.Values.xampp.ingress.host }}" | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: {{ include "xampp.fullname" . }}-{{.Values.environment }}-svc | ||
port: | ||
number: 80 | ||
|
||
{{- end }} | ||
{{- end }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{{- if .Values.xampp.enabled -}} | ||
{{- if .Values.xampp.service.create -}} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "xampp.fullname" . }}-{{.Values.environment }}-svc | ||
labels: | ||
{{- include "xampp.labels" . | nindent 4 }} | ||
{{- include "xampp.additionalLabels" . | nindent 4 }} | ||
spec: | ||
type: {{ .Values.xampp.service.type }} | ||
ports: | ||
|
||
- name: phpmyadmin | ||
protocol: TCP | ||
port: {{ .Values.xampp.service.serviceApplicationPort }} | ||
targetPort: 80 | ||
{{- if eq "NodePort" .Values.xampp.service.type }} | ||
nodePort: {{ .Values.xampp.service.serviceApplicationnodePort }} | ||
{{- end }} | ||
|
||
- name: sftp | ||
protocol: TCP | ||
port: {{ .Values.xampp.service.serviceSFTPPort }} | ||
targetPort: 22 | ||
{{- if eq "NodePort" .Values.xampp.service.type }} | ||
nodePort: {{ .Values.xampp.service.serviceSFTPnodePort }} | ||
{{- end }} | ||
|
||
- name: ftp | ||
protocol: TCP | ||
port: {{ .Values.xampp.service.serviceFTPPort }} | ||
targetPort: 21 | ||
{{- if eq "NodePort" .Values.xampp.service.type }} | ||
nodePort: {{ .Values.xampp.service.serviceFTPnodePort }} | ||
{{- end }} | ||
|
||
- name: mysql | ||
protocol: TCP | ||
port: {{ .Values.xampp.service.serviceMySQLPort }} | ||
targetPort: 3306 | ||
{{- if eq "NodePort" .Values.xampp.service.type }} | ||
nodePort: {{ .Values.xampp.service.serviceMySQLnodePort }} | ||
{{- end }} | ||
|
||
selector: | ||
{{- include "xampp.selectorLabels" . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# ############################################################################## | ||
# Xampp Helm Chart created by Fedir Indutnyi (Draft) | ||
# ############################################################################## | ||
# Default values for Xampp. | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
|
||
xamppnameOverride: xampp | ||
xamppfullnameOverride: xampp | ||
projectScope: xampp | ||
|
||
environment: dev | ||
|
||
xampp: | ||
enabled: true | ||
containers: | ||
replicaCount: 1 | ||
containerPort: 80 | ||
image: | ||
repository: 'tomsik68/xampp' | ||
pullPolicy: Always | ||
tag: "8" | ||
command: "" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably just me not understanding helm, so please tell me if I'm wrong. My current understanding is that this should be the same as the container's entrypoint - i.e. How does it work if the command value is set to an empty string? Is there a default somewhere that I'm not seeing? |
||
imagePullSecretName: "" | ||
pipelinedeployed: "" | ||
# If service.type eq NodePort then specify static service.nodePort | ||
service: | ||
create: true | ||
type: ClusterIP | ||
serviceApplicationPort: 80 | ||
serviceApplicationnodePort: 31062 | ||
serviceSFTPPort: 22 | ||
serviceSFTPnodePort: 31060 | ||
serviceFTPPort: 21 | ||
serviceSTPnodePort: 31061 | ||
serviceMySQLPort: 3306 | ||
serviceMySQLnodePort: 31063 | ||
ingress: | ||
enabled: false | ||
host: "example.local" | ||
|
||
|
||
|
||
|
||
deployment: | ||
additionalLabels: | ||
owner: xampp | ||
|
||
serviceAccount: | ||
# Specifies whether a service account should be created | ||
create: false | ||
# Annotations to add to the service account | ||
annotations: {} | ||
# The name of the service account to use. | ||
# If not set and create is true, a name is generated using the fullname template | ||
name: "" | ||
|
||
podAnnotations: | ||
# include Gitlab CI annotations for integration with CI deployment | ||
|
||
|
||
podSecurityContext: {} | ||
securityContext: {} | ||
# capabilities: | ||
# drop: | ||
# - ALL | ||
# readOnlyRootFilesystem: true | ||
# runAsNonRoot: true | ||
# runAsUser: 1000 | ||
|
||
|
||
|
||
resources: {} | ||
# We usually recommend not to specify default resources and to leave this as a conscious | ||
# choice for the user. This also increases chances charts run on environments with little | ||
# resources, such as Minikube. If you do want to specify resources, uncomment the following | ||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'. | ||
# limits: | ||
# cpu: 100m | ||
# memory: 128Mi | ||
# requests: | ||
# cpu: 100m | ||
# memory: 128Mi | ||
|
||
autoscaling: | ||
enabled: false | ||
minReplicas: 1 | ||
maxReplicas: 3 | ||
targetCPUUtilizationPercentage: 80 | ||
# targetMemoryUtilizationPercentage: 80 | ||
|
||
nodeSelector: {} | ||
|
||
tolerations: [] | ||
|
||
affinity: {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get rid of commented out code here.