diff --git a/charts/giropops-senhas/.helmignore b/charts/giropops-senhas/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/giropops-senhas/.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/giropops-senhas/dev/.helmignore b/charts/giropops-senhas/dev/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/giropops-senhas/dev/.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/giropops-senhas/dev/Chart.yaml b/charts/giropops-senhas/dev/Chart.yaml new file mode 100644 index 0000000..2907b93 --- /dev/null +++ b/charts/giropops-senhas/dev/Chart.yaml @@ -0,0 +1,7 @@ +apiVersion: v2 +name: giropops-senhas +description: Um pacote da aplicação giropops-senhas para Kubernetes. +icon: https://raw.githubusercontent.com/Tech-Preta/giropops-senhas/main/static/linuxtips-logo.png +type: application +version: 0.1.0 +appVersion: "1.16.0" diff --git a/charts/giropops-senhas/dev/templates/NOTES.txt b/charts/giropops-senhas/dev/templates/NOTES.txt new file mode 100644 index 0000000..08e961b --- /dev/null +++ b/charts/giropops-senhas/dev/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 "giropops-senhas.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 "giropops-senhas.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "giropops-senhas.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 "giropops-senhas.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/giropops-senhas/dev/templates/_helpers.tpl b/charts/giropops-senhas/dev/templates/_helpers.tpl new file mode 100644 index 0000000..dacc1fb --- /dev/null +++ b/charts/giropops-senhas/dev/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "giropops-senhas.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 "giropops-senhas.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 "giropops-senhas.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "giropops-senhas.labels" -}} +helm.sh/chart: {{ include "giropops-senhas.chart" . }} +{{ include "giropops-senhas.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "giropops-senhas.selectorLabels" -}} +app.kubernetes.io/name: {{ include "giropops-senhas.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "giropops-senhas.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "giropops-senhas.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/giropops-senhas/dev/templates/deployment.yaml b/charts/giropops-senhas/dev/templates/deployment.yaml new file mode 100644 index 0000000..daa91c2 --- /dev/null +++ b/charts/giropops-senhas/dev/templates/deployment.yaml @@ -0,0 +1,68 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "giropops-senhas.fullname" . }} + labels: + {{- include "giropops-senhas.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "giropops-senhas.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "giropops-senhas.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "giropops-senhas.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: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/giropops-senhas/dev/templates/hpa.yaml b/charts/giropops-senhas/dev/templates/hpa.yaml new file mode 100644 index 0000000..86b25b8 --- /dev/null +++ b/charts/giropops-senhas/dev/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "giropops-senhas.fullname" . }} + labels: + {{- include "giropops-senhas.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "giropops-senhas.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/giropops-senhas/dev/templates/ingress.yaml b/charts/giropops-senhas/dev/templates/ingress.yaml new file mode 100644 index 0000000..bb52f80 --- /dev/null +++ b/charts/giropops-senhas/dev/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "giropops-senhas.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 "giropops-senhas.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/giropops-senhas/dev/templates/service.yaml b/charts/giropops-senhas/dev/templates/service.yaml new file mode 100644 index 0000000..072e890 --- /dev/null +++ b/charts/giropops-senhas/dev/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "giropops-senhas.fullname" . }} + labels: + {{- include "giropops-senhas.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "giropops-senhas.selectorLabels" . | nindent 4 }} diff --git a/charts/giropops-senhas/dev/templates/serviceaccount.yaml b/charts/giropops-senhas/dev/templates/serviceaccount.yaml new file mode 100644 index 0000000..bdba6fb --- /dev/null +++ b/charts/giropops-senhas/dev/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "giropops-senhas.serviceAccountName" . }} + labels: + {{- include "giropops-senhas.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/charts/giropops-senhas/dev/templates/tests/test-connection.yaml b/charts/giropops-senhas/dev/templates/tests/test-connection.yaml new file mode 100644 index 0000000..cd24662 --- /dev/null +++ b/charts/giropops-senhas/dev/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "giropops-senhas.fullname" . }}-test-connection" + labels: + {{- include "giropops-senhas.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "giropops-senhas.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/charts/giropops-senhas/dev/values.yaml b/charts/giropops-senhas/dev/values.yaml new file mode 100644 index 0000000..fa0b474 --- /dev/null +++ b/charts/giropops-senhas/dev/values.yaml @@ -0,0 +1,96 @@ +replicaCount: 1 + +image: + repository: nginx + pullPolicy: IfNotPresent + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + create: true + automount: false + annotations: {} + name: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: {} +# fsGroup: 2000 + +securityContext: {} +# capabilities: +# drop: +# - ALL +# readOnlyRootFilesystem: true +# runAsNonRoot: true +# runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + kubernetes.io/ingress.class: nginx + 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 + +livenessProbe: + httpGet: + path: / + port: http +readinessProbe: + httpGet: + path: / + port: http + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/giropops-senhas/prd/.helmignore b/charts/giropops-senhas/prd/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/giropops-senhas/prd/.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/giropops-senhas/prd/Chart.yaml b/charts/giropops-senhas/prd/Chart.yaml new file mode 100644 index 0000000..0800a8c --- /dev/null +++ b/charts/giropops-senhas/prd/Chart.yaml @@ -0,0 +1,17 @@ +annotations: + catalog.cattle.io/display-name: Giropops Senhas - LINUXtips + catalog.cattle.io/os: linux +apiVersion: v2 +name: giropops-senhas +description: Um pacote da aplicação giropops-senhas para Kubernetes. +icon: https://raw.githubusercontent.com/Tech-Preta/giropops-senhas/main/static/linuxtips-logo.png +type: application +version: 0.1.0 +appVersion: "1.16.0" + +#dependencies: + +#- condition: redis.enabled +# name: redis +# repository: https://charts.bitnami.com/bitnami +# version: "20.0.2" diff --git a/charts/giropops-senhas/prd/templates/NOTES.txt b/charts/giropops-senhas/prd/templates/NOTES.txt new file mode 100644 index 0000000..08e961b --- /dev/null +++ b/charts/giropops-senhas/prd/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 "giropops-senhas.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 "giropops-senhas.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "giropops-senhas.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 "giropops-senhas.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/giropops-senhas/prd/templates/_helpers.tpl b/charts/giropops-senhas/prd/templates/_helpers.tpl new file mode 100644 index 0000000..0138d3c --- /dev/null +++ b/charts/giropops-senhas/prd/templates/_helpers.tpl @@ -0,0 +1,28 @@ +{{/* +Define o nome completo do release. +*/}} +{{- define "giropopsSenhas.fullname" -}} +{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Define o nome do ServiceAccount. +*/}} +{{- define "giropopsSenhas.serviceAccountName" -}} +{{- .Values.serviceAccount.name | default "default-service-account" -}} +{{- end -}} + +{{/* +Define os labels para o selector. +*/}} +{{- define "giropopsSenhas.selectorLabels" -}} +app: {{ include "giropopsSenhas.fullname" . }} +{{- end -}} + +{{/* +Define os labels para o deployment. +*/}} +{{- define "giropopsSenhas.labels" -}} +app: {{ include "giropopsSenhas.fullname" . }} +{{- end -}} + diff --git a/charts/giropops-senhas/prd/templates/deployment.yaml b/charts/giropops-senhas/prd/templates/deployment.yaml new file mode 100644 index 0000000..50f076c --- /dev/null +++ b/charts/giropops-senhas/prd/templates/deployment.yaml @@ -0,0 +1,44 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "giropopsSenhas.fullname" . }} + labels: + {{- include "giropopsSenhas.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount | default 1 }} + selector: + matchLabels: + {{- include "giropopsSenhas.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "giropopsSenhas.selectorLabels" . | nindent 8 }} + annotations: + {{- toYaml .Values.podAnnotations | nindent 8 }} + spec: + serviceAccountName: {{ include "giropopsSenhas.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy | default "IfNotPresent" }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + env: + {{- range .Values.giropopsSenhas.env }} + - name: {{ .name }} + value: {{ .value | quote }} + {{- end }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumes: + - name: giropops-senhas-pvc + persistentVolumeClaim: + claimName: {{ .Values.volumes.metadata.name | default "giropops-senhas-pvc" }} \ No newline at end of file diff --git a/charts/giropops-senhas/prd/templates/hpa.yaml b/charts/giropops-senhas/prd/templates/hpa.yaml new file mode 100644 index 0000000..86b25b8 --- /dev/null +++ b/charts/giropops-senhas/prd/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "giropops-senhas.fullname" . }} + labels: + {{- include "giropops-senhas.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "giropops-senhas.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/giropops-senhas/prd/templates/ingress.yaml b/charts/giropops-senhas/prd/templates/ingress.yaml new file mode 100644 index 0000000..4439aae --- /dev/null +++ b/charts/giropops-senhas/prd/templates/ingress.yaml @@ -0,0 +1,67 @@ + +{{- if .Values.ingress }} +{{- if .Values.ingress.enabled -}} + +{{- $fullName := include "giropopsSenhas.fullname" . -}} +{{- $svcPort := .Values.service.port | default "5000" -}} + +{{- 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 "giropopsSenhas.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 }} +{{- end }} diff --git a/charts/giropops-senhas/prd/templates/podmonitor.yaml b/charts/giropops-senhas/prd/templates/podmonitor.yaml new file mode 100644 index 0000000..6c91f23 --- /dev/null +++ b/charts/giropops-senhas/prd/templates/podmonitor.yaml @@ -0,0 +1,22 @@ +{{- if .Values.giropopsSenhas.podMonitor.enabled -}} +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: {{ include "giropopsSenhas.fullname" . }} + labels: + {{- include "giropopsSenhas.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "giropopsSenhas.selectorLabels" . | nindent 6 }} + namespaceSelector: + matchNames: + - {{ .Values.giropopsSenhas.podMonitor.namespace | default "default-namespace" }} + podMetricsEndpoints: + {{- range .Values.giropopsSenhas.podMonitor.endpoints }} + - port: {{ .port | default "http" }} + path: {{ .path | default "/" }} + interval: {{ .interval | default "30s" }} + scrapeTimeout: {{ .scrapeTimeout | default "10s" }} + {{- end }} +{{- end }} diff --git a/charts/giropops-senhas/prd/templates/pvc.yaml b/charts/giropops-senhas/prd/templates/pvc.yaml new file mode 100644 index 0000000..b3f320a --- /dev/null +++ b/charts/giropops-senhas/prd/templates/pvc.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Values.volumes.metadata.name }} + namespace: {{ .Values.volumes.metadata.namespace }} + labels: + {{- range $key, $value := .Values.volumes.metadata.labels }} + {{ $key }}: {{ $value }} + {{- end }} +spec: + storageClassName: {{ .Values.volumes.spec.storageClassName }} + accessModes: + {{- range .Values.volumes.spec.accessModes }} + - {{ . }} + {{- end }} + resources: + requests: + storage: {{ .Values.volumes.spec.resources.requests.storage }} \ No newline at end of file diff --git a/charts/giropops-senhas/prd/templates/redis-service.yaml b/charts/giropops-senhas/prd/templates/redis-service.yaml new file mode 100644 index 0000000..db90507 --- /dev/null +++ b/charts/giropops-senhas/prd/templates/redis-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: redis + labels: + {{ .Values.redis.labels | toYaml | nindent 4 }} +spec: + selector: + app: redis + ports: + - protocol: TCP + port: {{ .Values.redis.service.port }} + targetPort: {{ .Values.redis.service.targetPort }} + type: {{ .Values.redis.service.type }} \ No newline at end of file diff --git a/charts/giropops-senhas/prd/templates/redis.deployment.yaml b/charts/giropops-senhas/prd/templates/redis.deployment.yaml new file mode 100644 index 0000000..5fabe89 --- /dev/null +++ b/charts/giropops-senhas/prd/templates/redis.deployment.yaml @@ -0,0 +1,28 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + {{ .Values.redis.labels | toYaml | nindent 4 }} + name: redis-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: redis + template: + metadata: + labels: + app: redis + spec: + containers: + - image: {{ .Values.redis.image }} + name: redis + ports: + - containerPort: {{ .Values.redis.port }} + resources: + limits: + memory: {{ .Values.redis.resources.limits.memory }} + cpu: {{ .Values.redis.resources.limits.cpu }} + requests: + memory: {{ .Values.redis.resources.requests.memory }} + cpu: {{ .Values.redis.resources.requests.cpu }} \ No newline at end of file diff --git a/charts/giropops-senhas/prd/templates/service.yaml b/charts/giropops-senhas/prd/templates/service.yaml new file mode 100644 index 0000000..a570b21 --- /dev/null +++ b/charts/giropops-senhas/prd/templates/service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "giropopsSenhas.fullname" . }} + labels: + {{- include "giropopsSenhas.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type | default "ClusterIP" }} # Use default value if not provided + selector: + {{- toYaml .Values.service.selector | nindent 4 }} # Ensure the selector is properly rendered + ports: + - name: http + port: {{ .Values.service.port | default 5000 }} # Use default value if not provided + targetPort: {{ .Values.service.targetPort | default 5000 }} # Use default value if not provided diff --git a/charts/giropops-senhas/prd/templates/serviceaccount.yaml b/charts/giropops-senhas/prd/templates/serviceaccount.yaml new file mode 100644 index 0000000..f1ab54f --- /dev/null +++ b/charts/giropops-senhas/prd/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.name }} + namespace: {{ .Release.Namespace }} + annotations: + {{- with .Values.serviceAccount.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +--- +{{- end }} + diff --git a/charts/giropops-senhas/prd/templates/servicemonitor.yaml b/charts/giropops-senhas/prd/templates/servicemonitor.yaml new file mode 100644 index 0000000..fecb87e --- /dev/null +++ b/charts/giropops-senhas/prd/templates/servicemonitor.yaml @@ -0,0 +1,22 @@ +{{- if .Values.serviceMonitor.enabled -}} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "giropopsSenhas.fullname" . }} + labels: + {{- include "giropopsSenhas.labels" . | nindent 4 }} +spec: + namespaceSelector: + matchNames: + - {{ .Values.serviceMonitor.giropopsSenhas.namespace | default "default-namespace" }} # Use default if not set + selector: + matchLabels: + {{- include "giropopsSenhas.selectorLabels" . | nindent 6 }} + endpoints: + {{- range .Values.serviceMonitor.giropopsSenhas.endpoints }} + - port: {{ .port }} + path: {{ .path | default "/" }} # Default path if not set + interval: {{ .interval | default "30s" }} # Default interval if not set + scrapeTimeout: {{ .scrapeTimeout | default "10s" }} # Default timeout if not set + {{- end }} +{{- end -}} diff --git a/charts/giropops-senhas/prd/values.yaml b/charts/giropops-senhas/prd/values.yaml new file mode 100644 index 0000000..ecd540c --- /dev/null +++ b/charts/giropops-senhas/prd/values.yaml @@ -0,0 +1,180 @@ +giropopsSenhas: + enabled: true # Habilita o deploy do Giropops Senhas + replicaCount: 3 # Número de réplicas + serviceAccountName: giropops-senhas-sa # Nome da service account + env: + - name: REDIS_HOST # Nome da variável de ambiente para conexão com o Redis + value: "redis" # Endereço do serviço do Redis + + podLabels: # Labels do pod + app: giropops-senhas-prd-giropops-senhas # Label do pod + + podAnnotations: # Annotations do pod + prometheus.io/scrape: "true" # Habilita o scrape do Prometheus + prometheus.io/port: "5000" # Porta onde o Prometheus irá fazer o scrape + prometheus.io/path: "/metrics" # Path onde o Prometheus irá fazer o scrape + app: giropops-senhas-prd-giropops-senhas # Label do pod + + podMonitor: # Configuração do PodMonitor + enabled: true + namespace: kube-prometheus-stack + namespaceSelector: + matchNames: + - giropops-senhas-prd + selector: + matchLabels: + app: giropops-senhas-prd-giropops-senhas + endpoints: + - port: "http" + path: "/metrics" + interval: "30s" + scrapeTimeout: "10s" + - port: "http" + path: "/health" + interval: "30s" + scrapeTimeout: "10s" + +serviceMonitor: # Configuração do ServiceMonitor + enabled: true + giropopsSenhas: + namespace: kube-prometheus-stack + namespaceSelector: + matchNames: + - giropops-senhas-prd + selector: + matchLabels: + app: giropops-senhas-prd-giropops-senhas + endpoints: + - port: "http" + path: "/metrics" + interval: "30s" + scrapeTimeout: "10s" + - port: "http" + path: "/health" + interval: "30s" + scrapeTimeout: "10s" + +image: # Configuração da imagem + repository: nataliagranato/linuxtips-giropops-senhas + pullPolicy: IfNotPresent + tag: "c86af-20240813134736" + + imagePullSecrets: [] + nameOverride: "" + fullnameOverride: "" + +serviceAccount: # Configuração da service account + create: true + automount: true + annotations: {} + name: giropops-senhas-sa + + podSecurityContext: # Configuração do podSecurityContext + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 1000 + + securityContext: # Configuração do securityContext + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 1000 + +service: # Configuração do serviço + name: giropops-senhas-prd + type: ClusterIP + port: 5000 + targetPort: 5000 + selector: + app: giropops-senhas-prd-giropops-senhas + +ingress: # Configuração do ingress + enabled: true + className: nginx + annotations: + kubernetes.io/ingress.class: nginx + cert-manager.io/cluster-issuer: letsencrypt-prod + tls: # Configuração do TLS + - hosts: + - senhas-prd.nataliagranato.xyz + secretName: senhas-prd.nataliagranato.xyz + hosts: + - host: senhas-prd.nataliagranato.xyz + paths: + - path: / + pathType: Prefix + backend: + service: + name: giropops-senhas-prd + port: + number: 5000 + + resources: # Configuração de recursos + limits: + cpu: 200m + memory: 256Mi + requests: + cpu: 100m + memory: 128Mi + + livenessProbe: # Configuração do livenessProbe + httpGet: + path: / + port: 5000 + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + + readinessProbe: # Configuração do readinessProbe + httpGet: + path: / + port: 5000 + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 5 + failureThreshold: 3 + successThreshold: 1 + +autoscaling: # Configuração do autoscaling + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + targetMemoryUtilizationPercentage: 80 + +volumes: # Configuração de volumes + metadata: + name: senhas-volume + namespace: giropops-senhas-prd + labels: + app: giropops-senhas-prd + spec: + storageClassName: oci-bv + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + +redis: # Configuração do Redis + enabled: true + image: "nataliagranato/redis:v1.0.0" + replicas: 1 + port: 6379 + labels: + app: "redis" + + service: + type: "ClusterIP" + port: 6379 + targetPort: 6379 + name: "redis" + + resources: + requests: + memory: "128Mi" + cpu: "250m" + limits: + memory: "256Mi" + cpu: "500m" diff --git a/charts/giropops-senhas/stg/.helmignore b/charts/giropops-senhas/stg/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/giropops-senhas/stg/.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/giropops-senhas/stg/Chart.yaml b/charts/giropops-senhas/stg/Chart.yaml new file mode 100644 index 0000000..2907b93 --- /dev/null +++ b/charts/giropops-senhas/stg/Chart.yaml @@ -0,0 +1,7 @@ +apiVersion: v2 +name: giropops-senhas +description: Um pacote da aplicação giropops-senhas para Kubernetes. +icon: https://raw.githubusercontent.com/Tech-Preta/giropops-senhas/main/static/linuxtips-logo.png +type: application +version: 0.1.0 +appVersion: "1.16.0" diff --git a/charts/giropops-senhas/stg/templates/NOTES.txt b/charts/giropops-senhas/stg/templates/NOTES.txt new file mode 100644 index 0000000..08e961b --- /dev/null +++ b/charts/giropops-senhas/stg/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 "giropops-senhas.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 "giropops-senhas.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "giropops-senhas.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 "giropops-senhas.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/giropops-senhas/stg/templates/_helpers.tpl b/charts/giropops-senhas/stg/templates/_helpers.tpl new file mode 100644 index 0000000..dacc1fb --- /dev/null +++ b/charts/giropops-senhas/stg/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "giropops-senhas.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 "giropops-senhas.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 "giropops-senhas.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "giropops-senhas.labels" -}} +helm.sh/chart: {{ include "giropops-senhas.chart" . }} +{{ include "giropops-senhas.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "giropops-senhas.selectorLabels" -}} +app.kubernetes.io/name: {{ include "giropops-senhas.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "giropops-senhas.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "giropops-senhas.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/giropops-senhas/stg/templates/deployment.yaml b/charts/giropops-senhas/stg/templates/deployment.yaml new file mode 100644 index 0000000..daa91c2 --- /dev/null +++ b/charts/giropops-senhas/stg/templates/deployment.yaml @@ -0,0 +1,68 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "giropops-senhas.fullname" . }} + labels: + {{- include "giropops-senhas.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "giropops-senhas.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "giropops-senhas.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "giropops-senhas.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: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/giropops-senhas/stg/templates/hpa.yaml b/charts/giropops-senhas/stg/templates/hpa.yaml new file mode 100644 index 0000000..86b25b8 --- /dev/null +++ b/charts/giropops-senhas/stg/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "giropops-senhas.fullname" . }} + labels: + {{- include "giropops-senhas.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "giropops-senhas.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/giropops-senhas/stg/templates/ingress.yaml b/charts/giropops-senhas/stg/templates/ingress.yaml new file mode 100644 index 0000000..bb52f80 --- /dev/null +++ b/charts/giropops-senhas/stg/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "giropops-senhas.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 "giropops-senhas.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/giropops-senhas/stg/templates/service.yaml b/charts/giropops-senhas/stg/templates/service.yaml new file mode 100644 index 0000000..072e890 --- /dev/null +++ b/charts/giropops-senhas/stg/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "giropops-senhas.fullname" . }} + labels: + {{- include "giropops-senhas.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "giropops-senhas.selectorLabels" . | nindent 4 }} diff --git a/charts/giropops-senhas/stg/templates/serviceaccount.yaml b/charts/giropops-senhas/stg/templates/serviceaccount.yaml new file mode 100644 index 0000000..bdba6fb --- /dev/null +++ b/charts/giropops-senhas/stg/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "giropops-senhas.serviceAccountName" . }} + labels: + {{- include "giropops-senhas.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/charts/giropops-senhas/stg/templates/tests/test-connection.yaml b/charts/giropops-senhas/stg/templates/tests/test-connection.yaml new file mode 100644 index 0000000..cd24662 --- /dev/null +++ b/charts/giropops-senhas/stg/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "giropops-senhas.fullname" . }}-test-connection" + labels: + {{- include "giropops-senhas.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "giropops-senhas.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/charts/giropops-senhas/stg/values.yaml b/charts/giropops-senhas/stg/values.yaml new file mode 100644 index 0000000..fa0b474 --- /dev/null +++ b/charts/giropops-senhas/stg/values.yaml @@ -0,0 +1,96 @@ +replicaCount: 1 + +image: + repository: nginx + pullPolicy: IfNotPresent + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + create: true + automount: false + annotations: {} + name: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: {} +# fsGroup: 2000 + +securityContext: {} +# capabilities: +# drop: +# - ALL +# readOnlyRootFilesystem: true +# runAsNonRoot: true +# runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + kubernetes.io/ingress.class: nginx + 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 + +livenessProbe: + httpGet: + path: / + port: http +readinessProbe: + httpGet: + path: / + port: http + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {}