Skip to content

Commit

Permalink
Update-2023-08-15_16:42:49
Browse files Browse the repository at this point in the history
  • Loading branch information
pogossian committed Aug 15, 2023
1 parent 0d1ae6e commit c0b7dcd
Show file tree
Hide file tree
Showing 19 changed files with 804 additions and 1,517 deletions.
8 changes: 3 additions & 5 deletions charts/netris-controller/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ 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: 2.0.0-rc.4
version: 1.0.20

# 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: 4.0.0-rc.4
appVersion: 3.0.10.3
home: https://netris.ai
icon: https://www.netris.ai/wp-content/uploads/2021/01/logo-300.png # [todo] Change url to permalink
keywords:
Expand All @@ -47,11 +47,9 @@ dependencies:
version: 1.0.1
repository: https://charts.ntppool.org
- name: haproxy
version: 1.19.1
version: 1.1.3
repository: https://haproxytech.github.io/helm-charts
condition: haproxy.enabled
- name: graphite
version: 0.7.2
repository: https://kiwigrid.github.io
annotations:
artifacthub.io/prerelease: "true"
95 changes: 28 additions & 67 deletions charts/netris-controller/README.md

Large diffs are not rendered by default.

25 changes: 11 additions & 14 deletions charts/netris-controller/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- $path := .Values.ingress.path }}
{{- range $host := .Values.ingress.hosts }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host }}{{ $path }}
{{- if .Values.app.ingress.enabled }}
{{- $path := .Values.app.ingress.path }}
{{- range $host := .Values.app.ingress.hosts }}
http{{ if $.Values.app.ingress.tls }}s{{ end }}://{{ $host }}{{ $path }}
{{- end }}
{{- else if contains "NodePort" (index .Values "web-service-frontend").service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ printf "%s-%s" (include "netris-controller.fullname" .) "web-service-frontend" }})
{{- else if contains "NodePort" .Values.app.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ printf "%s-%s" (include "netris-controller.fullname" .) "app" }})
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" (index .Values "web-service-frontend").service.type }}
{{- else if contains "LoadBalancer" .Values.app.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 {{ printf "%s-%s" (include "netris-controller.fullname" .) "web-service-frontend" }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ printf "%s-%s" (include "netris-controller.fullname" .) "web-service-frontend" }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ (index .Values "web-service-frontend").service.port }}
{{- else if contains "ClusterIP" (index .Values "web-service-frontend").service.type }}
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ printf "%s-%s" (include "netris-controller.fullname" .) "app" }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ printf "%s-%s" (include "netris-controller.fullname" .) "app" }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.app.service.port }}
{{- else if contains "ClusterIP" .Values.app.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "netris-controller.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 }}

{{/* run deprecations */}}
{{ include "deprecations" . }}
34 changes: 0 additions & 34 deletions charts/netris-controller/templates/_deprecations.tpl

This file was deleted.

12 changes: 0 additions & 12 deletions charts/netris-controller/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,3 @@ secret-key: {{ (index $secret.data "secret-key") }}
secret-key: {{ randAlphaNum 40 | b64enc }}
{{- end }}
{{- end }}

{{/*
Generate a grpc-secret secret or use the existing one
*/}}
{{- define "grpc.secret" -}}
{{- $secret := lookup "v1" "Secret" .Release.Namespace (printf "%s-%s" (include "netris-controller.fullname" .) "grpc-secret") -}}
{{- if $secret }}
secret-key: {{ (index $secret.data "secret-key") }}
{{- else }}
secret-key: {{ randAlphaNum 40 | b64enc }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
{{- $microservicename := "web-service-backend" }}
{{- $microservicename := "app" }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -32,8 +32,6 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: init-wait-mariadb
securityContext:
{{- toYaml .Values.securityContext | nindent 10 }}
image: alpine:3.11
command:
- sh
Expand Down Expand Up @@ -78,13 +76,6 @@ spec:
value: {{ printf "%s-%s" (include "netris-controller.fullname" .) "telescope" }}:{{ (.Values.telescope.service.port ) }}
- name: GRAPHITE_WEBAPP_URL
value: {{ printf "%s%s-%s" "http://" (include "netris-controller.fullname" .) "graphite" }}:{{ printf "%s%s" (.Values.graphite.service.port |toString ) "/render/" }}
- name: SMTP_HOST
value: {{ printf "%s%s-%s" "smtp://" (include "netris-controller.fullname" .) "smtp" }}:{{ .Values.smtp.service.port }}
- name: GRPC_AUTH_KEYS
valueFrom:
secretKeyRef:
name: {{ printf "%s-%s" (include "netris-controller.fullname" .) "grpc-secret" }}
key: secret-key
- name: WEB_SESSION_SECRET
valueFrom:
secretKeyRef:
Expand All @@ -96,11 +87,11 @@ spec:
protocol: TCP
livenessProbe:
httpGet:
path: /health/
path: /
port: {{ (index .Values $microservicename).service.name }}
readinessProbe:
httpGet:
path: /health/
path: /
port: {{ (index .Values $microservicename).service.name }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
Expand Down Expand Up @@ -134,6 +125,83 @@ spec:
selector:
{{- printf "%s-%s" (include "netris-controller.selectorLabels" .) $microservicename | nindent 4 }}
---
{{- if (index .Values $microservicename).ingress.enabled -}}
{{- $fullName := printf "%s-%s" (include "netris-controller.fullname" .) $microservicename -}}
{{- $servicePort := (index .Values $microservicename).service.port -}}
{{- $ingressPath := (index .Values $microservicename).ingress.path -}}
{{- $ingressPathType := (index .Values $microservicename).ingress.pathType -}}
{{- $newAPI := .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}}
{{- if $newAPI -}}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress" }}
apiVersion: networking.k8s.io/v1beta1
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "netris-controller.labels" . | nindent 4 }}
{{- printf "%s-%s" (include "netris-controller.selectorLabels" .) $microservicename | nindent 4 }}
{{- if (index .Values $microservicename).ingress.labels }}
{{ toYaml (index .Values $microservicename).ingress.labels | indent 4 }}
{{- end }}
{{- if (index .Values $microservicename).ingress.annotations }}
annotations:
{{- range $key, $value := (index .Values $microservicename).ingress.annotations }}
{{ $key }}: {{ tpl $value $ | quote }}
{{- end }}
{{- end }}
spec:
{{- if (index .Values $microservicename).ingress.ingressClassName }}
ingressClassName: {{ (index .Values $microservicename).ingress.ingressClassName }}
{{- end -}}
{{- if (index .Values $microservicename).ingress.tls }}
tls:
{{ tpl (toYaml (index .Values $microservicename).ingress.tls) $ | indent 4 }}
{{- end }}
rules:
{{- if (index .Values $microservicename).ingress.hosts }}
{{- range (index .Values $microservicename).ingress.hosts }}
- host: {{ tpl . $}}
http:
paths:
- path: {{ $ingressPath }}
{{- if $newAPI }}
pathType: {{ $ingressPathType }}
{{- end }}
backend:
{{- if $newAPI }}
service:
name: {{ $fullName }}
port:
number: {{ $servicePort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
{{- else }}
- http:
paths:
- backend:
{{- if $newAPI }}
service:
name: {{ $fullName }}
port:
number: {{ $servicePort }}
pathType: {{ $ingressPathType }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $servicePort }}
{{- end }}
{{- if $ingressPath }}
path: {{ $ingressPath }}
{{- end }}
{{- end -}}
{{- end }}
---
{{- if (index .Values $microservicename).autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
Expand Down Expand Up @@ -163,3 +231,20 @@ spec:
targetAverageUtilization: {{ (index .Values $microservicename).autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
---
apiVersion: v1
kind: Pod
metadata:
name: "{{ printf "%s-%s" (include "netris-controller.fullname" .) $microservicename }}-test-connection"
labels:
{{- include "netris-controller.labels" . | nindent 4 }}
{{- printf "%s-%s" (include "netris-controller.selectorLabels" .) $microservicename | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ printf "%s-%s" (include "netris-controller.fullname" .) $microservicename }}:{{ (index .Values $microservicename).service.port }}']
restartPolicy: Never
8 changes: 2 additions & 6 deletions charts/netris-controller/templates/equinix-metal-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,12 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: init-wait-webapp
securityContext:
{{- toYaml .Values.securityContext | nindent 10 }}
image: alpine:3.11
command:
- sh
- -c
- for i in $(seq 1 200); do nc -z -w3 {{ printf "%s-%s" (include "netris-controller.fullname" .) "web-service-backend" }} {{ (index .Values "web-service-backend").service.port }} && exit 0 || sleep 3; done; exit 1
- for i in $(seq 1 200); do nc -z -w3 {{ printf "%s-%s" (include "netris-controller.fullname" .) "app" }} {{ .Values.app.service.port }} && exit 0 || sleep 3; done; exit 1
- name: init-wait-websession
securityContext:
{{- toYaml .Values.securityContext | nindent 10 }}
image: alpine:3.11
command:
- sh
Expand All @@ -58,7 +54,7 @@ spec:
- name: EQUINIX_ADDR
value: https://api.packet.net
- name: CONTROLLER_ADDR
value: http://{{ printf "%s-%s" (include "netris-controller.fullname" .) "web-service-backend" }}:{{ (index .Values "web-service-backend").service.port }}
value: http://{{ printf "%s-%s" (include "netris-controller.fullname" .) "app" }}:{{ .Values.app.service.port }}
- name: SESSION_PROVIDER_HOST
value: http://{{ printf "%s-%s" (include "netris-controller.fullname" .) "web-session-generator" }}:{{ (index .Values "web-session-generator").service.port }}
- name: WEB_SESSION_SECRET
Expand Down
18 changes: 0 additions & 18 deletions charts/netris-controller/templates/grpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: init-wait-mariadb
securityContext:
{{- toYaml .Values.securityContext | nindent 10 }}
image: alpine:3.11
command:
- sh
Expand All @@ -45,12 +43,6 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ (index .Values $microservicename).image.repository }}:{{ (index .Values $microservicename).image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ (index .Values $microservicename).image.pullPolicy }}
env:
- name: GRPC_AUTH_KEYS
valueFrom:
secretKeyRef:
name: {{ printf "%s-%s" (include "netris-controller.fullname" .) "grpc-secret" }}
key: secret-key
command: ['/app/servicebin', '-c', '/app/config/grpc.conf']
ports:
- name: {{ (index .Values $microservicename).service.name }}
Expand Down Expand Up @@ -169,13 +161,3 @@ data:
password={{ .Values.mariadb.auth.password }}
database={{ .Values.mariadb.auth.database }}
port={{ .Values.mariadb.primary.service.port }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ printf "%s-%s" (include "netris-controller.fullname" .) "grpc-secret" }}
labels:
{{- include "netris-controller.labels" . | nindent 4 }}
type: Opaque
data:
{{- ( include "grpc.secret" . ) | indent 2 -}}
Loading

0 comments on commit c0b7dcd

Please sign in to comment.