diff --git a/charts/portalmodelo/.helmignore b/charts/portalmodelo/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/portalmodelo/.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/portalmodelo/v0.5.0/Chart.yaml b/charts/portalmodelo/v0.5.0/Chart.yaml new file mode 100644 index 0000000..cff3f2e --- /dev/null +++ b/charts/portalmodelo/v0.5.0/Chart.yaml @@ -0,0 +1,7 @@ +apiVersion: v2 +name: portalmodelo +description: Portal Modelo para Casas Legislativas +type: application +version: 0.5.0 +appVersion: 3.0-21 +icon: https://git.interlegis.leg.br/SEIT/rancher-charts/raw/5a821368fe0244ae9017878dd2aae3173328816c/images/portalmodelo.png diff --git a/charts/portalmodelo/v0.5.0/templates/NOTES.txt b/charts/portalmodelo/v0.5.0/templates/NOTES.txt new file mode 100644 index 0000000..0a1428b --- /dev/null +++ b/charts/portalmodelo/v0.5.0/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Seu Portal Modelo pode ser acessado através da URL: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "portalmodelo.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 svc -w {{ template "portalmodelo.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "portalmodelo.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + 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={{ template "portalmodelo.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:80 +{{- end }} +2. Utilize as seguintes credenciais para acesso inicial: + Usuario: adm + Senha: {{ .Values.portal.adminPassword }} diff --git a/charts/portalmodelo/v0.5.0/templates/_helpers.tpl b/charts/portalmodelo/v0.5.0/templates/_helpers.tpl new file mode 100644 index 0000000..e5b9570 --- /dev/null +++ b/charts/portalmodelo/v0.5.0/templates/_helpers.tpl @@ -0,0 +1,52 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "portalmodelo.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 "portalmodelo.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 "portalmodelo.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "portalmodelo.labels" -}} +helm.sh/chart: {{ include "portalmodelo.chart" . }} +{{ include "portalmodelo.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "portalmodelo.selectorLabels" -}} +app.kubernetes.io/name: {{ include "portalmodelo.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/charts/portalmodelo/v0.5.0/templates/hpa.yaml b/charts/portalmodelo/v0.5.0/templates/hpa.yaml new file mode 100644 index 0000000..0510ee3 --- /dev/null +++ b/charts/portalmodelo/v0.5.0/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "portalmodelo.fullname" . }} + labels: + {{- include "portalmodelo.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "portalmodelo.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/portalmodelo/v0.5.0/templates/ingress.yaml b/charts/portalmodelo/v0.5.0/templates/ingress.yaml new file mode 100644 index 0000000..ed78d16 --- /dev/null +++ b/charts/portalmodelo/v0.5.0/templates/ingress.yaml @@ -0,0 +1,39 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "portalmodelo.fullname" . -}} +{{- $ingressPath := .Values.ingress.path -}} +{{- 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 "portalmodelo.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . | quote }} + http: + paths: + - path: {{ $ingressPath }} + backend: + serviceName: {{ $fullName }}-plone + servicePort: 8080 + {{- end }} + {{- end }} diff --git a/charts/portalmodelo/v0.5.0/templates/plone-deployment.yaml b/charts/portalmodelo/v0.5.0/templates/plone-deployment.yaml new file mode 100644 index 0000000..6731bfd --- /dev/null +++ b/charts/portalmodelo/v0.5.0/templates/plone-deployment.yaml @@ -0,0 +1,150 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "portalmodelo.fullname" . }}-plone + labels: + {{- include "portalmodelo.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + strategy: + {{- if .Values.instance.zeoclient }} + type: RollingUpdate + {{- else }} + type: Recreate + {{- end }} + selector: + matchLabels: + {{- include "portalmodelo.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "portalmodelo.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + initContainers: + {{- if not .Values.instance.zeoclient }} + - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + name: {{ .Release.Name }}-rmlock + command: + - "rm" + - "-f" + - "/data/filestorage/Data.fs.lock" + volumeMounts: + - mountPath: /data + name: data + {{- end }} + - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + name: {{ .Release.Name }}-initplone + command: + - "mkdir" + - "-p" + - "/data/filestorage" + - "/data/blobstorage" + - "/data/instance" + - "/data/log" + volumeMounts: + - mountPath: /data + name: data + {{- if .Values.portal.createAndUpgrade }} + - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + name: {{ .Release.Name }}-plonecfg + command: [ "/configure.sh" ] + env: + {{- if .Values.instance.zeoclient }} + - name: ZEO_ADDRESS + value: {{ template "portalmodelo.fullname" . }}-zeoserver:8100 + {{- else }} + - name: ZEO_ADDRESS + value: "" + {{- end }} + - name: EMAIL + value: {{ .Values.portal.adminEmail }} + - name: PASSWORD + value: {{ .Values.portal.adminPassword }} + - name: TITLE + value: {{ .Values.portal.title }} + - name: DESCR + value: {{ .Values.portal.description }} + - name: HOSTNAME + value: {{ .Values.portal.hostname }} + - name: ROOTPWD + value: {{ .Values.portal.rootPassword }} + - name: TZ + value: {{ .Values.portal.timeZone }} + volumeMounts: + - mountPath: /data + name: data + {{- end }} + containers: + - env: + {{- if .Values.instance.zeoclient }} + - name: ZEO_ADDRESS + value: {{ template "portalmodelo.fullname" . }}-zeoserver:8100 + - name: ZEO_SHARED_BLOB_DIR + value: "on" + {{- end }} + - name: TZ + value: {{ .Values.portal.timeZone }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + name: {{ .Release.Name }}-plone + ports: + - containerPort: 8080 + - containerPort: 8881 + livenessProbe: + exec: + command: + - /plone/instance/bin/instance + - monitor + - health_ok + initialDelaySeconds: 180 + failureThreshold: 2 + periodSeconds: 400 + successThreshold: 1 + timeoutSeconds: 5 + readinessProbe: + failureThreshold: 3 + httpGet: + path: / + port: 8080 + initialDelaySeconds: 90 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 2 + volumeMounts: + - mountPath: /data + name: data + resources: + {{- toYaml .Values.resources.plone | nindent 12 }} + restartPolicy: Always + volumes: + - name: data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: data + {{- else }} + emptyDir: {} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/portalmodelo/v0.5.0/templates/plone-service.yaml b/charts/portalmodelo/v0.5.0/templates/plone-service.yaml new file mode 100644 index 0000000..b75405f --- /dev/null +++ b/charts/portalmodelo/v0.5.0/templates/plone-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "portalmodelo.fullname" . }}-plone + labels: + {{- include "portalmodelo.labels" . | nindent 4 }} +spec: + ports: + - port: 8080 + targetPort: 8080 + protocol: TCP + name: "8080" + selector: + {{- include "portalmodelo.selectorLabels" . | nindent 4 }} diff --git a/charts/portalmodelo/v0.5.0/templates/pvc.yaml b/charts/portalmodelo/v0.5.0/templates/pvc.yaml new file mode 100644 index 0000000..0640056 --- /dev/null +++ b/charts/portalmodelo/v0.5.0/templates/pvc.yaml @@ -0,0 +1,19 @@ +{{- if .Values.persistence.enabled }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: data +spec: + accessModes: + - {{ .Values.persistence.accessMode }} + resources: + requests: + storage: {{ .Values.persistence.size }} +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} +{{- end }} diff --git a/charts/portalmodelo/v0.5.0/templates/zeoserver-deployment.yaml b/charts/portalmodelo/v0.5.0/templates/zeoserver-deployment.yaml new file mode 100644 index 0000000..11ed7b6 --- /dev/null +++ b/charts/portalmodelo/v0.5.0/templates/zeoserver-deployment.yaml @@ -0,0 +1,91 @@ +{{- if .Values.instance.zeoclient }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "portalmodelo.fullname" . }}-zeoserver + labels: + {{- include "portalmodelo.labels" . | nindent 4 }} +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + {{- include "portalmodelo.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "portalmodelo.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + initContainers: + - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + name: {{ .Release.Name }}-rmlock + command: + - "rm" + - "-f" + - "/data/filestorage/Data.fs.lock" + volumeMounts: + - mountPath: /data + name: data + - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + name: {{ .Release.Name }}-initzeo + command: + - "mkdir" + - "-p" + - "/data/filestorage" + - "/data/blobstorage" + - "/data/zeoserver" + - "/data/log" + volumeMounts: + - mountPath: /data + name: data + containers: + - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + args: + - zeoserver + env: + - name: ZEO_SHARED_BLOB_DIR + value: "on" + - name: TZ + value: {{ .Values.portal.timeZone }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + name: {{ .Release.Name }}-zeoserver + ports: + - containerPort: 8100 + volumeMounts: + - mountPath: /data + name: data + resources: + {{- toYaml .Values.resources.zeo | nindent 12 }} + restartPolicy: Always + volumes: + - name: data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: data + {{- else }} + emptyDir: {} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end}} diff --git a/charts/portalmodelo/v0.5.0/templates/zeoserver-service.yaml b/charts/portalmodelo/v0.5.0/templates/zeoserver-service.yaml new file mode 100644 index 0000000..6466204 --- /dev/null +++ b/charts/portalmodelo/v0.5.0/templates/zeoserver-service.yaml @@ -0,0 +1,17 @@ +{{- if .Values.instance.zeoclient }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "portalmodelo.fullname" . }}-zeoserver + labels: + {{- include "portalmodelo.labels" . | nindent 4 }} +spec: + ports: + - port: 8100 + targetPort: 8100 + protocol: TCP + name: "8100" + selector: + {{- include "portalmodelo.selectorLabels" . | nindent 4 }} +{{- end }} + diff --git a/charts/portalmodelo/v0.5.0/values.yaml b/charts/portalmodelo/v0.5.0/values.yaml new file mode 100644 index 0000000..642d028 --- /dev/null +++ b/charts/portalmodelo/v0.5.0/values.yaml @@ -0,0 +1,93 @@ +# Default values for portalmodelo. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: interlegis/portalmodelo + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +persistence: + enabled: true + #storageClass: "" + accessMode: ReadWriteOnce + size: 500Mi + +portal: + adminPassword: altereme + rootPassword: altereme + adminEmail: contato@tecnico.net + title: Câmara Municipal + description: Cidade - UF + hostname: teste.df.leg.br + timeZone: America/Sao_Paulo + createAndUpgrade: true + zodbCacheSize: 2000 + +instance: + zeoclient: false + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +ingress: + enabled: true + hosts: + - teste.df.leg.br + - www.teste.df.leg.br + path: / + tls: [] + # - secretName: teste-df-tls + # hosts: + # - teste.df.leg.br + # - www.teste.df.leg.br + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # certmanager.k8s.io/cluster-issuer: letsencrypt-staging # your cluerissuer name + +resources: + plone: + limits: + cpu: 1000m + memory: 1500Mi + requests: + cpu: 100m + memory: 650Mi + zeo: + limits: + cpu: 1000m + memory: 512Mi + requests: + cpu: 100m + memory: 64Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {}