From 412739e1185be6a9d8a50423904dce0d42995cd2 Mon Sep 17 00:00:00 2001 From: pulpo Date: Tue, 31 Mar 2020 12:06:38 -0300 Subject: [PATCH 1/6] Remove tls and added Dockerfile --- Dockerfile | 19 +++++++++++++++++++ src/bin/www | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4bc0727 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM node:slim as base +COPY src /app/src +RUN apt update && apt install -yqq curl gnupg2 && curl install.zerotier.com | bash && cd /var/lib/zerotier-one/ && rm authtoken.secret planet zerotier-one.pid zerotier-one.port identity.secret identity.public + +FROM base as dependencies +WORKDIR /app/src +RUN apt-get install -y build-essential python3 && npm install -g node-gyp && npm install + +FROM base as runtime +COPY src /app/ +COPY --from=dependencies /app/src/node_modules /app/src/node_modules +EXPOSE 3000 +RUN mv /app/src/etc/default.passwd /app/src/etc/passwd +WORKDIR /app/src/ +CMD zerotier-one -d && npm start + +# TODO +# - remove cache and trash + diff --git a/src/bin/www b/src/bin/www index 56fe4da..0faa7b8 100755 --- a/src/bin/www +++ b/src/bin/www @@ -11,8 +11,8 @@ const https = require('https'); const fs = require('fs'); const options = { - cert: fs.readFileSync('etc/tls/fullchain.pem'), - key: fs.readFileSync('etc/tls/privkey.pem') +// cert: fs.readFileSync('etc/tls/fullchain.pem'), +// key: fs.readFileSync('etc/tls/privkey.pem') } /** From 6daed3e1f612050482dd6d7b7b6b0538ae531903 Mon Sep 17 00:00:00 2001 From: pulpo Date: Tue, 31 Mar 2020 18:47:38 -0300 Subject: [PATCH 2/6] Add helmchart --- ztncui/.helmignore | 22 ++++++ ztncui/Chart.yaml | 21 ++++++ ztncui/templates/NOTES.txt | 21 ++++++ ztncui/templates/_helpers.tpl | 63 ++++++++++++++++ ztncui/templates/deployment.yaml | 84 +++++++++++++++++++++ ztncui/templates/ingress.yaml | 41 ++++++++++ ztncui/templates/pvc.yaml | 21 ++++++ ztncui/templates/service.yaml | 15 ++++ ztncui/templates/serviceaccount.yaml | 8 ++ ztncui/templates/tests/test-connection.yaml | 15 ++++ ztncui/values.yaml | 71 +++++++++++++++++ 11 files changed, 382 insertions(+) create mode 100644 ztncui/.helmignore create mode 100644 ztncui/Chart.yaml create mode 100644 ztncui/templates/NOTES.txt create mode 100644 ztncui/templates/_helpers.tpl create mode 100644 ztncui/templates/deployment.yaml create mode 100644 ztncui/templates/ingress.yaml create mode 100644 ztncui/templates/pvc.yaml create mode 100644 ztncui/templates/service.yaml create mode 100644 ztncui/templates/serviceaccount.yaml create mode 100644 ztncui/templates/tests/test-connection.yaml create mode 100644 ztncui/values.yaml diff --git a/ztncui/.helmignore b/ztncui/.helmignore new file mode 100644 index 0000000..50af031 --- /dev/null +++ b/ztncui/.helmignore @@ -0,0 +1,22 @@ +# 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 +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/ztncui/Chart.yaml b/ztncui/Chart.yaml new file mode 100644 index 0000000..746dc33 --- /dev/null +++ b/ztncui/Chart.yaml @@ -0,0 +1,21 @@ +apiVersion: v2 +name: ztncui +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. +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. +appVersion: 1.4.6 diff --git a/ztncui/templates/NOTES.txt b/ztncui/templates/NOTES.txt new file mode 100644 index 0000000..4599f12 --- /dev/null +++ b/ztncui/templates/NOTES.txt @@ -0,0 +1,21 @@ +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 }}{{ . }} + {{- 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 "ztncui.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 "ztncui.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "ztncui.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 "ztncui.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/ztncui/templates/_helpers.tpl b/ztncui/templates/_helpers.tpl new file mode 100644 index 0000000..a9d7fcf --- /dev/null +++ b/ztncui/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "ztncui.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 "ztncui.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 "ztncui.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "ztncui.labels" -}} +helm.sh/chart: {{ include "ztncui.chart" . }} +{{ include "ztncui.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "ztncui.selectorLabels" -}} +app.kubernetes.io/name: {{ include "ztncui.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "ztncui.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "ztncui.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/ztncui/templates/deployment.yaml b/ztncui/templates/deployment.yaml new file mode 100644 index 0000000..c05fa1a --- /dev/null +++ b/ztncui/templates/deployment.yaml @@ -0,0 +1,84 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "ztncui.fullname" . }} + labels: + {{- include "ztncui.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "ztncui.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "ztncui.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "ztncui.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + initContainers: + - name: verify-and-change-pass + image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.imagePullPolicy }} + command: ['sh','-c','ls -l /app/src/etc/passwd || cp /app/etc/default.passwd /app/src/etc/passwd'] + volumeMounts: + - name: zerotier-one + mountPath: /app/src/etc/ + subPath: passwd + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 3000 + protocol: TCP + env: + - name: HTTP_ALL_INTERFACES + value: "true" + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + volumeMounts: + - mountPath: /app/src/etc/ + name: zerotier-one + subPath: passwd + - mountPath: /var/lib/zerotier-one/ + name: zerotier-one + subPath: zerotier-one + + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumes: + - name: zerotier-one + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default (include "ztncui.fullname" .) }} + {{- else }} + emptyDir: {} + {{- end }} + + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/ztncui/templates/ingress.yaml b/ztncui/templates/ingress.yaml new file mode 100644 index 0000000..32929e3 --- /dev/null +++ b/ztncui/templates/ingress.yaml @@ -0,0 +1,41 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "ztncui.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "ztncui.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: {{ . }} + backend: + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} +{{- end }} diff --git a/ztncui/templates/pvc.yaml b/ztncui/templates/pvc.yaml new file mode 100644 index 0000000..21800d1 --- /dev/null +++ b/ztncui/templates/pvc.yaml @@ -0,0 +1,21 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "ztncui.fullname" . }} + labels: + app: {{ include "ztncui.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + annotations: + {{- if .Values.persistence.storageClass }} + volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} + {{- end }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- end }} diff --git a/ztncui/templates/service.yaml b/ztncui/templates/service.yaml new file mode 100644 index 0000000..fccca31 --- /dev/null +++ b/ztncui/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "ztncui.fullname" . }} + labels: + {{- include "ztncui.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: 3000 + protocol: TCP + name: http + selector: + {{- include "ztncui.selectorLabels" . | nindent 4 }} diff --git a/ztncui/templates/serviceaccount.yaml b/ztncui/templates/serviceaccount.yaml new file mode 100644 index 0000000..0a0f579 --- /dev/null +++ b/ztncui/templates/serviceaccount.yaml @@ -0,0 +1,8 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "ztncui.serviceAccountName" . }} + labels: +{{ include "ztncui.labels" . | nindent 4 }} +{{- end -}} diff --git a/ztncui/templates/tests/test-connection.yaml b/ztncui/templates/tests/test-connection.yaml new file mode 100644 index 0000000..73f420f --- /dev/null +++ b/ztncui/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "ztncui.fullname" . }}-test-connection" + labels: +{{ include "ztncui.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "ztncui.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/ztncui/values.yaml b/ztncui/values.yaml new file mode 100644 index 0000000..4c5e320 --- /dev/null +++ b/ztncui/values.yaml @@ -0,0 +1,71 @@ +# Default values for ztncui. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: pulpox/zerotier-controller + pullPolicy: Always + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # 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 + +service: + type: ClusterIP + port: 3000 + +ingress: + enabled: true + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: zt.labs.openbits.com.ar + paths: [ "/" ] + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +persistence: + enabled: true + accessMode: ReadWriteOnce + size: 1Gi + +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 + +nodeSelector: {} + +tolerations: [] + +affinity: {} From 24a827e9c66a9f67a1a0422a2fc456a5281645c6 Mon Sep 17 00:00:00 2001 From: Juan Matias Kungfoo de la Camara Beovide Date: Thu, 4 May 2023 12:36:30 -0300 Subject: [PATCH 3/6] Fix/ fixing curl command due to it was not working --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4bc0727..b91ef4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM node:slim as base COPY src /app/src -RUN apt update && apt install -yqq curl gnupg2 && curl install.zerotier.com | bash && cd /var/lib/zerotier-one/ && rm authtoken.secret planet zerotier-one.pid zerotier-one.port identity.secret identity.public +RUN apt update && apt install -yqq curl gnupg2 && curl -s https://install.zerotier.com/ | bash && cd /var/lib/zerotier-one/ && rm authtoken.secret planet zerotier-one.pid zerotier-one.port identity.secret identity.public FROM base as dependencies WORKDIR /app/src From 8d23e398edd1d2474b1a871b6a557c1ec1667159 Mon Sep 17 00:00:00 2001 From: Juan Matias Kungfoo de la Camara Beovide Date: Thu, 4 May 2023 15:31:08 -0300 Subject: [PATCH 4/6] Fix/ fixing duplicated const --- src/bin/www | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/bin/www b/src/bin/www index b459d6a..837bedd 100755 --- a/src/bin/www +++ b/src/bin/www @@ -10,11 +10,6 @@ const http = require('http'); const https = require('https'); const fs = require('fs'); -const options = { -// cert: fs.readFileSync('etc/tls/fullchain.pem'), -// key: fs.readFileSync('etc/tls/privkey.pem') -} - /** * Get ports from environment and store in Express. */ From 0b286469bb7132c04b6fa9985ae80eb65be9c705 Mon Sep 17 00:00:00 2001 From: Juan Matias Kungfoo de la Camara Beovide Date: Thu, 4 May 2023 15:38:50 -0300 Subject: [PATCH 5/6] Fix/ added docker.io for podman builds --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b91ef4f..1885f74 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:slim as base +FROM docker.io/node:slim as base COPY src /app/src RUN apt update && apt install -yqq curl gnupg2 && curl -s https://install.zerotier.com/ | bash && cd /var/lib/zerotier-one/ && rm authtoken.secret planet zerotier-one.pid zerotier-one.port identity.secret identity.public From 1387d76aa12e1f67d2ac9519e563dda6bcf54271 Mon Sep 17 00:00:00 2001 From: Juan Matias Kungfoo de la Camara Beovide Date: Thu, 4 May 2023 15:41:11 -0300 Subject: [PATCH 6/6] Fix/ removing unneeded files --- ztncui/.helmignore | 22 ------ ztncui/Chart.yaml | 21 ------ ztncui/templates/NOTES.txt | 21 ------ ztncui/templates/_helpers.tpl | 63 ---------------- ztncui/templates/deployment.yaml | 84 --------------------- ztncui/templates/ingress.yaml | 41 ---------- ztncui/templates/pvc.yaml | 21 ------ ztncui/templates/service.yaml | 15 ---- ztncui/templates/serviceaccount.yaml | 8 -- ztncui/templates/tests/test-connection.yaml | 15 ---- ztncui/values.yaml | 71 ----------------- 11 files changed, 382 deletions(-) delete mode 100644 ztncui/.helmignore delete mode 100644 ztncui/Chart.yaml delete mode 100644 ztncui/templates/NOTES.txt delete mode 100644 ztncui/templates/_helpers.tpl delete mode 100644 ztncui/templates/deployment.yaml delete mode 100644 ztncui/templates/ingress.yaml delete mode 100644 ztncui/templates/pvc.yaml delete mode 100644 ztncui/templates/service.yaml delete mode 100644 ztncui/templates/serviceaccount.yaml delete mode 100644 ztncui/templates/tests/test-connection.yaml delete mode 100644 ztncui/values.yaml diff --git a/ztncui/.helmignore b/ztncui/.helmignore deleted file mode 100644 index 50af031..0000000 --- a/ztncui/.helmignore +++ /dev/null @@ -1,22 +0,0 @@ -# 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 -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/ztncui/Chart.yaml b/ztncui/Chart.yaml deleted file mode 100644 index 746dc33..0000000 --- a/ztncui/Chart.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: v2 -name: ztncui -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. -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. -appVersion: 1.4.6 diff --git a/ztncui/templates/NOTES.txt b/ztncui/templates/NOTES.txt deleted file mode 100644 index 4599f12..0000000 --- a/ztncui/templates/NOTES.txt +++ /dev/null @@ -1,21 +0,0 @@ -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 }}{{ . }} - {{- 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 "ztncui.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 "ztncui.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "ztncui.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 "ztncui.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 -{{- end }} diff --git a/ztncui/templates/_helpers.tpl b/ztncui/templates/_helpers.tpl deleted file mode 100644 index a9d7fcf..0000000 --- a/ztncui/templates/_helpers.tpl +++ /dev/null @@ -1,63 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "ztncui.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 "ztncui.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 "ztncui.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Common labels -*/}} -{{- define "ztncui.labels" -}} -helm.sh/chart: {{ include "ztncui.chart" . }} -{{ include "ztncui.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end -}} - -{{/* -Selector labels -*/}} -{{- define "ztncui.selectorLabels" -}} -app.kubernetes.io/name: {{ include "ztncui.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end -}} - -{{/* -Create the name of the service account to use -*/}} -{{- define "ztncui.serviceAccountName" -}} -{{- if .Values.serviceAccount.create -}} - {{ default (include "ztncui.fullname" .) .Values.serviceAccount.name }} -{{- else -}} - {{ default "default" .Values.serviceAccount.name }} -{{- end -}} -{{- end -}} diff --git a/ztncui/templates/deployment.yaml b/ztncui/templates/deployment.yaml deleted file mode 100644 index c05fa1a..0000000 --- a/ztncui/templates/deployment.yaml +++ /dev/null @@ -1,84 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "ztncui.fullname" . }} - labels: - {{- include "ztncui.labels" . | nindent 4 }} -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - {{- include "ztncui.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: - {{- include "ztncui.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "ztncui.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - initContainers: - - name: verify-and-change-pass - image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.imagePullPolicy }} - command: ['sh','-c','ls -l /app/src/etc/passwd || cp /app/etc/default.passwd /app/src/etc/passwd'] - volumeMounts: - - name: zerotier-one - mountPath: /app/src/etc/ - subPath: passwd - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http - containerPort: 3000 - protocol: TCP - env: - - name: HTTP_ALL_INTERFACES - value: "true" - livenessProbe: - httpGet: - path: / - port: http - readinessProbe: - httpGet: - path: / - port: http - volumeMounts: - - mountPath: /app/src/etc/ - name: zerotier-one - subPath: passwd - - mountPath: /var/lib/zerotier-one/ - name: zerotier-one - subPath: zerotier-one - - resources: - {{- toYaml .Values.resources | nindent 12 }} - volumes: - - name: zerotier-one - {{- if .Values.persistence.enabled }} - persistentVolumeClaim: - claimName: {{ .Values.persistence.existingClaim | default (include "ztncui.fullname" .) }} - {{- else }} - emptyDir: {} - {{- end }} - - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/ztncui/templates/ingress.yaml b/ztncui/templates/ingress.yaml deleted file mode 100644 index 32929e3..0000000 --- a/ztncui/templates/ingress.yaml +++ /dev/null @@ -1,41 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "ztncui.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "ztncui.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: {{ . }} - backend: - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} -{{- end }} diff --git a/ztncui/templates/pvc.yaml b/ztncui/templates/pvc.yaml deleted file mode 100644 index 21800d1..0000000 --- a/ztncui/templates/pvc.yaml +++ /dev/null @@ -1,21 +0,0 @@ -{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: {{ include "ztncui.fullname" . }} - labels: - app: {{ include "ztncui.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" - annotations: - {{- if .Values.persistence.storageClass }} - volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} - {{- end }} -spec: - accessModes: - - {{ .Values.persistence.accessMode | quote }} - resources: - requests: - storage: {{ .Values.persistence.size | quote }} -{{- end }} diff --git a/ztncui/templates/service.yaml b/ztncui/templates/service.yaml deleted file mode 100644 index fccca31..0000000 --- a/ztncui/templates/service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "ztncui.fullname" . }} - labels: - {{- include "ztncui.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: 3000 - protocol: TCP - name: http - selector: - {{- include "ztncui.selectorLabels" . | nindent 4 }} diff --git a/ztncui/templates/serviceaccount.yaml b/ztncui/templates/serviceaccount.yaml deleted file mode 100644 index 0a0f579..0000000 --- a/ztncui/templates/serviceaccount.yaml +++ /dev/null @@ -1,8 +0,0 @@ -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "ztncui.serviceAccountName" . }} - labels: -{{ include "ztncui.labels" . | nindent 4 }} -{{- end -}} diff --git a/ztncui/templates/tests/test-connection.yaml b/ztncui/templates/tests/test-connection.yaml deleted file mode 100644 index 73f420f..0000000 --- a/ztncui/templates/tests/test-connection.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "ztncui.fullname" . }}-test-connection" - labels: -{{ include "ztncui.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test-success -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "ztncui.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never diff --git a/ztncui/values.yaml b/ztncui/values.yaml deleted file mode 100644 index 4c5e320..0000000 --- a/ztncui/values.yaml +++ /dev/null @@ -1,71 +0,0 @@ -# Default values for ztncui. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - repository: pulpox/zerotier-controller - pullPolicy: Always - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -serviceAccount: - # Specifies whether a service account should be created - create: true - # 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 - -service: - type: ClusterIP - port: 3000 - -ingress: - enabled: true - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: zt.labs.openbits.com.ar - paths: [ "/" ] - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -persistence: - enabled: true - accessMode: ReadWriteOnce - size: 1Gi - -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 - -nodeSelector: {} - -tolerations: [] - -affinity: {}