From 2032e74f49c5874e978265fb4a50b310c6dedc29 Mon Sep 17 00:00:00 2001 From: Aditya Raghuwanshi Date: Tue, 15 Mar 2022 23:38:34 -0700 Subject: [PATCH 1/8] Add Chips backend chart --- charts/chips-staging/.helmignore | 23 ++++++ charts/chips-staging/Chart.yaml | 6 ++ charts/chips-staging/templates/NOTES.txt | 22 +++++ charts/chips-staging/templates/_helpers.tpl | 62 ++++++++++++++ .../chips-staging/templates/deployment.yaml | 61 ++++++++++++++ charts/chips-staging/templates/hpa.yaml | 28 +++++++ charts/chips-staging/templates/ingress.yaml | 61 ++++++++++++++ charts/chips-staging/templates/service.yaml | 15 ++++ charts/chips-staging/values.yaml | 82 +++++++++++++++++++ 9 files changed, 360 insertions(+) create mode 100644 charts/chips-staging/.helmignore create mode 100644 charts/chips-staging/Chart.yaml create mode 100644 charts/chips-staging/templates/NOTES.txt create mode 100644 charts/chips-staging/templates/_helpers.tpl create mode 100644 charts/chips-staging/templates/deployment.yaml create mode 100644 charts/chips-staging/templates/hpa.yaml create mode 100644 charts/chips-staging/templates/ingress.yaml create mode 100644 charts/chips-staging/templates/service.yaml create mode 100644 charts/chips-staging/values.yaml diff --git a/charts/chips-staging/.helmignore b/charts/chips-staging/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/chips-staging/.helmignore @@ -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/ diff --git a/charts/chips-staging/Chart.yaml b/charts/chips-staging/Chart.yaml new file mode 100644 index 0000000..551be65 --- /dev/null +++ b/charts/chips-staging/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: chips-staging +description: A Helm chart for chips staging deployment +type: application +version: 0.1.0 +appVersion: "15671c8" diff --git a/charts/chips-staging/templates/NOTES.txt b/charts/chips-staging/templates/NOTES.txt new file mode 100644 index 0000000..8d3c90f --- /dev/null +++ b/charts/chips-staging/templates/NOTES.txt @@ -0,0 +1,22 @@ +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 }}{{ .path }} + {{- 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 "chips-staging.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 "chips-staging.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "chips-staging.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 "chips-staging.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 }} diff --git a/charts/chips-staging/templates/_helpers.tpl b/charts/chips-staging/templates/_helpers.tpl new file mode 100644 index 0000000..ed8ab8e --- /dev/null +++ b/charts/chips-staging/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "chips-staging.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 "chips-staging.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 "chips-staging.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "chips-staging.labels" -}} +helm.sh/chart: {{ include "chips-staging.chart" . }} +{{ include "chips-staging.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "chips-staging.selectorLabels" -}} +app.kubernetes.io/name: {{ include "chips-staging.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "chips-staging.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "chips-staging.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/chips-staging/templates/deployment.yaml b/charts/chips-staging/templates/deployment.yaml new file mode 100644 index 0000000..652f9d3 --- /dev/null +++ b/charts/chips-staging/templates/deployment.yaml @@ -0,0 +1,61 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "chips-staging.fullname" . }} + labels: + {{- include "chips-staging.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "chips-staging.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "chips-staging.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "chips-staging.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + 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 }} diff --git a/charts/chips-staging/templates/hpa.yaml b/charts/chips-staging/templates/hpa.yaml new file mode 100644 index 0000000..408ea91 --- /dev/null +++ b/charts/chips-staging/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "chips-staging.fullname" . }} + labels: + {{- include "chips-staging.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "chips-staging.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/chips-staging/templates/ingress.yaml b/charts/chips-staging/templates/ingress.yaml new file mode 100644 index 0000000..dc328e6 --- /dev/null +++ b/charts/chips-staging/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "chips-staging.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else 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 "chips-staging.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- 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: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/chips-staging/templates/service.yaml b/charts/chips-staging/templates/service.yaml new file mode 100644 index 0000000..79ae9ff --- /dev/null +++ b/charts/chips-staging/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "chips-staging.fullname" . }} + labels: + {{- include "chips-staging.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "chips-staging.selectorLabels" . | nindent 4 }} diff --git a/charts/chips-staging/values.yaml b/charts/chips-staging/values.yaml new file mode 100644 index 0000000..4a1b30d --- /dev/null +++ b/charts/chips-staging/values.yaml @@ -0,0 +1,82 @@ +# Default values for chips-staging. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: gcr.io/pathway-staging-342900/chips + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "staging" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +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: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 4000 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +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: {} From 345477570150f59083f7f5cbc45ae8e17050b028 Mon Sep 17 00:00:00 2001 From: Aditya Raghuwanshi Date: Tue, 15 Mar 2022 23:40:12 -0700 Subject: [PATCH 2/8] please linter --- charts/chips-staging/Chart.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/charts/chips-staging/Chart.yaml b/charts/chips-staging/Chart.yaml index 551be65..5e47284 100644 --- a/charts/chips-staging/Chart.yaml +++ b/charts/chips-staging/Chart.yaml @@ -4,3 +4,6 @@ description: A Helm chart for chips staging deployment type: application version: 0.1.0 appVersion: "15671c8" +maintainers: + - name: DevOps + email: devops@indiegogo.com \ No newline at end of file From 4de3eabbe17332ab188f175cf454a696df598a07 Mon Sep 17 00:00:00 2001 From: Aditya Raghuwanshi Date: Tue, 15 Mar 2022 23:46:42 -0700 Subject: [PATCH 3/8] lint --- charts/chips-staging/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/chips-staging/Chart.yaml b/charts/chips-staging/Chart.yaml index 5e47284..7fd49ca 100644 --- a/charts/chips-staging/Chart.yaml +++ b/charts/chips-staging/Chart.yaml @@ -6,4 +6,4 @@ version: 0.1.0 appVersion: "15671c8" maintainers: - name: DevOps - email: devops@indiegogo.com \ No newline at end of file + email: devops@indiegogo.com From 4a71873e95f1b0ac3858c86da6423dc6113e3156 Mon Sep 17 00:00:00 2001 From: Aditya Raghuwanshi Date: Wed, 16 Mar 2022 00:05:54 -0700 Subject: [PATCH 4/8] use the image that service account has access to --- charts/chips-staging/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/chips-staging/values.yaml b/charts/chips-staging/values.yaml index 4a1b30d..ec36748 100644 --- a/charts/chips-staging/values.yaml +++ b/charts/chips-staging/values.yaml @@ -5,10 +5,10 @@ replicaCount: 1 image: - repository: gcr.io/pathway-staging-342900/chips + repository: gcr.io/indiegogo-staging/chips pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: "staging" + tag: "stage" imagePullSecrets: [] nameOverride: "" From 5ecf95ede889833f36c55b654efe0f2d29e0786d Mon Sep 17 00:00:00 2001 From: Aditya Raghuwanshi Date: Wed, 16 Mar 2022 00:09:37 -0700 Subject: [PATCH 5/8] don't use service account --- charts/chips-staging/templates/_helpers.tpl | 13 +------------ charts/chips-staging/templates/deployment.yaml | 1 - charts/chips-staging/values.yaml | 9 --------- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/charts/chips-staging/templates/_helpers.tpl b/charts/chips-staging/templates/_helpers.tpl index ed8ab8e..d773093 100644 --- a/charts/chips-staging/templates/_helpers.tpl +++ b/charts/chips-staging/templates/_helpers.tpl @@ -48,15 +48,4 @@ Selector labels {{- define "chips-staging.selectorLabels" -}} app.kubernetes.io/name: {{ include "chips-staging.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "chips-staging.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "chips-staging.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/chips-staging/templates/deployment.yaml b/charts/chips-staging/templates/deployment.yaml index 652f9d3..72910da 100644 --- a/charts/chips-staging/templates/deployment.yaml +++ b/charts/chips-staging/templates/deployment.yaml @@ -24,7 +24,6 @@ spec: imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - serviceAccountName: {{ include "chips-staging.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: diff --git a/charts/chips-staging/values.yaml b/charts/chips-staging/values.yaml index ec36748..ab7f673 100644 --- a/charts/chips-staging/values.yaml +++ b/charts/chips-staging/values.yaml @@ -14,15 +14,6 @@ imagePullSecrets: [] nameOverride: "" fullnameOverride: "" -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: "" - podAnnotations: {} podSecurityContext: {} From a71f3eef04011e0f61220ca8cff442b827f6161a Mon Sep 17 00:00:00 2001 From: Aditya Raghuwanshi Date: Tue, 21 Jun 2022 13:32:46 -0700 Subject: [PATCH 6/8] Websocket bus --- charts/websocket-bus-staging/.helmignore | 23 ++++++ charts/websocket-bus-staging/Chart.yaml | 24 ++++++ .../websocket-bus-staging/templates/NOTES.txt | 22 ++++++ .../templates/_helpers.tpl | 62 +++++++++++++++ .../websocket-bus-staging/templates/cert.yaml | 7 ++ .../templates/deployment.yaml | 56 +++++++++++++ .../websocket-bus-staging/templates/hpa.yaml | 28 +++++++ .../templates/ingress.yaml | 58 ++++++++++++++ .../templates/service.yaml | 19 +++++ .../templates/serviceaccount.yaml | 12 +++ charts/websocket-bus-staging/values.yaml | 79 +++++++++++++++++++ 11 files changed, 390 insertions(+) create mode 100644 charts/websocket-bus-staging/.helmignore create mode 100644 charts/websocket-bus-staging/Chart.yaml create mode 100644 charts/websocket-bus-staging/templates/NOTES.txt create mode 100644 charts/websocket-bus-staging/templates/_helpers.tpl create mode 100644 charts/websocket-bus-staging/templates/cert.yaml create mode 100644 charts/websocket-bus-staging/templates/deployment.yaml create mode 100644 charts/websocket-bus-staging/templates/hpa.yaml create mode 100644 charts/websocket-bus-staging/templates/ingress.yaml create mode 100644 charts/websocket-bus-staging/templates/service.yaml create mode 100644 charts/websocket-bus-staging/templates/serviceaccount.yaml create mode 100644 charts/websocket-bus-staging/values.yaml diff --git a/charts/websocket-bus-staging/.helmignore b/charts/websocket-bus-staging/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/websocket-bus-staging/.helmignore @@ -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/ diff --git a/charts/websocket-bus-staging/Chart.yaml b/charts/websocket-bus-staging/Chart.yaml new file mode 100644 index 0000000..2f0ba51 --- /dev/null +++ b/charts/websocket-bus-staging/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: websocket-bus-staging +description: Websocker Bus for Chips + +# 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.1 + +# 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: "1.16.0" diff --git a/charts/websocket-bus-staging/templates/NOTES.txt b/charts/websocket-bus-staging/templates/NOTES.txt new file mode 100644 index 0000000..72a9185 --- /dev/null +++ b/charts/websocket-bus-staging/templates/NOTES.txt @@ -0,0 +1,22 @@ +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 }}{{ .path }} + {{- 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 "websocket-bus-staging.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 "websocket-bus-staging.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "websocket-bus-staging.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 "websocket-bus-staging.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 }} diff --git a/charts/websocket-bus-staging/templates/_helpers.tpl b/charts/websocket-bus-staging/templates/_helpers.tpl new file mode 100644 index 0000000..da5eee2 --- /dev/null +++ b/charts/websocket-bus-staging/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "websocket-bus-staging.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 "websocket-bus-staging.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 "websocket-bus-staging.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "websocket-bus-staging.labels" -}} +helm.sh/chart: {{ include "websocket-bus-staging.chart" . }} +{{ include "websocket-bus-staging.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "websocket-bus-staging.selectorLabels" -}} +app.kubernetes.io/name: {{ include "websocket-bus-staging.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "websocket-bus-staging.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "websocket-bus-staging.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/websocket-bus-staging/templates/cert.yaml b/charts/websocket-bus-staging/templates/cert.yaml new file mode 100644 index 0000000..37a8674 --- /dev/null +++ b/charts/websocket-bus-staging/templates/cert.yaml @@ -0,0 +1,7 @@ +apiVersion: networking.gke.io/v1 +kind: ManagedCertificate +metadata: + name: chips-stage-websocket-bus +spec: + domains: + - stage-bus.trypathway.com \ No newline at end of file diff --git a/charts/websocket-bus-staging/templates/deployment.yaml b/charts/websocket-bus-staging/templates/deployment.yaml new file mode 100644 index 0000000..f8d146c --- /dev/null +++ b/charts/websocket-bus-staging/templates/deployment.yaml @@ -0,0 +1,56 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "websocket-bus-staging.fullname" . }} + labels: + {{- include "websocket-bus-staging.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "websocket-bus-staging.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "websocket-bus-staging.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "websocket-bus-staging.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http-publisher + containerPort: 4001 + protocol: TCP + - name: http-websocket + containerPort: 4000 + protocol: TCP + 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 }} diff --git a/charts/websocket-bus-staging/templates/hpa.yaml b/charts/websocket-bus-staging/templates/hpa.yaml new file mode 100644 index 0000000..127ab56 --- /dev/null +++ b/charts/websocket-bus-staging/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "websocket-bus-staging.fullname" . }} + labels: + {{- include "websocket-bus-staging.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "websocket-bus-staging.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/websocket-bus-staging/templates/ingress.yaml b/charts/websocket-bus-staging/templates/ingress.yaml new file mode 100644 index 0000000..6b78d20 --- /dev/null +++ b/charts/websocket-bus-staging/templates/ingress.yaml @@ -0,0 +1,58 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "websocket-bus-staging.fullname" . -}} +{{- $publisherPort := .Values.service.publisherPort -}} +{{- $websocketPort := .Values.service.websocketPort -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else 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 "websocket-bus-staging.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- 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: + - pathType: ImplementationSpecific + backend: + service: + name: {{ $fullName }} + port: + number: {{ $publisherPort }} + - pathType: ImplementationSpecific + backend: + service: + name: {{ $fullName }} + port: + number: {{ $websocketPort }} + {{- end }} +{{- end }} diff --git a/charts/websocket-bus-staging/templates/service.yaml b/charts/websocket-bus-staging/templates/service.yaml new file mode 100644 index 0000000..af76335 --- /dev/null +++ b/charts/websocket-bus-staging/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "websocket-bus-staging.fullname" . }} + labels: + {{- include "websocket-bus-staging.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.publisherPort }} + targetPort: {{ .Values.service.publisherPort }} + protocol: TCP + name: publisher + - port: {{ .Values.service.websocketPort }} + targetPort: {{ .Values.service.websocketPort }} + protocol: TCP + name: websocket + selector: + {{- include "websocket-bus-staging.selectorLabels" . | nindent 4 }} diff --git a/charts/websocket-bus-staging/templates/serviceaccount.yaml b/charts/websocket-bus-staging/templates/serviceaccount.yaml new file mode 100644 index 0000000..dafb7d1 --- /dev/null +++ b/charts/websocket-bus-staging/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "websocket-bus-staging.serviceAccountName" . }} + labels: + {{- include "websocket-bus-staging.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/websocket-bus-staging/values.yaml b/charts/websocket-bus-staging/values.yaml new file mode 100644 index 0000000..67454a5 --- /dev/null +++ b/charts/websocket-bus-staging/values.yaml @@ -0,0 +1,79 @@ +# Default values for websocket-bus-staging. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "gcr.io/pathway-staging-342900/websock" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "latest" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +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: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: NodePort + publisherPort: 4001 + websocketPort: 4000 + +ingress: + enabled: true + className: "" + annotations: + networking.gke.io/managed-certificates: chips-stage-websocket-bus + hosts: + - host: stage-bus.trypathway.com + # tls: + # - secretName: chips-tls + # hosts: + # - stage-bus.trypathway.com. + +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: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} From 925290be9b8c1026d3f8da78dbb3c2d0280251a3 Mon Sep 17 00:00:00 2001 From: Aditya Raghuwanshi Date: Wed, 22 Jun 2022 22:31:15 -0700 Subject: [PATCH 7/8] start from scratch --- charts/chips-staging/.helmignore | 23 ------ charts/chips-staging/Chart.yaml | 9 --- charts/chips-staging/templates/NOTES.txt | 22 ------ charts/chips-staging/templates/_helpers.tpl | 51 ------------ .../chips-staging/templates/deployment.yaml | 60 -------------- charts/chips-staging/templates/hpa.yaml | 28 ------- charts/chips-staging/templates/ingress.yaml | 61 -------------- charts/chips-staging/templates/service.yaml | 15 ---- charts/chips-staging/values.yaml | 73 ----------------- charts/websocket-bus-staging/.helmignore | 23 ------ charts/websocket-bus-staging/Chart.yaml | 24 ------ .../websocket-bus-staging/templates/NOTES.txt | 22 ------ .../templates/_helpers.tpl | 62 --------------- .../websocket-bus-staging/templates/cert.yaml | 7 -- .../templates/deployment.yaml | 56 ------------- .../websocket-bus-staging/templates/hpa.yaml | 28 ------- .../templates/ingress.yaml | 58 -------------- .../templates/service.yaml | 19 ----- .../templates/serviceaccount.yaml | 12 --- charts/websocket-bus-staging/values.yaml | 79 ------------------- 20 files changed, 732 deletions(-) delete mode 100644 charts/chips-staging/.helmignore delete mode 100644 charts/chips-staging/Chart.yaml delete mode 100644 charts/chips-staging/templates/NOTES.txt delete mode 100644 charts/chips-staging/templates/_helpers.tpl delete mode 100644 charts/chips-staging/templates/deployment.yaml delete mode 100644 charts/chips-staging/templates/hpa.yaml delete mode 100644 charts/chips-staging/templates/ingress.yaml delete mode 100644 charts/chips-staging/templates/service.yaml delete mode 100644 charts/chips-staging/values.yaml delete mode 100644 charts/websocket-bus-staging/.helmignore delete mode 100644 charts/websocket-bus-staging/Chart.yaml delete mode 100644 charts/websocket-bus-staging/templates/NOTES.txt delete mode 100644 charts/websocket-bus-staging/templates/_helpers.tpl delete mode 100644 charts/websocket-bus-staging/templates/cert.yaml delete mode 100644 charts/websocket-bus-staging/templates/deployment.yaml delete mode 100644 charts/websocket-bus-staging/templates/hpa.yaml delete mode 100644 charts/websocket-bus-staging/templates/ingress.yaml delete mode 100644 charts/websocket-bus-staging/templates/service.yaml delete mode 100644 charts/websocket-bus-staging/templates/serviceaccount.yaml delete mode 100644 charts/websocket-bus-staging/values.yaml diff --git a/charts/chips-staging/.helmignore b/charts/chips-staging/.helmignore deleted file mode 100644 index 0e8a0eb..0000000 --- a/charts/chips-staging/.helmignore +++ /dev/null @@ -1,23 +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 -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/charts/chips-staging/Chart.yaml b/charts/chips-staging/Chart.yaml deleted file mode 100644 index 7fd49ca..0000000 --- a/charts/chips-staging/Chart.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v2 -name: chips-staging -description: A Helm chart for chips staging deployment -type: application -version: 0.1.0 -appVersion: "15671c8" -maintainers: - - name: DevOps - email: devops@indiegogo.com diff --git a/charts/chips-staging/templates/NOTES.txt b/charts/chips-staging/templates/NOTES.txt deleted file mode 100644 index 8d3c90f..0000000 --- a/charts/chips-staging/templates/NOTES.txt +++ /dev/null @@ -1,22 +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 }}{{ .path }} - {{- 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 "chips-staging.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 "chips-staging.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "chips-staging.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 "chips-staging.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 }} diff --git a/charts/chips-staging/templates/_helpers.tpl b/charts/chips-staging/templates/_helpers.tpl deleted file mode 100644 index d773093..0000000 --- a/charts/chips-staging/templates/_helpers.tpl +++ /dev/null @@ -1,51 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "chips-staging.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 "chips-staging.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 "chips-staging.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "chips-staging.labels" -}} -helm.sh/chart: {{ include "chips-staging.chart" . }} -{{ include "chips-staging.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "chips-staging.selectorLabels" -}} -app.kubernetes.io/name: {{ include "chips-staging.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} \ No newline at end of file diff --git a/charts/chips-staging/templates/deployment.yaml b/charts/chips-staging/templates/deployment.yaml deleted file mode 100644 index 72910da..0000000 --- a/charts/chips-staging/templates/deployment.yaml +++ /dev/null @@ -1,60 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "chips-staging.fullname" . }} - labels: - {{- include "chips-staging.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "chips-staging.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "chips-staging.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http - containerPort: 80 - protocol: TCP - livenessProbe: - httpGet: - path: / - port: http - readinessProbe: - httpGet: - path: / - port: http - 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 }} diff --git a/charts/chips-staging/templates/hpa.yaml b/charts/chips-staging/templates/hpa.yaml deleted file mode 100644 index 408ea91..0000000 --- a/charts/chips-staging/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "chips-staging.fullname" . }} - labels: - {{- include "chips-staging.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "chips-staging.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/charts/chips-staging/templates/ingress.yaml b/charts/chips-staging/templates/ingress.yaml deleted file mode 100644 index dc328e6..0000000 --- a/charts/chips-staging/templates/ingress.yaml +++ /dev/null @@ -1,61 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "chips-staging.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} - {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} - {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} - {{- end }} -{{- end }} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1 -{{- else 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 "chips-staging.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} - ingressClassName: {{ .Values.ingress.className }} - {{- end }} - {{- 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: {{ .path }} - {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} - pathType: {{ .pathType }} - {{- end }} - backend: - {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: {{ $fullName }} - port: - number: {{ $svcPort }} - {{- else }} - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/charts/chips-staging/templates/service.yaml b/charts/chips-staging/templates/service.yaml deleted file mode 100644 index 79ae9ff..0000000 --- a/charts/chips-staging/templates/service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "chips-staging.fullname" . }} - labels: - {{- include "chips-staging.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "chips-staging.selectorLabels" . | nindent 4 }} diff --git a/charts/chips-staging/values.yaml b/charts/chips-staging/values.yaml deleted file mode 100644 index ab7f673..0000000 --- a/charts/chips-staging/values.yaml +++ /dev/null @@ -1,73 +0,0 @@ -# Default values for chips-staging. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - repository: gcr.io/indiegogo-staging/chips - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "stage" - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -podAnnotations: {} - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: ClusterIP - port: 4000 - -ingress: - enabled: false - className: "" - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: - - path: / - pathType: ImplementationSpecific - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -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: {} diff --git a/charts/websocket-bus-staging/.helmignore b/charts/websocket-bus-staging/.helmignore deleted file mode 100644 index 0e8a0eb..0000000 --- a/charts/websocket-bus-staging/.helmignore +++ /dev/null @@ -1,23 +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 -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/charts/websocket-bus-staging/Chart.yaml b/charts/websocket-bus-staging/Chart.yaml deleted file mode 100644 index 2f0ba51..0000000 --- a/charts/websocket-bus-staging/Chart.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: v2 -name: websocket-bus-staging -description: Websocker Bus for Chips - -# 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.1 - -# 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: "1.16.0" diff --git a/charts/websocket-bus-staging/templates/NOTES.txt b/charts/websocket-bus-staging/templates/NOTES.txt deleted file mode 100644 index 72a9185..0000000 --- a/charts/websocket-bus-staging/templates/NOTES.txt +++ /dev/null @@ -1,22 +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 }}{{ .path }} - {{- 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 "websocket-bus-staging.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 "websocket-bus-staging.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "websocket-bus-staging.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 "websocket-bus-staging.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 }} diff --git a/charts/websocket-bus-staging/templates/_helpers.tpl b/charts/websocket-bus-staging/templates/_helpers.tpl deleted file mode 100644 index da5eee2..0000000 --- a/charts/websocket-bus-staging/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "websocket-bus-staging.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 "websocket-bus-staging.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 "websocket-bus-staging.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "websocket-bus-staging.labels" -}} -helm.sh/chart: {{ include "websocket-bus-staging.chart" . }} -{{ include "websocket-bus-staging.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "websocket-bus-staging.selectorLabels" -}} -app.kubernetes.io/name: {{ include "websocket-bus-staging.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "websocket-bus-staging.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "websocket-bus-staging.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/charts/websocket-bus-staging/templates/cert.yaml b/charts/websocket-bus-staging/templates/cert.yaml deleted file mode 100644 index 37a8674..0000000 --- a/charts/websocket-bus-staging/templates/cert.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: networking.gke.io/v1 -kind: ManagedCertificate -metadata: - name: chips-stage-websocket-bus -spec: - domains: - - stage-bus.trypathway.com \ No newline at end of file diff --git a/charts/websocket-bus-staging/templates/deployment.yaml b/charts/websocket-bus-staging/templates/deployment.yaml deleted file mode 100644 index f8d146c..0000000 --- a/charts/websocket-bus-staging/templates/deployment.yaml +++ /dev/null @@ -1,56 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "websocket-bus-staging.fullname" . }} - labels: - {{- include "websocket-bus-staging.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "websocket-bus-staging.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "websocket-bus-staging.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "websocket-bus-staging.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http-publisher - containerPort: 4001 - protocol: TCP - - name: http-websocket - containerPort: 4000 - protocol: TCP - 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 }} diff --git a/charts/websocket-bus-staging/templates/hpa.yaml b/charts/websocket-bus-staging/templates/hpa.yaml deleted file mode 100644 index 127ab56..0000000 --- a/charts/websocket-bus-staging/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "websocket-bus-staging.fullname" . }} - labels: - {{- include "websocket-bus-staging.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "websocket-bus-staging.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/charts/websocket-bus-staging/templates/ingress.yaml b/charts/websocket-bus-staging/templates/ingress.yaml deleted file mode 100644 index 6b78d20..0000000 --- a/charts/websocket-bus-staging/templates/ingress.yaml +++ /dev/null @@ -1,58 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "websocket-bus-staging.fullname" . -}} -{{- $publisherPort := .Values.service.publisherPort -}} -{{- $websocketPort := .Values.service.websocketPort -}} -{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} - {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} - {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} - {{- end }} -{{- end }} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1 -{{- else 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 "websocket-bus-staging.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} - ingressClassName: {{ .Values.ingress.className }} - {{- end }} - {{- 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: - - pathType: ImplementationSpecific - backend: - service: - name: {{ $fullName }} - port: - number: {{ $publisherPort }} - - pathType: ImplementationSpecific - backend: - service: - name: {{ $fullName }} - port: - number: {{ $websocketPort }} - {{- end }} -{{- end }} diff --git a/charts/websocket-bus-staging/templates/service.yaml b/charts/websocket-bus-staging/templates/service.yaml deleted file mode 100644 index af76335..0000000 --- a/charts/websocket-bus-staging/templates/service.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "websocket-bus-staging.fullname" . }} - labels: - {{- include "websocket-bus-staging.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.publisherPort }} - targetPort: {{ .Values.service.publisherPort }} - protocol: TCP - name: publisher - - port: {{ .Values.service.websocketPort }} - targetPort: {{ .Values.service.websocketPort }} - protocol: TCP - name: websocket - selector: - {{- include "websocket-bus-staging.selectorLabels" . | nindent 4 }} diff --git a/charts/websocket-bus-staging/templates/serviceaccount.yaml b/charts/websocket-bus-staging/templates/serviceaccount.yaml deleted file mode 100644 index dafb7d1..0000000 --- a/charts/websocket-bus-staging/templates/serviceaccount.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "websocket-bus-staging.serviceAccountName" . }} - labels: - {{- include "websocket-bus-staging.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/charts/websocket-bus-staging/values.yaml b/charts/websocket-bus-staging/values.yaml deleted file mode 100644 index 67454a5..0000000 --- a/charts/websocket-bus-staging/values.yaml +++ /dev/null @@ -1,79 +0,0 @@ -# Default values for websocket-bus-staging. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - repository: "gcr.io/pathway-staging-342900/websock" - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "latest" - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -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: "" - -podAnnotations: {} - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: NodePort - publisherPort: 4001 - websocketPort: 4000 - -ingress: - enabled: true - className: "" - annotations: - networking.gke.io/managed-certificates: chips-stage-websocket-bus - hosts: - - host: stage-bus.trypathway.com - # tls: - # - secretName: chips-tls - # hosts: - # - stage-bus.trypathway.com. - -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: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} - -tolerations: [] - -affinity: {} From 6ef95f8775b5687122af210f3ffc50db79e3ba40 Mon Sep 17 00:00:00 2001 From: Aditya Raghuwanshi Date: Thu, 23 Jun 2022 16:58:35 -0700 Subject: [PATCH 8/8] Websocket Bus deployment deployed with cert-manager --- charts/chips-websocket/.helmignore | 23 +++++++ charts/chips-websocket/Chart.yaml | 24 +++++++ charts/chips-websocket/templates/NOTES.txt | 1 + charts/chips-websocket/templates/_helpers.tpl | 62 +++++++++++++++++++ .../templates/backendconfig.yaml | 12 ++++ .../templates/clusterissuer.yaml | 20 ++++++ .../chips-websocket/templates/deployment.yaml | 56 +++++++++++++++++ charts/chips-websocket/templates/hpa.yaml | 28 +++++++++ charts/chips-websocket/templates/ingress.yaml | 42 +++++++++++++ charts/chips-websocket/templates/service.yaml | 23 +++++++ .../templates/serviceaccount.yaml | 12 ++++ charts/chips-websocket/values.yaml | 62 +++++++++++++++++++ 12 files changed, 365 insertions(+) create mode 100644 charts/chips-websocket/.helmignore create mode 100644 charts/chips-websocket/Chart.yaml create mode 100644 charts/chips-websocket/templates/NOTES.txt create mode 100644 charts/chips-websocket/templates/_helpers.tpl create mode 100644 charts/chips-websocket/templates/backendconfig.yaml create mode 100644 charts/chips-websocket/templates/clusterissuer.yaml create mode 100644 charts/chips-websocket/templates/deployment.yaml create mode 100644 charts/chips-websocket/templates/hpa.yaml create mode 100644 charts/chips-websocket/templates/ingress.yaml create mode 100644 charts/chips-websocket/templates/service.yaml create mode 100644 charts/chips-websocket/templates/serviceaccount.yaml create mode 100644 charts/chips-websocket/values.yaml diff --git a/charts/chips-websocket/.helmignore b/charts/chips-websocket/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/chips-websocket/.helmignore @@ -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/ diff --git a/charts/chips-websocket/Chart.yaml b/charts/chips-websocket/Chart.yaml new file mode 100644 index 0000000..05f4a45 --- /dev/null +++ b/charts/chips-websocket/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: chips-websocket +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. +# 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. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/charts/chips-websocket/templates/NOTES.txt b/charts/chips-websocket/templates/NOTES.txt new file mode 100644 index 0000000..250ab6d --- /dev/null +++ b/charts/chips-websocket/templates/NOTES.txt @@ -0,0 +1 @@ +Deployed \ No newline at end of file diff --git a/charts/chips-websocket/templates/_helpers.tpl b/charts/chips-websocket/templates/_helpers.tpl new file mode 100644 index 0000000..be603fa --- /dev/null +++ b/charts/chips-websocket/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "chips-websocket.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 "chips-websocket.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 "chips-websocket.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "chips-websocket.labels" -}} +helm.sh/chart: {{ include "chips-websocket.chart" . }} +{{ include "chips-websocket.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "chips-websocket.selectorLabels" -}} +app.kubernetes.io/name: {{ include "chips-websocket.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "chips-websocket.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "chips-websocket.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/chips-websocket/templates/backendconfig.yaml b/charts/chips-websocket/templates/backendconfig.yaml new file mode 100644 index 0000000..469f329 --- /dev/null +++ b/charts/chips-websocket/templates/backendconfig.yaml @@ -0,0 +1,12 @@ +apiVersion: cloud.google.com/v1 +kind: BackendConfig # https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-features +metadata: + name: websocket-config + labels: + {{- include "chips-websocket.labels" . | nindent 4 }} +spec: + timeoutSec: 3600 + connectionDraining: + drainingTimeoutSec: 3600 + sessionAffinity: + affinityType: "CLIENT_IP" \ No newline at end of file diff --git a/charts/chips-websocket/templates/clusterissuer.yaml b/charts/chips-websocket/templates/clusterissuer.yaml new file mode 100644 index 0000000..49069a8 --- /dev/null +++ b/charts/chips-websocket/templates/clusterissuer.yaml @@ -0,0 +1,20 @@ +apiVersion: cert-manager.io/v1 +kind: ClusterIssuer +metadata: + name: letsencrypt + labels: + {{- include "chips-websocket.labels" . | nindent 4 }} +spec: + acme: + # The ACME server URL + server: https://acme-v02.api.letsencrypt.org/directory + # Email address used for ACME registration + email: adi.raghuwanshi@indiegogo.com # Update to yours + # Name of a secret used to store the ACME account private key + privateKeySecretRef: + name: letsencrypt + # Enable the HTTP-01 challenge provider + solvers: + - http01: + ingress: + class: ingress-gce diff --git a/charts/chips-websocket/templates/deployment.yaml b/charts/chips-websocket/templates/deployment.yaml new file mode 100644 index 0000000..f8dff51 --- /dev/null +++ b/charts/chips-websocket/templates/deployment.yaml @@ -0,0 +1,56 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "chips-websocket.fullname" . }} + labels: + {{- include "chips-websocket.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "chips-websocket.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "chips-websocket.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "chips-websocket.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: websocket + containerPort: 4000 + protocol: TCP + - name: publisher + containerPort: 4001 + protocol: TCP + 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 }} diff --git a/charts/chips-websocket/templates/hpa.yaml b/charts/chips-websocket/templates/hpa.yaml new file mode 100644 index 0000000..d8d4d11 --- /dev/null +++ b/charts/chips-websocket/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "chips-websocket.fullname" . }} + labels: + {{- include "chips-websocket.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "chips-websocket.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/chips-websocket/templates/ingress.yaml b/charts/chips-websocket/templates/ingress.yaml new file mode 100644 index 0000000..dc7c163 --- /dev/null +++ b/charts/chips-websocket/templates/ingress.yaml @@ -0,0 +1,42 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "chips-websocket.fullname" . }} + annotations: + # specify the name of the global IP address resource to be associated with the HTTP(S) Load Balancer. + kubernetes.io/ingress.global-static-ip-name: pathway-ingress + # add an annotation indicating the issuer to use. + cert-manager.io/cluster-issuer: letsencrypt + # controls whether the ingress is modified ‘in-place’, + # or a new one is created specifically for the HTTP01 challenge. + acme.cert-manager.io/http01-edit-in-place: "true" + kubernetes.io/ingress.allow-http: "false" + labels: + {{- include "chips-websocket.labels" . | nindent 4 }} +spec: + tls: # < placing a host in the TLS config will indicate a certificate should be created + - hosts: + - stage-bus.trypathway.com + - stage-websock.trypathway.com + secretName: stage-bus-cert-secret # < cert-manager will store the created certificate in this secret + rules: + - host: stage-bus.trypathway.com + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ include "chips-websocket.fullname" . }} + port: + number: 4001 + - host: stage-websock.trypathway.com + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ include "chips-websocket.fullname" . }} + port: + number: 4000 diff --git a/charts/chips-websocket/templates/service.yaml b/charts/chips-websocket/templates/service.yaml new file mode 100644 index 0000000..94cb923 --- /dev/null +++ b/charts/chips-websocket/templates/service.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "chips-websocket.fullname" . }} + labels: + {{- include "chips-websocket.labels" . | nindent 4 }} + annotations: + cloud.google.com/backend-config: '{"ports": { + "websocket": "websocket-config" + }}' +spec: + type: NodePort + ports: + - port: 4000 + targetPort: 4000 + protocol: TCP + name: websocket + - port: 4001 + targetPort: 4001 + protocol: TCP + name: publisher + selector: + {{- include "chips-websocket.selectorLabels" . | nindent 4 }} diff --git a/charts/chips-websocket/templates/serviceaccount.yaml b/charts/chips-websocket/templates/serviceaccount.yaml new file mode 100644 index 0000000..d5a1a0c --- /dev/null +++ b/charts/chips-websocket/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "chips-websocket.serviceAccountName" . }} + labels: + {{- include "chips-websocket.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/chips-websocket/values.yaml b/charts/chips-websocket/values.yaml new file mode 100644 index 0000000..3c93130 --- /dev/null +++ b/charts/chips-websocket/values.yaml @@ -0,0 +1,62 @@ +# Default values for chips-websocket. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "gcr.io/pathway-staging-342900/websock" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "17b73c4" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +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: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +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: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {}