Skip to content

Commit

Permalink
Upgraded to Helm API v2 (Helm 3+)
Browse files Browse the repository at this point in the history
  • Loading branch information
winromulus committed Jul 9, 2020
1 parent 6e15b6b commit e1f79db
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 43 deletions.
2 changes: 1 addition & 1 deletion azure-pipelines.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: $(version).$(Rev:r)

variables:
version: 3.0
version: 4.0
buildConfiguration: "Release"
imageRepository: "emberstack/sftp"
DOCKER_CLI_EXPERIMENTAL: 'enabled'
Expand Down
1 change: 1 addition & 0 deletions src/deploy/helm/sftp/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
Expand Down
10 changes: 6 additions & 4 deletions src/deploy/helm/sftp/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
apiVersion: v1
description: A Helm chart to deploy SFTP
icon: https://raw.githubusercontent.com/EmberStack/CDN/master/Projects/docker-sftp/openssh.png
apiVersion: v2
name: sftp
description: A Helm chart to deploy SFTP
type: application
version: 0.1.0
appVersion: 0.1.0

icon: https://raw.githubusercontent.com/EmberStack/CDN/master/Projects/docker-sftp/openssh.png
keywords:
- sftp
- openssh
Expand All @@ -15,4 +18,3 @@ sources:
maintainers:
- name: winromulus
email: [email protected]
engine: gotpl
42 changes: 21 additions & 21 deletions src/deploy/helm/sftp/LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License

Copyright (c) 2019 emberstack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2019 emberstack
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
22 changes: 20 additions & 2 deletions src/deploy/helm/sftp/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,29 @@ Create chart name and version as used by the chart label.
Common labels
*/}}
{{- define "sftp.labels" -}}
app.kubernetes.io/name: {{ include "sftp.name" . }}
helm.sh/chart: {{ include "sftp.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ include "sftp.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

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

{{/*
Create the name of the service account to use
*/}}
{{- define "sftp.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "sftp.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion src/deploy/helm/sftp/templates/config-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Secret
metadata:
name: {{ template "sftp.fullname" . }}
labels:
{{ include "sftp.labels" . | indent 4 }}
{{- include "sftp.labels" . | nindent 4 }}
type: Opaque
stringData:
sftp.json: |-
Expand Down
21 changes: 15 additions & 6 deletions src/deploy/helm/sftp/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,32 @@ kind: Deployment
metadata:
name: {{ include "sftp.fullname" . }}
labels:
{{ include "sftp.labels" . | indent 4 }}
{{- include "sftp.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "sftp.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- include "sftp.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "sftp.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- include "sftp.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "sftp.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- with .Values.initContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- if .Values.image.tag }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- else }}
Expand All @@ -47,7 +50,13 @@ spec:
{{- with .Values.storage.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- end }}
livenessProbe:
tcpSocket:
port: ssh
readinessProbe:
tcpSocket:
port: ssh
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if or .Values.configuration .Values.storage.volumes }}
Expand Down
11 changes: 5 additions & 6 deletions src/deploy/helm/sftp/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ kind: Service
metadata:
name: {{ include "sftp.fullname" . }}
labels:
{{ include "sftp.labels" . | indent 4 }}
{{- if .Values.service.annotations }}
{{- include "sftp.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if ne .Values.service.type "NodePort" }}
{{- if .Values.service.clusterIP }}
Expand Down Expand Up @@ -35,5 +35,4 @@ spec:
protocol: TCP
name: ssh
selector:
app.kubernetes.io/name: {{ include "sftp.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- include "sftp.selectorLabels" . | nindent 4 }}
12 changes: 12 additions & 0 deletions src/deploy/helm/sftp/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "sftp.serviceAccountName" . }}
labels:
{{- include "sftp.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end -}}
21 changes: 19 additions & 2 deletions src/deploy/helm/sftp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,31 @@ imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""


configuration: null

serviceAccount:
# Specifies whether a service account should be created
create: true
# 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:

podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
storage:
volumeMounts: []
volumes: []


initContainers: []

service:
Expand Down

0 comments on commit e1f79db

Please sign in to comment.