diff --git a/deploy-templates/.helmignore b/deploy-templates/.helmignore new file mode 100755 index 00000000..0e8a0eb3 --- /dev/null +++ b/deploy-templates/.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/deploy-templates/Chart.yaml b/deploy-templates/Chart.yaml new file mode 100644 index 00000000..1794c4cc --- /dev/null +++ b/deploy-templates/Chart.yaml @@ -0,0 +1,29 @@ +apiVersion: v2 +name: edp-tekton +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. +appVersion: 1.16.0 + +home: https://github.com/epam/edp-tekton +sources: + - https://github.com/epam/edp-tekton +maintainers: + - name: DEV Team diff --git a/deploy-templates/README.md b/deploy-templates/README.md new file mode 100644 index 00000000..600a7975 --- /dev/null +++ b/deploy-templates/README.md @@ -0,0 +1,55 @@ +# edp-tekton + +![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.0](https://img.shields.io/badge/AppVersion-1.16.0-informational?style=flat-square) + +A Helm chart for Kubernetes + +**Homepage:** + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| DEV Team | | | + +## Source Code + +* + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity | +| autoscaling.enabled | bool | `false` | | +| autoscaling.maxReplicas | int | `100` | | +| autoscaling.minReplicas | int | `1` | | +| autoscaling.targetCPUUtilizationPercentage | int | `80` | | +| framework | string | `"other"` | | +| fullnameOverride | string | `""` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"edp-tekton"` | | +| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. | +| imagePullSecrets[0].name | string | `"regcred"` | | +| ingress.annotations | object | `{}` | | +| ingress.dnsWildcard | string | `"core.kuberocketci.io"` | | +| ingress.enabled | bool | `false` | | +| ingress.path | string | `"/"` | | +| ingress.pathType | string | `"Prefix"` | pathType is only for k8s >= 1.1= | +| ingress.tls | list | `[]` | | +| livenessProbe.tcpSocket.port | string | `"http"` | | +| nameOverride | string | `""` | | +| nodeSelector | object | `{}` | https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector | +| podAnnotations | object | `{}` | | +| podSecurityContext | object | `{}` | | +| readinessProbe.initialDelaySeconds | int | `20` | | +| readinessProbe.tcpSocket.port | string | `"http"` | | +| replicaCount | int | `1` | | +| resources | object | `{}` | | +| securityContext | object | `{}` | | +| service.port | int | `80` | | +| service.type | string | `"ClusterIP"` | | +| serviceAccount.annotations | object | `{}` | Annotations to add to the service account | +| serviceAccount.create | bool | `true` | Specifies whether a service account should be created | +| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | +| tolerations | list | `[]` | https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ | diff --git a/deploy-templates/README.md.gotmpl b/deploy-templates/README.md.gotmpl new file mode 100644 index 00000000..c58fe7d5 --- /dev/null +++ b/deploy-templates/README.md.gotmpl @@ -0,0 +1,17 @@ +{{ template "chart.header" . }} + +{{ template "chart.deprecationWarning" . }} + +{{ template "chart.badgesSection" . }} + +{{ template "chart.description" . }} + +{{ template "chart.homepageLine" . }} + +{{ template "chart.maintainersSection" . }} + +{{ template "chart.sourcesSection" . }} + +{{ template "chart.requirementsSection" . }} + +{{ template "chart.valuesSection" . }} diff --git a/deploy-templates/templates/NOTES.txt b/deploy-templates/templates/NOTES.txt new file mode 100755 index 00000000..d8bd9ac1 --- /dev/null +++ b/deploy-templates/templates/NOTES.txt @@ -0,0 +1 @@ +1. Application edp-tekton has been successfully deployed!! diff --git a/deploy-templates/templates/_helpers.tpl b/deploy-templates/templates/_helpers.tpl new file mode 100755 index 00000000..724aa899 --- /dev/null +++ b/deploy-templates/templates/_helpers.tpl @@ -0,0 +1,96 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "edp-tekton.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 "edp-tekton.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 "edp-tekton.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "edp-tekton.labels" -}} +helm.sh/chart: {{ include "edp-tekton.chart" . }} +{{ include "edp-tekton.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "edp-tekton.selectorLabels" -}} +app.kubernetes.io/name: {{ include "edp-tekton.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "edp-tekton.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "edp-tekton.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Return the appropriate apiVersion for ingress +*/}} +{{- define "edp-tekton.ingress.apiVersion" -}} + {{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" .Capabilities.KubeVersion.Version) -}} + {{- print "networking.k8s.io/v1" -}} + {{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}} + {{- print "networking.k8s.io/v1beta1" -}} + {{- else -}} + {{- print "extensions/v1beta1" -}} + {{- end -}} +{{- end -}} + +{{/* +Return if ingress is stable. +*/}} +{{- define "edp-tekton.ingress.isStable" -}} + {{- eq (include "edp-tekton.ingress.apiVersion" .) "networking.k8s.io/v1" -}} +{{- end -}} + +{{/* +Return if ingress supports ingressClassName. +*/}} +{{- define "edp-tekton.ingress.supportsIngressClassName" -}} + {{- or (eq (include "edp-tekton.ingress.isStable" .) "true") (and (eq (include "edp-tekton.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}} +{{- end -}} + +{{/* +Return if ingress supports pathType. +*/}} +{{- define "edp-tekton.ingress.supportsPathType" -}} + {{- or (eq (include "edp-tekton.ingress.isStable" .) "true") (and (eq (include "edp-tekton.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}} +{{- end -}} \ No newline at end of file diff --git a/deploy-templates/templates/deployment.yaml b/deploy-templates/templates/deployment.yaml new file mode 100755 index 00000000..820ef0ba --- /dev/null +++ b/deploy-templates/templates/deployment.yaml @@ -0,0 +1,57 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "edp-tekton.fullname" . }} + labels: + {{- include "edp-tekton.labels" . | nindent 4 }} +spec: +{{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} +{{- end }} + selector: + matchLabels: + {{- include "edp-tekton.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "edp-tekton.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "edp-tekton.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: 8080 + protocol: TCP + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + 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/deploy-templates/templates/hpa.yaml b/deploy-templates/templates/hpa.yaml new file mode 100755 index 00000000..ffe254ad --- /dev/null +++ b/deploy-templates/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "edp-tekton.fullname" . }} + labels: + {{- include "edp-tekton.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "edp-tekton.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/deploy-templates/templates/ingress.yaml b/deploy-templates/templates/ingress.yaml new file mode 100755 index 00000000..cc8699af --- /dev/null +++ b/deploy-templates/templates/ingress.yaml @@ -0,0 +1,55 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "edp-tekton.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- $ingressApiIsStable := eq (include "edp-tekton.ingress.isStable" .) "true" -}} +{{- $ingressSupportsIngressClassName := eq (include "edp-tekton.ingress.supportsIngressClassName" .) "true" -}} +{{- $ingressSupportsPathType := eq (include "edp-tekton.ingress.supportsPathType" .) "true" -}} +{{- $ingressPathType := .Values.ingress.pathType -}} +kind: Ingress +apiVersion: {{ include "edp-tekton.ingress.apiVersion" . }} +metadata: + name: {{ $fullName }} + labels: + {{- include "edp-tekton.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and $ingressSupportsIngressClassName .Values.ingress.ingressClassName }} + ingressClassName: {{ .Values.ingress.ingressClassName }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + {{- if .Values.ingress.host }} + - host: {{ .Values.ingress.host }} + {{else}} + - host: {{ $fullName }}-{{ .Release.Namespace}}.{{ .Values.ingress.dnsWildcard}} + {{end}} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- if .Values.ingress.host }} + - host: {{ .Values.ingress.host }} + {{else}} + - host: {{ $fullName }}-{{ .Release.Namespace}}.{{ .Values.ingress.dnsWildcard}} + {{end}} + http: + paths: + - path: {{ .Values.ingress.path }} + {{- if $ingressSupportsPathType }} + pathType: {{ $ingressPathType }} + {{- end }} + backend: + {{- if $ingressApiIsStable }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} \ No newline at end of file diff --git a/deploy-templates/templates/service.yaml b/deploy-templates/templates/service.yaml new file mode 100755 index 00000000..e286f1f9 --- /dev/null +++ b/deploy-templates/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "edp-tekton.fullname" . }} + labels: + {{- include "edp-tekton.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "edp-tekton.selectorLabels" . | nindent 4 }} diff --git a/deploy-templates/templates/serviceaccount.yaml b/deploy-templates/templates/serviceaccount.yaml new file mode 100755 index 00000000..c3d1f92f --- /dev/null +++ b/deploy-templates/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "edp-tekton.serviceAccountName" . }} + labels: + {{- include "edp-tekton.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/deploy-templates/templates/tests/test-connection.yaml b/deploy-templates/templates/tests/test-connection.yaml new file mode 100755 index 00000000..48963125 --- /dev/null +++ b/deploy-templates/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "edp-tekton.fullname" . }}-test-connection" + labels: + {{- include "edp-tekton.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "edp-tekton.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/deploy-templates/values.yaml b/deploy-templates/values.yaml new file mode 100644 index 00000000..8b17694a --- /dev/null +++ b/deploy-templates/values.yaml @@ -0,0 +1,99 @@ +# Default values for edp-tekton. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: edp-tekton + pullPolicy: IfNotPresent + # -- Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: +# Define secret to pull images. Secret can be provisioned by edp-install or manually. + - name: regcred +nameOverride: "" +fullnameOverride: "" +framework: other + +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: 80 + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # -- pathType is only for k8s >= 1.1= + pathType: Prefix + # For Kubernetes >= 1.18 you should specify the ingress-controller via the field ingressClassName + # See https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#specifying-the-class-of-an-ingress + # ingressClassName: nginx + # If need to use specific host, define host value below. By default host formed according to the pattern: -. + # host: + path: "/" + dnsWildcard: core.kuberocketci.io + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +livenessProbe: + tcpSocket: + port: http + +readinessProbe: + tcpSocket: + port: http + initialDelaySeconds: 20 + +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 + +# -- https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector +nodeSelector: {} + +# -- https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ +tolerations: [] + +# -- https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +affinity: {}