Skip to content

Commit 4da497e

Browse files
Bump versions and add k8s template
Signed-off-by: Mario Vejlupek <[email protected]>
1 parent e31810b commit 4da497e

File tree

10 files changed

+299
-3
lines changed

10 files changed

+299
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ entrypoint
22
entrypoint.dwarf
33
.cache
44
authorized_keys
5-
tmp
5+
tmp
6+
.envrc

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# BUILDER
2-
FROM crystallang/crystal:1.3-alpine as BUILDER
2+
FROM crystallang/crystal:1.12-alpine as BUILDER
33

44
WORKDIR /app
55

@@ -9,7 +9,7 @@ COPY sshd_config.ecr /app
99
RUN crystal build entrypoint.cr --release --no-debug
1010

1111
# IMAGE
12-
FROM alpine:3.15.0
12+
FROM alpine:3.19.1
1313

1414
LABEL org.opencontainers.image.source https://github.com/Container-Driven-Development/sftp
1515

k8s/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

k8s/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: sftp
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "3.0"

k8s/templates/_helpers.tpl

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "sftp.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 "sftp.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 "sftp.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "sftp.labels" -}}
37+
helm.sh/chart: {{ include "sftp.chart" . }}
38+
{{ include "sftp.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 "sftp.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "sftp.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 "sftp.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "sftp.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}

k8s/templates/deployment.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "sftp.fullname" . }}
5+
labels:
6+
{{- include "sftp.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
selector:
10+
matchLabels:
11+
{{- include "sftp.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
{{- with .Values.podAnnotations }}
15+
annotations:
16+
{{- toYaml . | nindent 8 }}
17+
{{- end }}
18+
labels:
19+
{{- include "sftp.labels" . | nindent 8 }}
20+
{{- with .Values.podLabels }}
21+
{{- toYaml . | nindent 8 }}
22+
{{- end }}
23+
spec:
24+
{{- with .Values.imagePullSecrets }}
25+
imagePullSecrets:
26+
{{- toYaml . | nindent 8 }}
27+
{{- end }}
28+
serviceAccountName: {{ include "sftp.serviceAccountName" . }}
29+
securityContext:
30+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
31+
containers:
32+
- name: {{ .Chart.Name }}
33+
securityContext:
34+
{{- toYaml .Values.securityContext | nindent 12 }}
35+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
36+
imagePullPolicy: {{ .Values.image.pullPolicy }}
37+
ports:
38+
- name: sftp
39+
containerPort: {{ .Values.service.port }}
40+
protocol: TCP
41+
livenessProbe:
42+
{{- toYaml .Values.livenessProbe | nindent 12 }}
43+
readinessProbe:
44+
{{- toYaml .Values.readinessProbe | nindent 12 }}
45+
resources:
46+
{{- toYaml .Values.resources | nindent 12 }}
47+
{{- with .Values.volumeMounts }}
48+
volumeMounts:
49+
{{- toYaml . | nindent 12 }}
50+
{{- end }}
51+
{{- with .Values.volumes }}
52+
volumes:
53+
{{- toYaml . | nindent 8 }}
54+
{{- end }}
55+
{{- with .Values.nodeSelector }}
56+
nodeSelector:
57+
{{- toYaml . | nindent 8 }}
58+
{{- end }}
59+
{{- with .Values.affinity }}
60+
affinity:
61+
{{- toYaml . | nindent 8 }}
62+
{{- end }}
63+
{{- with .Values.tolerations }}
64+
tolerations:
65+
{{- toYaml . | nindent 8 }}
66+
{{- end }}

k8s/templates/service.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "sftp.fullname" . }}
5+
labels:
6+
{{- include "sftp.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: sftp
12+
protocol: TCP
13+
name: sftp
14+
selector:
15+
{{- include "sftp.selectorLabels" . | nindent 4 }}

k8s/templates/serviceaccount.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if .Values.serviceAccount.create -}}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "sftp.serviceAccountName" . }}
6+
labels:
7+
{{- include "sftp.labels" . | nindent 4 }}
8+
{{- with .Values.serviceAccount.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
13+
{{- end }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: "{{ include "sftp.fullname" . }}-test-connection"
5+
labels:
6+
{{- include "sftp.labels" . | nindent 4 }}
7+
annotations:
8+
"helm.sh/hook": test
9+
spec:
10+
containers:
11+
- name: wget
12+
image: busybox
13+
command: ['wget']
14+
args: ['{{ include "sftp.fullname" . }}:{{ .Values.service.port }}']
15+
restartPolicy: Never

k8s/values.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Default values for sftp.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
extraEnv:
6+
- name: SSHD_ENABLE_SSH # Enable for ssh access
7+
value: false
8+
- name: SSH_CLIENT_somename
9+
value: ssh-ed25519 AAAAC3NzaA1lZCI1NTE5AAAA...
10+
11+
replicaCount: 1
12+
13+
image:
14+
repository: ghcr.io/container-driven-development/sftp
15+
pullPolicy: IfNotPresent
16+
# Overrides the image tag whose default is the chart appVersion.
17+
tag: ""
18+
19+
imagePullSecrets: []
20+
nameOverride: ""
21+
fullnameOverride: ""
22+
23+
serviceAccount:
24+
# Specifies whether a service account should be created
25+
create: true
26+
# Automatically mount a ServiceAccount's API credentials?
27+
automount: true
28+
# Annotations to add to the service account
29+
annotations: {}
30+
# The name of the service account to use.
31+
# If not set and create is true, a name is generated using the fullname template
32+
name: ""
33+
34+
podAnnotations: {}
35+
podLabels: {}
36+
37+
service:
38+
type: LoadBalancer
39+
port: 36622
40+
41+
resources:
42+
# We usually recommend not to specify default resources and to leave this as a conscious
43+
# choice for the user. This also increases chances charts run on environments with little
44+
# resources, such as Minikube. If you do want to specify resources, uncomment the following
45+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
46+
limits:
47+
memory: 512Mi
48+
requests:
49+
cpu: 100m
50+
memory: 128Mi
51+
52+
livenessProbe:
53+
tcpSocket:
54+
port: sftp
55+
readinessProbe:
56+
tcpSocket:
57+
port: sftp
58+
59+
60+
# Additional volumes on the output Deployment definition.
61+
volumes: []
62+
# - name: foo
63+
# secret:
64+
# secretName: mysecret
65+
# optional: false
66+
67+
# Additional volumeMounts on the output Deployment definition.
68+
volumeMounts: []
69+
# - name: foo
70+
# mountPath: "/etc/foo"
71+
# readOnly: true
72+
73+
nodeSelector: {}
74+
75+
tolerations: []
76+
77+
affinity: {}

0 commit comments

Comments
 (0)