diff --git a/go.mod b/go.mod index f9542cd559..5a21c26b65 100644 --- a/go.mod +++ b/go.mod @@ -315,7 +315,7 @@ require ( replace ( github.com/argoproj/argo-workflows/v3 v3.5.13 => github.com/devtron-labs/argo-workflows/v3 v3.5.13 github.com/cyphar/filepath-securejoin v0.4.1 => github.com/cyphar/filepath-securejoin v0.3.6 // indirect - github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250605114955-3c18ccee2f64 - github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250605114955-3c18ccee2f64 + github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250609102534-69e3ce614c73 + github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250609102534-69e3ce614c73 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 => go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 ) diff --git a/go.sum b/go.sum index 82297a7631..7a0a01c56d 100644 --- a/go.sum +++ b/go.sum @@ -237,10 +237,10 @@ github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzq github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/devtron-labs/argo-workflows/v3 v3.5.13 h1:3pINq0gXOSeTw2z/vYe+j80lRpSN5Rp/8mfQORh8SmU= github.com/devtron-labs/argo-workflows/v3 v3.5.13/go.mod h1:/vqxcovDPT4zqr4DjR5v7CF8ggpY1l3TSa2CIG3jmjA= -github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250605114955-3c18ccee2f64 h1:p61fSzpy5CFCV481Egs8eTjiKvvm7oBfuCjTx/WHdMA= -github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250605114955-3c18ccee2f64/go.mod h1:9LCkYfiWaEKIBkmxw9jX1GujvEMyHwmDtVsatffAkeU= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250605114955-3c18ccee2f64 h1:NzO5vd+xy0/q0kePeTTVCCybYQXyt9L2h5JKhC3MC80= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250605114955-3c18ccee2f64/go.mod h1:/Ciy9tD9OxZOWBDPIasM448H7uvSo4+ZJiExpfwBZpA= +github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250609102534-69e3ce614c73 h1:pEXT25dlNGu5+xfEeqnuDt6X8kAsywWMvbWHxnK+Y2c= +github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250609102534-69e3ce614c73/go.mod h1:9LCkYfiWaEKIBkmxw9jX1GujvEMyHwmDtVsatffAkeU= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250609102534-69e3ce614c73 h1:22oC4Ii7+Rz6rl1OO7YNhzsFwQ+wobSdlmql/kNdVH0= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250609102534-69e3ce614c73/go.mod h1:/Ciy9tD9OxZOWBDPIasM448H7uvSo4+ZJiExpfwBZpA= github.com/devtron-labs/go-bitbucket v0.9.60-beta h1:VEx1jvDgdtDPS6A1uUFoaEi0l1/oLhbr+90xOwr6sDU= github.com/devtron-labs/go-bitbucket v0.9.60-beta/go.mod h1:GnuiCesvh8xyHeMCb+twm8lBR/kQzJYSKL28ZfObp1Y= github.com/devtron-labs/protos v0.0.3-0.20250323220609-ecf8a0f7305e h1:U6UdYbW8a7xn5IzFPd8cywjVVPfutGJCudjePAfL/Hs= diff --git a/pkg/cluster/ClusterService.go b/pkg/cluster/ClusterService.go index 5ddd499945..4bfaae197b 100644 --- a/pkg/cluster/ClusterService.go +++ b/pkg/cluster/ClusterService.go @@ -23,9 +23,12 @@ import ( "github.com/devtron-labs/common-lib/async" informerBean "github.com/devtron-labs/common-lib/informer" "github.com/devtron-labs/common-lib/utils/k8s/commonBean" + configMap2 "github.com/devtron-labs/common-lib/utils/k8s/configMap" + bean3 "github.com/devtron-labs/devtron/pkg/argoApplication/bean" "github.com/devtron-labs/devtron/pkg/cluster/adapter" "github.com/devtron-labs/devtron/pkg/cluster/bean" repository2 "github.com/devtron-labs/devtron/pkg/cluster/environment/repository" + "github.com/devtron-labs/devtron/pkg/cluster/helper" "github.com/devtron-labs/devtron/pkg/cluster/read" cronUtil "github.com/devtron-labs/devtron/util/cron" "github.com/robfig/cron/v3" @@ -231,22 +234,9 @@ func (impl *ClusterServiceImpl) Save(parent context.Context, bean *bean.ClusterB impl.SyncNsInformer(bean) } impl.logger.Info("saving secret for cluster informer") - k8sClient, err := impl.K8sUtil.GetCoreV1ClientInCluster() - if err != nil { - impl.logger.Errorw("error in getting k8s Client in cluster", "err", err, "clusterName", bean.ClusterName) - return bean, nil - } - //creating cluster secret, this secret will be read informer in kubelink to know that a new cluster has been added - secretName := ParseSecretNameForKubelinkInformer(bean.Id) - - data := make(map[string][]byte) - data[informerBean.SecretFieldClusterId] = []byte(fmt.Sprintf("%v", bean.Id)) - data[informerBean.SecretFieldAction] = []byte(informerBean.ClusterActionAdd) - data[clusterBean.SecretFieldUpdatedOn] = []byte(time.Now().String()) // this field will ensure that informer detects change as other fields can be constant even if cluster config changes - // TODO Asutosh: Why not UPSERT ?? - _, err = impl.K8sUtil.CreateSecret(clusterBean.DefaultNamespace, data, secretName, informerBean.ClusterModifyEventSecretType, k8sClient, nil, nil) - if err != nil { - impl.logger.Errorw("error in creating secret for informers", "secretName", secretName, "err", err) + cmData, labels := helper.CreateClusterModifyEventData(bean.Id, informerBean.ClusterActionAdd) + if err = impl.upsertClusterConfigMap(bean, cmData, labels); err != nil { + impl.logger.Errorw("error upserting cluster secret", "cmData", cmData, "err", err) return bean, nil } return bean, nil @@ -473,12 +463,9 @@ func (impl *ClusterServiceImpl) Update(ctx context.Context, bean *bean.ClusterBe } impl.logger.Infow("saving secret for cluster informer") if bean.HasConfigOrUrlChanged { - data := make(map[string][]byte) - data[informerBean.SecretFieldClusterId] = []byte(fmt.Sprintf("%v", bean.Id)) - data[informerBean.SecretFieldAction] = []byte(informerBean.ClusterActionUpdate) - data[clusterBean.SecretFieldUpdatedOn] = []byte(time.Now().String()) // this field will ensure that informer detects change as other fields can be constant even if cluster config changes - if err = impl.upsertClusterSecret(bean, data); err != nil { - impl.logger.Errorw("error upserting cluster secret", "data", data, "err", err) + cmData, labels := helper.CreateClusterModifyEventData(bean.Id, informerBean.ClusterActionUpdate) + if err = impl.upsertClusterConfigMap(bean, cmData, labels); err != nil { + impl.logger.Errorw("error upserting cluster secret", "cmData", cmData, "err", err) // TODO Asutosh: why error is not propagated ?? return bean, nil } @@ -486,29 +473,30 @@ func (impl *ClusterServiceImpl) Update(ctx context.Context, bean *bean.ClusterBe return bean, nil } -func (impl *ClusterServiceImpl) upsertClusterSecret(bean *bean.ClusterBean, data map[string][]byte) error { +func (impl *ClusterServiceImpl) upsertClusterConfigMap(bean *bean.ClusterBean, data, labels map[string]string) error { k8sClient, err := impl.K8sUtil.GetCoreV1ClientInCluster() if err != nil { impl.logger.Errorw("error in getting k8s client", "err", err) return err } - // below secret will act as an event for informer running on a secret object in kubelink and kubewatch - secretName := ParseSecretNameForKubelinkInformer(bean.Id) - secret, err := impl.K8sUtil.GetSecret(clusterBean.DefaultNamespace, secretName, k8sClient) + // below cm will act as an event for informer running on a secret object in kubelink and kubewatch + cmName := ParseCmNameForK8sInformerOnClusterEvent(bean.Id) + configMap, err := impl.K8sUtil.GetConfigMap(bean3.DevtronCDNamespae, cmName, k8sClient) if err != nil && !k8sError.IsNotFound(err) { - impl.logger.Errorw("error in getting cluster secret", "secretName", secretName, "err", err) + impl.logger.Errorw("error in getting cluster config map", "cmName", cmName, "err", err) return err } else if k8sError.IsNotFound(err) { - _, err = impl.K8sUtil.CreateSecret(clusterBean.DefaultNamespace, data, secretName, informerBean.ClusterModifyEventSecretType, k8sClient, nil, nil) + _, err = impl.K8sUtil.CreateConfigMapObject(cmName, bean3.DevtronCDNamespae, k8sClient, configMap2.WithData(data), configMap2.WithLabels(labels)) if err != nil { - impl.logger.Errorw("error in creating secret for informers", "secretName", secretName, "err", err) + impl.logger.Errorw("error in creating cm object for informer", "cmName", cmName, "err", err) return err } } else { - secret.Data = data - secret, err = impl.K8sUtil.UpdateSecret(clusterBean.DefaultNamespace, secret, k8sClient) + configMap.Labels = labels + configMap.Data = data + configMap, err = impl.K8sUtil.UpdateConfigMap(bean3.DevtronCDNamespae, configMap, k8sClient) if err != nil { - impl.logger.Errorw("error in updating secret for informers", "secretName", secretName, "err", err) + impl.logger.Errorw("error in updating cm for informers", "cmName", cmName, "err", err) return err } } diff --git a/pkg/cluster/bean/bean.go b/pkg/cluster/bean/bean.go index a2438a2b44..7023bd95de 100644 --- a/pkg/cluster/bean/bean.go +++ b/pkg/cluster/bean/bean.go @@ -83,6 +83,6 @@ type DefaultClusterComponent struct { } const ( - DefaultNamespace = "default" - SecretFieldUpdatedOn = "updated_on" + DefaultNamespace = "default" + CmFieldUpdatedOn = "updated_on" ) diff --git a/pkg/cluster/clusterUtil.go b/pkg/cluster/clusterUtil.go index 48ed681400..f1915fd72c 100644 --- a/pkg/cluster/clusterUtil.go +++ b/pkg/cluster/clusterUtil.go @@ -3,9 +3,9 @@ package cluster import "fmt" const ( - SecretName = "cluster-event" + CmName = "cluster-event" ) -func ParseSecretNameForKubelinkInformer(clusterId int) string { - return fmt.Sprintf("%s-%d", SecretName, clusterId) +func ParseCmNameForK8sInformerOnClusterEvent(clusterId int) string { + return fmt.Sprintf("%s-%d", CmName, clusterId) } diff --git a/pkg/cluster/helper/helper.go b/pkg/cluster/helper/helper.go new file mode 100644 index 0000000000..77bb955bcc --- /dev/null +++ b/pkg/cluster/helper/helper.go @@ -0,0 +1,20 @@ +package helper + +import ( + "fmt" + informerBean "github.com/devtron-labs/common-lib/informer" + clusterBean "github.com/devtron-labs/devtron/pkg/cluster/bean" + "time" +) + +func CreateClusterModifyEventData(clusterId int, action string) (map[string]string, map[string]string) { + data := make(map[string]string) + data[informerBean.CmFieldClusterId] = fmt.Sprintf("%v", clusterId) + data[informerBean.CmFieldAction] = action + data[clusterBean.CmFieldUpdatedOn] = time.Now().String() + + labels := make(map[string]string) + labels[informerBean.ClusterModifyEventSecretTypeKey] = informerBean.ClusterModifyEventCmLabelValue + + return data, labels +} diff --git a/pkg/delete/DeleteService.go b/pkg/delete/DeleteService.go index 86d9240f95..e1cb141983 100644 --- a/pkg/delete/DeleteService.go +++ b/pkg/delete/DeleteService.go @@ -23,6 +23,7 @@ import ( dockerRegistryRepository "github.com/devtron-labs/devtron/internal/sql/repository/dockerRegistry" "github.com/devtron-labs/devtron/internal/util" "github.com/devtron-labs/devtron/pkg/appStore/installedApp/repository" + bean4 "github.com/devtron-labs/devtron/pkg/argoApplication/bean" "github.com/devtron-labs/devtron/pkg/chartRepo" "github.com/devtron-labs/devtron/pkg/cluster" bean2 "github.com/devtron-labs/devtron/pkg/cluster/bean" @@ -35,6 +36,7 @@ import ( bean3 "github.com/devtron-labs/devtron/pkg/team/bean" "github.com/go-pg/pg" "go.uber.org/zap" + k8sError "k8s.io/apimachinery/pkg/api/errors" http2 "net/http" ) @@ -45,7 +47,7 @@ type DeleteService interface { DeleteChartRepo(deleteRequest *chartRepo.ChartRepoDto) error DeleteDockerRegistryConfig(deleteRequest *types.DockerArtifactStoreBean) error CanDeleteChartRegistryPullConfig(storeId string) bool - DeleteClusterSecret(deleteRequest *bean2.ClusterBean, err error) error + DeleteClusterConfigMap(deleteRequest *bean2.ClusterBean) error } type DeleteServiceImpl struct { @@ -95,9 +97,10 @@ func (impl DeleteServiceImpl) DeleteCluster(deleteRequest *bean2.ClusterBean, us impl.logger.Errorw("error im deleting cluster", "err", err, "deleteRequest", deleteRequest) return err } - err = impl.DeleteClusterSecret(deleteRequest, err) + // deleting a cluster config map created at time of cluster creation/updation so that informer in kubelink and kubewatch can delete the cluster from cache + err = impl.DeleteClusterConfigMap(deleteRequest) if err != nil { - impl.logger.Errorw("error in deleting cluster secret", "clusterId", deleteRequest.Id, "error", err) + impl.logger.Errorw("error in deleting cluster cm", "clusterId", deleteRequest.Id, "error", err) // We are not returning error as it is not a blocking call as cluster can be unreachable at that time, and we have already deleted cluster from db. //return err } @@ -105,16 +108,27 @@ func (impl DeleteServiceImpl) DeleteCluster(deleteRequest *bean2.ClusterBean, us return nil } -func (impl DeleteServiceImpl) DeleteClusterSecret(deleteRequest *bean2.ClusterBean, err error) error { +func (impl DeleteServiceImpl) DeleteClusterConfigMap(deleteRequest *bean2.ClusterBean) error { // kubelink informers are listening this secret, deleting this secret will inform kubelink that this cluster is deleted k8sClient, err := impl.K8sUtil.GetCoreV1ClientInCluster() if err != nil { impl.logger.Errorw("error in getting in cluster k8s client", "err", err, "clusterName", deleteRequest.ClusterName) return nil } - secretName := cluster.ParseSecretNameForKubelinkInformer(deleteRequest.Id) - err = impl.K8sUtil.DeleteSecret(bean2.DefaultNamespace, secretName, k8sClient) - return err + cmName := cluster.ParseCmNameForK8sInformerOnClusterEvent(deleteRequest.Id) + err = impl.K8sUtil.DeleteConfigMap(bean4.DevtronCDNamespae, cmName, k8sClient) + if k8sError.IsNotFound(err) { + // when cm not found in devtroncd ns then delete the secret in default ns(secret name would be the same as cm name) + err = impl.K8sUtil.DeleteSecret(bean2.DefaultNamespace, cmName, k8sClient) + if err != nil { + impl.logger.Errorw("error in deleting cluster secret in default ns ", "secretName", cmName, "err", err) + return err + } + } else if err != nil { + impl.logger.Errorw("error in deleting cluster config map in devtroncd ns ", "cmName", cmName, "err", err) + return err + } + return nil } func (impl DeleteServiceImpl) DeleteEnvironment(deleteRequest *bean.EnvironmentBean, userId int32) error { diff --git a/pkg/delete/DeleteServiceExtended.go b/pkg/delete/DeleteServiceExtended.go index 230cca66e2..eb70061f76 100644 --- a/pkg/delete/DeleteServiceExtended.go +++ b/pkg/delete/DeleteServiceExtended.go @@ -96,7 +96,7 @@ func (impl DeleteServiceExtendedImpl) DeleteCluster(deleteRequest *bean2.Cluster impl.logger.Errorw("error im deleting cluster", "err", err, "deleteRequest", deleteRequest) return err } - err = impl.DeleteClusterSecret(deleteRequest, err) + err = impl.DeleteClusterConfigMap(deleteRequest) if err != nil { impl.logger.Errorw("error in deleting cluster secret", "clusterId", deleteRequest.Id, "error", err) // We are not returning error as it is not a blocking call as cluster can be unreachable at that time, and we have already deleted cluster from db. diff --git a/sample-docker-templates/django/Dockerfile b/sample-docker-templates/django/Dockerfile index b84c90ebe6..cfd5124629 100644 --- a/sample-docker-templates/django/Dockerfile +++ b/sample-docker-templates/django/Dockerfile @@ -1,48 +1,47 @@ -# Dockerfile +# Base Image - slim Python +FROM python:3.13-slim -# Base Image -FROM python:3.8 +# Environment settings +ENV PYTHONUNBUFFERED=1 LANG=C.UTF-8 -# set default environment variables -ENV PYTHONUNBUFFERED 1 -ENV LANG C.UTF-8 - -# to take runtime arguments and set env variables +# Django superuser build args ARG DJANGO_SUPERUSER_USERNAME -ENV DJANGO_SUPERUSER_USERNAME=${DJANGO_SUPERUSER_USERNAME} - ARG DJANGO_SUPERUSER_PASSWORD -ENV DJANGO_SUPERUSER_PASSWORD=${DJANGO_SUPERUSER_PASSWORD} - ARG DJANGO_SUPERUSER_EMAIL +ENV DJANGO_SUPERUSER_USERNAME=${DJANGO_SUPERUSER_USERNAME} +ENV DJANGO_SUPERUSER_PASSWORD=${DJANGO_SUPERUSER_PASSWORD} ENV DJANGO_SUPERUSER_EMAIL=${DJANGO_SUPERUSER_EMAIL} -# create and set working directory -RUN mkdir /app +# Set workdir WORKDIR /app -RUN chown -R www-data:www-data /app - -# Add current directory code to working directory -COPY . /app/ - -# install environment dependencies -RUN pip install -r requirements.txt - -# install nginx -RUN apt-get update && apt-get install nginx vim -y --no-install-recommends +# Install system dependencies and nginx, then install Python deps +COPY requirements.txt . +RUN apt-get update && \ + apt-get install -y --no-install-recommends nginx vim && \ + pip install --no-cache-dir -r requirements.txt && \ + rm -rf /var/lib/apt/lists/* -#Refer https://github.com/devtron-labs/devtron/blob/main/sample-docker-templates/django/nginx.default for sample nginx.default file -COPY nginx.default /etc/nginx/sites-available/default +# Copy app code, nginx.conf, and start script +COPY app/ ./ +COPY nginx.conf /etc/nginx/nginx.conf +RUN chmod +x start-server.sh -RUN ln -sf /dev/stdout /var/log/nginx/access.log \ - && ln -sf /dev/stderr /var/log/nginx/error.log +# Create non-root user and set permissions +RUN groupadd -g 2002 nonroot && \ + useradd -u 2002 -g nonroot -s /bin/bash -m nonroot && \ + mkdir -p /tmp/nginx-logs && \ + chown -R nonroot:nonroot /app /tmp/nginx-logs +# Expose port 8080 +EXPOSE 8080 -# start server -EXPOSE 8000 +# Switch to non-root +USER nonroot +# Stop signal for graceful shutdown +# https://docs.docker.com/reference/dockerfile/#stopsignal STOPSIGNAL SIGTERM -# Refer https://github.com/devtron-labs/devtron/blob/main/sample-docker-templates/django/start-server.sh for sample start-server.sh file +# Start server (migrations, superuser, gunicorn, nginx) CMD ["/app/start-server.sh"] \ No newline at end of file diff --git a/sample-docker-templates/django/nginx.conf b/sample-docker-templates/django/nginx.conf new file mode 100644 index 0000000000..a657db03c5 --- /dev/null +++ b/sample-docker-templates/django/nginx.conf @@ -0,0 +1,36 @@ +worker_processes auto; +error_log /tmp/nginx-logs/error.log warn; +pid /tmp/nginx-logs/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + + access_log /tmp/nginx-logs/access.log; + + client_body_temp_path /tmp/nginx-logs/client_temp; + proxy_temp_path /tmp/nginx-logs/proxy_temp; + fastcgi_temp_path /tmp/nginx-logs/fastcgi_temp; + uwsgi_temp_path /tmp/nginx-logs/uwsgi_temp; + scgi_temp_path /tmp/nginx-logs/scgi_temp; + + server { + listen 8080; + server_name localhost; + + location / { + proxy_pass http://127.0.0.1:8000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + location /static/ { + root /app; + } + } +} diff --git a/sample-docker-templates/django/nginx.default b/sample-docker-templates/django/nginx.default deleted file mode 100644 index 952503a128..0000000000 --- a/sample-docker-templates/django/nginx.default +++ /dev/null @@ -1,15 +0,0 @@ -# nginx.default - -server { - listen 8020; - server_name example.org; - - location / { - proxy_pass http://127.0.0.1:8000; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } - location /static { - root /app; - } -} diff --git a/sample-docker-templates/django/start-server.sh b/sample-docker-templates/django/start-server.sh index fa9671fede..a571b37dae 100755 --- a/sample-docker-templates/django/start-server.sh +++ b/sample-docker-templates/django/start-server.sh @@ -1,22 +1,13 @@ -#!/usr/bin/env bash -# -# Copyright (c) 2024. Devtron Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# +#!/bin/sh -# start-server.sh -python manage.py migrate -python manage.py createsuperuser --no-input +# Apply DB migrations +python /app/manage.py migrate -(gunicorn DjangoApp.wsgi --user www-data --bind 0.0.0.0:8000 --workers 3) && nginx -g "daemon off;" +# create superuser +python /app/manage.py createsuperuser --no-input + +# Start gunicorn as non-root user binding on port 8000 +gunicorn demo-project.wsgi:application --user nonroot --bind 0.0.0.0:8000 --workers 3 & + +# Start nginx (already configured to run without root) +nginx -g "daemon off;" diff --git a/sample-docker-templates/flask/Dockerfile b/sample-docker-templates/flask/Dockerfile index ad20d787cc..8261490866 100644 --- a/sample-docker-templates/flask/Dockerfile +++ b/sample-docker-templates/flask/Dockerfile @@ -1,39 +1,40 @@ -#Base Image -FROM python:3.8 +# Base Image - slim Python +FROM python:3.13-slim -#Getting System Ready to install dependencies -RUN apt-get clean \ - && apt-get -y update +# Environment settings +ENV PYTHONUNBUFFERED=1 LANG=C.UTF-8 -#Installing nginx -RUN apt-get -y install nginx \ - && apt-get -y install python3-dev \ - && apt-get -y install build-essential - -#Creating symbolic link for access and error log from nginx -RUN ln -sf /dev/stdout /var/log/nginx/access.log \ - && ln -sf /dev/stderr /var/log/nginx/error.log +# Set workdir +WORKDIR /app -#Creating a dir in Container -RUN mkdir /app +COPY requirements.txt requirements.txt -#Moving into the directory created -WORKDIR /app +# Install system dependencies and nginx, then install Python deps +RUN apt-get update && \ + apt-get install -y --no-install-recommends nginx gcc python3-dev musl-dev build-essential libexpat1 && \ + pip install --no-cache-dir -r requirements.txt && \ + apt-get purge -y --auto-remove gcc python3-dev musl-dev build-essential && \ + rm -rf /var/lib/apt/lists/* -#Changing ownership of files in /app -RUN chown -R www-data:www-data /app +# Copy app code, configs, and start script +COPY nginx.conf /etc/nginx/nginx.conf +COPY app.py uwsgi.ini start.sh ./ +RUN chmod +x start.sh -#Adding the complete project in dir created -ADD . /app/ +# Create non-root user and set permissions +RUN groupadd -g 2002 nonroot && \ + useradd -u 2002 -g nonroot -s /bin/bash -m nonroot && \ + mkdir -p /tmp/nginx-logs && \ + chown -R nonroot:nonroot /app /tmp/nginx-logs -#Installing dependencies -RUN pip3 install -r requirements.txt +# Expose port 8080 +EXPOSE 8080 -# Refer https://raw.githubusercontent.com/devtron-labs/devtron/main/sample-docker-templates/flask/nginx.default for sample nginx.default file -COPY nginx.default /etc/nginx/sites-available/default +# Switch to non-root +USER nonroot -#Refer https://raw.githubusercontent.com/devtron-labs/devtron/main/sample-docker-templates/flask/start.sh for sample start.sh file -#Making start.sh executable -RUN chmod +x ./start.sh +# Stop signal for graceful shutdown +STOPSIGNAL SIGTERM -CMD ["./start.sh"] +# Start server (migrations, superuser, gunicorn, nginx) +CMD ["/app/start.sh"] \ No newline at end of file diff --git a/sample-docker-templates/flask/nginx.conf b/sample-docker-templates/flask/nginx.conf new file mode 100644 index 0000000000..8b7f64cdf6 --- /dev/null +++ b/sample-docker-templates/flask/nginx.conf @@ -0,0 +1,35 @@ +worker_processes auto; +error_log /tmp/nginx-logs/error.log warn; +pid /tmp/nginx-logs/nginx.pid; + +events {} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + access_log /tmp/nginx-logs/access.log; + + client_body_temp_path /tmp/nginx-logs/client_temp; + proxy_temp_path /tmp/nginx-logs/proxy_temp; + fastcgi_temp_path /tmp/nginx-logs/fastcgi_temp; + uwsgi_temp_path /tmp/nginx-logs/uwsgi_temp; + scgi_temp_path /tmp/nginx-logs/scgi_temp; + + server { + listen 8080; + server_name localhost; + + location / { + proxy_pass http://127.0.0.1:5000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location /static/ { + alias /app/static/; + } + } +} diff --git a/sample-docker-templates/flask/nginx.default b/sample-docker-templates/flask/nginx.default deleted file mode 100644 index c2fbc75164..0000000000 --- a/sample-docker-templates/flask/nginx.default +++ /dev/null @@ -1,23 +0,0 @@ -# nginx.default - -server { - listen 8000 default_server; - listen [::]:8000 default_server; - server_name example.org; - root /app; - - location / { - include uwsgi_params; - uwsgi_pass unix:/tmp/uwsgi.socket; - } - - location /static { - root /app; - } - - # For https uncomment the below lines - - # listen 443 ssl; - # give your ssl_certificate in this block - -} \ No newline at end of file diff --git a/sample-docker-templates/flask/start.sh b/sample-docker-templates/flask/start.sh index ef72c97d44..cbfafbf0f4 100644 --- a/sample-docker-templates/flask/start.sh +++ b/sample-docker-templates/flask/start.sh @@ -1,22 +1,7 @@ -#!/usr/bin/env bash -# -# Copyright (c) 2024. Devtron Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -service nginx start -# Refer https://raw.githubusercontent.com/devtron-labs/devtron/main/sample-docker-templates/flask/uwsgi.ini for sample uwsgi.ini file -uwsgi --ini uwsgi.ini +#!/bin/sh +# Start uWSGI in the background +uwsgi --ini /app/uwsgi.ini & +# Start Nginx in the foreground +nginx -g "daemon off;" \ No newline at end of file diff --git a/sample-docker-templates/flask/uwsgi.ini b/sample-docker-templates/flask/uwsgi.ini index 9d73c94025..42d2601f34 100644 --- a/sample-docker-templates/flask/uwsgi.ini +++ b/sample-docker-templates/flask/uwsgi.ini @@ -1,14 +1,11 @@ [uwsgi] module = app:app -uid = www-data -gid = www-data master = true processes = 5 -socket = /tmp/uwsgi.socket -chmod-sock = 664 -vacuum = true - -die-on-term = true - +http = 127.0.0.1:5000 +uid = nonroot +gid = nonroot +vacuum = true +die-on-term = true \ No newline at end of file diff --git a/sample-docker-templates/go/Dockerfile b/sample-docker-templates/go/Dockerfile index d868e7c930..5a65993ddd 100644 --- a/sample-docker-templates/go/Dockerfile +++ b/sample-docker-templates/go/Dockerfile @@ -1,36 +1,44 @@ -################################# Build Container ############################### +################################# Build Container ################################# -FROM golang:1.16 as builder +# Use the latest stable Go image for building +FROM golang:1.22.3 AS builder -# Setup the working directory +# Set working directory inside the container WORKDIR /app -# COPY go module -COPY go.mod go.sum /app/ - -# Download go modules and cache for next time build +# Copy Go module files and download dependencies +COPY go.mod go.sum ./ RUN go mod download -# Add source code -ADD . /app/ +# Copy the entire source code into the container +COPY . . -# Build the source +# Build the Go binary with CGO disabled for static linking RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main app.go +################################# Production Container ############################ + +# Use a minimal and secure Alpine base image +FROM alpine:3.20 -################################# Prod Container ################################# +# Install CA certificates (for HTTPS calls) +RUN apk --no-cache add ca-certificates -# Use a minimal alpine image -FROM alpine:3.7 +# Create a non-root user with UID/GID 2002 +RUN addgroup -g 2002 nonroot && \ + adduser -u 2002 -G nonroot -S nonroot -# Add ca-certificates in case you need them -RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* +# Switch to the non-root user +USER nonroot # Set working directory -WORKDIR /root +WORKDIR /home/nonroot -# Copy the binary from builder +# Copy the compiled binary from the builder stage COPY --from=builder /app/main . -# Run the binary -CMD ["./main"] \ No newline at end of file +# Expose port 8080 for the application +EXPOSE 8080 + +# Start the application +CMD ["./main"] diff --git a/sample-docker-templates/java/Gradle_Dockerfile b/sample-docker-templates/java/Gradle_Dockerfile index 30945dc67d..f3f5029071 100644 --- a/sample-docker-templates/java/Gradle_Dockerfile +++ b/sample-docker-templates/java/Gradle_Dockerfile @@ -1,30 +1,39 @@ ################################# Build Container ############################### -# Base Image of Build Container -FROM gradle:4.7.0-jdk8-alpine AS build +# Use latest Gradle with JDK 21 and Alpine for minimal size and speed +FROM gradle:8.13.0-jdk21-alpine AS build -# Changing the ownership of file and copying files in container +# Set working directory and ensure proper permissions COPY --chown=gradle:gradle . /home/gradle/src -# Moving into workdir WORKDIR /home/gradle/src -# Compiling & building the code -RUN gradle build --no-daemon +# Build the application without using the Gradle daemon +RUN gradle build --no-daemon ################################# Prod Container ################################# -# Base Image for Prod Container -FROM openjdk:8-jre-slim +# Use a minimal JDK base image for production +FROM eclipse-temurin:21-jdk-jammy -# Exposing Port of this container -EXPOSE 8080 +# Create a non-root user to run the app securely +RUN addgroup --gid 2002 nonroot && \ + adduser --gid 2002 --uid 2002 nonroot --disabled-password --gecos "" + +# Set the working directory +WORKDIR /app + +# Copy the JAR file from the build stage +COPY --from=build /home/gradle/src/build/libs/*.jar /app/demo.jar -# Creating a dir -RUN mkdir /app +# Set ownership of the jar file +RUN chown nonroot:nonroot /app/demo.jar -# Copying only the jar files created before -COPY --from=build /home/gradle/src/build/libs/*.jar /app/my-app.jar +# Switch to non-root user +USER nonroot + +# Expose the application port +EXPOSE 8080 -# Uncomment if you want to run default commands during the initialization of this container -# CMD exec java -jar /app/my-app.jar \ No newline at end of file +# Run the jar file +CMD ["java", "-jar", "/app/demo.jar"] diff --git a/sample-docker-templates/java/Maven_Dockerfile b/sample-docker-templates/java/Maven_Dockerfile index 52d7181417..e64d1f9b3d 100644 --- a/sample-docker-templates/java/Maven_Dockerfile +++ b/sample-docker-templates/java/Maven_Dockerfile @@ -1,33 +1,46 @@ ################################# Build Container ############################### -# Base Image for Build Container -FROM maven:3.5.3-jdk-8-alpine as base +# Use latest Maven with Amazon Corretto 21 on Debian for consistent build environment +FROM maven:3.9.9-amazoncorretto-21-debian as base -# Moving into working directory +# Set working directory inside container WORKDIR /build -# Copying pom.xml file initially for caching +# Copy pom.xml separately to leverage Docker cache for dependencies COPY pom.xml . -# Downloading Dependencies +# Download dependencies for offline use RUN mvn dependency:go-offline -# Copying files to /build/src/ inside container +# Copy the source code to container COPY src/ /build/src/ -# Building package -RUN mvn package +# Build the project and package the application +RUN mvn clean package ################################# Prod Container ################################# -# Base Image for Prod Container -FROM openjdk:8-jre-alpine +# Use a slim OpenJDK 21 image based on Debian for production +FROM eclipse-temurin:21-jdk-jammy -# Exposing Port of this new container -EXPOSE 4567 +# Create a non-root user 'nonroot' for security best practices +RUN addgroup --gid 2002 nonroot && \ + adduser --gid 2002 --uid 2002 nonroot --disabled-password --gecos "" -# Copying the executable jar file build on previous container -COPY --from=base /build/target/*.jar /app/my-app.jar +# Set working directory +WORKDIR /app -# Uncomment if you want to run default commands during the initialization of this container -# CMD exec java -jar /app/my-app.jar \ No newline at end of file +# Copy the built jar from build stage +COPY --from=base /build/target/*.jar /app/demo.jar + +# Change ownership to non-root user +RUN chown nonroot:nonroot /app/demo.jar + +# Switch to non-root user +USER nonroot + +# Expose the port the app listens on +EXPOSE 8080 + +# Default command to run the jar file +CMD ["java", "-jar", "/app/demo.jar"] diff --git a/sample-docker-templates/kotlin/Dockerfile b/sample-docker-templates/kotlin/Dockerfile index 198db63704..a14b68b76b 100644 --- a/sample-docker-templates/kotlin/Dockerfile +++ b/sample-docker-templates/kotlin/Dockerfile @@ -1,41 +1,38 @@ -# Using Base image -FROM alpine:latest +# --- Build stage --- +FROM gradle:8.13.0-jdk21-alpine AS builder -# Build args -ARG VCS_REF -ARG BUILD_DATE +# Set working directory +WORKDIR /src -# Setting resource quota -ARG MIN_MEM=2G -ARG MAX_MEM=2G +# Copy Gradle build files first (leverages Docker caching) +COPY build.gradle.kts settings.gradle.kts ./ -RUN apk add --update bash && \ - apk fetch openjdk8 && \ - apk add --no-cache openjdk8; +# Pre-create expected source directory to avoid COPY issues +RUN mkdir -p src/main/kotlin -RUN apk add --no-cache build-base wget && \ - cd /usr/lib && \ - # Installing Kotlin compiler in zip file - wget 'https://github.com/JetBrains/kotlin/releases/download/v1.3.72/kotlin-compiler-1.3.72.zip' && \ - # Unzipping the downloaded zip file - unzip kotlin-compiler-*.zip && \ - rm kotlin-compiler-*.zip && \ - rm -f kotlinc/bin/*.bat; +# Copy Kotlin source files +COPY app.kt src/main/kotlin/App.kt -# Setting up environmental variable path -ENV PATH $PATH:/usr/lib/kotlinc/bin +# Build the application distribution (binary JAR + startup scripts) +RUN gradle installDist --no-daemon --parallel -# Making a directory named 'app' in the container -RUN mkdir app +# --- Final stage --- +FROM eclipse-temurin:21-jre-jammy -# Copying 'app.kt' from 'app' folder on host to recently created 'app' folder in container -COPY app/app.kt /app +# Add a non-root user for security +RUN addgroup --gid 2002 nonroot && \ + adduser --gid 2002 --uid 2002 nonroot --disabled-password --gecos "" -# Set working directory -WORKDIR /app +WORKDIR /home/nonroot + +# Copy the built distribution from the builder stage +COPY --from=builder /src/build/install/app ./ + +# Switch to non-root user +USER nonroot -# Compiling source -RUN kotlinc app.kt -include-runtime -d app.jar +# Expose the application port +EXPOSE 8080 -# Execution -CMD ["java","-jar","./app.jar"] \ No newline at end of file +# Run the application +CMD ["bin/app"] \ No newline at end of file diff --git a/sample-docker-templates/node/Dockerfile b/sample-docker-templates/node/Dockerfile index 123a903771..bcb34f5679 100644 --- a/sample-docker-templates/node/Dockerfile +++ b/sample-docker-templates/node/Dockerfile @@ -1,36 +1,47 @@ -# Base Image -From node:12.18.1 +# Use a minimal Node.js base image +FROM node:22-alpine -# Seeting up env as production +# Set environment for production ENV NODE_ENV=production -#Getting System Ready to install dependencies -RUN apt-get clean \ - && apt-get -y update - -# Installing nginx -RUN apt-get -y install nginx \ - && apt-get -y install python3-dev \ - && apt-get -y install build-essential +# Install necessary packages: nginx only +RUN apk update && apk add --no-cache nginx -# Creating symbolic link for access and error log from nginx -RUN ln -sf /dev/stdout /var/log/nginx/access.log \ - && ln -sf /dev/stderr /var/log/nginx/error.log +# Set working directory +WORKDIR /app +# Copy only package files first to install dependencies +COPY package*.json ./ -# Making /app dir as working dir -WORKDIR /app -# Adding complete files and dirs in app dir in container -ADD . /app/ +# Install production dependencies +RUN npm install --prefer-offline --no-audit && \ + npm i -g pm2 + +# Now copy the rest of the source +COPY . . + +# Main global config +COPY nginx.conf /etc/nginx/nginx.conf + +# Default server/site config +COPY nginx-default.conf /etc/nginx/http.d/default.conf + +# Create non-root user and set permissions +RUN addgroup -g 2002 nonroot && \ + adduser -u 2002 -G nonroot -S nonroot && \ + mkdir -p /var/lib/nginx/tmp/client_body && \ + chown -R nonroot:nonroot /app /var/log/nginx /var/lib/nginx -# Refer https://raw.githubusercontent.com/devtron-labs/devtron/main/sample-docker-templates/node/nginx.default for sample nginx.default -COPY nginx.default /etc/nginx/sites-available/default +# Expose port 8080 +EXPOSE 8080 -# Installing dependencies -RUN npm install --production -RUN npm i -g pm2 +# Switch to non-root user +USER nonroot -# Starting Server -CMD ["sh", "-c", "service nginx start ; pm2-runtime src/index.js -i 0"] +# Link logs to stdout/stderr +RUN ln -sf /dev/stdout /var/log/nginx/access.log && \ + ln -sf /dev/stderr /var/log/nginx/error.log +# Start your app listening on port 8080 +CMD ["sh", "-c", "nginx && pm2-runtime src/index.js -i 0 --port=8080"] \ No newline at end of file diff --git a/sample-docker-templates/node/nginx-default.conf b/sample-docker-templates/node/nginx-default.conf new file mode 100644 index 0000000000..fd1cac68a1 --- /dev/null +++ b/sample-docker-templates/node/nginx-default.conf @@ -0,0 +1,34 @@ +# This contains a server block defining how a specific domain/route should be handled. +# nginx-default.conf + +# To allow a non-root container process to bind to privileged ports (e.g., 80 or 443), +# you need to add the NET_BIND_SERVICE capability to the security context: +# +# securityContext: +# allowPrivilegeEscalation: false +# capabilities: +# add: +# - NET_BIND_SERVICE +# drop: +# - ALL +# +# Since adding capabilities may reduce security or require extra setup in Kubernetes, +# it's simpler and safer to use an unprivileged port like 8080 for your app. + + +server { + listen 8080; + listen [::]:8080; + root /app; + server_name localhost; + + + location / { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass http://127.0.0.1:3000; + } + +} \ No newline at end of file diff --git a/sample-docker-templates/node/nginx.conf b/sample-docker-templates/node/nginx.conf new file mode 100644 index 0000000000..40a22b8fa2 --- /dev/null +++ b/sample-docker-templates/node/nginx.conf @@ -0,0 +1,23 @@ +# This is the global Nginx configuration file (typically contains user, worker_processes, http block, etc.) +# /etc/nginx/nginx.conf + +# user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log notice; +pid /tmp/nginx.pid; +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + sendfile on; + keepalive_timeout 65; + + include /etc/nginx/http.d/*.conf; +} diff --git a/sample-docker-templates/node/nginx.default b/sample-docker-templates/node/nginx.default deleted file mode 100644 index 831c838473..0000000000 --- a/sample-docker-templates/node/nginx.default +++ /dev/null @@ -1,17 +0,0 @@ -# nginx.default - -server { - listen 80; - listen [::]:80; - server_name example.org; - root /app; - - location / { - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_pass http://127.0.0.1:3000; - } - -} diff --git a/sample-docker-templates/php/Apache_Dockerfile b/sample-docker-templates/php/Apache_Dockerfile index 66d9b684b8..1947445fd2 100644 --- a/sample-docker-templates/php/Apache_Dockerfile +++ b/sample-docker-templates/php/Apache_Dockerfile @@ -1,16 +1,19 @@ -# Base Image -FROM php:7-apache +# Using latest stable PHP with Apache (8.3) +FROM php:8.3-apache -# Enabling modules from /etc/apache2/mods-available to /etc/apache2/mods-enabled +# Enable apache mod_rewrite RUN a2enmod rewrite -# Restarting apache2 server -RUN /etc/init.d/apache2 restart +# Create non-root user with UID/GID 2002 and set ownership +RUN groupadd -g 2002 nonroot && \ + useradd -u 2002 -g nonroot -m nonroot && \ + chown -R nonroot:www-data /var/www/html -# Giving ownship of html dir to www-data user -RUN chown -R www-data:www-data /var/www/html +# Copy application source code +COPY --chown=nonroot:www-data . /var/www/html/ +# Switch to non-root user for security +USER nonroot -# Copy application source -COPY . /var/www/html/ - +# Apache runs as www-data internally, so no need to restart here +# CMD is inherited from base image and will run apache2 in foreground by default diff --git a/sample-docker-templates/php/Nginx_Dockerfile b/sample-docker-templates/php/Nginx_Dockerfile index 1a925599af..b693b5f08f 100644 --- a/sample-docker-templates/php/Nginx_Dockerfile +++ b/sample-docker-templates/php/Nginx_Dockerfile @@ -1,31 +1,25 @@ -# base image -FROM ubuntu:16.04 +# Use Ubuntu 24.04 LTS as base image for latest stable environment +FROM ubuntu:24.04 -# update & install system -RUN apt-get update -RUN apt-get -y upgrade +ENV DEBIAN_FRONTEND=noninteractive -# installing packages -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --fix-missing php7.0 \ - php7.0-cli \ - php-fpm +RUN apt-get update && apt-get upgrade -y && \ + apt-get install -y --no-install-recommends php8.3 php8.3-cli php8.3-fpm nginx && \ + apt-get clean && rm -rf /var/lib/apt/lists/* -RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y nginx-full +# Create non-root user and set permissions +RUN groupadd -g 2002 nonroot && \ + useradd -u 2002 -g nonroot -s /bin/bash -m nonroot && \ + mkdir -p /run/php && \ + chown -R nonroot:nonroot /var/www/html /run/php -# copying nginx conf to its path COPY nginx-site.conf /etc/nginx/sites-available/default -# setting working dir WORKDIR /var/www/html/ - -# creating nested dir where fpm service would be found -RUN mkdir -p /run/php - -# copying static files to location COPY . /var/www/html -# service exposed EXPOSE 80 -# executing command -CMD ["/bin/bash", "-c", "service php7.0-fpm start && nginx -g \"daemon off;\""] \ No newline at end of file +USER nonroot + +CMD ["/bin/bash", "-c", "php-fpm8.3 --daemonize && nginx -g 'daemon off;'"] diff --git a/sample-docker-templates/php/nginx-site.conf b/sample-docker-templates/php/nginx-site.conf index ad094bf4f6..dfd383d0fa 100644 --- a/sample-docker-templates/php/nginx-site.conf +++ b/sample-docker-templates/php/nginx-site.conf @@ -1,6 +1,6 @@ server { - listen 80; ## listen for ipv4; this line is default and implied - listen [::]:80 default ipv6only=on; ## listen for ipv6 + listen 8080; # listen for ipv4 as non-root + listen [::]:8080 default ipv6only=on; # listen for ipv6 as non-root root /var/www/html; index index.php index.html index.htm; @@ -40,7 +40,7 @@ server { location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/run/php/php7.0-fpm.sock; + fastcgi_pass unix:/run/php/php8.3-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_index index.php; diff --git a/sample-docker-templates/php/php7.4/Dockerfile b/sample-docker-templates/php/php7.4/Dockerfile index ddff47d9fe..cff82f55d8 100644 --- a/sample-docker-templates/php/php7.4/Dockerfile +++ b/sample-docker-templates/php/php7.4/Dockerfile @@ -1,24 +1,28 @@ -FROM ubuntu:20.04 +FROM ubuntu:24.04 -RUN apt-get update -RUN apt-get -y upgrade +ENV DEBIAN_FRONTEND=noninteractive -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --fix-missing php7.4 \ - php7.4-cli \ - php-fpm \ - php7.4-mysql \ - php7.4-curl \ - net-tools +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + php8.3-cli \ + php8.3-fpm \ + nginx && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +RUN groupadd -g 2002 nonroot && \ + useradd -u 2002 -g nonroot -s /bin/bash -m nonroot && \ + mkdir -p /run/php && \ + chown -R nonroot:nonroot /var/www/html /run/php -RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y nginx-full ADD nginx-site.conf /etc/nginx/sites-available/default WORKDIR /var/www/html/ -RUN mkdir -p /run/php - COPY . /var/www/html EXPOSE 80 -CMD ["/bin/bash", "-c", "service php7.4-fpm start && nginx -g \"daemon off;\""] \ No newline at end of file +USER nonroot + +CMD ["/bin/bash", "-c", "php-fpm8.3 --daemonize && nginx -g 'daemon off;'"] diff --git a/sample-docker-templates/php/php7.4/nginx-site.conf b/sample-docker-templates/php/php7.4/nginx-site.conf index 6b0e2929cb..dfd383d0fa 100644 --- a/sample-docker-templates/php/php7.4/nginx-site.conf +++ b/sample-docker-templates/php/php7.4/nginx-site.conf @@ -1,6 +1,6 @@ server { - listen 80; ## listen for ipv4; this line is default and implied - listen [::]:80 default ipv6only=on; ## listen for ipv6 + listen 8080; # listen for ipv4 as non-root + listen [::]:8080 default ipv6only=on; # listen for ipv6 as non-root root /var/www/html; index index.php index.html index.htm; @@ -40,7 +40,7 @@ server { location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/run/php/php7.4-fpm.sock; + fastcgi_pass unix:/run/php/php8.3-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_index index.php; diff --git a/sample-docker-templates/react/Dockerfile b/sample-docker-templates/react/Dockerfile index c89eb45a94..42c13bec10 100644 --- a/sample-docker-templates/react/Dockerfile +++ b/sample-docker-templates/react/Dockerfile @@ -1,32 +1,55 @@ ###### BUILD ENVIRONMENT ###### -# Base Image -FROM node:12.18.1 as build +# Use official Node.js LTS base image for building the React app +FROM node:22.14.0 AS build -# Moving into working directory +# Set NODE_ENV for the build stage +ENV NODE_ENV=production + +# Set working directory WORKDIR /app -# Adding all files and dirs to /app inside container -ADD . /app/ +# Copy only package files first to leverage Docker layer caching +COPY package*.json ./ + -# Installing dependencies +# Install dependencies RUN npm install -# Creating Production build for react-app +# Copy the rest of the application source +COPY . . + +# Create production build RUN npm run build -# In this dockerfile using the concept of docker multistage build ###### PRODUCTION ENVIRONMENT ###### -# Base Image for prod env +# Use stable NGINX Alpine image for serving static files FROM nginx:stable-alpine -# Adding the build files from previous container to nginx/html +# Create a non-root user +RUN addgroup -g 2002 nonroot && \ + adduser -u 2002 -G nonroot -S nonroot + +# Copy the React build output from the build stage COPY --from=build /app/build /usr/share/nginx/html -# Exposing port 80 to listen http requests -EXPOSE 80 +# Set permissions for non-root user +RUN chown -R nonroot:nonroot /usr/share/nginx/html /var/cache/nginx /var/log/nginx + +# Copy custom NGINX config +COPY nginx.conf /etc/nginx/nginx.conf + +# Redirect logs to Docker's logging system +RUN ln -sf /dev/stdout /var/log/nginx/access.log && \ + ln -sf /dev/stderr /var/log/nginx/error.log + +# Run as non-root user +USER nonroot + +# Expose port (non-privileged) +EXPOSE 8080 -# Command to run +# Start NGINX in foreground CMD ["nginx", "-g", "daemon off;"] diff --git a/sample-docker-templates/react/nginx.conf b/sample-docker-templates/react/nginx.conf new file mode 100644 index 0000000000..a874a4849d --- /dev/null +++ b/sample-docker-templates/react/nginx.conf @@ -0,0 +1,32 @@ +worker_processes auto; +error_log /var/log/nginx/error.log warn; +pid /tmp/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + sendfile on; + keepalive_timeout 65; + + server { + listen 8080; + server_name localhost; + + root /usr/share/nginx/html; + index index.html index.htm; + + location / { + try_files $uri $uri/ /index.html; + } + + error_page 404 /index.html; + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + } +} diff --git a/sample-docker-templates/rust/Dockerfile b/sample-docker-templates/rust/Dockerfile index 97e7454de0..8a2726543a 100644 --- a/sample-docker-templates/rust/Dockerfile +++ b/sample-docker-templates/rust/Dockerfile @@ -1,25 +1,31 @@ -# Using Base image -FROM alpine:latest +# --- Build Stage --- +FROM rust:1.77-alpine AS builder -#Build args -ARG VCS_REF -ARG BUILD_DATE +WORKDIR /src -# Setting resource quota -ARG MIN_MEM=2G -ARG MAX_MEM=2G +# Copy your Rust source code +COPY src/main.rs . -# Installing rust and making a folder named 'src' into it -RUN apk add --no-cache rust && mkdir /src +# Build the Rust binary +RUN rustc main.rs -o app -# Copying 'main.rs' from 'src' folder on host to recently created 'src' folder in container -COPY src/main.rs /src +# --- Final Stage --- +FROM alpine:3.21 -# Set working directory -WORKDIR /src +# Create a non-root user for security +RUN addgroup -g 2002 nonroot && \ + adduser -u 2002 -G nonroot -S nonroot + +WORKDIR /app + +# Copy the compiled Rust binary from the builder stage +COPY --from=builder /src/app . + +# Expose the port your Rust app uses (adjust as needed) +EXPOSE 8080 -#Compiling source -RUN rustc main.rs +# Switch to non-root user +USER nonroot -#Execution -CMD ["./main"] \ No newline at end of file +# Command to run the app +CMD ["./app"] diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-5-0/app-values.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-5-0/app-values.yaml index 8af5840d9e..1bef49257f 100644 --- a/scripts/devtron-reference-helm-charts/cronjob-chart_1-5-0/app-values.yaml +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-5-0/app-values.yaml @@ -174,4 +174,4 @@ shareProcessNamespace: false setHostnameAsFQDN: false readinessGates: [] ephemeralContainers: [] -topologySpreadConstraints: [] +topologySpreadConstraints: [] \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/.image_descriptor_template.json b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/.image_descriptor_template.json new file mode 100644 index 0000000000..8a99a95664 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/.image_descriptor_template.json @@ -0,0 +1 @@ +{"server":{"deployment":{"image_tag":"{{.Tag}}","image":"{{.Name}}"}},"pipelineName": "{{.PipelineName}}","releaseVersion":"{{.ReleaseVersion}}","deploymentType": "{{.DeploymentType}}", "app": "{{.App}}", "env": "{{.Env}}", "appMetrics": {{.AppMetrics}}} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/Chart.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/Chart.yaml new file mode 100644 index 0000000000..12593984ab --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for Kubernetes +name: cronjob-chart_1-6-0 +version: 1.6.0 diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/app-values.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/app-values.yaml new file mode 100644 index 0000000000..2eb2c02033 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/app-values.yaml @@ -0,0 +1,177 @@ +# Mandatory configs +kind: Job + +jobConfigs: + backoffLimit: 5 + activeDeadlineSeconds: 100 + parallelism: 1 + completions: 2 + suspend: false + # ttlSecondsAfterFinished: 100 +cronjobConfigs: + schedule: "* * * * *" + startingDeadlineSeconds: 100 + concurrencyPolicy: Allow + suspend: false + successfulJobsHistoryLimit: 3 + failedJobsHistoryLimit: 1 + restartPolicy: OnFailure + timeZone: "UTC" + +kedaAutoscaling: + envSourceContainerName: "" + minReplicaCount: 1 + maxReplicaCount: 2 + pollingInterval: 30 + successfulJobsHistoryLimit: 5 + failedJobsHistoryLimit: 5 + rolloutStrategy: default + scalingStrategy: + strategy: "custom" + customScalingQueueLengthDeduction: 1 + customScalingRunningJobPercentage: "0.5" + pendingPodConditions: + - "Ready" + - "PodScheduled" + - "AnyOtherCustomPodCondition" + multipleScalersCalculation : "max" + triggers: + - type: rabbitmq + metadata: + queueName: hello + host: RabbitMqHost + queueLength : '5' + authenticationRef: {} + triggerAuthentication: + enabled: false + name: "" + spec: {} + +MinReadySeconds: 60 +GracePeriod: 30 +image: + pullPolicy: IfNotPresent +service: + type: ClusterIP + enabled: false + #name: "service-1234567890" + annotations: {} + # test1: test2 + # test3: test4 +ContainerPort: + - name: app + port: 8080 + servicePort: 80 + envoyPort: 8799 + useHTTP2: true + supportStreaming: true + idleTimeout: 1800s +# servicemonitor: +# enabled: true +# path: /abc +# scheme: 'http' +# interval: 30s +# scrapeTimeout: 20s +# metricRelabelings: +# - sourceLabels: [namespace] +# regex: '(.*)' +# replacement: myapp +# targetLabel: target_namespace +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: 1 + memory: 200Mi + requests: + cpu: 0.10 + memory: 100Mi + +# Optional configs + +command: + enabled: false + value: [] + +args: + enabled: false + value: + - /bin/sh + - -c + - touch /tmp/healthy; sleep 30; rm -rf /tmp/healthy; sleep 600 + +#For adding custom labels to pods + +podLabels: {} +# customKey: customValue +podAnnotations: {} +# customKey: customValue + +rawYaml: [] + +initContainers: [] + ## Additional init containers to run before the Scheduler pods. + ## for example, be used to run a sidecar that chown Logs storage. + #- name: volume-mount-hack + # image: busybox + # command: ["sh", "-c", "chown -R 1000:1000 logs"] + # volumeMounts: + # - mountPath: /usr/local/airflow/logs + # name: logs-data + +containers: [] + ## Additional containers to run along with application pods. + ## for example, be used to run a sidecar that chown Logs storage . + #- name: volume-mount-hack + # image: busybox + # command: ["sh", "-c", "chown -R 1000:1000 logs"] + # volumeMounts: + # - mountPath: /usr/local/airflow/logs + # name: logs-data + +volumeMounts: [] +# - name: log-volume +# mountPath: /var/log + +volumes: [] +# - name: log-volume +# emptyDir: {} + +tolerations: [] + +Spec: + Affinity: + Key: + # Key: kops.k8s.io/instancegroup + Values: + +prometheus: + release: monitoring + +server: + deployment: + image_tag: 1-95af053 + image: "" + +servicemonitor: + additionalLabels: {} + +imagePullSecrets: [] + # - test1 + # - test2 + +containerSecurityContext: + allowPrivilegeEscalation: false + +podSecurityContext: {} + # runAsUser: 1000 + # runAsGroup: 3000 + # fsGroup: 2000 + +shareProcessNamespace: false +setHostnameAsFQDN: false +readinessGates: [] +ephemeralContainers: [] +topologySpreadConstraints: [] diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/env-values.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/env-values.yaml new file mode 100644 index 0000000000..a0fcb7e26b --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/env-values.yaml @@ -0,0 +1,33 @@ +MaxSurge: 1 +MaxUnavailable: 0 +GracePeriod: 30 +pauseForSecondsBeforeSwitchActive: 30 +waitForSecondsBeforeScalingDown: 30 + +Spec: + Affinity: + key: "" + Values: nodes + +secret: + enabled: false + data: {} +# my_own_secret: S3ViZXJuZXRlcyBXb3Jrcw== + +EnvVariables: [] +# - name: FLASK_ENV +# value: qa + +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: "0.05" + memory: 50Mi + requests: + cpu: "0.01" + memory: 10Mi + + diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/pipeline-values.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/pipeline-values.yaml new file mode 100644 index 0000000000..40a5ec633d --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/pipeline-values.yaml @@ -0,0 +1,24 @@ +deployment: + strategy: + blueGreen: + autoPromotionSeconds: 30 + scaleDownDelaySeconds: 30 + previewReplicaCount: 1 + autoPromotionEnabled: false + rolling: + maxSurge: "25%" + maxUnavailable: 1 + canary: + maxSurge: "25%" + maxUnavailable: 1 + steps: + - setWeight: 25 + - pause: + duration: 15 # 1 min + - setWeight: 50 + - pause: + duration: 15 # 1 min + - setWeight: 75 + - pause: + duration: 15 # 1 min + recreate: {} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/release-values.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/release-values.yaml new file mode 100644 index 0000000000..48eb3f482c --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/release-values.yaml @@ -0,0 +1,14 @@ +server: + deployment: + image_tag: IMAGE_TAG + image: IMAGE_REPO + enabled: false +dbMigrationConfig: + enabled: false + +pauseForSecondsBeforeSwitchActive: 0 +waitForSecondsBeforeScalingDown: 0 +autoPromotionSeconds: 30 + +#used for deployment algo selection +orchestrator.deploymant.algo: 1 diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/schema.json b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/schema.json new file mode 100644 index 0000000000..5462a77cfd --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/schema.json @@ -0,0 +1,764 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "containerExtraSpecs": { + "type": "object", + "title": "containerExtraSpecs", + "description": "Define container extra specs here" + }, + "ContainerPort": { + "type": "array", + "description": "defines ports on which application services will be exposed to other services", + "title": "Container Port", + "items": { + "type": "object", + "properties": { + "envoyPort": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "envoy port for the container", + "title": "Envoy Port" + }, + "idleTimeout": { + "type": "string", + "description": "duration of time for which a connection is idle before the connection is terminated", + "title": "Idle Timeout" + }, + "name": { + "type": "string", + "description": "name of the port", + "title": "Name" + }, + "port": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "Port", + "title": "port for the container" + }, + "servicePort": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "port of the corresponding kubernetes service", + "title": "Service Port" + }, + "nodePort": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "nodeport of the corresponding kubernetes service", + "title": "Node Port" + }, + "supportStreaming": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "field to enable/disable timeout for high performance protocols like grpc", + "title": "Support Streaming" + }, + "useHTTP2": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": " field for setting if envoy container can accept(or not) HTTP2 requests", + "title": "Use HTTP2" + } + } + } + }, + "EnvVariables": { + "type": "array", + "items": {}, + "description": "contains environment variables needed by the containers", + "title": "Environment Variables" + }, + "EnvVariablesFromFieldPath": { + "type": "array", + "description": "Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs", + "title": "EnvVariablesFromFieldPath", + "items": [ + { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "name", + "description": "Env variable name to be" + }, + "fieldPath": { + "type": "string", + "title": "fieldPath", + "description": "Path of the field to select in the specified API version" + } + } + } + ] + }, + "EnvVariablesFromSecretKeys": { + "type": "array", + "description": "Selects a field of the deployment: It is use to get the name of Environment Variable name, Secret name and the Key name from which we are using the value in that corresponding Environment Variable.", + "title": "EnvVariablesFromSecretKeys", + "items": [ + { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "name", + "description": "Env variable name to be used." + }, + "secretName": { + "type": "string", + "title": "secretName", + "description": "Name of Secret from which we are taking the value." + }, + "keyName": { + "type": "string", + "title": "keyName", + "description": "Name of The Key Where the value is mapped with." + } + } + } + ] + }, + "EnvVariablesFromConfigMapKeys": { + "type": "array", + "description": "Selects a field of the deployment: It is use to get the name of Environment Variable name, Config Map name and the Key name from which we are using the value in that corresponding Environment Variable.", + "title": "EnvVariablesFromConfigMapKeys", + "items": [ + { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "name", + "description": "Env variable name to be used." + }, + "configMapName": { + "type": "string", + "title": "configMapName", + "description": "Name of configMap from which we are taking the value." + }, + "keyName": { + "type": "string", + "title": "keyName", + "description": "Name of The Key Where the value is mapped with." + } + } + } + ] + }, + "GracePeriod": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "time for which Kubernetes waits before terminating the pods", + "title": "Grace Period" + }, + "MaxSurge": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "maximum number of pods that can be created over the desired number of pods", + "title": "Maximum Surge" + }, + "MaxUnavailable": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "maximum number of pods that can be unavailable during the update process", + "title": "Maximum Unavailable" + }, + "MinReadySeconds": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "minimum number of seconds for which a newly created Pod should be ready without any of its containers crashing, for it to be considered available", + "title": "Minimum Ready Seconds" + }, + "Spec": { + "type": "object", + "description": "used to define the desire state of the given container", + "title": "Spec", + "properties": { + "Affinity": { + "type": "object", + "description": "Node/Inter-pod Affinity allows you to constrain which nodes your pod is eligible to schedule on, based on labels of the node/pods", + "title": "Affinity", + "properties": { + "Key": { + "anyOf": [ + { + "type": "null" + }, + { + "type": "string", + "description": "Key part of the label for node/pod selection", + "title": "Key" + } + ] + }, + "Values": { + "type": "string", + "description": "Value part of the label for node/pod selection", + "title": "Values" + }, + "key": { + "type": "string" + } + } + } + } + }, + "args": { + "type": "object", + "description": " used to give arguments to command", + "title": "Arguments", + "properties": { + "enabled": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "used for enabling/disabling aruguments", + "title": "Enabled" + }, + "value": { + "type": "array", + "description": "values of the arguments", + "title": "Value", + "items": [ + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "string" + } + ] + } + } + }, + "command": { + "type": "object", + "description": "contains the commands for the server", + "title": "Command", + "properties": { + "enabled": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "used for enabling/disabling commands" + }, + "value": { + "type": "array", + "items": {}, + "description": "contains the commands", + "title": "Value" + }, + "workingDir": { + "type": "object", + "items": {}, + "description": "contains the working directory", + "title": "Working directory" + } + } + }, + "cronjobConfigs": { + "type": "object", + "description": " used to give configs to schdule cronjob", + "title": "Cronjob Configs", + "properties": { + "concurrencyPolicy": { + "type": "string", + "description": "Specifies how to treat concurrent executions of a Job.", + "title": "cronjobConfigs", + "enum": [ "Allow", "Forbid","Replace"] + }, + "failedJobsHistoryLimit": { + "type": "integer", + "description": "The number of failed finished jobs to retain. Value must be non-negative integer. Defaults to 1.", + "title": "failedJobsHistoryLimit" + }, + "restartPolicy": { + "type": "string", + "description": "It restarts the docker container based on defined conditions.", + "title": "Restart Policy", + "enum": [ + "Always", + "OnFailure", + "Never" + ] + }, + "schedule": { + "type": "string", + "description": "The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.", + "title": "schedule" + }, + "startingDeadlineSeconds":{ + "type": "integer", + "description": "Optional deadline in seconds for starting the job if it misses scheduled time for any reason.", + "title": "startingDeadlineSeconds" + }, + "successfulJobsHistoryLimit": { + "type": "integer", + "description": "The number of successful finished jobs to retain. Value must be non-negative integer. Defaults to 3.", + "title": "Successful Jobs History Limit" + }, + "suspend":{ + "type":"boolean", + "description": "This flag tells the controller to suspend subsequent executions, it does not apply to already started executions. Defaults is false." + }, + "timeZone":{ + "type":"string", + "description": "You can specify a time zone for a CronJob by setting timeZone to the name of a valid time zone, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones." + } + } + }, + "jobConfigs":{ + "type":"object", + "description": "used to give configs to schdule job", + "title": "Job Config", + "properties": { + "activeDeadlineSeconds":{ + "type":"integer", + "description": "Specifies the duration in seconds relative to the startTime that the job may be continuously active before the system tries to terminate it; value must be positive integer.", + "title": "Active Deadline Seconds" + }, + "backoffLimit":{ + "type":"integer", + "description": "Specifies the number of retries before marking this job failed. Defaults is 5" + }, + "completions":{ + "type":"integer", + "description": "Specifies the desired number of successfully finished pods the job should be run with. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/" + }, + "parallelism":{ + "type":"integer", + "description": "Specifies the maximum desired number of pods the job should run at any given time. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/" + }, + "suspend":{ + "type":"boolean", + "description": "This flag tells the controller to suspend subsequent executions, it does not apply to already started executions. Defaults is false." + } + } + }, + "kind":{ + "type": "string", + "description": "Kind is a string value representing the object type.", + "enum": [ + "Job", + "CronJob", + "ScaledJob" + ], + "title": "Kind" + + }, + + "kedaAutoscaling": { + "type": "object", + "description": "Kubernetes-based event driven autoscaler. With KEDA, one can drive the scaling of any container in Kubernetes based on the no. of events needing to be processed", + "title": "KEDA Autoscaling", + "properties": { + "envSourceContainerName":{ + "type": "string", + "description": "Is an optional property that specifies the name of container in the target resource, from which KEDA should try to get environment properties holding secrets etc. ", + "title": "Env Source Container Name" + }, + "failedJobsHistoryLimit": { + "type": "integer", + "description": "specifies how many failed jobs to keep", + "title": "Failed Jobs History Limit" + }, + "maxReplicaCount":{ + "type":"integer", + "description": "maxReplicaCount in KEDA specifies the maximum number of replicas the target resource can be scaled to.", + "title": "Max Replica Count" + }, + "minReplicaCount":{ + "type":"integer", + "description": "minReplicaCount in KEDA specifies the minimum number of replicas a resource will be scaled down to.", + "title": "Max Replica Count" + + }, + "pollingInterval":{ + "type": "integer", + "description": "This is the interval to check each trigger on. By default, KEDA will check each trigger source on every ScaledObject every 30 seconds.", + "title": "Polling Interval" + }, + "rolloutStrategy": { + "type": "string", + "description": "rollout.strategy specifies the rollout strategy KEDA will use while updating an existing ScaledJob", + "enum":[ + "gradual","default" + ] + }, + "scalingStrategy": { + "type": "object", + "properties": + { + "customScalingQueueLengthDeduction":{ + "type": "integer", + "description": "Optional. A parameter to optimize custom ScalingStrategy.", + "title": "Custom Scaling Queue Length Deduction" + }, + "customScalingRunningJobPercentage":{ + "type": "string", + "description": "Optional. A parameter to optimize custom ScalingStrategy.", + "title": "Custom Scaling QueueLengthDeduction" + }, + "multipleScalersCalculation": + { + "type": "string", + "description": "Select a behavior if you have multiple triggers", + "title": "Multiple Scalers Calculation", + "enum":[ + "max", "min", "avg", "sum" + ] + + }, + "pendingPodConditions": { + "type": "array", + "description": "Optional. A parameter to calculate pending job count per the specified pod conditions", + "title": "Pending Pod Conditions" + }, + "strategy":{ + "type": "string", + "description": "Optional. Default: default. Which Scaling Strategy to use.", + "title":"Strategy", + "enum": ["default", "custom", "accurate"] + } + } + + }, + "successfulJobsHistoryLimit": { + "type": "integer", + "description": " The number of successful finished jobs to retain. Value must be non-negative integer. Defaults to 3.", + "title": "Successful Jobs History Limit" + }, + "triggerAuthentication":{ + "type": "object", + "title": "Trigger Authentication", + "description": "TriggerAuthentication allows you to describe authentication parameters separate from the ScaledObject and the deployment containers.", + "properties": + { + "enabled": { + "type": "boolean", + "description": "enabling TriggerAuthentication" + }, + "name": { + "type": "string" + }, + "spec":{ + "type": "object" + } + } + }, + "triggers":{ + "type":"array", + "description": "list of triggers to activate scaling of the target resource" + } + + } + + }, + "podAnnotations":{ + "type": "object", + "description": "adding extra annotations to pod" + }, + "ephemeralContainers": + { + "type": "array", + "description": "List of ephemeral containers run in this pod. Ephemeral containers may be run in an existing pod to perform user-initiated actions such as debugging." + }, + "initContainers":{ + "type":"array", + "description":"List of initialization containers belonging to the pod. Init containers are executed in order prior to containers being started." + }, + "imagePullSecrets": + { + "type":"array", + "description":" ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations for them to use. More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod" + } + , + "containerSecurityContext": { + "type": "object", + "description": " defines privilege and access control settings for a Container", + "title": "Container Security Context" + }, + "containers": { + "type": "array", + "items": {}, + "description": " used to run side-car containers along with the main container within same pod" + }, + "dbMigrationConfig": { + "type": "object", + "description": "used to configure database migration", + "title": "Db Migration Config", + "properties": { + "enabled": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "used for enabling/disabling the config", + "title": "Enabled" + } + } + }, + "image": { + "type": "object", + "description": "used to access images in kubernetes", + "title": "Image", + "properties": { + "pullPolicy": { + "type": "string", + "description": "used to define the instances calling the image", + "title": "Pull Policy", + "enum": [ + "IfNotPresent", + "Always" + ] + } + } + }, + "podExtraSpecs": { + "type": "object", + "description": "ExtraSpec for the pods to be configured", + "title": "podExtraSpecs" + }, + "podLabels": { + "type": "object", + "description": "key/value pairs that are attached to pods, are intended to be used to specify identifying attributes of objects that are meaningful and relevant to users, but do not directly imply semantics to the core system", + "title": "Pod Labels" + }, + "podSecurityContext": { + "type": "object", + "description": "defines privilege and access control settings for a Pod or Container", + "title": "Pod Security Context" + }, + "prometheus": { + "type": "object", + "description": "a kubernetes monitoring tool", + "title": "Prometheus", + "properties": { + "release": { + "type": "string", + "description": "name of the file to be monitored, describes the state of prometheus" + } + } + }, + "rawYaml": { + "type": "array", + "items": {}, + "description": "Accepts an array of Kubernetes objects. One can specify any kubernetes yaml here & it will be applied when a app gets deployed.", + "title": "Raw YAML" + }, + "resources": { + "type": "object", + "description": "minimum and maximum RAM and CPU available to the application", + "title": "Resources", + "properties": { + "limits": { + "type": "object", + "description": "the maximum values a container can reach", + "title": "Limits", + "properties": { + "cpu": { + "type": "string", + "format": "cpu", + "description": "limit of CPU", + "title": "CPU" + }, + "memory": { + "type": "string", + "format": "memory", + "description": "limit of memory", + "title": "Memory" + } + } + }, + "requests": { + "type": "object", + "description": "request is what the container is guaranteed to get", + "title": "Requests", + "properties": { + "cpu": { + "type": "string", + "format": "cpu", + "description": "request value of CPU", + "title": "CPU" + }, + "memory": { + "type": "string", + "format": "memory", + "description": "request value of memory", + "title": "Memory" + } + } + } + } + }, + "secret": { + "type": "object", + "properties": { + "data": { + "type": "object" + }, + "enabled": { + "type": "boolean" + } + } + }, + "server": { + "type": "object", + "description": "used for providing server configurations.", + "title": "Server", + "properties": { + "deployment": { + "type": "object", + "description": "gives the details for deployment", + "title": "Deployment", + "properties": { + "image": { + "type": "string", + "description": "URL of the image", + "title": "Image" + }, + "image_tag": { + "type": "string", + "description": "tag of the image", + "title": "Image Tag" + } + } + } + } + }, + "service": { + "type": "object", + "description": "defines annotations and the type of service", + "title": "Service", + "properties": { + "annotations": { + "type": "object", + "title": "Annotations", + "description": "annotations of service" + }, + "type": { + "type": "string", + "description": "type of service", + "title": "Type", + "enum": [ + "ClusterIP", + "LoadBalancer", + "NodePort", + "ExternalName" + ] + }, + "enabled": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "used to enable or disable service", + "title": "Enabled" + } + } + }, + "serviceAccount": { + "type": "object", + "description": "defines service account for pods", + "title": "Service Account", + "properties": { + "annotations": { + "type": "object", + "title": "Annotations", + "description": "annotations of service account" + }, + "name": { + "type": "string", + "description": "name of service account", + "title": "Name" + }, + "create": { + "type": "boolean", + "description": "If set to true, a service account will be created, ensuring that no roles or role bindings are created in the process." + + } + } + }, + "servicemonitor": { + "type": "object", + "description": "gives the set of targets to be monitored", + "title": "Service Monitor", + "properties": { + "additionalLabels": { + "type": "object" + } + } + }, + "tolerations": { + "type": "array", + "items": {}, + "description": "a mechanism which work together with Taints which ensures that pods are not placed on inappropriate nodes", + "title": "Tolerations" + }, + "topologySpreadConstraints": { + "type": "array", + "items": {}, + "description": "used to control how Pods are spread across a cluster among failure-domains such as regions, zones, nodes, and other user-defined topology domains", + "title": "Topology Spread Constraints" + }, + "volumeMounts": { + "type": "array", + "items": {}, + "description": "used to provide mounts to the volume", + "title": "Volume Mounts" + }, + "volumes": { + "type": "array", + "items": {}, + "description": "required when some values need to be read from or written to an external disk", + "title": "Volumes" + }, + "waitForSecondsBeforeScalingDown": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "Wait for given period of time before scaling down the container", + "title": "Wait For Seconds Before Scaling Down" + } + } +} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/secrets-test-values.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/secrets-test-values.yaml new file mode 100644 index 0000000000..4a20404db8 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/secrets-test-values.yaml @@ -0,0 +1 @@ +{"ConfigSecrets":{"enabled":true,"secrets":[{"data":{"standard_key":"c3RhbmRhcmQtdmFsdWU="},"external":false,"externalType":"","mountPath":"/test","name":"normal-secret","type":"volume"},{"data":{"secret_key":"U0VDUkVUIERBVEE="},"external":true,"externalType":"AWSSecretsManager","mountPath":"","name":"external-secret-3","type":"environment"}]}} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/NOTES.txt b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/NOTES.txt new file mode 100644 index 0000000000..c6ccbb8211 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/NOTES.txt @@ -0,0 +1,13 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include ".Chart.Name .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 {{ include ".Chart.Name .fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include ".Chart.Name .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.kubernetes.io/name={{ include ".Chart.Name .name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/_helpers.tpl b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/_helpers.tpl new file mode 100644 index 0000000000..03fabbc338 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/_helpers.tpl @@ -0,0 +1,159 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define ".Chart.Name .name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create service name +*/}} +{{- define ".servicename" -}} +{{- if .Values.service.name -}} +{{- .Values.service.name | trunc 63 | trimSuffix "-" -}} +{{- else if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 55 | trimSuffix "-" -}}-service +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 55 | trimSuffix "-" -}}-service +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 55 | trimSuffix "-" -}}-service +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create preview service name +*/}} +{{- define ".previewservicename" -}} +{{- if .Values.service.name -}} +{{- .Values.service.name | trunc 55 | trimSuffix "-" -}}-preview +{{- else if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 47 | trimSuffix "-" -}}-preview-service +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 47 | trimSuffix "-" -}}-preview-service +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 47 | trimSuffix "-" -}}-preview-service +{{- end -}} +{{- end -}} +{{- 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 ".Chart.Name .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 ".Chart.Name .chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define ".Chart.Name .color" -}} +{{- $active0 := (index .Values.server.deployment 0).enabled -}} +{{/* +{{- $active1 := (index .Values.server.deployment 1).enabled -}} +*/}} +{{- $active1 := include "safeenabledcheck" . -}} +{{- $active := and $active0 $active1 -}} +{{- $active -}} +{{- end -}} + +{{- define "safeenabledcheck" -}} +{{- if (eq (len .Values.server.deployment) 2) -}} + {{- if (index .Values.server.deployment 1).enabled -}} + {{- $active := true -}} + {{- $active -}} + {{- else -}} + {{- $active := false -}} + {{- $active -}} + {{- end -}} +{{- else -}} + {{- $active := false -}} + {{- $active -}} +{{- end -}} +{{- end -}} + + +{{- define "isCMVolumeExists" -}} + {{- $isCMVolumeExists := false -}} + {{- if .Values.ConfigMaps.enabled }} + {{- range .Values.ConfigMaps.maps }} + {{- if eq .type "volume"}} + {{- $isCMVolumeExists = true}} + {{- end }} + {{- end }} + {{- end }} + {{- $isCMVolumeExists -}} +{{- end -}} + +{{- define "isSecretVolumeExists" -}} + {{- $isSecretVolumeExists := false -}} + {{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{- if eq .type "volume"}} + {{- $isSecretVolumeExists = true}} + {{- end }} + {{- end }} + {{- end }} + {{- $isSecretVolumeExists -}} +{{- end -}} + + + + +{{- define "serviceMonitorEnabled" -}} + {{- $SMenabled := false -}} + {{- range .Values.ContainerPort }} + {{- if .servicemonitor }} + {{- if and .servicemonitor.enabled }} + {{- $SMenabled = true -}} + {{- end }} + {{- end }} + {{- end }} + {{- $SMenabled -}} +{{- end -}} + + {{- $hasCMEnvExists := false -}} + {{- $hasCMVolumeExists := false -}} + {{- if .Values.ConfigMaps.enabled }} + {{- range .Values.ConfigMaps.maps }} + {{- if eq .type "volume"}} + {{- $hasCMVolumeExists = true}} + {{- end }} + {{- if eq .type "environment"}} + {{- $hasCMEnvExists = true}} + {{- end }} + {{- end }} + {{- end }} + + {{- $hasSecretEnvExists := false -}} + {{- $hasSecretVolumeExists := false -}} + {{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{- if eq .type "volume"}} + {{- $hasSecretVolumeExists = true}} + {{- end }} + {{- if eq .type "environment"}} + {{- $hasSecretEnvExists = true}} + {{- end }} + {{- end }} + {{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/_job_template_spec.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/_job_template_spec.yaml new file mode 100644 index 0000000000..72a380d3b1 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/_job_template_spec.yaml @@ -0,0 +1,45 @@ +{{- define "job-template-spec" }} +{{- if $.Values.jobConfigs }} +{{- if $.Values.jobConfigs.jobExtraSpecs }} +{{ toYaml $.Values.jobConfigs.jobExtraSpecs }} +{{- end }} +{{- if $.Values.jobConfigs.backoffLimit }} +backoffLimit: {{ $.Values.jobConfigs.backoffLimit }} +{{- end }} +{{- if $.Values.jobConfigs.activeDeadlineSeconds }} +activeDeadlineSeconds: {{ $.Values.jobConfigs.activeDeadlineSeconds }} +{{- end }} +{{- if $.Values.jobConfigs.parallelism }} +parallelism: {{ $.Values.jobConfigs.parallelism }} +{{- end }} +{{- if $.Values.jobConfigs.completions }} +completions: {{ $.Values.jobConfigs.completions }} +{{- end }} +{{- if semverCompare ">1.20" .Capabilities.KubeVersion.GitVersion }} +{{- if $.Values.jobConfigs.suspend }} +suspend: {{ $.Values.jobConfigs.suspend }} +{{- end }} +{{- end }} +{{- if $.Values.jobConfigs.ttlSecondsAfterFinished }} +ttlSecondsAfterFinished: {{ $.Values.jobConfigs.ttlSecondsAfterFinished }} +{{- end }} +{{- end }} +template: + metadata: + {{- if $.Values.podAnnotations }} + annotations: + {{- range $key, $value := $.Values.podAnnotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + labels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + release: {{ $.Release.Name }} + {{- if $.Values.podLabels }} +{{ toYaml $.Values.podLabels | indent 6 }} + {{- end }} + spec: + {{- include "pod-template-spec" . | indent 4 }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/_pod_template_spec.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/_pod_template_spec.yaml new file mode 100644 index 0000000000..3ec7993346 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/_pod_template_spec.yaml @@ -0,0 +1,341 @@ +{{ define "pod-template-spec" }} +{{- $hasCMEnvExists := false -}} +{{- $hasCMVolumeExists := false -}} +{{- if .Values.ConfigMaps.enabled }} +{{- range .Values.ConfigMaps.maps }} +{{- if eq .type "volume"}} +{{- $hasCMVolumeExists = true}} +{{- end }} +{{- if eq .type "environment"}} +{{- $hasCMEnvExists = true}} +{{- end }} +{{- end }} +{{- end }} + +{{- $hasPVCExists := false -}} +{{- if .Values.persistentVolumeClaim.name }} +{{- $hasPVCExists = true }} +{{- end }} + + +{{- $hasSecretEnvExists := false -}} +{{- $hasSecretVolumeExists := false -}} +{{- if .Values.ConfigSecrets.enabled }} +{{- range .Values.ConfigSecrets.secrets }} +{{- if eq .type "volume"}} +{{- $hasSecretVolumeExists = true}} +{{- end }} +{{- if eq .type "environment"}} +{{- $hasSecretEnvExists = true}} +{{- end }} +{{- end }} +{{- end }} +{{- if $.Values.podExtraSpecs }} +{{ toYaml $.Values.podExtraSpecs }} +{{- end }} +{{- if $.Values.shareProcessNamespace }} +shareProcessNamespace: {{ $.Values.shareProcessNamespace }} +{{- end }} +{{- if $.Values.GracePeriod }} +terminationGracePeriodSeconds: {{ $.Values.GracePeriod }} +{{- end }} +{{- if $.Values.topologySpreadConstraints }} +topologySpreadConstraints: +{{- range $.Values.topologySpreadConstraints }} +- maxSkew: {{ .maxSkew }} + topologyKey: {{ .topologyKey }} + whenUnsatisfiable: {{ .whenUnsatisfiable }} + labelSelector: + matchLabels: + {{- if and .autoLabelSelector .customLabelSelector }} +{{ toYaml .customLabelSelector | indent 6 }} + {{- else if .autoLabelSelector }} + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + release: {{ $.Release.Name }} + {{- else if .customLabelSelector }} +{{ toYaml .customLabelSelector | indent 6 }} + {{- end }} +{{- end }} +{{- end }} +{{- if $.Values.podSpec.subdomain }} +subdomain: {{ $.Values.podSpec.subdomain }} +{{- end }} +{{- if $.Values.podSpec.setHostnameAsFQDN }} +setHostnameAsFQDN: {{ $.Values.podSpec.setHostnameAsFQDN }} +{{- end }} +{{- if $.Values.podSpec.schedulerName }} +schedulerName: {{ $.Values.podSpec.schedulerName }} +{{- end }} +{{- if $.Values.podSpec.readinessGates }} +readinessGates: + {{ toYaml $.podSpec.readinessGates }} +{{- end }} +{{- if $.Values.podSpec.dnsPolicy }} +dnsPolicy: {{ $.Values.podSpec.dnsPolicy }} +{{- end }} +{{- if $.Values.podSpec.enableServiceLinks }} +dnsPolicy: {{ $.Values.podSpec.enableServiceLinks }} +{{- end }} +{{- with $.Values.ephemeralContainers }} +ephemeralContainers: +{{- toYaml $.Values.ephemeralContainers }} +{{- end }} +{{- with $.Values.dnsConfig }} +dnsConfig: +{{- toYaml $.Values.dnsConfig }} +{{- end }} +restartPolicy: {{ $.Values.restartPolicy | default "OnFailure" }} +{{- if and $.Values.Spec.Affinity.Key $.Values.Spec.Affinity.Values }} +affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: {{ $.Values.Spec.Affinity.Key }} + operator: In + values: + - {{ $.Values.Spec.Affinity.Values | default "nodes" }} +{{- end }} +{{- if $.Values.serviceAccountName }} +serviceAccountName: {{ $.Values.serviceAccountName }} +{{- end }} +{{- if .Values.tolerations }} +tolerations: +{{ toYaml .Values.tolerations | indent 2 }} +{{- end }} +{{- if $.Values.podSecurityContext }} +securityContext: +{{ toYaml .Values.podSecurityContext | indent 2 }} +{{- end }} +{{- if $.Values.imagePullSecrets }} +imagePullSecrets: +{{- range .Values.imagePullSecrets }} + - name: {{ . }} +{{- end }} +{{- end}} +{{- if $.Values.initContainers }} +initContainers: +{{- range $i, $c := .Values.initContainers }} +{{- if .reuseContainerImage }} + - name: {{ $.Chart.Name }}-init-{{ add1 $i }} + image: "{{ $.Values.server.deployment.image }}:{{ $.Values.server.deployment.image_tag }}" + imagePullPolicy: {{ $.Values.image.pullPolicy }} +{{- if .command }} + command: +{{ toYaml .command | indent 6 -}} +{{- end }} +{{- if .resources }} + resources: +{{ toYaml .resources | indent 6 }} +{{- end }} +{{- if .volumeMounts }} + volumeMounts: +{{ toYaml .volumeMounts | indent 6 -}} +{{- end }} +{{- else }} + - +{{ toYaml $c | indent 4 -}} +{{- end }} +{{- end }} +{{- end }} +containers: +{{- if $.Values.containers }} +{{ toYaml $.Values.containers | indent 2 -}} +{{- end }} + - name: {{ $.Chart.Name }} + image: "{{ .Values.server.deployment.image }}:{{ .Values.server.deployment.image_tag }}" + imagePullPolicy: {{ $.Values.image.pullPolicy }} +{{- if $.Values.containerExtraSpecs }} +{{ toYaml .Values.containerExtraSpecs | indent 4 }} +{{- end }} +{{- if $.Values.privileged }} + securityContext: + privileged: true +{{- end }} +{{- if $.Values.containerSecurityContext }} + securityContext: +{{ toYaml .Values.containerSecurityContext | indent 6 }} +{{- end }} +{{- if and $.Values.containerSecurityContext $.Values.privileged }} + securityContext: + privileged: true +{{ toYaml .Values.containerSecurityContext | indent 6 }} +{{- end }} + ports: + {{- range $.Values.ContainerPort }} + - name: {{ .name }} + containerPort: {{ .port }} + protocol: TCP + {{- end }} +{{- if and $.Values.command.value $.Values.command.enabled }} + command: +{{ toYaml $.Values.command.value | indent 6 -}} +{{- end }} +{{- if and $.Values.args.value $.Values.args.enabled }} + args: +{{ toYaml $.Values.args.value | indent 6 -}} +{{- end }} + env: + - name: CONFIG_HASH + value: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + - name: SECRET_HASH + value: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} + - name: DEVTRON_APP_NAME + value: {{ template ".Chart.Name .name" $ }} + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + {{- range $.Values.EnvVariablesFromFieldPath }} + - name: {{ .name }} + valueFrom: + fieldRef: + fieldPath: {{ .fieldPath }} + {{- end }} + {{- range $.Values.EnvVariables }} + - name: {{ .name}} + value: {{ .value | quote }} + {{- end }} + {{- if or (and ($hasCMEnvExists) (.Values.ConfigMaps.enabled)) (and ($hasSecretEnvExists) (.Values.ConfigSecrets.enabled)) }} + envFrom: + {{- if .Values.ConfigMaps.enabled }} + {{- range .Values.ConfigMaps.maps }} + {{- if eq .type "environment" }} + - configMapRef: + {{- if eq .external true }} + name: {{ .name }} + {{- else if eq .external false }} + name: {{ .name}}-{{ $.Values.app }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{- if eq .type "environment" }} + - secretRef: + {{if eq .external true}} + name: {{ .name }} + {{else if eq .external false}} + name: {{ .name}}-{{ $.Values.app }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + resources: +{{ toYaml $.Values.resources | trim | indent 6 }} + volumeMounts: +{{- with .Values.volumeMounts }} +{{ toYaml . | trim | indent 6 }} +{{- end }} +{{- if $.Values.persistentVolumeClaim.name }} + - name: {{ $.Values.persistentVolumeClaim.name }}-vol + mountPath: {{ $.Values.persistentVolumeClaim.mountPath | default "/tmp" }} +{{- end}} + {{- if .Values.ConfigMaps.enabled }} + {{- range .Values.ConfigMaps.maps }} + {{- if eq .type "volume"}} + {{- $cmName := .name -}} + {{- $cmMountPath := .mountPath -}} + {{- if eq .subPath false }} + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath }} + + {{- else }} + {{- range $k, $v := .data }} + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath }}/{{ $k}} + subPath: {{ $k}} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + + {{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{- if eq .type "volume"}} + {{- $cmName := .name -}} + {{- $cmMountPath := .mountPath -}} + {{- if eq .subPath false }} + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath }} + + {{- else }} + {{if (or (eq .externalType "ESO_GoogleSecretsManager") (eq .externalType "ESO_AWSSecretsManager") (eq .externalType "ESO_HashiCorpVault") (eq .externalType "ESO_AzureSecretsManager"))}} + {{- if and (.esoSubPath) (ne (len .esoSubPath) 0) }} + {{- range .esoSubPath }} + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath}}/{{ . }} + subPath: {{ . }} + {{- end }} + {{- else }} + {{- range .esoSecretData.esoData }} + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath}}/{{ .secretKey }} + subPath: {{ .secretKey }} + {{- end }} + {{- end }} + {{- else }} + {{- range $k, $v := .data }} # for others secrets the mount path will be .data[i].secretKey + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath}}/{{ $k}} + subPath: {{ $k}} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- if and (eq (len .Values.volumes) 0) (eq ($hasPVCExists) false) (or (eq (.Values.ConfigSecrets.enabled) true) (eq (.Values.ConfigMaps.enabled) true)) (eq ($hasCMVolumeExists) false) (eq ($hasSecretVolumeExists) false) }} []{{- end }} + {{- if and (eq (len .Values.volumeMounts) 0) (eq ($hasPVCExists) false) (eq (.Values.ConfigSecrets.enabled) false) (eq (.Values.ConfigMaps.enabled) false) }} [] {{- end }} +volumes: +{{- if $.Values.appMetrics }} + - name: envoy-config-volume + configMap: + name: sidecar-config-{{ template ".Chart.Name .name" $ }} +{{- end }} +{{- with .Values.volumes }} +{{ toYaml . | trim | indent 2 }} +{{- end }} +{{- if .Values.ConfigMaps.enabled }} +{{- range .Values.ConfigMaps.maps }} +{{- if eq .type "volume"}} + - name: {{ .name | replace "." "-"}}-vol + configMap: + {{- if eq .external true }} + name: {{ .name }} + {{- else if eq .external false }} + name: {{ .name}}-{{ $.Values.app }} + {{- end }} + {{- if eq (len .filePermission) 0 }} + {{- else }} + defaultMode: {{ .filePermission}} + {{- end }} +{{- end }} +{{- end }} +{{- end }} + +{{- if .Values.ConfigSecrets.enabled }} +{{- range .Values.ConfigSecrets.secrets }} +{{- if eq .type "volume"}} + - name: {{ .name | replace "." "-"}}-vol + secret: + {{- if eq .external true }} + secretName: {{ .name }} + {{- else if eq .external false }} + secretName: {{ .name}}-{{ $.Values.app }} + {{- end }} + {{- if eq (len .filePermission) 0 }} + {{- else }} + defaultMode: {{ .filePermission}} + {{- end }} +{{- end }} +{{- end }} +{{- end }} +{{- if and (eq (len .Values.volumes) 0) (or (eq (.Values.ConfigSecrets.enabled) true) (eq (.Values.ConfigMaps.enabled) true)) (eq ($hasCMVolumeExists) false) (eq ($hasSecretVolumeExists) false) (eq (.Values.appMetrics) false) }} []{{- end }} +{{- if and (eq (len .Values.volumes) 0) (eq (.Values.ConfigSecrets.enabled) false) (eq (.Values.ConfigMaps.enabled) false) (eq (.Values.appMetrics) false) }} []{{- end }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/configmap.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/configmap.yaml new file mode 100644 index 0000000000..ac7f15fafb --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/configmap.yaml @@ -0,0 +1,14 @@ +{{- if .Values.ConfigMaps.enabled }} + {{- range .Values.ConfigMaps.maps }} + {{if eq .external false}} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + creationTimestamp: 2019-08-12T18:38:34Z + name: {{ .name}}-{{ $.Values.app }} +data: +{{ toYaml .data | trim | indent 2 }} + {{- end}} + {{- end}} +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/cronjob.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/cronjob.yaml new file mode 100644 index 0000000000..e2d9ad1ae2 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/cronjob.yaml @@ -0,0 +1,44 @@ +{{- if eq .Values.kind "CronJob" }} +{{- if semverCompare "<1.21" .Capabilities.KubeVersion.GitVersion }} +apiVersion: batch/v1beta1 +{{- else }} +apiVersion: batch/v1 +{{- end }} +kind: CronJob +metadata: + name: {{ include ".Chart.Name .fullname" $ }} + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} + releaseVersion: {{ $.Values.releaseVersion | quote }} +spec: + {{- if $.Values.cronjobConfigs }} + {{- if $.Values.cronjobConfigs.timeZone }} + timeZone: {{ $.Values.cronjobConfigs.timeZone }} + {{- end }} + {{- if $.Values.cronjobConfigs.schedule }} + schedule: {{ $.Values.cronjobConfigs.schedule | quote }} + {{- end }} + {{- if $.Values.cronjobConfigs.startingDeadlineSeconds }} + startingDeadlineSeconds: {{ $.Values.cronjobConfigs.startingDeadlineSeconds }} + {{- end }} + {{- if $.Values.cronjobConfigs.concurrencyPolicy }} + concurrencyPolicy: {{ $.Values.cronjobConfigs.concurrencyPolicy }} + {{- end }} + {{- if semverCompare ">1.20" .Capabilities.KubeVersion.GitVersion }} + {{- if $.Values.cronjobConfigs.suspend }} + suspend: {{ $.Values.cronjobConfigs.suspend }} + {{- end }} + {{- end }} + {{- if $.Values.cronjobConfigs.successfulJobsHistoryLimit }} + successfulJobsHistoryLimit: {{ $.Values.cronjobConfigs.successfulJobsHistoryLimit }} + {{- end }} + {{- if $.Values.cronjobConfigs.failedJobsHistoryLimit }} + failedJobsHistoryLimit: {{ $.Values.cronjobConfigs.failedJobsHistoryLimit }} + {{- end }} + {{- end }} + jobTemplate: + spec: + {{- include "job-template-spec" . | indent 6 }} +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/externalsecrets.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/externalsecrets.yaml new file mode 100644 index 0000000000..efd291af5d --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/externalsecrets.yaml @@ -0,0 +1,76 @@ +{{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{if eq .external true }} + {{if (or (eq .externalType "ESO_GoogleSecretsManager") (eq .externalType "ESO_AWSSecretsManager") (eq .externalType "ESO_HashiCorpVault") (eq .externalType "ESO_AzureSecretsManager"))}} +{{- if .esoSecretData.secretStore }} +--- +apiVersion: external-secrets.io/v1beta1 +kind: SecretStore +metadata: + name: {{ .name}} + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} +spec: + provider: + {{- toYaml .esoSecretData.secretStore | nindent 4 }} +{{- end }} +--- +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: {{ .name }} + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} +spec: + {{- if .esoSecretData.refreshInterval }} + refreshInterval: {{ .esoSecretData.refreshInterval }} + {{- else }} + refreshInterval: 1h + {{- end}} + {{- if and .esoSecretData.secretStoreRef (not .esoSecretData.secretStore) }} + secretStoreRef: +{{ toYaml .esoSecretData.secretStoreRef | indent 4 }} + {{- else }} + secretStoreRef: + name: {{ .name}} + kind: SecretStore + {{- end }} + target: + name: {{ .name}} + {{- if .esoSecretData.template }} + template: + {{- toYaml .esoSecretData.template | nindent 6 }} + {{- end }} + creationPolicy: Owner + {{- if .esoSecretData.esoDataFrom }} + dataFrom: + {{- toYaml .esoSecretData.esoDataFrom | nindent 4 }} + {{- else }} + data: + {{- range .esoSecretData.esoData }} + - secretKey: {{ .secretKey }} + remoteRef: + key: {{ .key }} + {{- if .property }} + property: {{ .property }} + {{- end }} + {{- end}} +{{- end}} +{{- end}} +{{- end}} +{{- end}} +{{- end}} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/generic.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/generic.yaml new file mode 100644 index 0000000000..db95e84267 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/generic.yaml @@ -0,0 +1,4 @@ +{{- range .Values.rawYaml }} +--- +{{ toYaml . }} + {{- end -}} diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/job.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/job.yaml new file mode 100644 index 0000000000..e2762026e8 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/job.yaml @@ -0,0 +1,14 @@ +{{ if eq .Values.kind "Job" }} +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ include ".Chart.Name .fullname" $ }}-{{ $.Values.releaseVersion }} + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} + releaseVersion: {{ $.Values.releaseVersion | quote }} + pipelineName: {{ .Values.pipelineName }} +spec: + {{- include "job-template-spec" . | indent 2 }} +{{ end }} diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/keda-autoscaling.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/keda-autoscaling.yaml new file mode 100644 index 0000000000..7601b17910 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/keda-autoscaling.yaml @@ -0,0 +1,45 @@ +{{- if eq .Values.kind "ScaledJob" }} +apiVersion: keda.sh/v1alpha1 +kind: ScaledJob +metadata: + name: {{ template ".Chart.Name .fullname" $ }}-keda +spec: + {{- if $.Values.kedaAutoscaling.maxReplicaCount }} + maxReplicaCount: {{ $.Values.kedaAutoscaling.maxReplicaCount | default 1 }} + {{- end }} + {{- if $.Values.kedaAutoscaling.minReplicaCount }} + minReplicaCount: {{ $.Values.kedaAutoscaling.minReplicaCount | default 0 }} + {{- end }} + {{- if $.Values.kedaAutoscaling.pollingInterval }} + pollingInterval: {{ $.Values.kedaAutoscaling.pollingInterval | default 30 }} + {{- end }} + {{- if $.Values.kedaAutoscaling.scalingStrategy }} + scalingStrategy: +{{ toYaml $.Values.kedaAutoscaling.scalingStrategy | indent 4 }} + {{- end }} + {{- if $.Values.kedaAutoscaling.successfulJobsHistoryLimit }} + successfulJobsHistoryLimit: {{ $.Values.kedaAutoscaling.successfulJobsHistoryLimit | default 100 }} + {{- end }} + {{- if $.Values.kedaAutoscaling.rolloutStrategy }} + rolloutStrategy: {{ $.Values.kedaAutoscaling.rolloutStrategy }} + {{- end }} + {{- if $.Values.kedaAutoscaling.failedJobsHistoryLimit }} + failedJobsHistoryLimit: {{ $.Values.kedaAutoscaling.failedJobsHistoryLimit | default 100 }} + {{- end }} + {{- if $.Values.kedaAutoscaling.envSourceContainerName }} + envSourceContainerName: {{ $.Values.kedaAutoscaling.envSourceContainerName }} + {{- end }} + triggers: +{{ toYaml $.Values.kedaAutoscaling.triggers | indent 4 }} + jobTargetRef: +{{- include "job-template-spec" . | indent 4 }} +--- +{{- if $.Values.kedaAutoscaling.triggerAuthentication.enabled }} +apiVersion: keda.sh/v1alpha1 +kind: TriggerAuthentication +metadata: + name: {{ $.Values.kedaAutoscaling.triggerAuthentication.name }} +spec: +{{ toYaml $.Values.kedaAutoscaling.triggerAuthentication.spec | indent 2 }} +{{- end }} +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/metrics-service-monitor.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/metrics-service-monitor.yaml new file mode 100644 index 0000000000..9130dc2f80 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/metrics-service-monitor.yaml @@ -0,0 +1,30 @@ +{{- if $.Values.appMetrics -}} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template ".Chart.Name .fullname" $ }} + labels: + app: {{ template ".Chart.Name .name" . }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" . }} + release: {{ .Values.prometheus.release }} +spec: + jobLabel: {{ template ".Chart.Name .name" $ }} + endpoints: + - port: envoy-admin + interval: 30s + path: /stats/prometheus + selector: + matchLabels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + namespaceSelector: + matchNames: + - {{.Release.Namespace}} + podTargetLabels: + - appId + - envId + - rollouts-pod-template-hash +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/prometheusrules.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/prometheusrules.yaml new file mode 100644 index 0000000000..90f398bff4 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/prometheusrules.yaml @@ -0,0 +1,22 @@ +{{- if .Values.prometheusRule.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: {{ template ".Chart.Name .fullname" . }} + {{- if .Values.prometheusRule.namespace }} + namespace: {{ .Values.prometheusRule.namespace }} + {{- end }} + labels: + kind: Prometheus + chart: {{ template ".Chart.Name .chart" . }} + release: {{ .Values.prometheus.release }} + {{- if .Values.prometheusRule.additionalLabels }} +{{ toYaml .Values.prometheusRule.additionalLabels | indent 4 }} + {{- end }} +spec: + {{- with .Values.prometheusRule.rules }} + groups: + - name: {{ template ".Chart.Name .fullname" $ }} + rules: {{- toYaml . | nindent 6 }} + {{- end }} + {{- end }} diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/secret.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/secret.yaml new file mode 100644 index 0000000000..9a8ab67837 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/secret.yaml @@ -0,0 +1,57 @@ +{{- if $.Values.secret.enabled }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: app-secret +type: Opaque +data: +{{ toYaml $.Values.secret.data | indent 2 }} +{{- end }} + + +{{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{if eq .external false}} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ .name}}-{{ $.Values.app }} +type: Opaque +data: +{{ toYaml .data | trim | indent 2 }} +{{- end}} + {{if eq .external true }} + {{if (or (eq .externalType "AWSSecretsManager") (eq .externalType "AWSSystemManager") (eq .externalType "HashiCorpVault"))}} +--- +apiVersion: kubernetes-client.io/v1 +kind: ExternalSecret +metadata: + name: {{ .name}} +spec: + {{- if .roleARN }} + roleArn: .roleARN + {{- end}} + {{- if eq .externalType "AWSSecretsManager"}} + backendType: secretsManager + {{- end}} + {{- if eq .externalType "AWSSystemManager"}} + backendType: systemManager + {{- end}} + {{- if eq .externalType "HashiCorpVault"}} + backendType: vault + {{- end}} + data: + {{- range .secretData }} + - key: {{.key}} + name: {{.name}} + {{- if .property }} + property: {{.property}} + {{- end}} + isBinary: {{.isBinary}} + {{- end}} + {{- end}} + {{- end}} + {{- end}} + {{- end}} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/service.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/service.yaml new file mode 100644 index 0000000000..99ef805c7c --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/service.yaml @@ -0,0 +1,67 @@ +{{- if .Values.service.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ template ".servicename" . }} + labels: + app: {{ template ".Chart.Name .name" . }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" . }} + release: {{ .Release.Name }} +{{- if .Values.service.annotations }} + annotations: +{{ toYaml .Values.service.annotations | indent 4 }} +{{- end}} +spec: + type: {{ .Values.service.type | default "ClusterIP" }} + ports: + {{- range .Values.ContainerPort }} + {{- if .servicePort }} + - port: {{ .servicePort }} + {{- else }} + - port: {{ .port }} + {{- end }} + targetPort: {{ .name }} + protocol: TCP + name: {{ .name }} + {{- end }} + {{- if $.Values.appMetrics }} + - port: 9901 + name: envoy-admin + {{- end }} + selector: + app: {{ template ".Chart.Name .name" . }} +{{- if eq .Values.deploymentType "BLUE-GREEN" }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ template ".previewservicename" . }} + labels: + app: {{ template ".Chart.Name .name" . }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" . }} + release: {{ .Release.Name }} +spec: + type: ClusterIP + ports: + {{- range .Values.ContainerPort }} + {{- if .servicePort }} + - port: {{ .servicePort }} + {{- else }} + - port: {{ .port }} + {{- end }} + targetPort: {{ .name }} + protocol: TCP + name: {{ .name }} + {{- end }} + {{- if $.Values.appMetrics }} + - port: 9901 + name: envoy-admin + {{- end }} + selector: + app: {{ template ".Chart.Name .name" . }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/servicemonitor.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/servicemonitor.yaml new file mode 100644 index 0000000000..1f90c722cb --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/servicemonitor.yaml @@ -0,0 +1,48 @@ +{{ $serviceMonitorEnabled := include "serviceMonitorEnabled" . }} +{{- if eq "true" $serviceMonitorEnabled -}} +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template ".Chart.Name .fullname" . }}-sm + labels: + kind: Prometheus + app: {{ template ".Chart.Name .name" . }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" . }} + release: {{ .Values.prometheus.release }} + {{- if .Values.servicemonitor.additionalLabels }} +{{ toYaml .Values.servicemonitor.additionalLabels | indent 4 }} + {{- end }} +spec: + endpoints: + {{- range .Values.ContainerPort }} + {{- if .servicemonitor }} + {{- if .servicemonitor.enabled}} + {{- if .servicePort }} + - port: {{ .name }} + {{- if .servicemonitor.path }} + path: {{ .servicemonitor.path}} + {{- end }} + {{- if .servicemonitor.scheme }} + scheme: {{ .servicemonitor.scheme}} + {{- end }} + {{- if .servicemonitor.interval }} + interval: {{ .servicemonitor.interval}} + {{- end }} + {{- if .servicemonitor.scrapeTimeout }} + scrapeTimeout: {{ .servicemonitor.scrapeTimeout}} + {{- end }} + {{- if .servicemonitor.metricRelabelings}} + metricRelabelings: +{{toYaml .servicemonitor.metricRelabelings | indent 8 }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + selector: + matchLabels: + app: {{ template ".Chart.Name .name" $ }} +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/sidecar-configmap.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/sidecar-configmap.yaml new file mode 100644 index 0000000000..30dc74cbda --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/templates/sidecar-configmap.yaml @@ -0,0 +1,166 @@ +{{- if .Values.appMetrics }} +apiVersion: v1 +kind: ConfigMap +metadata: + creationTimestamp: 2019-08-12T18:38:34Z + name: sidecar-config-{{ template ".Chart.Name .name" $ }} +data: + envoy-config.json: | + { + "stats_config": { + "use_all_default_tags": false, + "stats_tags": [ + { + "tag_name": "cluster_name", + "regex": "^cluster\\.((.+?(\\..+?\\.svc\\.cluster\\.local)?)\\.)" + }, + { + "tag_name": "tcp_prefix", + "regex": "^tcp\\.((.*?)\\.)\\w+?$" + }, + { + "tag_name": "response_code", + "regex": "_rq(_(\\d{3}))$" + }, + { + "tag_name": "response_code_class", + "regex": ".*_rq(_(\\dxx))$" + }, + { + "tag_name": "http_conn_manager_listener_prefix", + "regex": "^listener(?=\\.).*?\\.http\\.(((?:[_.[:digit:]]*|[_\\[\\]aAbBcCdDeEfF[:digit:]]*))\\.)" + }, + { + "tag_name": "http_conn_manager_prefix", + "regex": "^http\\.(((?:[_.[:digit:]]*|[_\\[\\]aAbBcCdDeEfF[:digit:]]*))\\.)" + }, + { + "tag_name": "listener_address", + "regex": "^listener\\.(((?:[_.[:digit:]]*|[_\\[\\]aAbBcCdDeEfF[:digit:]]*))\\.)" + }, + { + "tag_name": "mongo_prefix", + "regex": "^mongo\\.(.+?)\\.(collection|cmd|cx_|op_|delays_|decoding_)(.*?)$" + } + ], + "stats_matcher": { + "inclusion_list": { + "patterns": [ + { + "regex": ".*_rq_\\dxx$" + }, + { + "regex": ".*_rq_time$" + }, + { + "regex": "cluster.*" + }, + ] + } + } + }, + "admin": { + "access_log_path": "/dev/null", + "address": { + "socket_address": { + "address": "0.0.0.0", + "port_value": 9901 + } + } + }, + "static_resources": { + "clusters": [ + {{- range $index, $element := .Values.ContainerPort }} + { + "name": "{{ $.Values.app }}-{{ $index }}", + "type": "STATIC", + "connect_timeout": "0.250s", + "lb_policy": "ROUND_ROBIN", +{{- if $element.idleTimeout }} + "common_http_protocol_options": { + "idle_timeout": {{ $element.idleTimeout | quote }} + }, +{{- end }} +{{- if or $element.useHTTP2 $element.useGRPC }} + "http2_protocol_options": {}, +{{- end }} +{{- if and (not $element.useGRPC) (not $element.supportStreaming) }} + "max_requests_per_connection": "1", +{{- end }} + "load_assignment": { + "cluster_name": "9", + "endpoints": { + "lb_endpoints": [ + { + "endpoint": { + "address": { + "socket_address": { + "protocol": "TCP", + "address": "127.0.0.1", + "port_value": {{ $element.port }} + } + } + } + } + ] + } + } + }, + {{- end }} + ], + "listeners":[ + {{- range $index, $element := .Values.ContainerPort }} + { + "address": { + "socket_address": { + "protocol": "TCP", + "address": "0.0.0.0", + "port_value": {{ $element.envoyPort | default (add 8790 $index) }} + } + }, + "filter_chains": [ + { + "filters": [ + { + "name": "envoy.filters.network.http_connection_manager", + "config": { + "codec_type": "AUTO", + "stat_prefix": "stats", + "route_config": { + "virtual_hosts": [ + { + "name": "backend", + "domains": [ + "*" + ], + "routes": [ + { + "match": { + "prefix": "/" + }, + "route": { +{{- if $element.supportStreaming }} + "timeout": "0s", +{{- end }} + "cluster": "{{ $.Values.app }}-{{ $index }}" + } + } + ] + } + ] + }, + "http_filters": { + "name": "envoy.filters.http.router" + } + } + } + ] + } + ] + }, + {{- end }} + ] + } + } +--- +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/test_values.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/test_values.yaml new file mode 100644 index 0000000000..199aeb6010 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/test_values.yaml @@ -0,0 +1,417 @@ +# Default values for myapp. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +kind: CronJob + +jobConfigs: + backoffLimit: 5 + activeDeadlineSeconds: 100 + parallelism: 1 + completions: 2 + suspend: false + ttlSecondsAfterFinished: 100 + +cronjobConfigs: + schedule: "* * * * *" + startingDeadlineSeconds: 100 + concurrencyPolicy: Allow + suspend: false + successfulJobsHistoryLimit: 3 + failedJobsHistoryLimit: 1 + restartPolicy: OnFailure + timeZone: "UTC" + +imagePullSecrets: + - test1 + - test2 +MinReadySeconds: 5 +MaxSurge: 1 +MaxUnavailable: 0 +GracePeriod: 30 +ContainerPort: + - name: app + port: 8080 + servicePort: 80 + envoyPort: 8799 + useHTTP2: true + supportStreaming: true + idleTimeout: 1800s + servicemonitor: + enabled: true + path: /abc + scheme: 'http' + interval: 30s + scrapeTimeout: 20s + metricRelabelings: + - sourceLabels: [namespace] + regex: '(.*)' + replacement: myapp + targetLabel: target_namespace + - name: app1 + port: 8090 + servicePort: 8080 + useGRPC: true + servicemonitor: + enabled: true + - name: app2 + port: 8091 + servicePort: 8081 + useGRPC: true + +pauseForSecondsBeforeSwitchActive: 30 +waitForSecondsBeforeScalingDown: 30 +autoPromotionSeconds: 30 + +Spec: + Affinity: + Key: + # Key: kops.k8s.io/instancegroup + Values: + + +image: + pullPolicy: IfNotPresent + +secret: + enabled: false + +service: + enabled: false + type: ClusterIP + # name: "1234567890123456789012345678901234567890123456789012345678901234567890" + annotations: {} + # test1: test2 + # test3: test4 + +server: + deployment: + image_tag: 1-95af053 + image: "" +deploymentType: "RECREATE" + + +EnvVariables: + - name: FLASK_ENV + value: qa + +prometheus: + release: monitoring + +servicemonitor: + additionalLabels: {} + +kedaAutoscaling: + envSourceContainerName: "" + minReplicaCount: 1 + maxReplicaCount: 2 + pollingInterval: 30 + successfulJobsHistoryLimit: 5 + failedJobsHistoryLimit: 5 + rolloutStrategy: default + scalingStrategy: + strategy: "custom" + customScalingQueueLengthDeduction: 1 + customScalingRunningJobPercentage: "0.5" + pendingPodConditions: + - "Ready" + - "PodScheduled" + - "AnyOtherCustomPodCondition" + multipleScalersCalculation : "max" + triggers: + - type: rabbitmq + metadata: + queueName: hello + host: RabbitMqHost + queueLength : '5' + authenticationRef: {} + triggerAuthentication: + enabled: true + name: "" + spec: {} + +prometheusRule: + enabled: true + additionalLabels: {} + namespace: "" + rules: + # These are just examples rules, please adapt them to your needs + - alert: TooMany500s + expr: 100 * ( sum( nginx_ingress_controller_requests{status=~"5.+"} ) / sum(nginx_ingress_controller_requests) ) > 5 + for: 1m + labels: + severity: critical + annotations: + description: Too many 5XXs + summary: More than 5% of the all requests did return 5XX, this require your attention + - alert: TooMany400s + expr: 100 * ( sum( nginx_ingress_controller_requests{status=~"4.+"} ) / sum(nginx_ingress_controller_requests) ) > 5 + for: 1m + labels: + severity: critical + annotations: + description: Too many 4XXs + summary: More than 5% of the all requests did return 4XX, this require your attention + +command: + enabled: true + value: + - /bin/sh + +args: + enabled: false + value: [] + +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: 1 + memory: 200Mi + requests: + cpu: 0.10 + memory: 100Mi +volumeMounts: + - name: log-volume + mountPath: /var/log + +volumes: + - name: log-volume + emptyDir: {} + + +nodeSelector: {} + + +#used for deployment algo selection +orchestrator.deploymant.algo: 1 + +ConfigMaps: + enabled: false + # maps: + # - name: config-map-1 + # type: environment + # external: false + # data: + # key1: key1value-1 + # key2: key2value-1 + # key3: key3value-1 + # - name: config-map-2 + # type: volume + # external: false + # mountPath: /etc/config/2 + # subPath: false + # filePermission: "777" + # data: + # key1: | + # club : manchester utd + # nation : england + # key2: abc-2 + # key3: abc-2 + # - name: config-map-3 + # type: environment + # external: true + # mountPath: /etc/config/3 + # data: [] + # - name: config-map-4 + # type: volume + # external: true + # mountPath: /etc/config/4 + # data: [] +ConfigSecrets: + enabled: true + secrets: + - name: config-secret-1 + type: environment + external: true + externalType: ESO_AWSSecretsManager + esoSecretData: + secretStoreRef: + kind: ClusteSecret + name: test-secret + aws: + service: SecretsManager + region: us-east-1 + auth: + secretRef: + accessKeyIDSecretRef: + name: awssm-secret + key: access-key + secretAccessKeySecretRef: + name: awssm-secret + key: secret-access-key + esoData: + - secretKey: prod-mysql-password + key: secrets/prod-mysql-secrets + property: prodPassword + - secretKey: prod-mysql-password + key: secrets/prod-mysql-secrets + property: prodPassword + - secretKey: prod-mysql-password + key: secrets/prod-mysql-secrets + property: prodPassword + - secretKey: prod-mysql-password + key: secrets/prod-mysql-secrets + property: prodPassword + data: + key1: key1value-1 + key2: key2value-1 + key3: key3value-1 + # - name: config-secret-1 + # type: environment + # external: false + # data: + # key1: key1value-1 + # key2: key2value-1 + # key3: key3value-1 + # - name: config-secret-2x + # type: volume + # external: false + # mountPath: /etc/config/2 + # subPath: false + # filePermission: "777" + # data: + # key1: | + # club : manchester utd + # nation : england + # key2: abc-2 + # key3: abc-2 + + +initContainers: + ## Additional init containers to run before the Scheduler pods. + ## for example, be used to run a sidecar that chown Logs storage. + ## If reuse container image is set as true, you cannot specify an addition init container along with the image. + # - reuseContainerImage: true + # volumeMounts: + # - mountPath: /etc/ls-oms + # name: ls-oms-cm-vol + # command: + # - flyway + # - -configFiles=/etc/ls-oms/flyway.conf + # - migrate + + # - name: volume-mount-hack + # image: busybox + # command: ["sh", "-c", "chown -R 1000:1000 logs"] + # volumeMounts: + # - mountPath: /usr/local/airflow/logs + # name: logs-data + # resources: + # limits: + # cpu: 50m + # memory: 100Mi + # requests: + # cpu: 10m + # memory: 50Mi + - name: volume-mount-hack2 + image: busybox + command: ["sh", "-c", "chown -R 1000:1000 logs"] + volumeMounts: + - mountPath: /usr/local/airflow/logs + name: logs-data + resources: + limits: + cpu: 50m + memory: 100Mi + requests: + cpu: 10m + memory: 50Mi + +containers: + ## Additional init containers to run before the Scheduler pods. + ## for example, be used to run a sidecar that chown Logs storage . + # - name: volume-mount-hack + # image: busybox + # command: ["sh", "-c", "chown -R 1000:1000 logs"] + # volumeMounts: + # - mountPath: /usr/local/airflow/logs + # name: logs-data + + +rawYaml: [] +# - apiVersion: v1 +# kind: Service +# metadata: +# annotations: +# labels: +# app: sample-metrics-app +# name: sample-metrics-app +# namespace: default +# spec: +# ports: +# - name: web +# port: 80 +# protocol: TCP +# targetPort: 8080 +# selector: +# app: sample-metrics-app +# sessionAffinity: None +# type: ClusterIP +# - apiVersion: v1 +# kind: Service +# metadata: +# annotations: +# labels: +# app: sample-metrics-app +# name: sample-metrics-app +# namespace: default +# spec: +# ports: +# - name: web +# port: 80 +# protocol: TCP +# targetPort: 8080 +# selector: +# app: sample-metrics-app +# sessionAffinity: None +# type: ClusterIP + +# If you need to provide some extra specs for main container which are not included by default in deployment template +# then provide them here +containerExtraSpecs: + container: "extraspec" + demokey: "demovalue" + +# If you need to provide some extra specs for pod which are not included by default in deployment template +# then provide them here +podExtraSpecs: + pod: "extraspec" + demokey: "demovalue" + +podDisruptionBudget: {} + # minAvailable: 1 + # maxUnavailable: 1 + + ## Node tolerations for server scheduling to nodes with taints + ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ +## + +tolerations: [] + # - key: "key" + # operator: "Equal|Exists" + # value: "value" + # effect: "NoSchedule|PreferNoSchedule|NoExecute(1.6 only)" + +appMetrics: false + +podAnnotations: + fluentbit.io/exclude: true + +podLabels: + severity: critical + +containerSecurityContext: + allowPrivilegeEscalation: false + capabilities: + add: + - SYS_PTRACE + + +podSecurityContext: + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 2000 + +shareProcessNamespace: true diff --git a/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/values.yaml b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/values.yaml new file mode 100644 index 0000000000..690d141c32 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/values.yaml @@ -0,0 +1,325 @@ +# Default values for myapp. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +MinReadySeconds: 5 +MaxSurge: 1 +MaxUnavailable: 0 +GracePeriod: 30 +ContainerPort: + - name: app + port: 8080 + servicePort: 80 + envoyPort: 8799 + useHTTP2: true + supportStreaming: true + idleTimeout: 1800s +# servicemonitor: +# enabled: true +# path: /abc +# scheme: 'http' +# interval: 30s +# scrapeTimeout: 20s +# metricRelabelings: +# - sourceLabels: [namespace] +# regex: '(.*)' +# replacement: myapp +# targetLabel: target_namespace + + # - name: app1 + # port: 8090 + # servicePort: 8080 + # useGRPC: true + +pauseForSecondsBeforeSwitchActive: 30 +waitForSecondsBeforeScalingDown: 30 +autoPromotionSeconds: 30 +shareProcessNamespace: false +setHostnameAsFQDN: false +readinessGates: [] +ephemeralContainers: [] +topologySpreadConstraints: [] + # - maxSkew: 1 + # topologyKey: zone + # whenUnsatisfiable: DoNotSchedule + # autoLabelSelector: true + # customLabelSelector: + # foo: bar + +podSpec: {} + # subdomain: "" + # setHostnameAsFQDN: "" + # schedulerName: "" + # readinessGates: + # - conditionType: "www.example.com/feature-1" + # dnsPolicy: "" + # enableServiceLinks: false + # dnsConfig: {} + +Spec: + Affinity: + Key: +# Key: kops.k8s.io/instancegroup + Values: + +restartPolicy: OnFailure + +image: + pullPolicy: IfNotPresent + +secret: + enabled: false + +service: + type: ClusterIP + enabled: false +# name: "1234567890123456789012345678901234567890123456789012345678901234567890" + annotations: {} + # test1: test2 + # test3: test4 + +server: + deployment: + image_tag: 1-95af053 + image: "" + + +EnvVariables: [] + # - name: FLASK_ENV + # value: qa + +EnvVariablesFromFieldPath: [] +# - name: POD_NAME +# fieldPath: metadata.name + +prometheus: + release: monitoring + +servicemonitor: + additionalLabels: {} + + +prometheusRule: + enabled: false + additionalLabels: {} + namespace: "" +# rules: +# # These are just examples rules, please adapt them to your needs +# - alert: TooMany500s +# expr: 100 * ( sum( nginx_ingress_controller_requests{status=~"5.+"} ) / sum(nginx_ingress_controller_requests) ) > 5 +# for: 1m +# labels: +# severity: critical +# annotations: +# description: Too many 5XXs +# summary: More than 5% of the all requests did return 5XX, this require your attention +# - alert: TooMany400s +# expr: 100 * ( sum( nginx_ingress_controller_requests{status=~"4.+"} ) / sum(nginx_ingress_controller_requests) ) > 5 +# for: 1m +# labels: +# severity: critical +# annotations: +# description: Too many 4XXs +# summary: More than 5% of the all requests did return 4XX, this require your attention +# + +command: + enabled: false + value: [] + +args: + enabled: false + value: [] + +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: 1 + memory: 200Mi + requests: + cpu: 0.10 + memory: 100Mi + +volumeMounts: [] +# - name: log-volume +# mountPath: /var/log + +volumes: [] +# - name: log-volume +# emptyDir: {} + + +nodeSelector: {} + + +#used for deployment algo selection +orchestrator.deploymant.algo: 1 + +ConfigMaps: + enabled: false + maps: [] +# - name: config-map-1 +# type: environment +# external: false +# data: +# key1: key1value-1 +# key2: key2value-1 +# key3: key3value-1 +# - name: config-map-2 +# type: volume +# external: false +# mountPath: /etc/config/2 +# data: +# key1: | +# club : manchester utd +# nation : england +# key2: abc-2 +# key3: abc-2 +# - name: config-map-3 +# type: environment +# external: true +# mountPath: /etc/config/3 +# data: [] +# - name: config-map-4 +# type: volume +# external: true +# mountPath: /etc/config/4 +# data: [] + + +ConfigSecrets: + enabled: false + secrets: [] +# - name: config-secret-1 +# type: environment +# external: false +# data: +# key1: key1value-1 +# key2: key2value-1 +# key3: key3value-1 +# - name: config-secret-2 +# type: volume +# external: false +# mountPath: /etc/config/2 +# data: +# key1: | +# club : manchester utd +# nation : england +# key2: abc-2 + + +initContainers: [] + ## Additional init containers to run before the Scheduler pods. + ## for example, be used to run a sidecar that chown Logs storage . + #- name: volume-mount-hack + # image: busybox + # command: ["sh", "-c", "chown -R 1000:1000 logs"] + # volumeMounts: + # - mountPath: /usr/local/airflow/logs + # name: logs-data + ## Uncomment below line ONLY IF you want to reuse the container image. + ## This will assign your application's docker image to init container. + # reuseContainerImage: true + +containers: [] + ## Additional init containers to run before the Scheduler pods. + ## for example, be used to run a sidecar that chown Logs storage . + #- name: volume-mount-hack + # image: busybox + # command: ["sh", "-c", "chown -R 1000:1000 logs"] + # volumeMounts: + # - mountPath: /usr/local/airflow/logs + # name: logs-data + +podExtraSpecs: {} +containerExtraSpecs: {} + +kedaAutoscaling: {} + # envSourceContainerName: "" + # minReplicaCount: 1 + # maxReplicaCount: 2 + # pollingInterval: 30 + # successfulJobsHistoryLimit: 5 + # failedJobsHistoryLimit: 5 + # rolloutStrategy: default + # scalingStrategy: + # strategy: "custom" + # customScalingQueueLengthDeduction: 1 + # customScalingRunningJobPercentage: "0.5" + # pendingPodConditions: + # - "Ready" + # - "PodScheduled" + # - "AnyOtherCustomPodCondition" + # multipleScalersCalculation : "max" + # triggers: + # - type: rabbitmq + # metadata: + # queueName: hello + # host: RabbitMqHost + # queueLength : '5' + # authenticationRef: {} + # triggerAuthentication: + # enabled: false + # name: "" + # spec: {} + +rawYaml: [] +# - apiVersion: v1 +# kind: Service +# metadata: +# annotations: +# labels: +# app: sample-metrics-app +# name: sample-metrics-app +# namespace: default +# spec: +# ports: +# - name: web +# port: 80 +# protocol: TCP +# targetPort: 8080 +# selector: +# app: sample-metrics-app +# sessionAffinity: None +# type: ClusterIP +# - apiVersion: v1 +# kind: Service +# metadata: +# annotations: +# labels: +# app: sample-metrics-app +# name: sample-metrics-app +# namespace: default +# spec: +# ports: +# - name: web +# port: 80 +# protocol: TCP +# targetPort: 8080 +# selector: +# app: sample-metrics-app +# sessionAffinity: None +# type: ClusterIP + +podDisruptionBudget: {} +# minAvailable: 1 +# maxUnavailable: 1 + + ## Node tolerations for server scheduling to nodes with taints + ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + ## + +tolerations: [] + # - key: "key" + # operator: "Equal|Exists" + # value: "value" + # effect: "NoSchedule|PreferNoSchedule|NoExecute(1.6 only)" + +imagePullSecrets: [] + # - test1 + # - test2 + +persistentVolumeClaim: {} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/.helmignore b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/.helmignore new file mode 100644 index 0000000000..50af031725 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/.helmignore @@ -0,0 +1,22 @@ +# 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 +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/.image_descriptor_template.json b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/.image_descriptor_template.json new file mode 100644 index 0000000000..8a99a95664 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/.image_descriptor_template.json @@ -0,0 +1 @@ +{"server":{"deployment":{"image_tag":"{{.Tag}}","image":"{{.Name}}"}},"pipelineName": "{{.PipelineName}}","releaseVersion":"{{.ReleaseVersion}}","deploymentType": "{{.DeploymentType}}", "app": "{{.App}}", "env": "{{.Env}}", "appMetrics": {{.AppMetrics}}} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/Chart.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/Chart.yaml new file mode 100644 index 0000000000..c645c79172 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for Kubernetes +name: gpu-workload-4-21-0 +version: 4.21.0 diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/README.md b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/README.md new file mode 100644 index 0000000000..07f18f2885 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/README.md @@ -0,0 +1,991 @@ + +# Deployment Chart - v4.21.0 + +## 1. Yaml File - + +### Container Ports + +This defines ports on which application services will be exposed to other services + +```yaml +ContainerPort: + - envoyPort: 8799 + idleTimeout: + name: app + port: 8080 + servicePort: 80 + nodePort: 32056 + supportStreaming: true + useHTTP2: true + protocol: TCP +``` + +| Key | Description | +| :--- | :--- | +| `envoyPort` | envoy port for the container. | +| `idleTimeout` | the duration of time that a connection is idle before the connection is terminated. | +| `name` | name of the port. | +| `port` | port for the container. | +| `servicePort` | port of the corresponding kubernetes service. | +| `nodePort` | nodeport of the corresponding kubernetes service. | +| `supportStreaming` | Used for high performance protocols like grpc where timeout needs to be disabled. | +| `useHTTP2` | Envoy container can accept HTTP2 requests. | +| `protocol` | Protocol for port. Must be UDP, TCP, or SCTP. Defaults to "TCP"| + +### EnvVariables +```yaml +EnvVariables: [] +``` +To set environment variables for the containers that run in the Pod. +### EnvVariablesFromSecretKeys +```yaml +EnvVariablesFromSecretKeys: + - name: ENV_NAME + secretName: SECRET_NAME + keyName: SECRET_KEY + +``` + It is use to get the name of Environment Variable name, Secret name and the Key name from which we are using the value in that corresponding Environment Variable. + + ### EnvVariablesFromConfigMapKeys +```yaml +EnvVariablesFromConfigMapKeys: + - name: ENV_NAME + configMapName: CONFIG_MAP_NAME + keyName: CONFIG_MAP_KEY + +``` + It is use to get the name of Environment Variable name, Config Map name and the Key name from which we are using the value in that corresponding Environment Variable. + +### Liveness Probe + +If this check fails, kubernetes restarts the pod. This should return error code in case of non-recoverable error. + +```yaml +LivenessProbe: + Path: "" + port: 8080 + initialDelaySeconds: 20 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + failureThreshold: 3 + httpHeaders: + - name: Custom-Header + value: abc + scheme: "" + tcp: true + grpc: + port: 8080 + service: "" +``` + +| Key | Description | +| :--- | :--- | +| `Path` | It define the path where the liveness needs to be checked. | +| `initialDelaySeconds` | It defines the time to wait before a given container is checked for liveliness. | +| `periodSeconds` | It defines the time to check a given container for liveness. | +| `successThreshold` | It defines the number of successes required before a given container is said to fulfil the liveness probe. | +| `timeoutSeconds` | It defines the time for checking timeout. | +| `failureThreshold` | It defines the maximum number of failures that are acceptable before a given container is not considered as live. | +| `httpHeaders` | Custom headers to set in the request. HTTP allows repeated headers,You can override the default headers by defining .httpHeaders for the probe. | +| `scheme` | Scheme to use for connecting to the host (HTTP or HTTPS). Defaults to HTTP. +| `tcp` | The kubelet will attempt to open a socket to your container on the specified port. If it can establish a connection, the container is considered healthy. | +| `grpc` | GRPC specifies an action involving a GRPC port. Port is a required field if using gRPC service for health probes. Number must be in the range 1 to 65535. Service (optional) is the name of the service to place in the gRPC HealthCheckRequest. | + + + +### MaxUnavailable + +```yaml + MaxUnavailable: 0 +``` +The maximum number of pods that can be unavailable during the update process. The value of "MaxUnavailable: " can be an absolute number or percentage of the replicas count. The default value of "MaxUnavailable: " is 25%. + +### MaxSurge + +```yaml +MaxSurge: 1 +``` +The maximum number of pods that can be created over the desired number of pods. For "MaxSurge: " also, the value can be an absolute number or percentage of the replicas count. +The default value of "MaxSurge: " is 25%. + +### Min Ready Seconds + +```yaml +MinReadySeconds: 60 +``` +This specifies the minimum number of seconds for which a newly created Pod should be ready without any of its containers crashing, for it to be considered available. This defaults to 0 (the Pod will be considered available as soon as it is ready). + +### Readiness Probe + +If this check fails, kubernetes stops sending traffic to the application. This should return error code in case of errors which can be recovered from if traffic is stopped. + +```yaml +ReadinessProbe: + Path: "" + port: 8080 + initialDelaySeconds: 20 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + failureThreshold: 3 + httpHeaders: + - name: Custom-Header + value: abc + scheme: "" + tcp: true + grpc: + port: 8080 + service: "" +``` + +| Key | Description | +| :--- | :--- | +| `Path` | It define the path where the readiness needs to be checked. | +| `initialDelaySeconds` | It defines the time to wait before a given container is checked for readiness. | +| `periodSeconds` | It defines the time to check a given container for readiness. | +| `successThreshold` | It defines the number of successes required before a given container is said to fulfill the readiness probe. | +| `timeoutSeconds` | It defines the time for checking timeout. | +| `failureThreshold` | It defines the maximum number of failures that are acceptable before a given container is not considered as ready. | +| `httpHeaders` | Custom headers to set in the request. HTTP allows repeated headers,You can override the default headers by defining .httpHeaders for the probe. | +| `scheme` | Scheme to use for connecting to the host (HTTP or HTTPS). Defaults to HTTP. +| `tcp` | The kubelet will attempt to open a socket to your container on the specified port. If it can establish a connection, the container is considered healthy. | +| `grpc` | GRPC specifies an action involving a GRPC port. Port is a required field if using gRPC service for health probes. Number must be in the range 1 to 65535. Service (optional) is the name of the service to place in the gRPC HealthCheckRequest. | + + +### Pod Disruption Budget + +You can create `PodDisruptionBudget` for each application. A PDB limits the number of pods of a replicated application that are down simultaneously from voluntary disruptions. For example, an application would like to ensure the number of replicas running is never brought below the certain number. + +```yaml +podDisruptionBudget: + minAvailable: 1 +``` + +or + +```yaml +podDisruptionBudget: + maxUnavailable: 50% +``` + +You can specify either `maxUnavailable` or `minAvailable` in a PodDisruptionBudget and it can be expressed as integers or as a percentage + +| Key | Description | +| :--- | :--- | +| `minAvailable` | Evictions are allowed as long as they leave behind 1 or more healthy pods of the total number of desired replicas. | +| `maxUnavailable` | Evictions are allowed as long as at most 1 unhealthy replica among the total number of desired replicas. | + +### Ambassador Mappings + +You can create ambassador mappings to access your applications from outside the cluster. At its core a Mapping resource maps a resource to a service. + +```yaml +ambassadorMapping: + ambassadorId: "prod-emissary" + cors: {} + enabled: true + hostname: devtron.example.com + labels: {} + prefix: / + retryPolicy: {} + rewrite: "" + tls: + context: "devtron-tls-context" + create: false + hosts: [] + secretName: "" +``` + +| Key | Description | +| :--- | :--- | +| `enabled` | Set true to enable ambassador mapping else set false.| +| `ambassadorId` | used to specify id for specific ambassador mappings controller. | +| `cors` | used to specify cors policy to access host for this mapping. | +| `weight` | used to specify weight for canary ambassador mappings. | +| `hostname` | used to specify hostname for ambassador mapping. | +| `prefix` | used to specify path for ambassador mapping. | +| `labels` | used to provide custom labels for ambassador mapping. | +| `retryPolicy` | used to specify retry policy for ambassador mapping. | +| `corsPolicy` | Provide cors headers on flagger resource. | +| `rewrite` | used to specify whether to redirect the path of this mapping and where. | +| `tls` | used to create or define ambassador TLSContext resource. | +| `extraSpec` | used to provide extra spec values which not present in deployment template for ambassador resource. | + +### Autoscaling + +This is connected to HPA and controls scaling up and down in response to request load. + +```yaml +autoscaling: + enabled: false + MinReplicas: 1 + MaxReplicas: 2 + TargetCPUUtilizationPercentage: 90 + TargetMemoryUtilizationPercentage: 80 + containerResource: + enabled: true + TargetCPUUtilizationPercentage: 90 + TargetMemoryUtilizationPercentage: 80 + + extraMetrics: [] +``` + +| Key | Description | +| :--- | :--- | +| `enabled` | Set true to enable autoscaling else set false.| +| `MinReplicas` | Minimum number of replicas allowed for scaling. | +| `MaxReplicas` | Maximum number of replicas allowed for scaling. | +| `TargetCPUUtilizationPercentage` | The target CPU utilization that is expected for a container. | +| `TargetMemoryUtilizationPercentage` | The target memory utilization that is expected for a container. | +| `extraMetrics` | Used to give external metrics for autoscaling. | +| `containerResource` | Used to scale resource as per container resource. | + +### Flagger + +You can use flagger for canary releases with deployment objects. It supports flexible traffic routing with istio service mesh as well. + +```yaml +flaggerCanary: + addOtherGateways: [] + addOtherHosts: [] + analysis: + interval: 15s + maxWeight: 50 + stepWeight: 5 + threshold: 5 + annotations: {} + appProtocol: http + corsPolicy: + allowCredentials: false + allowHeaders: + - x-some-header + allowMethods: + - GET + allowOrigin: + - example.com + maxAge: 24h + createIstioGateway: + annotations: {} + enabled: false + host: example.com + labels: {} + tls: + enabled: false + secretName: example-tls-secret + enabled: false + gatewayRefs: null + headers: + request: + add: + x-some-header: value + labels: {} + loadtest: + enabled: true + url: http://flagger-loadtester.istio-system/ + match: + - uri: + prefix: / + port: 8080 + portDiscovery: true + retries: null + rewriteUri: / + targetPort: 8080 + thresholds: + latency: 500 + successRate: 90 + timeout: null +``` + +| Key | Description | +| :--- | :--- | +| `enabled` | Set true to enable canary releases using flagger else set false.| +| `addOtherGateways` | To provide multiple istio gateways for flagger. | +| `addOtherHosts` | Add multiple hosts for istio service mesh with flagger. | +| `analysis` | Define how the canary release should progresss and at what interval. | +| `annotations` | Annotation to add on flagger resource. | +| `labels` | Labels to add on flagger resource. | +| `appProtocol` | Protocol to use for canary. | +| `corsPolicy` | Provide cors headers on flagger resource. | +| `createIstioGateway` | Set to true if you want to create istio gateway as well with flagger. | +| `headers` | Add headers if any. | +| `loadtest` | Enable load testing for your canary release. | + + + +### Fullname Override + +```yaml +fullnameOverride: app-name +``` +`fullnameOverride` replaces the release fullname created by default by devtron, which is used to construct Kubernetes object names. By default, devtron uses {app-name}-{environment-name} as release fullname. + +### Image + +```yaml +image: + pullPolicy: IfNotPresent +``` + +Image is used to access images in kubernetes, pullpolicy is used to define the instances calling the image, here the image is pulled when the image is not present,it can also be set as "Always". + +### imagePullSecrets + +`imagePullSecrets` contains the docker credentials that are used for accessing a registry. + +```yaml +imagePullSecrets: + - regcred +``` +regcred is the secret that contains the docker credentials that are used for accessing a registry. Devtron will not create this secret automatically, you'll have to create this secret using dt-secrets helm chart in the App store or create one using kubectl. You can follow this documentation Pull an Image from a Private Registry [https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) . + +### Ingress + +This allows public access to the url, please ensure you are using right nginx annotation for nginx class, its default value is nginx + +```yaml +ingress: + enabled: false + # For K8s 1.19 and above use ingressClassName instead of annotation kubernetes.io/ingress.class: + className: nginx + annotations: {} + hosts: + - host: example1.com + paths: + - /example + - host: example2.com + paths: + - /example2 + - /example2/healthz + tls: [] +``` +Legacy deployment-template ingress format + +```yaml +ingress: + enabled: false + # For K8s 1.19 and above use ingressClassName instead of annotation kubernetes.io/ingress.class: + ingressClassName: nginx-internal + annotations: {} + path: "" + host: "" + tls: [] +``` + +| Key | Description | +| :--- | :--- | +| `enabled` | Enable or disable ingress | +| `annotations` | To configure some options depending on the Ingress controller | +| `path` | Path name | +| `host` | Host name | +| `tls` | It contains security details | + +### Ingress Internal + +This allows private access to the url, please ensure you are using right nginx annotation for nginx class, its default value is nginx + +```yaml +ingressInternal: + enabled: false + # For K8s 1.19 and above use ingressClassName instead of annotation kubernetes.io/ingress.class: + ingressClassName: nginx-internal + annotations: {} + hosts: + - host: example1.com + paths: + - /example + - host: example2.com + paths: + - /example2 + - /example2/healthz + tls: [] +``` + +| Key | Description | +| :--- | :--- | +| `enabled` | Enable or disable ingress | +| `annotations` | To configure some options depending on the Ingress controller | +| `path` | Path name | +| `host` | Host name | +| `tls` | It contains security details | + +### additionalBackends + +This defines additional backend path in the ingress . + +```yaml + hosts: + - host: chart-example2.local + pathType: "ImplementationSpecific" + paths: + - /example2 + - /example2/healthz + additionalBackends: + - path: /example1 + pathType: "ImplementationSpecific" + backend: + service: + name: test-service + port: + number: 80 +``` + +### Init Containers +```yaml +initContainers: + - reuseContainerImage: true + securityContext: + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 2000 + volumeMounts: + - mountPath: /etc/ls-oms + name: ls-oms-cm-vol + args: + - sleep 300 + command: + - flyway + - -configFiles=/etc/ls-oms/flyway.conf + - migrate + + - name: nginx + image: nginx:1.14.2 + securityContext: + privileged: true + ports: + - containerPort: 80 + command: ["/usr/local/bin/nginx"] + args: ["-g", "daemon off;"] +``` +Specialized containers that run before app containers in a Pod. Init containers can contain utilities or setup scripts not present in an app image. One can use base image inside initContainer by setting the reuseContainerImage flag to `true`. + +### Istio + +Istio is a service mesh which simplifies observability, traffic management, security and much more with it's virtual services and gateways. + +```yaml +istio: + enable: true + gateway: + annotations: {} + enabled: false + host: example.com + labels: {} + tls: + enabled: false + secretName: example-tls-secret + virtualService: + annotations: {} + enabled: false + gateways: [] + hosts: [] + http: + - corsPolicy: + allowCredentials: false + allowHeaders: + - x-some-header + allowMethods: + - GET + allowOrigin: + - example.com + maxAge: 24h + headers: + request: + add: + x-some-header: value + match: + - uri: + prefix: /v1 + - uri: + prefix: /v2 + retries: + attempts: 2 + perTryTimeout: 3s + rewriteUri: / + route: + - destination: + host: service1 + port: 80 + timeout: 12s + - route: + - destination: + host: service2 + labels: {} +``` + +### Pause For Seconds Before Switch Active +```yaml +pauseForSecondsBeforeSwitchActive: 30 +``` +To wait for given period of time before switch active the container. + +### Resources + +These define minimum and maximum RAM and CPU available to the application. + +```yaml +resources: + limits: + cpu: "1" + memory: "200Mi" + requests: + cpu: "0.10" + memory: "100Mi" +``` + +Resources are required to set CPU and memory usage. + +#### Limits + +Limits make sure a container never goes above a certain value. The container is only allowed to go up to the limit, and then it is restricted. + +#### Requests + +Requests are what the container is guaranteed to get. + +### Service + +This defines annotations and the type of service, optionally can define name also. + +Supports "ClientIP" and "None". Used to maintain session affinity. Enable + client IP based session affinity. + +```yaml + service: + type: ClusterIP + annotations: {} + sessionAffinity: + enabled: true + sessionAffinityConfig: {} +``` + +### Volumes + +```yaml +volumes: + - name: log-volume + emptyDir: {} + - name: logpv + persistentVolumeClaim: + claimName: logpvc +``` + +It is required when some values need to be read from or written to an external disk. + +### Volume Mounts + +```yaml +volumeMounts: + - mountPath: /var/log/nginx/ + name: log-volume + - mountPath: /mnt/logs + name: logpvc + subPath: employee +``` + +It is used to provide mounts to the volume. + +### Affinity and anti-affinity + +```yaml +Spec: + Affinity: + Key: + Values: +``` + +Spec is used to define the desire state of the given container. + +Node Affinity allows you to constrain which nodes your pod is eligible to schedule on, based on labels of the node. + +Inter-pod affinity allow you to constrain which nodes your pod is eligible to be scheduled based on labels on pods. + +#### Key + +Key part of the label for node selection, this should be same as that on node. Please confirm with devops team. + +#### Values + +Value part of the label for node selection, this should be same as that on node. Please confirm with devops team. + +### Tolerations + +```yaml +tolerations: + - key: "key" + operator: "Equal" + value: "value" + effect: "NoSchedule|PreferNoSchedule|NoExecute(1.6 only)" +``` + +Taints are the opposite, they allow a node to repel a set of pods. + +A given pod can access the given node and avoid the given taint only if the given pod satisfies a given taint. + +Taints and tolerations are a mechanism which work together that allows you to ensure that pods are not placed on inappropriate nodes. Taints are added to nodes, while tolerations are defined in the pod specification. When you taint a node, it will repel all the pods except those that have a toleration for that taint. A node can have one or many taints associated with it. + +### Arguments + +```yaml +args: + enabled: false + value: [] +``` + +This is used to give arguments to command. + +### Command + +```yaml +command: + enabled: false + value: [] +``` + +It contains the commands for the server. + +| Key | Description | +| :--- | :--- | +| `enabled` | To enable or disable the command. | +| `value` | It contains the commands. | + + +### Containers +Containers section can be used to run side-car containers along with your main container within same pod. Containers running within same pod can share volumes and IP Address and can address each other @localhost. We can use base image inside container by setting the reuseContainerImage flag to `true`. + +```yaml + containers: + - name: nginx + image: nginx:1.14.2 + ports: + - containerPort: 80 + command: ["/usr/local/bin/nginx"] + args: ["-g", "daemon off;"] + - reuseContainerImage: true + securityContext: + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 2000 + volumeMounts: + - mountPath: /etc/ls-oms + name: ls-oms-cm-vol + command: + - flyway + - -configFiles=/etc/ls-oms/flyway.conf + - migrate +``` + +### Prometheus + +```yaml + prometheus: + release: monitoring +``` + +It is a kubernetes monitoring tool and the name of the file to be monitored as monitoring in the given case.It describes the state of the prometheus. + +### rawYaml + +```yaml +rawYaml: + - apiVersion: v1 + kind: Service + metadata: + name: my-service + spec: + selector: + app: MyApp + ports: + - protocol: TCP + port: 80 + targetPort: 9376 + type: ClusterIP +``` +Accepts an array of Kubernetes objects. You can specify any kubernetes yaml here and it will be applied when your app gets deployed. + +### Grace Period + +```yaml +GracePeriod: 30 +``` +Kubernetes waits for the specified time called the termination grace period before terminating the pods. By default, this is 30 seconds. If your pod usually takes longer than 30 seconds to shut down gracefully, make sure you increase the `GracePeriod`. + +A Graceful termination in practice means that your application needs to handle the SIGTERM message and begin shutting down when it receives it. This means saving all data that needs to be saved, closing down network connections, finishing any work that is left, and other similar tasks. + +There are many reasons why Kubernetes might terminate a perfectly healthy container. If you update your deployment with a rolling update, Kubernetes slowly terminates old pods while spinning up new ones. If you drain a node, Kubernetes terminates all pods on that node. If a node runs out of resources, Kubernetes terminates pods to free those resources. It’s important that your application handle termination gracefully so that there is minimal impact on the end user and the time-to-recovery is as fast as possible. + + +### Server + +```yaml +server: + deployment: + image_tag: 1-95a53 + image: "" +``` + +It is used for providing server configurations. + +#### Deployment + +It gives the details for deployment. + +| Key | Description | +| :--- | :--- | +| `image_tag` | It is the image tag | +| `image` | It is the URL of the image | + +### Service Monitor + +```yaml +servicemonitor: + enabled: true + path: /abc + scheme: 'http' + interval: 30s + scrapeTimeout: 20s + metricRelabelings: + - sourceLabels: [namespace] + regex: '(.*)' + replacement: myapp + targetLabel: target_namespace +``` + +It gives the set of targets to be monitored. + +### Db Migration Config + +```yaml +dbMigrationConfig: + enabled: false +``` + +It is used to configure database migration. + + +### KEDA Autoscaling +[KEDA](https://keda.sh) is a Kubernetes-based Event Driven Autoscaler. With KEDA, you can drive the scaling of any container in Kubernetes based on the number of events needing to be processed. KEDA can be installed into any Kubernetes cluster and can work alongside standard Kubernetes components like the Horizontal Pod Autoscaler(HPA). + +Example for autosccaling with KEDA using Prometheus metrics is given below: +```yaml +kedaAutoscaling: + enabled: true + minReplicaCount: 1 + maxReplicaCount: 2 + idleReplicaCount: 0 + pollingInterval: 30 + advanced: + restoreToOriginalReplicaCount: true + horizontalPodAutoscalerConfig: + behavior: + scaleDown: + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + triggers: + - type: prometheus + metadata: + serverAddress: http://:9090 + metricName: http_request_total + query: envoy_cluster_upstream_rq{appId="300", cluster_name="300-0", container="envoy",} + threshold: "50" + triggerAuthentication: + enabled: false + name: + spec: {} + authenticationRef: {} +``` +Example for autosccaling with KEDA based on kafka is given below : +```yaml +kedaAutoscaling: + enabled: true + minReplicaCount: 1 + maxReplicaCount: 2 + idleReplicaCount: 0 + pollingInterval: 30 + advanced: {} + triggers: + - type: kafka + metadata: + bootstrapServers: b-2.kafka-msk-dev.example.c2.kafka.ap-southeast-1.amazonaws.com:9092,b-3.kafka-msk-dev.example.c2.kafka.ap-southeast-1.amazonaws.com:9092,b-1.kafka-msk-dev.example.c2.kafka.ap-southeast-1.amazonaws.com:9092 + topic: Orders-Service-ESP.info + lagThreshold: "100" + consumerGroup: oders-remove-delivered-packages + allowIdleConsumers: "true" + triggerAuthentication: + enabled: true + name: keda-trigger-auth-kafka-credential + spec: + secretTargetRef: + - parameter: sasl + name: keda-kafka-secrets + key: sasl + - parameter: username + name: keda-kafka-secrets + key: username + authenticationRef: + name: keda-trigger-auth-kafka-credential +``` + +### Winter-Soldier +Winter Soldier can be used to +- cleans up (delete) Kubernetes resources +- reduce workload pods to 0 + +**_NOTE:_** After deploying this we can create the Hibernator object and provide the custom configuration by which workloads going to delete, sleep and many more. for more information check [the main repo](https://github.com/devtron-labs/winter-soldier) + +Given below is template values you can give in winter-soldier: +```yaml +winterSoldier: + enabled: false + apiVersion: pincher.devtron.ai/v1alpha1 + action: sleep + timeRangesWithZone: + timeZone: "Asia/Kolkata" + timeRanges: [] + targetReplicas: [] + fieldSelector: [] +``` +Here, +| Key | values | Description | +| :--- | :--- | :--- | +| `enabled` | `fasle`,`true` | decide the enabling factor | +| `apiVersion` | `pincher.devtron.ai/v1beta1`, `pincher.devtron.ai/v1alpha1` | specific api version | +| `action` | `sleep`,`delete`, `scale` | This specify the action need to perform. | +| `timeRangesWithZone`:`timeZone` | eg:- `"Asia/Kolkata"`,`"US/Pacific"` | It use to specify the timeZone used. (It uses standard format. please refer [this](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)) | +| `timeRangesWithZone`:`timeRanges` | array of [ `timeFrom`, `timeTo`, `weekdayFrom`, `weekdayTo`] | It use to define time period/range on which the user need to perform the specified action. you can have multiple timeRanges.
These settings will take `action` on Sat and Sun from 00:00 to 23:59:59, | +| `targetReplicas` | `[n]` : n - number of replicas to scale. | These is mandatory field when the `action` is `scale`
Defalut value is `[]`. | +| `fieldSelector` | `- AfterTime(AddTime( ParseTime({{metadata.creationTimestamp}}, '2006-01-02T15:04:05Z'), '5m'), Now()) ` | These value will take a list of methods to select the resources on which we perform specified `action` . | + + +here is an example, +```yaml +winterSoldier: + apiVersion: pincher.devtron.ai/v1alpha1 + enabled: true + annotations: {} + labels: {} + timeRangesWithZone: + timeZone: "Asia/Kolkata" + timeRanges: + - timeFrom: 00:00 + timeTo: 23:59:59 + weekdayFrom: Sat + weekdayTo: Sun + - timeFrom: 00:00 + timeTo: 08:00 + weekdayFrom: Mon + weekdayTo: Fri + - timeFrom: 20:00 + timeTo: 23:59:59 + weekdayFrom: Mon + weekdayTo: Fri + action: scale + targetReplicas: [1,1,1] + fieldSelector: + - AfterTime(AddTime( ParseTime({{metadata.creationTimestamp}}, '2006-01-02T15:04:05Z'), '10h'), Now()) +``` +Above settings will take action on `Sat` and `Sun` from 00:00 to 23:59:59, and on `Mon`-`Fri` from 00:00 to 08:00 and 20:00 to 23:59:59. If `action:sleep` then runs hibernate at timeFrom and unhibernate at `timeTo`. If `action: delete` then it will delete workloads at `timeFrom` and `timeTo`. Here the `action:scale` thus it scale the number of resource replicas to `targetReplicas: [1,1,1]`. Here each element of `targetReplicas` array is mapped with the corresponding elments of array `timeRangesWithZone/timeRanges`. Thus make sure the length of both array is equal, otherwise the cnages cannot be observed. + +The above example will select the application objects which have been created 10 hours ago across all namespaces excluding application's namespace. Winter soldier exposes following functions to handle time, cpu and memory. + +- ParseTime - This function can be used to parse time. For eg to parse creationTimestamp use ParseTime({{metadata.creationTimestamp}}, '2006-01-02T15:04:05Z') +- AddTime - This can be used to add time. For eg AddTime(ParseTime({{metadata.creationTimestamp}}, '2006-01-02T15:04:05Z'), '-10h') ll add 10h to the time. Use d for day, h for hour, m for minutes and s for seconds. Use negative number to get earlier time. +- Now - This can be used to get current time. +- CpuToNumber - This can be used to compare CPU. For eg any({{spec.containers.#.resources.requests}}, { MemoryToNumber(.memory) < MemoryToNumber('60Mi')}) will check if any resource.requests is less than 60Mi. + + +### Security Context +A security context defines privilege and access control settings for a Pod or Container. + +To add a security context for main container: +```yaml +containerSecurityContext: + allowPrivilegeEscalation: false +``` + +To add a security context on pod level: +```yaml +podSecurityContext: + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 2000 +``` + +### Topology Spread Constraints +You can use topology spread constraints to control how Pods are spread across your cluster among failure-domains such as regions, zones, nodes, and other user-defined topology domains. This can help to achieve high availability as well as efficient resource utilization. + +```yaml +topologySpreadConstraints: + - maxSkew: 1 + topologyKey: zone + whenUnsatisfiable: DoNotSchedule + autoLabelSelector: true + customLabelSelector: {} + minDomains: 1 + nodeAffinityPolicy: Ignore +``` + +### Persistent Volume Claim +You can use persistent volume claim to mount volume as per your usecase. + +```yaml +persistentVolumeClaim: + name: my-pvc + storageClassName: default + accessMode: + - ReadWriteOnce + mountPath: /tmp +``` + +### Vertical Pod Autoscaling +This is connected to VPA and controls scaling up and down in response to request load. +```yaml +verticalPodScaling: + enabled: true + resourcePolicy: {} + updatePolicy: {} + ``` + +### Scheduler Name + +You can provide you own custom scheduler to schedule your application + +```yaml +schedulerName: "" +``` + +### Deployment Metrics + +It gives the realtime metrics of the deployed applications + +| Key | Description | +| :--- | :--- | +| `Deployment Frequency` | It shows how often this app is deployed to production | +| `Change Failure Rate` | It shows how often the respective pipeline fails. | +| `Mean Lead Time` | It shows the average time taken to deliver a change to production. | +| `Mean Time to Recovery` | It shows the average time taken to fix a failed pipeline. | + +## 2. Show application metrics + +If you want to see application metrics like different HTTP status codes metrics, application throughput, latency, response time. Enable the Application metrics from below the deployment template Save button. After enabling it, you should be able to see all metrics on App detail page. By default it remains disabled. +![](../../../.gitbook/assets/deployment_application_metrics%20%282%29.png) + +Once all the Deployment template configurations are done, click on `Save` to save your deployment configuration. Now you are ready to create [Workflow](workflow/) to do CI/CD. + +### Helm Chart Json Schema + +Helm Chart [json schema](../../../scripts/devtron-reference-helm-charts/reference-chart_4-11-0/schema.json) is used to validate the deployment template values. + +### Other Validations in Json Schema + +The values of CPU and Memory in limits must be greater than or equal to in requests respectively. Similarly, In case of envoyproxy, the values of limits are greater than or equal to requests as mentioned below. +``` +resources.limits.cpu >= resources.requests.cpu +resources.limits.memory >= resources.requests.memory +envoyproxy.resources.limits.cpu >= envoyproxy.resources.requests.cpu +envoyproxy.resources.limits.memory >= envoyproxy.resources.requests.memory +``` diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/app-values.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/app-values.yaml new file mode 100644 index 0000000000..6ac6588b9c --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/app-values.yaml @@ -0,0 +1,537 @@ +# Mandatory configs + +podDisruptionBudget: {} +deploymentLabels: {} +deploymentAnnotations: {} + +containerSpec: + lifecycle: + enabled: false + preStop: + exec: + command: ["sleep","10"] + postStart: + httpGet: + host: example.com + path: /example + port: 90 + +replicaCount: 1 +MinReadySeconds: 60 +GracePeriod: 30 +image: + pullPolicy: IfNotPresent +restartPolicy: Always +service: + type: ClusterIP + # enabled: true + #name: "service-1234567890" + loadBalancerSourceRanges: [] + # loadBalancerSourceRanges: + # - 1.2.3.4/32 + # - 1.2.5.6/23 + annotations: {} + # test1: test2 + # test3: test4 +ContainerPort: + - name: app + port: 8080 + servicePort: 80 + envoyPort: 8799 + useHTTP2: false + supportStreaming: false + idleTimeout: 1800s + protocol: TCP +# servicemonitor: +# enabled: true +# path: /abc +# scheme: 'http' +# interval: 30s +# scrapeTimeout: 20s +# metricRelabelings: +# - sourceLabels: [namespace] +# regex: '(.*)' +# replacement: myapp +# targetLabel: target_namespace +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: 0.10 + memory: 100Mi + requests: + cpu: 0.10 + memory: 100Mi + +gpu: + enabled: false + provider: "nvidia.com/gpu" + resources: + limits: 1 + requests: 1 + +# Optional configs +LivenessProbe: + Path: "" + port: 8080 + scheme: "" + httpHeaders: [] +# - name: Custom-Header +# value: abc + tcp: false + command: [] + initialDelaySeconds: 20 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + failureThreshold: 3 + grpc: {} + + +ReadinessProbe: + Path: "" + port: 8080 + scheme: "" + httpHeaders: [] +# - name: Custom-Header +# value: abc + tcp: false + command: [] + initialDelaySeconds: 20 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + failureThreshold: 3 + grpc: {} + + +StartupProbe: + Path: "" + port: 8080 + initialDelaySeconds: 20 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + failureThreshold: 3 + httpHeaders: [] + command: [] + tcp: false + grpc: {} + + +ingress: + enabled: false + className: "" + labels: {} + annotations: {} +# nginx.ingress.kubernetes.io/force-ssl-redirect: 'false' +# nginx.ingress.kubernetes.io/ssl-redirect: 'false' +# kubernetes.io/ingress.class: nginx +# nginx.ingress.kubernetes.io/rewrite-target: /$2 +# nginx.ingress.kubernetes.io/canary: "true" +# nginx.ingress.kubernetes.io/canary-weight: "10" + + hosts: + - host: chart-example1.local + pathType: "ImplementationSpecific" + paths: + - /example1 + - host: chart-example2.local + pathType: "ImplementationSpecific" + paths: + - /example2 + - /example2/healthz + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +istio: + enable: false + gateway: + enabled: false + labels: {} + annotations: {} + host: example.com + tls: + enabled: false + secretName: example-secret + virtualService: + enabled: false + labels: {} + annotations: {} + gateways: [] + hosts: [] + http: [] + # - match: + # - uri: + # prefix: /v1 + # - uri: + # prefix: /v2 + # timeout: 12 + # headers: + # request: + # add: + # x-some-header: "value" + # retries: + # attempts: 2 + # perTryTimeout: 3s + destinationRule: + enabled: false + labels: {} + annotations: {} + subsets: [] + trafficPolicy: {} + peerAuthentication: + enabled: false + labels: {} + annotations: {} + selector: + enabled: false + mtls: + mode: "" + portLevelMtls: {} + requestAuthentication: + enabled: false + labels: {} + annotations: {} + selector: + enabled: false + jwtRules: [] + authorizationPolicy: + enabled: false + labels: {} + annotations: {} + action: + provider: {} + rules: [] + +winterSoldier: + enabled: false + apiVersion: pincher.devtron.ai/v1alpha1 + annotation: {} + labels: {} + type: Deployment + timeRangesWithZone: + timeZone: "Asia/Kolkata" + timeRanges: [] + action: sleep + targetReplicas: [] + fieldSelector: + - AfterTime(AddTime(ParseTime({{metadata.creationTimestamp}}, '2006-01-02T15:04:05Z'), '5m'), Now()) + +networkPolicy: + enabled: false + annotations: {} + labels: {} + podSelector: + matchExpressions: [] + matchLabels: {} + policyTypes: [] + ingress: [] + egress: [] + +flaggerCanary: + enabled: false + labels: {} + annotations: {} + createIstioGateway: + enabled: false + labels: {} + annotations: {} + host: + tls: + enabled: false + secretName: + # Istio gateways (optional) + addOtherGateways: [] + # Istio virtual service host names (optional) + addOtherHosts: [] + # Istio gateway refs (optional) + gatewayRefs: + # - name: istio-gateway + # namespace: istio-system + #service port + serviceport: 8080 + #containerPort + targetPort: 8080 + # discover all port open in container + portDiscovery: true + # application protocol (optional) + appProtocol: http + # Istio retry policy (optional) + retries: + # attempts: 3 + # perTryTimeout: 1s + # retryOn: "gateway-error,connect-failure,refused-stream" + # HTTP match conditions (optional) + match: + - uri: + prefix: / + # HTTP rewrite (optional) + rewriteUri: / + # timeout (optional) + timeout: + # Add headers (optional) + headers: + # request: + # add: + # x-some-header: "value" + # cross-origin resource sharing policy (optional) + corsPolicy: + # allowOrigin: + # - example.com + # allowMethods: + # - GET + # allowCredentials: false + # allowHeaders: + # - x-some-header + # maxAge: 24h + analysis: + # schedule interval (default 60s) + interval: 15s + # max number of failed metric checks before rollback + threshold: 5 + # max traffic percentage routed to canary + # percentage (0-100) + maxWeight: 50 + # canary increment step + # percentage (0-100) + stepWeight: 5 + thresholds: + # minimum req success rate (non 5xx responses) + # percentage (0-100) + successRate: 90 + # maximum req duration P99 + # milliseconds + latency: 500 + loadtest: + enabled: true + # load tester address + url: http://flagger-loadtester.istio-system/ + +ingressInternal: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # nginx.ingress.kubernetes.io/canary: "true" + # nginx.ingress.kubernetes.io/canary-weight: "10" + + hosts: + - host: chart-example1.internal + pathType: "ImplementationSpecific" + paths: + - /example1 + - host: chart-example2.internal + pathType: "ImplementationSpecific" + paths: + - /example2 + - /example2/healthz + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +command: + workingDir: {} + enabled: false + value: [] + +args: + enabled: false + value: + - /bin/sh + - -c + - touch /tmp/healthy; sleep 30; rm -rf /tmp/healthy; sleep 600 + +#For adding custom labels to pods + +podLabels: {} +# customKey: customValue +podAnnotations: {} +# customKey: customValue + +rawYaml: [] + +topologySpreadConstraints: [] + +initContainers: [] + ## Additional init containers to run before the Scheduler pods. + ## for example, be used to run a sidecar that chown Logs storage . + #- name: volume-mount-hack + # image: busybox + # command: ["sh", "-c", "chown -R 1000:1000 logs"] + # volumeMounts: + # - mountPath: /usr/local/airflow/logs + # name: logs-data + +containers: [] + ## Additional containers to run along with application pods. + ## for example, be used to run a sidecar that chown Logs storage . + #- name: volume-mount-hack + # image: busybox + # command: ["sh", "-c", "chown -R 1000:1000 logs"] + # volumeMounts: + # - mountPath: /usr/local/airflow/logs + # name: logs-data + +volumeMounts: [] +# - name: log-volume +# mountPath: /var/log + +volumes: [] +# - name: log-volume +# emptyDir: {} + +dbMigrationConfig: + enabled: false + +tolerations: [] + +podSecurityContext: {} + +containerSecurityContext: {} + +Spec: + Affinity: + Key: "" + # Key: kops.k8s.io/instancegroup + Values: "" + +affinity: + enabled: false + values: {} + +ambassadorMapping: + enabled: false + labels: {} + prefix: / + ambassadorId: "" + hostname: devtron.example.com + rewrite: "" + retryPolicy: {} + cors: {} + tls: + context: "" + create: false + secretName: "" + hosts: [] + +autoscaling: + enabled: false + MinReplicas: 1 + MaxReplicas: 2 + TargetCPUUtilizationPercentage: 70 + TargetMemoryUtilizationPercentage: 80 + annotations: {} + labels: {} + behavior: {} + containerResource: + enabled: false + TargetCPUUtilizationPercentage: 90 + TargetMemoryUtilizationPercentage: 80 +# scaleDown: +# stabilizationWindowSeconds: 300 +# policies: +# - type: Percent +# value: 100 +# periodSeconds: 15 +# scaleUp: +# stabilizationWindowSeconds: 0 +# policies: +# - type: Percent +# value: 100 +# periodSeconds: 15 +# - type: Pods +# value: 4 +# periodSeconds: 15 +# selectPolicy: Max + + extraMetrics: [] +# - external: +# metricName: pubsub.googleapis.com|subscription|num_undelivered_messages +# metricSelector: +# matchLabels: +# resource.labels.subscription_id: echo-read +# targetAverageValue: "2" +# type: External +# + +kedaAutoscaling: + enabled: false + envSourceContainerName: "" # Optional. Default: .spec.template.spec.containers[0] + minReplicaCount: 1 + maxReplicaCount: 2 + advanced: {} + triggers: [] + triggerAuthentication: + enabled: false + name: "" + spec: {} + authenticationRef: {} + +# kedaHttpScaledObject: +# enabled: false +# minReplicaCount: 1 +# maxReplicaCount: 2 +# targetPendingRequests: +# scaledownPeriod: +# servicePort: 80 # port of the service (required) + +prometheus: + release: monitoring + +server: + deployment: + image_tag: 1-95af053 + image: "" + +servicemonitor: + additionalLabels: {} + +envoyproxy: + image: quay.io/devtron/envoy:v1.16.0 + configMapName: "" + lifecycle: {} + resources: + limits: + cpu: 50m + memory: 50Mi + requests: + cpu: 50m + memory: 50Mi + +## Pods Service Account +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ +## +serviceAccount: + ## @param serviceAccount.create Enable creation of ServiceAccount for pods + ## + create: false + ## @param serviceAccount.name The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the `.Chart.Name .fullname` template + name: "" + ## @param serviceAccount.annotations Annotations for service account. Evaluated as a template. + ## Only used if `create` is `true`. + ## + annotations: {} + +imagePullSecrets: [] + # - test1 + # - test2 +hostAliases: [] +# - ip: "127.0.0.1" +# hostnames: +# - "foo.local" +# - "bar.local" +# - ip: "10.1.2.3" +# hostnames: +# - "foo.remote" +# - "bar.remote" + +verticalPodScaling: + enabled: false \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/env-values.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/env-values.yaml new file mode 100644 index 0000000000..48b794e8f2 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/env-values.yaml @@ -0,0 +1,66 @@ +replicaCount: 1 +MaxSurge: 1 +MaxUnavailable: 0 +GracePeriod: 30 +pauseForSecondsBeforeSwitchActive: 30 +waitForSecondsBeforeScalingDown: 30 + +Spec: + Affinity: + Key: "" + Values: "" + +autoscaling: + enabled: false + MinReplicas: 1 + MaxReplicas: 2 + TargetCPUUtilizationPercentage: 90 + TargetMemoryUtilizationPercentage: 80 + behavior: {} +# scaleDown: +# stabilizationWindowSeconds: 300 +# policies: +# - type: Percent +# value: 100 +# periodSeconds: 15 +# scaleUp: +# stabilizationWindowSeconds: 0 +# policies: +# - type: Percent +# value: 100 +# periodSeconds: 15 +# - type: Pods +# value: 4 +# periodSeconds: 15 +# selectPolicy: Max + extraMetrics: [] +# - external: +# metricName: pubsub.googleapis.com|subscription|num_undelivered_messages +# metricSelector: +# matchLabels: +# resource.labels.subscription_id: echo-read +# targetAverageValue: "2" +# type: External +# +secret: + enabled: false + data: {} +# my_own_secret: S3ViZXJuZXRlcyBXb3Jrcw== + +EnvVariables: [] +# - name: FLASK_ENV +# value: qa + +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: "0.05" + memory: 50Mi + requests: + cpu: "0.01" + memory: 10Mi + + diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/pipeline-values.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/pipeline-values.yaml new file mode 100644 index 0000000000..dbe4db3e8e --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/pipeline-values.yaml @@ -0,0 +1,6 @@ +deployment: + strategy: + recreate: {} + rolling: + maxSurge: "25%" + maxUnavailable: 1 diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/release-values.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/release-values.yaml new file mode 100644 index 0000000000..48eb3f482c --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/release-values.yaml @@ -0,0 +1,14 @@ +server: + deployment: + image_tag: IMAGE_TAG + image: IMAGE_REPO + enabled: false +dbMigrationConfig: + enabled: false + +pauseForSecondsBeforeSwitchActive: 0 +waitForSecondsBeforeScalingDown: 0 +autoPromotionSeconds: 30 + +#used for deployment algo selection +orchestrator.deploymant.algo: 1 diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/schema.json b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/schema.json new file mode 100644 index 0000000000..2195d4aedb --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/schema.json @@ -0,0 +1,1398 @@ + +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "containerExtraSpecs":{ + "type": "object", + "title": "containerExtraSpecs", + "description": "Define container extra specs here" + }, + "ContainerPort": { + "type": "array", + "description": "defines ports on which application services will be exposed to other services", + "title": "Container Port", + "items": { + "type": "object", + "properties": { + "envoyPort": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "envoy port for the container", + "title": "Envoy Port" + }, + "idleTimeout": { + "type": "string", + "description": "duration of time for which a connection is idle before the connection is terminated", + "title": "Idle Timeout" + }, + "name": { + "type": "string", + "description": "name of the port", + "title": "Name" + }, + "port": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "Port", + "title": "port for the container" + }, + "servicePort": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "port of the corresponding kubernetes service", + "title": "Service Port" + }, + "nodePort": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "nodeport of the corresponding kubernetes service", + "title": "Node Port" + }, + "supportStreaming": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "field to enable/disable timeout for high performance protocols like grpc", + "title": "Support Streaming" + }, + "useHTTP2": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": " field for setting if envoy container can accept(or not) HTTP2 requests", + "title": "Use HTTP2" + } + } + } + }, + "EnvVariables": { + "type": "array", + "items": {}, + "description": "contains environment variables needed by the containers", + "title": "Environment Variables" + }, + "EnvVariablesFromFieldPath":{ + "type": "array", + "description": "Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs", + "title": "EnvVariablesFromFieldPath", + "items": [ + { + "type": "object", + "properties": { + "name":{ + "type": "string", + "title": "name", + "description": "Env variable name to be" + }, + "fieldPath":{ + "type": "string", + "title": "fieldPath", + "description": "Path of the field to select in the specified API version" + } + } + } + ] + }, + "EnvVariablesFromSecretKeys": { + "type": "array", + "description": "Selects a field of the deployment: It is use to get the name of Environment Variable name, Secret name and the Key name from which we are using the value in that corresponding Environment Variable.", + "title": "EnvVariablesFromSecretKeys", + "items": [ + { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "name", + "description": "Env variable name to be used." + }, + "secretName": { + "type": "string", + "title": "secretName", + "description": "Name of Secret from which we are taking the value." + }, + "keyName": { + "type": "string", + "title": "keyName", + "description": "Name of The Key Where the value is mapped with." + } + } + } + ] + }, + "EnvVariablesFromConfigMapKeys": { + "type": "array", + "description": "Selects a field of the deployment: It is use to get the name of Environment Variable name, Config Map name and the Key name from which we are using the value in that corresponding Environment Variable.", + "title": "EnvVariablesFromConfigMapKeys", + "items": [ + { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "name", + "description": "Env variable name to be used." + }, + "configMapName": { + "type": "string", + "title": "configMapName", + "description": "Name of configMap from which we are taking the value." + }, + "keyName": { + "type": "string", + "title": "keyName", + "description": "Name of The Key Where the value is mapped with." + } + } + } + ] + }, + "GracePeriod": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "time for which Kubernetes waits before terminating the pods", + "title": "Grace Period" + }, + "LivenessProbe": { + "type": "object", + "description": "used by the kubelet to know when to restart a container", + "title": "Liveness Probe", + "properties": { + "Path": { + "type": "string", + "description": "defines the path where the liveness needs to be checked", + "title": "Path" + }, + "command": { + "type": "array", + "items": {}, + "description": "commands executed to perform a probe", + "title": "Command" + }, + "failureThreshold": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "defines the maximum number of failures that are acceptable before a given container is not considered as live", + "title": "Failure Threshold" + }, + "httpHeaders": { + "type": "array", + "items": {}, + "description": "used to override the default headers by defining .httpHeaders for the probe", + "title": "HTTP headers" + }, + "initialDelaySeconds": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "defines the time to wait before a given container is checked for liveness", + "title": "Initial Delay Seconds" + }, + "periodSeconds": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "defines the time to check a given container for liveness", + "title": "Period Seconds" + }, + "port": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "port to access on the container", + "title": "Port" + }, + "scheme": { + "type": "string", + "description": "Scheme to use for connecting to the host (HTTP or HTTPS). Defaults to HTTP.", + "title": "Scheme" + }, + "successThreshold": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "defines the number of successes required before a given container is said to fulfil the liveness probe", + "title": "Success Threshold" + }, + "tcp": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "If enabled, the kubelet will attempt to open a socket to container. If connection is established, the container is considered healthy", + "title": "TCP" + }, + "timeoutSeconds": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "defines the time for checking timeout", + "title": "Timeout Seconds" + } + } + }, + "MaxSurge": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "maximum number of pods that can be created over the desired number of pods", + "title": "Maximum Surge" + }, + "MaxUnavailable": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "maximum number of pods that can be unavailable during the update process", + "title": "Maximum Unavailable" + }, + "MinReadySeconds": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "minimum number of seconds for which a newly created Pod should be ready without any of its containers crashing, for it to be considered available", + "title": "Minimum Ready Seconds" + }, + "ReadinessProbe": { + "type": "object", + "description": "kubelet uses readiness probes to know when a container is ready to start accepting traffic", + "title": "Readiness Probe", + "properties": { + "Path": { + "type": "string", + "description": "defines the path where the readiness needs to be checked", + "title": "Path" + }, + "command": { + "type": "array", + "items": {}, + "description": "commands executed to perform a probe", + "title": "Command" + }, + "failureThreshold": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "defines the maximum number of failures that are acceptable before a given container is not considered as ready", + "title": "Failure Threshold" + }, + "httpHeader": { + "type": "array", + "items": {}, + "description": "used to override the default headers by defining .httpHeaders for the probe", + "title": "HTTP headers" + }, + "initialDelaySeconds": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "defines the time to wait before a given container is checked for readiness", + "title": "Initial Delay Seconds" + }, + "periodSeconds": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "defines the time to check a given container for readiness", + "title": "Period Seconds" + }, + "port": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "port to access on the container", + "title": "Port" + }, + "scheme": { + "type": "string", + "description": "Scheme to use for connecting to the host (HTTP or HTTPS). Defaults to HTTP.", + "title": "Scheme" + }, + "successThreshold": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "defines the number of successes required before a given container is said to fulfil the readiness probe", + "title": "Success Threshold" + }, + "tcp": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "If enabled, the kubelet will attempt to open a socket to container. If connection is established, the container is considered healthy", + "title": "TCP" + }, + "timeoutSeconds": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "defines the time for checking timeout", + "title": "Timeout Seconds" + } + } + }, + "networkPolicy": { + "type": "object", + "description": "NetworkPolicy describes what network traffic is allowed for a set of Pods", + "title": "Network Policy", + "properties": { + "enabled":{ + "type":"boolean", + "description": "used to enable or disable NetworkPolicy" + }, + "annotations":{ + "type": "object", + "description": "Annotations for NetworkPolicy" + }, + "labels":{ + "type":"object", + "description": "Labels for NetworkPolicy" + }, + "podSelector":{ + "type": "object", + "description": "Selects the pods to which this NetworkPolicy object applies", + "properties": { + "matchExpressions":{ + "type":"array", + "description": "list of label selector" + }, + "matchLabels":{ + "type":"object", + "description": "map of {key,value} pairs" + } + } + }, + "policyTypes":{ + "type":"array", + "description": "List of rule types that the NetworkPolicy relates to. Valid options are Ingress,Egress." + }, + "ingress":{ + "type":"array", + "description": "List of ingress rules to be applied to the selected pods" + }, + "egress":{ + "type":"array", + "description": "List of egress rules to be applied to the selected pods" + } + } + }, + "istio": { + "type": "object", + "description": "Istio Service mesh", + "title": "Istio" + }, + "flaggerCanary":{ + "type": "object", + "description": "Flagger for canary release with istio service mesh", + "title": "Flagger Canary Release" + }, + "Spec": { + "type": "object", + "description": "used to define the desire state of the given container", + "title": "Spec", + "properties": { + "Affinity": { + "type": "object", + "description": "Node/Inter-pod Affinity allows you to constrain which nodes your pod is eligible to schedule on, based on labels of the node/pods", + "title": "Affinity", + "properties": { + "Key": { + "anyOf": [ + { + "type": "null" + }, + { + "type": "string", + "description": "Key part of the label for node/pod selection", + "title": "Key" + } + ] + }, + "Values": { + "type": "string", + "description": "Value part of the label for node/pod selection", + "title": "Values" + }, + "key": { + "type": "string" + } + } + } + } + }, + "ambassadorMapping": { + "type": "object", + "description": "used to create ambassador mapping resource", + "title": "Mapping", + "properties": { + "ambassadorId": { + "type": "string", + "description": "used to specify id for specific ambassador mappings controller", + "title": "Ambassador ID" + }, + "cors": { + "type": "object", + "description": "used to specify cors policy to access host for this mapping", + "title": "CORS" + }, + "enabled": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "used to specify whether to create an ambassador mapping or not", + "title": "Enabled" + }, + "weight": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "used to specify weight for canary ambassador mappings" + }, + "hostname": { + "type": "string", + "description": "used to specify hostname for ambassador mapping", + "title": "Hostname" + }, + "labels": { + "type": "object", + "description": "used to provide custom labels for ambassador mapping", + "title": "Labels" + }, + "prefix": { + "type": "string", + "description": "used to specify path for ambassador mapping", + "title": "Prefix" + }, + "retryPolicy": { + "type": "object", + "description": "used to specify retry policy for ambassador mapping", + "title": "Retry Policy" + }, + "rewrite": { + "type": "string", + "description": "used to specify whether to redirect the path of this mapping and where", + "title": "Rewrite" + }, + "tls": { + "type": "object", + "description": "used to create or define ambassador TLSContext resource", + "title": "TLS Context" + }, + "extraSpec": { + "type": "object", + "description": "used to provide extra spec values which not present in deployment template for ambassador resource", + "title": "Extra Spec" + } + } + }, + "args": { + "type": "object", + "description": " used to give arguments to command", + "title": "Arguments", + "properties": { + "enabled": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "used for enabling/disabling aruguments", + "title": "Enabled" + }, + "value": { + "type": "array", + "description": "values of the arguments", + "title": "Value", + "items": [ + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "string" + } + ] + } + } + }, + "autoscaling": { + "type": "object", + "description": "connected to HPA and controls scaling up and down in response to request load", + "title": "Autoscaling", + "properties": { + "MaxReplicas": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "Maximum number of replicas allowed for scaling", + "title": "Maximum Replicas" + }, + "MinReplicas": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "Minimum number of replicas allowed for scaling", + "title": "Minimum Replicas" + }, + "TargetCPUUtilizationPercentage": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "The target CPU utilization that is expected for a container", + "title": "TargetCPUUtilizationPercentage" + }, + "TargetMemoryUtilizationPercentage": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "The target memory utilization that is expected for a container", + "title": "TargetMemoryUtilizationPercentage" + }, + "behavior": { + "type": "object", + "description": "describes behavior and scaling policies for that behavior", + "title": "Behavior" + }, + "enabled": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "used for enabling/disabling autoscaling", + "title": "Enabled" + }, + "labels": { + "type": "object", + "description": "labels for HPA", + "title": "labels" + }, + "annotations": { + "type": "object", + "description": "used to configure some options for HPA", + "title": "annotations" + }, + "extraMetrics": { + "type": "array", + "items": {}, + "description": "used to give external metrics for autoscaling", + "title": "Extra Metrics" + } + } + }, + "command": { + "type": "object", + "description": "contains the commands for the server", + "title": "Command", + "properties": { + "enabled": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "used for enabling/disabling commands" + }, + "value": { + "type": "array", + "items": {}, + "description": "contains the commands", + "title": "Value" + }, + "workingDir": { + "type": "object", + "items": {}, + "description": "contains the working directory", + "title": "Working directory" + } + } + }, + "containerSecurityContext": { + "type": "object", + "description": " defines privilege and access control settings for a Container", + "title": "Container Security Context" + }, + "containers": { + "type": "array", + "items": {}, + "description": " used to run side-car containers along with the main container within same pod" + }, + "dbMigrationConfig": { + "type": "object", + "description": "used to configure database migration", + "title": "Db Migration Config", + "properties": { + "enabled": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "used for enabling/disabling the config", + "title": "Enabled" + } + } + }, + "envoyproxy": { + "type": "object", + "description": "envoy is attached as a sidecar to the application container to collect metrics like 4XX, 5XX, throughput and latency", + "title": "Envoy Proxy", + "properties": { + "configMapName": { + "type": "string", + "description": "configMap containing configuration for Envoy", + "title": "ConfigMap" + }, + "lifecycle":{ + "type": "object", + "description": "Actions that the management system should take in response to container lifecycle events", + "title": "lifecycle", + "properties": { + "enabled":{ + "type": "boolean" + }, + "postStart":{ + "type": "object", + "title": "postStart", + "description": "PostStart is called immediately after a container is created" + }, + "preStop":{ + "type": "object", + "title": "preStop", + "description": "PreStop is called immediately before a container is terminated" + } + } + }, + "image": { + "type": "string", + "description": "image of envoy to be used" + }, + "resources": { + "type": "object", + "description": "minimum and maximum RAM and CPU available to the application", + "title": "Resources", + "properties": { + "limits": { + "type": "object", + "description": "the maximum values a container can reach", + "title": "Limits", + "properties": { + "cpu": { + "type": "string", + "format": "cpu", + "description": "limit of CPU", + "title": "CPU" + }, + "memory": { + "type": "string", + "format": "memory", + "description": "limit of memory", + "title": "Memory" + } + } + }, + "requests": { + "type": "object", + "description": "request is what the container is guaranteed to get", + "title": "Requests", + "properties": { + "cpu": { + "type": "string", + "format": "cpu", + "description": "request value of CPU", + "title": "CPU" + }, + "memory": { + "type": "string", + "format": "memory", + "description": "request value of memory", + "title": "Memory" + } + } + } + } + } + } + }, + "gpu": { + "type": "object", + "description": "GPU resource configuration", + "title": "GPU", + "properties": { + "enabled": { + "type": "boolean", + "description": "Enable GPU resources", + "title": "GPU Spec" + }, + "provider": { + "type": "string", + "description": "GPU driver type e.g. nvidia.com/gpu, amd.com/gpu, intel.com/gpu" + }, + "resources": { + "type": "object", + "description": "GPU resource requests and limits", + "properties": { + "limits": { + "type": "string", + "description": "GPU resource limits" + }, + "requests": { + "type": "string", + "description": "GPU resource requests" + } + } + } + } + }, + "hostAliases":{ + "type": "array", + "title": "hostAliases", + "description": "HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file", + "items": [ + { + "type": "object", + "properties": { + "ip":{ + "type": "string", + "title": "IP", + "description": "IP address of the host file entry" + }, + "hostnames":{ + "type": "array", + "description": "Hostnames for the above IP address", + "items": [ + { + "type": "string" + } + ] + } + } + } + ] + }, + "image": { + "type": "object", + "description": "used to access images in kubernetes", + "title": "Image", + "properties": { + "pullPolicy": { + "type": "string", + "description": "used to define the instances calling the image", + "title": "Pull Policy", + "enum": ["IfNotPresent", "Always"] + } + } + }, + "restartPolicy": { + "type": "string", + "description": "It restarts the docker container based on defined conditions.", + "title": "Restart Policy", + "enum": [ + "Always", + "OnFailure", + "Never" + ] + }, + "imagePullSecrets": { + "type": "array", + "items": {}, + "description": "contains the docker credentials that are used for accessing a registry", + "title": "Image PullSecrets" + }, + "winterSoldier": { + "type": "object", + "description": "allows to scale, sleep or delete the resource based on time.", + "title": "winterSoldier", + "properties": { + "annotations": { + "type": "object", + "description": "used to configure some options depending on the winterSoldier controller", + "title": "Annotations" + }, + "labels": { + "type": "object", + "description": "labels for winterSoldier", + "title": "winterSoldier labels", + "default": "" + }, + "enabled": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "used to enable or disable ingress", + "title": "Enabled" + }, + "apiVersion": { + "type": "string", + "description": "Api version for winterSoldier", + "title": "winterSoldier apiVersion", + "default": "pincher.devtron.ai/v1alpha1" + }, + "timeRangesWithZone": { + "type": "object", + "description": "describe time zone and time ranges to input in the winterSoldier", + "title": "Time Ranges With Zone", + "timeZone": { + "type": "string", + "description": "describe time zone, and follow standard format", + "title": "Time Zone" + }, + "timeRanges": { + "type": "array", + "items": {}, + "description": "used to take array of time ranges in which each element contains timeFrom, timeTo, weekdayFrom and weekdayTo.", + "title": "Time Ranges" + } + }, + "type": { + "type": "string", + "description": "describe the type of application Rollout/deployment.", + "title": "Type" + }, + "action": { + "type": "string", + "description": "describe the action to be performed by winterSoldier.", + "title": "Action" + }, + "targetReplicas": { + "type": "array", + "description": "describe the number of replicas to which the resource should scale up or down.", + "title": "Target Replicas" + }, + "fieldSelector": { + "type": "array", + "description": "it takes arrays of methods to select specific fields.", + "title": "Field Selector" + } + } + }, + "ingress": { + "type": "object", + "description": "allows public access to URLs", + "title": "Ingress", + "properties": { + "annotations": { + "type": "object", + "description": "used to configure some options depending on the Ingress controller", + "title": "Annotations" + }, + "className": { + "type": "string", + "description": "name of ingress class, a reference to an IngressClass resource that contains additional configuration including the name of the controller", + "title": "Ingress class name", + "default": "nginx" + }, + "labels": { + "type": "object", + "description": "labels for ingress", + "title": "Ingress labels", + "default": "" + }, + "enabled": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "used to enable or disable ingress", + "title": "Enabled" + }, + "hosts": { + "type": "array", + "description": "list of hosts in ingress", + "title": "Hosts", + "items": [ + { + "type": "object", + "properties": { + "host": { + "type": "string", + "description": "host URL", + "title": "Host" + }, + "pathType": { + "type": "string", + "description": "type of path", + "title": "PathType" + }, + "paths": { + "type": "array", + "description": "list of paths for a given host", + "title": "Paths", + "items": [ + { + "type": "string" + } + ] + } + } + } + ] + }, + "tls": { + "type": "array", + "items": {}, + "description": "contains security details - private key and certificate", + "title": "TLS" + } + } + }, + "ingressInternal": { + "type": "object", + "description": "allows private access to the URLs", + "properties": { + "annotations": { + "type": "object", + "description": "used to configure some options depending on the Ingress controller", + "title": "Annotations" + }, + "className": { + "type": "string", + "description": "name of ingress class, a reference to an IngressClass resource that contains additional configuration including the name of the controller", + "title": "Ingress class name", + "default": "nginx-internal" + }, + "enabled": { + "type": [ + "boolean", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "used to enable or disable ingress", + "title": "Enabled" + }, + "hosts": { + "type": "array", + "description": "list of hosts in ingress", + "title": "Hosts", + "items": [ + { + "type": "object", + "properties": { + "host": { + "type": "string", + "description": "host URL", + "title": "Host" + }, + "pathType": { + "type": "string", + "description": "type of path", + "title": "PathType" + }, + "paths": { + "type": "array", + "description": "list of paths for a given host", + "title": "Paths", + "items": [ + { + "type": "string" + } + ] + } + } + } + ] + }, + "tls": { + "type": "array", + "items": {}, + "description": "contains security details - private key and certificate", + "title": "TLS" + } + } + }, + "initContainers": { + "type": "array", + "items": {}, + "description": "specialized containers that run before app containers in a Pod, can contain utilities or setup scripts not present in an app image", + "title": "Init Containers" + }, + "kedaAutoscaling": { + "type": "object", + "description": "Kubernetes-based event driven autoscaler. With KEDA, one can drive the scaling of any container in Kubernetes based on the no. of events needing to be processed", + "title": "KEDA Autoscaling", + "properties": { + "advanced": { + "type": "object" + }, + "authenticationRef": { + "type": "object" + }, + "enabled": { + "type": "boolean" + }, + "envSourceContainerName": { + "type": "string" + }, + "maxReplicaCount": { + "type": "integer" + }, + "minReplicaCount": { + "type": "integer" + }, + "triggerAuthentication": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "spec": { + "type": "object" + } + } + }, + "triggers": { + "type": "array", + "items": {} + } + } + }, + "containerSpec": { + "type":"object", + "description": "define the container specic configuration", + "title": "containerSpec", + "properties": { + "lifecycle": { + "type": "object", + "description": "Actions that the management system should take in response to container lifecycle events", + "title": "lifecycle", + "properties": { + "enabled":{ + "type": "boolean" + }, + "postStart":{ + "type": "object", + "title": "postStart", + "description": "PostStart is called immediately after a container is created.You could use this event to check that a required API is available before the container’s main work begins" + }, + "preStop":{ + "type": "object", + "title": "preStop", + "description": "PreStop is called immediately before a container is terminated" + } + } + } + } + }, + "pauseForSecondsBeforeSwitchActive": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "tell how much to wait for given period of time before switch active the container", + "title": "Pause For Seconds Before SwitchActive" + }, + "podAnnotations": { + "type":"object", + "description": "used to attach metadata and configs in Kubernetes", + "title": "Pod Annotations" + }, + "podDisruptionBudget": { + "type": "object", + "description": "PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods", + "properties": { + "minAvailable":{ + "type": "string", + "title": "minAvailable", + "description": "An eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod" + }, + "maxUnavailable":{ + "type": "string", + "title": "maxUnavailable", + "description": "An eviction is allowed if at most \"maxUnavailable\" pods selected by \"selector\" are unavailable after the eviction, i.e. even in absence of the evicted pod." + } + } + }, + "deploymentLabels": { + "type": "object", + "description": "deploymentLabels is an object to define the label on deployment.", + "title": "DeploymentLabels" + }, + "deploymentAnnotations": { + "type": "object", + "description": "deploymentAnnotations is an object to define the annotations on deployment.", + "title": "DeploymentAnnotations" + }, + "podExtraSpecs":{ + "type": "object", + "description": "ExtraSpec for the pods to be configured", + "title": "podExtraSpecs" + }, + "podLabels": { + "type":"object", + "description": "key/value pairs that are attached to pods, are intended to be used to specify identifying attributes of objects that are meaningful and relevant to users, but do not directly imply semantics to the core system", + "title": "Pod Labels" + }, + "podSecurityContext": { + "type":"object", + "description": "defines privilege and access control settings for a Pod or Container", + "title": "Pod Security Context" + }, + "prometheus": { + "type": "object", + "description": "a kubernetes monitoring tool", + "title": "Prometheus", + "properties": { + "release": { + "type": "string", + "description": "name of the file to be monitored, describes the state of prometheus" + } + } + }, + "rawYaml": { + "type": "array", + "items": {}, + "description": "Accepts an array of Kubernetes objects. One can specify any kubernetes yaml here & it will be applied when a app gets deployed.", + "title": "Raw YAML" + }, + "replicaCount": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "count of Replicas of pod", + "title": "REplica Count" + }, + "resources": { + "type": "object", + "description": "minimum and maximum RAM and CPU available to the application", + "title": "Resources", + "properties": { + "limits": { + "type": "object", + "description": "the maximum values a container can reach", + "title": "Limits", + "properties": { + "cpu": { + "type": "string", + "format": "cpu", + "description": "limit of CPU", + "title": "CPU" + }, + "memory": { + "type": "string", + "format": "memory", + "description": "limit of memory", + "title": "Memory" + } + } + }, + "requests": { + "type": "object", + "description": "request is what the container is guaranteed to get", + "title": "Requests", + "properties": { + "cpu": { + "type": "string", + "format": "cpu", + "description": "request value of CPU", + "title": "CPU" + }, + "memory": { + "type": "string", + "format": "memory", + "description": "request value of memory", + "title": "Memory" + } + } + } + } + }, + "secret": { + "type": "object", + "properties": { + "data": { + "type": "object" + }, + "enabled": { + "type": "boolean" + } + } + }, + "server": { + "type": "object", + "description": "used for providing server configurations.", + "title": "Server", + "properties": { + "deployment": { + "type": "object", + "description": "gives the details for deployment", + "title": "Deployment", + "properties": { + "image": { + "type": "string", + "description": "URL of the image", + "title": "Image" + }, + "image_tag": { + "type": "string", + "description": "tag of the image", + "title": "Image Tag" + } + } + } + } + }, + "service": { + "type": "object", + "description": "defines annotations and the type of service", + "title": "Service", + "properties": { + "annotations": { + "type": "object", + "title": "Annotations", + "description": "annotations of service" + }, + "type": { + "type": "string", + "description": "type of service", + "title": "Type", + "enum": [ + "ClusterIP", + "LoadBalancer", + "NodePort", + "ExternalName" + ] + } + } + }, + "serviceAccount": { + "type": "object", + "description": "defines service account for pods", + "title": "Service Account", + "properties": { + "annotations": { + "type": "object", + "title": "Annotations", + "description": "annotations of service account" + }, + "name": { + "type": "string", + "description": "name of service account", + "title": "Name" + }, + "create": { + "type": "boolean" + } + } + }, + "servicemonitor": { + "type": "object", + "description": "gives the set of targets to be monitored", + "title": "Service Monitor", + "properties": { + "additionalLabels": { + "type": "object" + } + } + }, + "tolerations": { + "type": "array", + "items": {}, + "description": "a mechanism which work together with Taints which ensures that pods are not placed on inappropriate nodes", + "title": "Tolerations" + }, + "topologySpreadConstraints": { + "type": "array", + "items": {}, + "description": "used to control how Pods are spread across a cluster among failure-domains such as regions, zones, nodes, and other user-defined topology domains", + "title": "Topology Spread Constraints" + }, + "volumeMounts": { + "type": "array", + "items": {}, + "description": "used to provide mounts to the volume", + "title": "Volume Mounts" + }, + "volumes": { + "type": "array", + "items": {}, + "description": "required when some values need to be read from or written to an external disk", + "title": "Volumes" + }, + "waitForSecondsBeforeScalingDown": { + "type": [ + "integer", + "string" + ], + "pattern": "^@{{[a-zA-Z0-9-+/*%_\\s]+}}$", + "description": "Wait for given period of time before scaling down the container", + "title": "Wait For Seconds Before Scaling Down" + } + } +} + diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/secrets-test-values.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/secrets-test-values.yaml new file mode 100644 index 0000000000..4a20404db8 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/secrets-test-values.yaml @@ -0,0 +1 @@ +{"ConfigSecrets":{"enabled":true,"secrets":[{"data":{"standard_key":"c3RhbmRhcmQtdmFsdWU="},"external":false,"externalType":"","mountPath":"/test","name":"normal-secret","type":"volume"},{"data":{"secret_key":"U0VDUkVUIERBVEE="},"external":true,"externalType":"AWSSecretsManager","mountPath":"","name":"external-secret-3","type":"environment"}]}} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/NOTES.txt b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/NOTES.txt new file mode 100644 index 0000000000..2b14478168 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range $.Values.ingress.paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host }}{{ . }} + {{- 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 ".Chart.Name .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 {{ include ".Chart.Name .fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include ".Chart.Name .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.kubernetes.io/name={{ include ".Chart.Name .name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/_helpers.tpl b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/_helpers.tpl new file mode 100644 index 0000000000..10de322e2a --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/_helpers.tpl @@ -0,0 +1,167 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define ".Chart.Name .name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create service name +*/}} +{{- define ".servicename" -}} +{{- if .Values.service.name -}} +{{- .Values.service.name | trunc 63 | trimSuffix "-" -}} +{{- else if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 55 | trimSuffix "-" -}}-service +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 55 | trimSuffix "-" -}}-service +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 55 | trimSuffix "-" -}}-service +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create preview service name +*/}} +{{- define ".previewservicename" -}} +{{- if .Values.service.name -}} +{{- .Values.service.name | trunc 55 | trimSuffix "-" -}}-preview +{{- else if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 47 | trimSuffix "-" -}}-preview-service +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 47 | trimSuffix "-" -}}-preview-service +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 47 | trimSuffix "-" -}}-preview-service +{{- end -}} +{{- end -}} +{{- 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 ".Chart.Name .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 ".Chart.Name .chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define ".Chart.Name .color" -}} +{{- $active0 := (index .Values.server.deployment 0).enabled -}} +{{/* +{{- $active1 := (index .Values.server.deployment 1).enabled -}} +*/}} +{{- $active1 := include "safeenabledcheck" . -}} +{{- $active := and $active0 $active1 -}} +{{- $active -}} +{{- end -}} + +{{- define "safeenabledcheck" -}} +{{- if (eq (len .Values.server.deployment) 2) -}} + {{- if (index .Values.server.deployment 1).enabled -}} + {{- $active := true -}} + {{- $active -}} + {{- else -}} + {{- $active := false -}} + {{- $active -}} + {{- end -}} +{{- else -}} + {{- $active := false -}} + {{- $active -}} +{{- end -}} +{{- end -}} + + +{{- define "isCMVolumeExists" -}} + {{- $isCMVolumeExists := false -}} + {{- if .Values.ConfigMaps.enabled }} + {{- range .Values.ConfigMaps.maps }} + {{- if eq .type "volume"}} + {{- $isCMVolumeExists = true}} + {{- end }} + {{- end }} + {{- end }} + {{- $isCMVolumeExists -}} +{{- end -}} + +{{- define "isSecretVolumeExists" -}} + {{- $isSecretVolumeExists := false -}} + {{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{- if eq .type "volume"}} + {{- $isSecretVolumeExists = true}} + {{- end }} + {{- end }} + {{- end }} + {{- $isSecretVolumeExists -}} +{{- end -}} + + + + +{{- define "serviceMonitorEnabled" -}} + {{- $SMenabled := false -}} + {{- range .Values.ContainerPort }} + {{- if .servicemonitor }} + {{- if and .servicemonitor.enabled }} + {{- $SMenabled = true -}} + {{- end }} + {{- end }} + {{- end }} + {{- $SMenabled -}} +{{- end -}} + +{{- define "VerticalPodAutoScalingEnabled" -}} + {{- $SMenabled := false -}} + {{- if and .Values.verticalPodScaling.enabled }} + {{- $SMenabled = true -}} + {{- end }} + {{- $SMenabled -}} +{{- end -}} + +{{/* Create the name of the service account to use */}} +{{- define "serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include ".Chart.Name .fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* Check for app/release labels in customPodLabels and replace accordingly */}} +{{- define "customPodLabelsContainsApp" -}} + {{- $LabelsContain := false -}} + {{- if hasKey .Values.customPodLabels "app" }} + {{- $LabelsContain = true -}} + {{- end }} + {{- $LabelsContain -}} +{{- end -}} + +{{- define "customPodLabelsContainsRelease" -}} + {{- $LabelsContain := false -}} + {{- if hasKey .Values.customPodLabels "release" }} + {{- $LabelsContain = true -}} + {{- end }} + {{- $LabelsContain -}} +{{- end -}} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/ambassador.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/ambassador.yaml new file mode 100644 index 0000000000..9d4a431c26 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/ambassador.yaml @@ -0,0 +1,94 @@ +{{ $svcName := include ".servicename" . }} +{{ $svcPort := (index .Values.ContainerPort 0).servicePort }} +{{- if $.Values.ambassadorMapping.enabled }} +{{- with $.Values.ambassadorMapping }} +apiVersion: getambassador.io/v3alpha1 +kind: Mapping +metadata: + {{- if .name }} + name: {{ .name }} + {{- else }} + name: {{ include ".Chart.Name .fullname" $ }}-mapping + {{- end }} + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + release: {{ $.Release.Name }} + releaseVersion: {{ $.Values.releaseVersion | quote }} + pipelineName: {{ $.Values.pipelineName }} + {{- if .labels }} +{{ toYaml .labels | nindent 4 }} + {{- end }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} +spec: + {{- if .ambassadorId }} + ambassador_id: {{ .ambassadorId }} + {{- end }} + {{- if .hostname }} + hostname: {{ .hostname | quote }} + {{- end }} + prefix: {{ .prefix }} + {{- if .rewrite }} + rewrite: {{ .rewrite }} + {{- end }} + service: {{ $svcName }}.{{ $.Release.Namespace }}:{{ $svcPort }} + {{- if .retryPolicy }} + retry_policy: +{{ toYaml .retryPolicy | indent 4 }} + {{- end }} + {{- if .cors }} + cors: +{{ toYaml .cors | indent 4 }} + {{- end }} + {{- if .weight }} + weight: {{ .weight }} + {{- end }} + {{- if .method }} + method: {{ .method }} + {{- end }} + {{- if .extraSpec }} +{{ toYaml .extraSpec | indent 2 }} + {{- end }} + {{- if .tls }} + {{- if .tls.context }} + tls: {{ .tls.context }} +{{- if .tls.create }} +--- +apiVersion: getambassador.io/v3alpha1 +kind: TLSContext +metadata: + name: {{ .tls.context }} + labels: + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} + releaseVersion: {{ $.Values.releaseVersion | quote }} + pipelineName: {{ $.Values.pipelineName }} + {{- if .tls.labels }} +{{ toYaml .tls.labels | nindent 4 }} + {{- end }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} +spec: + {{- if .tls.secretName }} + secret: {{ .tls.secretName }} + {{- end }} + {{- if .tls.hosts }} + hosts: +{{ toYaml .tls.hosts | nindent 4 }} + {{- end }} + {{- if .tls.extraSpec }} +{{ toYaml .tls.extraSpec | indent 2 }} + {{- end }} +{{- end }} + {{- end }} + {{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/configmap.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/configmap.yaml new file mode 100644 index 0000000000..4e7879665e --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/configmap.yaml @@ -0,0 +1,22 @@ +{{- if .Values.ConfigMaps.enabled }} + {{- range .Values.ConfigMaps.maps }} + {{if eq .external false}} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .name}}-{{ $.Values.app }} + labels: + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} +data: +{{ toYaml .data | trim | indent 2 }} + {{- end}} + {{- end}} +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/deployment.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/deployment.yaml new file mode 100644 index 0000000000..129c6c57cb --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/deployment.yaml @@ -0,0 +1,1284 @@ + {{- $hasCMEnvExists := false -}} + {{- $hasCMVolumeExists := false -}} + {{- if .Values.ConfigMaps.enabled }} + {{- range .Values.ConfigMaps.maps }} + {{- if eq .type "volume"}} + {{- $hasCMVolumeExists = true}} + {{- end }} + {{- if eq .type "environment"}} + {{- $hasCMEnvExists = true}} + {{- end }} + {{- end }} + {{- end }} + + {{- $hasPVCExists := false -}} + {{- if .Values.persistentVolumeClaim.name }} + {{- $hasPVCExists = true }} + {{- end }} + + {{- $hasSecretEnvExists := false -}} + {{- $hasSecretVolumeExists := false -}} + {{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{- if eq .type "volume"}} + {{- $hasSecretVolumeExists = true}} + {{- end }} + {{- if eq .type "environment"}} + {{- $hasSecretEnvExists = true}} + {{- end }} + {{- end }} + {{- end }} + {{ $CustomLabelsApp:= include "customPodLabelsContainsApp" . }} + {{ $CustomLabelsRelease:= include "customPodLabelsContainsRelease" . }} + + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include ".Chart.Name .fullname" $ }} + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} + releaseVersion: {{ $.Values.releaseVersion | quote }} + pipelineName: {{ .Values.pipelineName }} +{{- if .Values.deploymentLabels }} +{{ toYaml .Values.deploymentLabels | indent 4 }} +{{- end }} +{{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} +{{- end }} + +{{- if .Values.deploymentAnnotations }} + annotations: +{{ toYaml .Values.deploymentAnnotations | indent 4 }} +{{- end }} +spec: + selector: + matchLabels: +{{- if .Values.customMatchLabels }} +{{ toYaml .Values.customMatchLabels | indent 6 }} +{{- else }} + app: {{ .Values.customPodLabels.app | default (include ".Chart.Name .name" $) }} + release: {{ .Values.customPodLabels.release | default $.Release.Name }} +{{- end }} + replicas: {{ $.Values.replicaCount }} + minReadySeconds: {{ $.Values.MinReadySeconds }} + template: + metadata: + {{- if .Values.podAnnotations }} + annotations: + {{- range $key, $value := .Values.podAnnotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + labels: + {{- if not (eq "true" $CustomLabelsApp) }} + app: {{ .Values.customPodLabels.app | default (include ".Chart.Name .name" $) }} + {{- end }} + {{- if not (eq "true" $CustomLabelsRelease) }} + release: {{ .Values.customPodLabels.release |default $.Release.Name }} + {{- end }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} +{{- if .Values.customPodLabels }} +{{ toYaml .Values.customPodLabels | indent 8 }} +{{- end }} +{{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 8 }} +{{- end }} +{{- if .Values.podLabels }} +{{ toYaml .Values.podLabels | indent 8 }} +{{- end }} + spec: +{{- if $.Values.podExtraSpecs }} +{{ toYaml .Values.podExtraSpecs | indent 6 }} +{{- end }} + terminationGracePeriodSeconds: {{ $.Values.GracePeriod }} + restartPolicy: Always +{{- if $.Values.hostAliases }} + hostAliases: +{{ toYaml .Values.hostAliases | indent 8 }} +{{- end }} +{{- if and $.Values.Spec.Affinity.Key $.Values.Spec.Affinity.Values }} + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: {{ $.Values.Spec.Affinity.Key }} + operator: In + values: + - {{ $.Values.Spec.Affinity.Values | default "nodes" }} +{{- else if $.Values.affinity.enabled }} + affinity: +{{ toYaml .Values.affinity.values | indent 8 }} +{{- end }} +{{- if $.Values.serviceAccountName }} + serviceAccountName: {{ $.Values.serviceAccountName }} +{{- else }} + serviceAccountName: {{ template "serviceAccountName" . }} +{{- end }} +{{- if $.Values.schedulerName }} + schedulerName: {{ .Values.schedulerName }} +{{- end }} + {{- if .Values.tolerations }} + tolerations: +{{ toYaml .Values.tolerations | indent 8 }} + {{- end }} +{{- if $.Values.imagePullSecrets}} + imagePullSecrets: + {{- range .Values.imagePullSecrets }} + - name: {{ . }} + {{- end }} +{{- end}} +{{- if $.Values.topologySpreadConstraints }} + topologySpreadConstraints: +{{- range $.Values.topologySpreadConstraints }} + - maxSkew: {{ .maxSkew }} + topologyKey: {{ .topologyKey }} + whenUnsatisfiable: {{ .whenUnsatisfiable }} + {{- if semverCompare "<=1.30-0" $.Capabilities.KubeVersion.GitVersion }} + {{- if .minDomains }} + minDomains: {{ .minDomains }} + {{- end }} + {{- end }} + {{- if .nodeAffinityPolicy }} + nodeAffinityPolicy: {{ .nodeAffinityPolicy }} + {{- end }} + {{- if .nodeTaintsPolicy }} + nodeTaintsPolicy: {{ .nodeTaintsPolicy }} + {{- end }} + labelSelector: + matchLabels: + {{- if and .autoLabelSelector .customLabelSelector }} +{{ toYaml .customLabelSelector | indent 12 }} + {{- else if .autoLabelSelector }} + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + release: {{ $.Release.Name }} + {{- else if .customLabelSelector }} +{{ toYaml .customLabelSelector | indent 12 }} + {{- end }} +{{- end }} +{{- end }} +{{- if $.Values.topologySpreadConstraint }} + topologySpreadConstraints: +{{ toYaml .Values.topologySpreadConstraint }} +{{- end }} +{{- if $.Values.podSecurityContext }} + securityContext: +{{ toYaml .Values.podSecurityContext | indent 8 }} +{{- end }} +{{- if $.Values.restartPolicy }} + restartPolicy: {{ $.Values.restartPolicy }} +{{- end }} +{{- if $.Values.initContainers}} + initContainers: +{{- range $i, $c := .Values.initContainers }} +{{- if .reuseContainerImage}} + - name: {{ $.Chart.Name }}-init-{{ add1 $i }} + image: "{{ $.Values.server.deployment.image }}:{{ $.Values.server.deployment.image_tag }}" + imagePullPolicy: {{ $.Values.image.pullPolicy }} +{{- if .securityContext }} + securityContext: +{{ toYaml .securityContext | indent 12 }} +{{- end }} +{{- if .command}} + command: +{{ toYaml .command | indent 12 -}} +{{- end}} +{{- if .args}} + args: +{{ toYaml .args | indent 12 -}} +{{- end }} +{{- if .resources}} + resources: +{{ toYaml .resources | indent 12 -}} +{{- end }} +{{- if .volumeMounts}} + volumeMounts: +{{ toYaml .volumeMounts | indent 12 -}} +{{- end}} +{{- else}} + - +{{ toYaml . | indent 10 }} +{{- end}} +{{- end}} +{{- end}} + containers: + - name: {{ $.Chart.Name }} + image: "{{ .Values.server.deployment.image }}:{{ .Values.server.deployment.image_tag }}" + imagePullPolicy: {{ $.Values.image.pullPolicy }} + {{- if $.Values.containerSpec.lifecycle.enabled }} + lifecycle: + {{- if $.Values.containerSpec.lifecycle.preStop }} + preStop: +{{ toYaml $.Values.containerSpec.lifecycle.preStop | indent 12 -}} + {{- end }} + {{- if $.Values.containerSpec.lifecycle.postStart }} + postStart: +{{ toYaml $.Values.containerSpec.lifecycle.postStart | indent 12 -}} + {{- end }} + {{- end }} +{{- if and $.Values.containerSecurityContext $.Values.privileged }} + securityContext: + privileged: true +{{ toYaml .Values.containerSecurityContext | indent 12 }} +{{- else if $.Values.privileged }} + securityContext: + privileged: true +{{- else if $.Values.containerSecurityContext }} + securityContext: +{{ toYaml .Values.containerSecurityContext | indent 12 }} +{{- end }} +{{- if $.Values.containerExtraSpecs }} +{{ toYaml .Values.containerExtraSpecs | indent 10 }} +{{- end }} +{{- if $.Values.resizePolicy }} + resizePolicy: +{{ toYaml .Values.resizePolicy | indent 12 }} +{{- end }} + ports: + {{- range $.Values.ContainerPort }} + - name: {{ .name}} + containerPort: {{ .port }} + protocol: {{ .protocol | default "TCP" }} + {{- end}} +{{- if and $.Values.command.enabled $.Values.command.workingDir }} + workingDir: {{ $.Values.command.workingDir }} +{{- end}} +{{- if and $.Values.command.value $.Values.command.enabled}} + command: +{{ toYaml $.Values.command.value | indent 12 -}} +{{- end}} +{{- if and $.Values.args.value $.Values.args.enabled}} + args: +{{ toYaml $.Values.args.value | indent 12 -}} +{{- end }} + env: + - name: CONFIG_HASH + value: {{ include (print $.Chart.Name "/templates/configmap.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.ConfigHash) }}{{ .Values.devtronInternal.containerSpecs.ConfigHash }}{{ end }} + - name: SECRET_HASH + value: {{ include (print $.Chart.Name "/templates/secret.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.SecretHash) }}{{ .Values.devtronInternal.containerSpecs.SecretHash }}{{ end }} + - name: DEVTRON_APP_NAME + value: {{ template ".Chart.Name .name" $ }} + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: DEVTRON_CONTAINER_REPO + value: "{{ .Values.server.deployment.image }}" + - name: DEVTRON_CONTAINER_TAG + value: "{{ .Values.server.deployment.image_tag }}" + {{- range $.Values.EnvVariablesFromFieldPath }} + - name: {{ .name }} + valueFrom: + fieldRef: + fieldPath: {{ .fieldPath }} + {{- end}} + {{- range $.Values.EnvVariables }} + {{- if and .name .value }} + - name: {{ .name }} + value: {{ .value | quote }} + {{- end }} + {{- end }} + {{- range $.Values.EnvVariablesFromSecretKeys }} + {{- if and .name .secretName .keyName }} + - name: {{ .name }} + valueFrom: + secretKeyRef: + name: {{ .secretName }} + key: {{ .keyName }} + {{- end }} + {{- end }} + {{- range $.Values.EnvVariablesFromConfigMapKeys }} + {{- if and .name .configMapName .keyName }} + - name: {{ .name }} + valueFrom: + configMapKeyRef: + name: {{ .configMapName }} + key: {{ .keyName }} + {{- end }} + {{- end }} + {{- if or (and ($hasCMEnvExists) (.Values.ConfigMaps.enabled)) (and ($hasSecretEnvExists) (.Values.ConfigSecrets.enabled)) }} + envFrom: + {{- if .Values.ConfigMaps.enabled }} + {{- range .Values.ConfigMaps.maps }} + {{- if eq .type "environment" }} + - configMapRef: + {{- if eq .external true }} + name: {{ .name }} + {{- else if eq .external false }} + name: {{ .name}}-{{ $.Values.app }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{- if eq .type "environment" }} + - secretRef: + {{if eq .external true}} + name: {{ .name }} + {{else if eq .external false}} + name: {{ .name}}-{{ $.Values.app }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + +{{- if or $.Values.LivenessProbe.Path $.Values.LivenessProbe.command $.Values.LivenessProbe.tcp $.Values.LivenessProbe.grpc }} + livenessProbe: +{{- if $.Values.LivenessProbe.Path }} + httpGet: + path: {{ $.Values.LivenessProbe.Path }} + port: {{ $.Values.LivenessProbe.port }} + scheme: {{ $.Values.LivenessProbe.scheme }} + {{- if $.Values.LivenessProbe.httpHeaders }} + httpHeaders: + {{- range $.Values.LivenessProbe.httpHeaders}} + - name: {{.name}} + value: {{.value}} + {{- end}} + {{- end }} +{{- end }} +{{- if $.Values.LivenessProbe.command }} + exec: + command: +{{ toYaml .Values.LivenessProbe.command | indent 16 }} +{{- end}} +{{- if and $.Values.LivenessProbe.tcp }} + tcpSocket: + port: {{ $.Values.LivenessProbe.port }} +{{- end}} + initialDelaySeconds: {{ $.Values.LivenessProbe.initialDelaySeconds }} + periodSeconds: {{ $.Values.LivenessProbe.periodSeconds }} + successThreshold: {{ $.Values.LivenessProbe.successThreshold }} + timeoutSeconds: {{ $.Values.LivenessProbe.timeoutSeconds }} + failureThreshold: {{ $.Values.LivenessProbe.failureThreshold }} + {{- if $.Values.LivenessProbe.grpc }} + grpc: +{{ toYaml .Values.LivenessProbe.grpc | indent 14 }} + {{- end }} +{{- end }} +{{- if or $.Values.ReadinessProbe.Path $.Values.ReadinessProbe.command $.Values.ReadinessProbe.tcp $.Values.ReadinessProbe.grpc }} + readinessProbe: +{{- if $.Values.ReadinessProbe.Path }} + httpGet: + path: {{ $.Values.ReadinessProbe.Path }} + port: {{ $.Values.ReadinessProbe.port }} + scheme: {{ $.Values.ReadinessProbe.scheme }} + {{- if $.Values.ReadinessProbe.httpHeaders }} + httpHeaders: + {{- range $.Values.ReadinessProbe.httpHeaders}} + - name: {{.name}} + value: {{.value}} + {{- end}} + {{- end }} +{{- end }} +{{- if $.Values.ReadinessProbe.command }} + exec: + command: +{{ toYaml .Values.ReadinessProbe.command | indent 16 }} +{{- end}} +{{- if and $.Values.ReadinessProbe.tcp }} + tcpSocket: + port: {{ $.Values.ReadinessProbe.port }} +{{- end}} + initialDelaySeconds: {{ $.Values.ReadinessProbe.initialDelaySeconds }} + periodSeconds: {{ $.Values.ReadinessProbe.periodSeconds }} + successThreshold: {{ $.Values.ReadinessProbe.successThreshold }} + timeoutSeconds: {{ $.Values.ReadinessProbe.timeoutSeconds }} + failureThreshold: {{ $.Values.ReadinessProbe.failureThreshold }} + {{- if $.Values.ReadinessProbe.grpc }} + grpc: +{{ toYaml .Values.ReadinessProbe.grpc | indent 14 }} + {{- end}} +{{- end }} +{{- $resources := $.Values.resources | default dict }} +{{- $gpu := $.Values.gpu | default dict }} +{{- $gpuEnabled := and (hasKey $gpu "enabled") $gpu.enabled (hasKey $gpu "provider") (hasKey $gpu "resources") }} +{{- $gpuLimits := dict }} +{{- $gpuRequests := dict }} +{{- if $gpuEnabled }} + {{- $gpuLimits = dict $gpu.provider ($gpu.resources.limits | default 0) }} + {{- $gpuLimits = dict "limits" $gpuLimits }} + {{- $gpuRequests = dict $gpu.provider ($gpu.resources.requests | default 0) }} + {{- $gpuRequests = dict "requests" $gpuRequests }} +{{- end }} +{{- $limits := merge (get $resources "limits" | default dict) (get $gpuLimits "limits" | default dict) }} +{{- $requests := merge (get $resources "requests" | default dict) (get $gpuRequests "requests" | default dict) }} +{{- if or $limits $requests }} + resources: +{{- if $limits }} + limits: +{{ toYaml $limits | indent 14 }} +{{- end }} +{{- if $requests }} + requests: +{{ toYaml $requests | indent 14 }} +{{- end }} +{{- end }} +{{- if or $.Values.StartupProbe.Path $.Values.StartupProbe.command $.Values.StartupProbe.tcp $.Values.StartupProbe.grpc }} + startupProbe: +{{- if $.Values.StartupProbe.Path }} + httpGet: + path: {{ $.Values.StartupProbe.Path }} + port: {{ $.Values.StartupProbe.port }} + {{- if $.Values.StartupProbe.httpHeaders }} + httpHeaders: + {{- range $.Values.StartupProbe.httpHeaders}} + - name: {{.name}} + value: {{.value}} + {{- end}} + {{- end }} +{{- end }} +{{- if $.Values.StartupProbe.command }} + exec: + command: +{{ toYaml .Values.StartupProbe.command | indent 16 }} +{{- end}} +{{- if and $.Values.StartupProbe.tcp }} + tcpSocket: + port: {{ $.Values.StartupProbe.port }} +{{- end}} + initialDelaySeconds: {{ $.Values.StartupProbe.initialDelaySeconds }} + periodSeconds: {{ $.Values.StartupProbe.periodSeconds }} + successThreshold: {{ $.Values.StartupProbe.successThreshold }} + timeoutSeconds: {{ $.Values.StartupProbe.timeoutSeconds }} + failureThreshold: {{ $.Values.StartupProbe.failureThreshold }} + {{- if $.Values.StartupProbe.grpc }} + grpc: +{{ toYaml .Values.StartupProbe.grpc | indent 14 }} + {{- end}} +{{- end }} + volumeMounts: +{{- with .Values.volumeMounts }} +{{ toYaml . | trim | indent 12 }} +{{- end }} +{{- if $.Values.persistentVolumeClaim.name }} + - name: {{ .Values.persistentVolumeClaim.name }}-vol + mountPath: {{ .Values.persistentVolumeClaim.mountPath | default "/tmp" }} +{{- end}} + {{- if .Values.ConfigMaps.enabled }} + {{- range .Values.ConfigMaps.maps }} + {{- if eq .type "volume"}} + {{- $cmName := .name -}} + {{- $cmMountPath := .mountPath -}} + {{- if eq .subPath false }} + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath }} + + {{- else }} + {{- range $k, $v := .data }} + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath }}/{{ $k}} + subPath: {{ $k}} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + + {{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{- if eq .type "volume"}} + {{- $cmName := .name -}} + {{- $cmMountPath := .mountPath -}} + {{- if eq .subPath false }} + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath }} + + {{- else }} + {{if (or (eq .externalType "ESO_GoogleSecretsManager") (eq .externalType "ESO_AWSSecretsManager") (eq .externalType "ESO_HashiCorpVault") (eq .externalType "ESO_AzureSecretsManager"))}} + {{- if and (.esoSubPath) (ne (len .esoSubPath) 0) }} + {{- range .esoSubPath }} + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath}}/{{ . }} + subPath: {{ . }} + {{- end }} + {{- else }} + {{- range .esoSecretData.esoData }} + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath}}/{{ .secretKey }} + subPath: {{ .secretKey }} + {{- end }} + {{- end }} + {{- else }} + {{- range $k, $v := .data }} # for others secrets the mount path will be .data[i].secretKey + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath}}/{{ $k}} + subPath: {{ $k}} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- if and (eq (len .Values.volumes) 0) (eq ($hasPVCExists) false) (or (eq (.Values.ConfigSecrets.enabled) true) (eq (.Values.ConfigMaps.enabled) true)) (eq ($hasCMVolumeExists) false) (eq ($hasSecretVolumeExists) false) }} []{{- end }} + {{- if and (eq (len .Values.volumeMounts) 0) (eq ($hasPVCExists) false) (eq (.Values.ConfigSecrets.enabled) false) (eq (.Values.ConfigMaps.enabled) false) }} [] {{- end }} +{{- if $.Values.appMetrics }} + - name: envoy + image: {{ $.Values.envoyproxy.image | default "quay.io/devtron/envoy:v1.16.0"}} + {{- if $.Values.envoyproxy.lifecycle }} + lifecycle: +{{ toYaml .Values.envoyproxy.lifecycle | indent 12 -}} + {{- else if $.Values.containerSpec.lifecycle.enabled }} + lifecycle: + {{- if $.Values.containerSpec.lifecycle.preStop }} + preStop: +{{ toYaml $.Values.containerSpec.lifecycle.preStop | indent 12 -}} + {{- end }} + {{- end }} + resources: +{{ toYaml $.Values.envoyproxy.resources | trim | indent 12 }} + ports: + - containerPort: 9901 + protocol: TCP + name: envoy-admin + {{- range $index, $element := .Values.ContainerPort }} + - name: envoy-{{ $element.name}} + containerPort: {{ $element.envoyPort | default (add 8790 $index) }} + protocol: TCP + {{- end }} + command: ["/usr/local/bin/envoy"] + args: ["-c", "/etc/envoy-config/envoy-config.json", "-l", "info", "--log-format", "[METADATA][%Y-%m-%d %T.%e][%t][%l][%n] %v"] + volumeMounts: + - name: {{ $.Values.envoyproxy.configMapName | default "envoy-config-volume" }} + mountPath: /etc/envoy-config/ +{{- if $.Values.envoyproxy.readinessProbe}} + readinessProbe: +{{ toYaml $.Values.envoyproxy.readinessProbe | indent 12}} +{{- end }} +{{- if $.Values.envoyproxy.livenessProbe}} + livenessProbe: +{{ toYaml $.Values.envoyproxy.livenessProbe | indent 12}} +{{- end }} +{{- end}} +{{- if $.Values.containers }} +{{- range $i, $c := .Values.containers }} +{{- if .reuseContainerImage}} + - name: {{ $.Chart.Name }}-sidecontainer-{{ add1 $i }} + image: "{{ $.Values.server.deployment.image }}:{{ $.Values.server.deployment.image_tag }}" + imagePullPolicy: {{ $.Values.image.pullPolicy }} +{{- if .env }} + env: +{{ toYaml .env | indent 12 }} +{{- end }} + {{- if .envFrom }} + envFrom: +{{ toYaml .env | indent 12 }} +{{- end }} +{{- if .securityContext }} + securityContext: +{{ toYaml .securityContext | indent 12 }} +{{- end }} +{{- if .command}} + command: +{{ toYaml .command | indent 12 -}} +{{- end}} +{{- if .resizePolicy }} + resizePolicy: +{{ toYaml .resziePolicy | indent 12}} +{{- end }} +{{- if .resources}} + resources: +{{ toYaml .resources | indent 12 -}} +{{- end}} +{{- if .volumeMounts}} + volumeMounts: +{{ toYaml .volumeMounts | indent 12 -}} +{{- end}} +{{- else}} + - +{{ toYaml . | indent 10 }} +{{- end}} +{{- end}} +{{- end}} + + + volumes: + {{- if $.Values.appMetrics }} + - name: envoy-config-volume + configMap: + name: sidecar-config-{{ template ".Chart.Name .name" $ }} + {{- end }} +{{- with .Values.volumes }} +{{ toYaml . | trim | indent 8 }} +{{- end }} +{{- if .Values.persistentVolumeClaim.name }} + - name: {{.Values.persistentVolumeClaim.name}}-vol + persistentVolumeClaim: + claimName: {{.Values.persistentVolumeClaim.name }} +{{- end}} + {{- if .Values.ConfigMaps.enabled }} + {{- range .Values.ConfigMaps.maps }} + {{- if eq .type "volume"}} + - name: {{ .name | replace "." "-"}}-vol + configMap: + {{- if eq .external true }} + name: {{ .name }} + {{- else if eq .external false }} + name: {{ .name}}-{{ $.Values.app }} + {{- end }} + {{- if eq (len .filePermission) 0 }} + {{- else }} + defaultMode: {{ .filePermission}} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + + {{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{- if eq .type "volume"}} + - name: {{ .name | replace "." "-"}}-vol + secret: + {{- if eq .external true }} + secretName: {{ .name }} + {{- else if eq .external false }} + secretName: {{ .name}}-{{ $.Values.app }} + {{- end }} + {{- if eq (len .filePermission) 0 }} + {{- else }} + defaultMode: {{ .filePermission}} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- if and (eq (len .Values.volumes) 0) (eq ($hasPVCExists) false) (or (eq (.Values.ConfigSecrets.enabled) true) (eq (.Values.ConfigMaps.enabled) true)) (eq ($hasCMVolumeExists) false) (eq ($hasSecretVolumeExists) false) (eq (.Values.appMetrics) false) }} []{{- end }} + {{- if and (eq (len .Values.volumes) 0) (eq ($hasPVCExists) false) (eq (.Values.ConfigSecrets.enabled) false) (eq (.Values.ConfigMaps.enabled) false) (eq (.Values.appMetrics) false) }} [] {{- end }} + + revisionHistoryLimit: 3 +## pauseForSecondsBeforeSwitchActive: {{ $.Values.pauseForSecondsBeforeSwitchActive }} +# waitForSecondsBeforeScalingDown: {{ $.Values.waitForSecondsBeforeScalingDown }} + strategy: + {{- if eq .Values.deploymentType "ROLLING" }} + type: "RollingUpdate" + rollingUpdate: + maxSurge: {{ $.Values.deployment.strategy.rolling.maxSurge }} + maxUnavailable: {{ $.Values.deployment.strategy.rolling.maxUnavailable }} + {{- end }} + {{- if eq .Values.deploymentType "RECREATE" }} + type: "Recreate" + {{- end }} +{{- if $.Values.secondaryWorkload.enabled }} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include ".Chart.Name .fullname" $ }}-{{ $.Values.secondaryWorkload.postfix | default "sec" }} + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} + releaseVersion: {{ $.Values.releaseVersion | quote }} + pipelineName: {{ .Values.pipelineName }} +{{- if .Values.deploymentLabels }} +{{ toYaml .Values.deploymentLabels | indent 4 }} +{{- end }} +{{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} +{{- end }} + +{{- if .Values.deploymentAnnotations }} + annotations: +{{ toYaml .Values.deploymentAnnotations | indent 4 }} +{{- end }} +spec: + selector: + matchLabels: +{{- if .Values.customMatchLabels }} +{{ toYaml .Values.customMatchLabels | indent 6 }} +{{- else }} + app: {{ .Values.customPodLabels.app | default (include ".Chart.Name .name" $) }} + release: {{ .Values.customPodLabels.release | default $.Release.Name }} +{{- end }} + replicas: {{ $.Values.secondaryWorkload.replicaCount | default 1 }} + minReadySeconds: {{ $.Values.MinReadySeconds }} + template: + metadata: + {{- if .Values.podAnnotations }} + annotations: + {{- range $key, $value := .Values.podAnnotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + labels: + {{- if not (eq "true" $CustomLabelsApp) }} + app: {{ .Values.customPodLabels.app | default (include ".Chart.Name .name" $) }} + {{- end }} + {{- if not (eq "true" $CustomLabelsRelease) }} + release: {{ .Values.customPodLabels.release |default $.Release.Name }} + {{- end }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} +{{- if .Values.customPodLabels }} +{{ toYaml .Values.customPodLabels | indent 8 }} +{{- end }} +{{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 8 }} +{{- end }} +{{- if .Values.podLabels }} +{{ toYaml .Values.podLabels | indent 8 }} +{{- end }} + spec: +{{- if $.Values.podExtraSpecs }} +{{ toYaml .Values.podExtraSpecs | indent 6 }} +{{- end }} + terminationGracePeriodSeconds: {{ $.Values.GracePeriod }} + restartPolicy: Always +{{- if $.Values.hostAliases }} + hostAliases: +{{ toYaml .Values.hostAliases | indent 8 }} +{{- end }} +{{- with $.Values.secondaryWorkload }} +{{- if and .Spec.Affinity.Key .Spec.Affinity.Values }} + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: {{ .Spec.Affinity.Key }} + operator: In + values: + - {{ .Spec.Affinity.Values | default "nodes" }} +{{- else if .affinity.enabled }} + affinity: +{{ toYaml .affinity.values | indent 8 }} +{{- end }} +{{- end }} +{{- if $.Values.serviceAccountName }} + serviceAccountName: {{ $.Values.serviceAccountName }} +{{- else }} + serviceAccountName: {{ template "serviceAccountName" . }} +{{- end }} +{{- if $.Values.schedulerName }} + schedulerName: {{ .Values.schedulerName }} +{{- end }} + {{- if $.Values.secondaryWorkload.tolerations }} + tolerations: +{{ toYaml $.Values.secondaryWorkload.tolerations | indent 8 }} + {{- end }} +{{- if $.Values.imagePullSecrets}} + imagePullSecrets: + {{- range .Values.imagePullSecrets }} + - name: {{ . }} + {{- end }} +{{- end}} +{{- if $.Values.topologySpreadConstraints }} + topologySpreadConstraints: +{{- range $.Values.topologySpreadConstraints }} + - maxSkew: {{ .maxSkew }} + topologyKey: {{ .topologyKey }} + whenUnsatisfiable: {{ .whenUnsatisfiable }} + {{- if semverCompare "<=1.30-0" $.Capabilities.KubeVersion.GitVersion }} + {{- if .minDomains }} + minDomains: {{ .minDomains }} + {{- end }} + {{- end }} + {{- if .nodeAffinityPolicy }} + nodeAffinityPolicy: {{ .nodeAffinityPolicy }} + {{- end }} + {{- if .nodeTaintsPolicy }} + nodeTaintsPolicy: {{ .nodeTaintsPolicy }} + {{- end }} + labelSelector: + matchLabels: + {{- if and .autoLabelSelector .customLabelSelector }} +{{ toYaml .customLabelSelector | indent 12 }} + {{- else if .autoLabelSelector }} + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + release: {{ $.Release.Name }} + {{- else if .customLabelSelector }} +{{ toYaml .customLabelSelector | indent 12 }} + {{- end }} +{{- end }} +{{- end }} +{{- if $.Values.topologySpreadConstraint }} + topologySpreadConstraints: +{{ toYaml .Values.topologySpreadConstraint }} +{{- end }} +{{- if $.Values.podSecurityContext }} + securityContext: +{{ toYaml .Values.podSecurityContext | indent 8 }} +{{- end }} +{{- if $.Values.restartPolicy }} + restartPolicy: {{ $.Values.restartPolicy }} +{{- end }} +{{- if $.Values.initContainers}} + initContainers: +{{- range $i, $c := .Values.initContainers }} +{{- if .reuseContainerImage}} + - name: {{ $.Chart.Name }}-init-{{ add1 $i }} + image: "{{ $.Values.server.deployment.image }}:{{ $.Values.server.deployment.image_tag }}" + imagePullPolicy: {{ $.Values.image.pullPolicy }} +{{- if .securityContext }} + securityContext: +{{ toYaml .securityContext | indent 12 }} +{{- end }} +{{- if .command}} + command: +{{ toYaml .command | indent 12 -}} +{{- end}} +{{- if .args}} + args: +{{ toYaml .args | indent 12 -}} +{{- end}} +{{- if .resources}} + resources: +{{ toYaml .resources | indent 12 -}} +{{- end}} +{{- if .volumeMounts}} + volumeMounts: +{{ toYaml .volumeMounts | indent 12 -}} +{{- end}} +{{- else}} + - +{{ toYaml . | indent 10 }} +{{- end}} +{{- end}} +{{- end}} + containers: + - name: {{ $.Chart.Name }} + image: "{{ .Values.server.deployment.image }}:{{ .Values.server.deployment.image_tag }}" + imagePullPolicy: {{ $.Values.image.pullPolicy }} + {{- if $.Values.containerSpec.lifecycle.enabled }} + lifecycle: + {{- if $.Values.containerSpec.lifecycle.preStop }} + preStop: +{{ toYaml $.Values.containerSpec.lifecycle.preStop | indent 12 -}} + {{- end }} + {{- if $.Values.containerSpec.lifecycle.postStart }} + postStart: +{{ toYaml $.Values.containerSpec.lifecycle.postStart | indent 12 -}} + {{- end }} + {{- end }} +{{- if and $.Values.containerSecurityContext $.Values.privileged }} + securityContext: + privileged: true +{{ toYaml .Values.containerSecurityContext | indent 12 }} +{{- else if $.Values.privileged }} + securityContext: + privileged: true +{{- else if $.Values.containerSecurityContext }} + securityContext: +{{ toYaml .Values.containerSecurityContext | indent 12 }} +{{- end }} +{{- if $.Values.containerExtraSpecs }} +{{ toYaml .Values.containerExtraSpecs | indent 10 }} +{{- end }} +{{- if $.Values.resizePolicy }} + resizePolicy: +{{ toYaml .Values.resizePolicy | indent 12 }} +{{- end }} + ports: + {{- range $.Values.ContainerPort }} + - name: {{ .name}} + containerPort: {{ .port }} + protocol: {{ .protocol | default "TCP" }} + {{- end}} +{{- if and $.Values.command.enabled $.Values.command.workingDir }} + workingDir: {{ $.Values.command.workingDir }} +{{- end}} +{{- if and $.Values.command.value $.Values.command.enabled}} + command: +{{ toYaml $.Values.command.value | indent 12 -}} +{{- end}} +{{- if and $.Values.args.value $.Values.args.enabled}} + args: +{{ toYaml $.Values.args.value | indent 12 -}} +{{- end }} + env: + - name: CONFIG_HASH + value: {{ include (print $.Chart.Name "/templates/configmap.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.ConfigHash) }}{{ .Values.devtronInternal.containerSpecs.ConfigHash }}{{ end }} + - name: SECRET_HASH + value: {{ include (print $.Chart.Name "/templates/secret.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.SecretHash) }}{{ .Values.devtronInternal.containerSpecs.SecretHash }}{{ end }} + - name: DEVTRON_APP_NAME + value: {{ template ".Chart.Name .name" $ }} + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: DEVTRON_CONTAINER_REPO + value: "{{ .Values.server.deployment.image }}" + - name: DEVTRON_CONTAINER_TAG + value: "{{ .Values.server.deployment.image_tag }}" + {{- range $.Values.EnvVariablesFromFieldPath }} + - name: {{ .name }} + valueFrom: + fieldRef: + fieldPath: {{ .fieldPath }} + {{- end}} + {{- range $.Values.EnvVariables }} + {{- if and .name .value }} + - name: {{ .name }} + value: {{ .value | quote }} + {{- end }} + {{- end }} + {{- range $.Values.EnvVariablesFromSecretKeys }} + {{- if and .name .secretName .keyName }} + - name: {{ .name }} + valueFrom: + secretKeyRef: + name: {{ .secretName }} + key: {{ .keyName }} + {{- end }} + {{- end }} + {{- range $.Values.EnvVariablesFromConfigMapKeys }} + {{- if and .name .configMapName .keyName }} + - name: {{ .name }} + valueFrom: + configMapKeyRef: + name: {{ .configMapName }} + key: {{ .keyName }} + {{- end }} + {{- end }} + {{- if or (and ($hasCMEnvExists) (.Values.ConfigMaps.enabled)) (and ($hasSecretEnvExists) (.Values.ConfigSecrets.enabled)) }} + envFrom: + {{- if .Values.ConfigMaps.enabled }} + {{- range .Values.ConfigMaps.maps }} + {{- if eq .type "environment" }} + - configMapRef: + {{- if eq .external true }} + name: {{ .name }} + {{- else if eq .external false }} + name: {{ .name}}-{{ $.Values.app }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{- if eq .type "environment" }} + - secretRef: + {{if eq .external true}} + name: {{ .name }} + {{else if eq .external false}} + name: {{ .name}}-{{ $.Values.app }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + +{{- if or $.Values.LivenessProbe.Path $.Values.LivenessProbe.command $.Values.LivenessProbe.tcp $.Values.LivenessProbe.grpc }} + livenessProbe: +{{- if $.Values.LivenessProbe.Path }} + httpGet: + path: {{ $.Values.LivenessProbe.Path }} + port: {{ $.Values.LivenessProbe.port }} + scheme: {{ $.Values.LivenessProbe.scheme }} + {{- if $.Values.LivenessProbe.httpHeaders }} + httpHeaders: + {{- range $.Values.LivenessProbe.httpHeaders}} + - name: {{.name}} + value: {{.value}} + {{- end}} + {{- end }} +{{- end }} +{{- if $.Values.LivenessProbe.command }} + exec: + command: +{{ toYaml .Values.LivenessProbe.command | indent 16 }} +{{- end}} +{{- if and $.Values.LivenessProbe.tcp }} + tcpSocket: + port: {{ $.Values.LivenessProbe.port }} +{{- end}} + initialDelaySeconds: {{ $.Values.LivenessProbe.initialDelaySeconds }} + periodSeconds: {{ $.Values.LivenessProbe.periodSeconds }} + successThreshold: {{ $.Values.LivenessProbe.successThreshold }} + timeoutSeconds: {{ $.Values.LivenessProbe.timeoutSeconds }} + failureThreshold: {{ $.Values.LivenessProbe.failureThreshold }} + {{- if $.Values.LivenessProbe.grpc }} + grpc: +{{ toYaml .Values.LivenessProbe.grpc | indent 14 }} + {{- end }} +{{- end }} +{{- if or $.Values.ReadinessProbe.Path $.Values.ReadinessProbe.command $.Values.ReadinessProbe.tcp $.Values.ReadinessProbe.grpc }} + readinessProbe: +{{- if $.Values.ReadinessProbe.Path }} + httpGet: + path: {{ $.Values.ReadinessProbe.Path }} + port: {{ $.Values.ReadinessProbe.port }} + scheme: {{ $.Values.ReadinessProbe.scheme }} + {{- if $.Values.ReadinessProbe.httpHeaders }} + httpHeaders: + {{- range $.Values.ReadinessProbe.httpHeaders}} + - name: {{.name}} + value: {{.value}} + {{- end}} + {{- end }} +{{- end }} +{{- if $.Values.ReadinessProbe.command }} + exec: + command: +{{ toYaml .Values.ReadinessProbe.command | indent 16 }} +{{- end}} +{{- if and $.Values.ReadinessProbe.tcp }} + tcpSocket: + port: {{ $.Values.ReadinessProbe.port }} +{{- end}} + initialDelaySeconds: {{ $.Values.ReadinessProbe.initialDelaySeconds }} + periodSeconds: {{ $.Values.ReadinessProbe.periodSeconds }} + successThreshold: {{ $.Values.ReadinessProbe.successThreshold }} + timeoutSeconds: {{ $.Values.ReadinessProbe.timeoutSeconds }} + failureThreshold: {{ $.Values.ReadinessProbe.failureThreshold }} + {{- if $.Values.ReadinessProbe.grpc }} + grpc: +{{ toYaml .Values.ReadinessProbe.grpc | indent 14 }} + {{- end}} +{{- end }} + resources: +{{ toYaml $.Values.resources | trim | indent 12 }} +{{- if or $.Values.StartupProbe.Path $.Values.StartupProbe.command $.Values.StartupProbe.tcp $.Values.StartupProbe.grpc }} + startupProbe: +{{- if $.Values.StartupProbe.Path }} + httpGet: + path: {{ $.Values.StartupProbe.Path }} + port: {{ $.Values.StartupProbe.port }} + {{- if $.Values.StartupProbe.httpHeaders }} + httpHeaders: + {{- range $.Values.StartupProbe.httpHeaders}} + - name: {{.name}} + value: {{.value}} + {{- end}} + {{- end }} +{{- end }} +{{- if $.Values.StartupProbe.command }} + exec: + command: +{{ toYaml .Values.StartupProbe.command | indent 16 }} +{{- end}} +{{- if and $.Values.StartupProbe.tcp }} + tcpSocket: + port: {{ $.Values.StartupProbe.port }} +{{- end}} + initialDelaySeconds: {{ $.Values.StartupProbe.initialDelaySeconds }} + periodSeconds: {{ $.Values.StartupProbe.periodSeconds }} + successThreshold: {{ $.Values.StartupProbe.successThreshold }} + timeoutSeconds: {{ $.Values.StartupProbe.timeoutSeconds }} + failureThreshold: {{ $.Values.StartupProbe.failureThreshold }} + {{- if $.Values.StartupProbe.grpc }} + grpc: +{{ toYaml .Values.StartupProbe.grpc | indent 14 }} + {{- end}} +{{- end }} + volumeMounts: +{{- with .Values.volumeMounts }} +{{ toYaml . | trim | indent 12 }} +{{- end }} +{{- if $.Values.persistentVolumeClaim.name }} + - name: {{ .Values.persistentVolumeClaim.name }}-vol + mountPath: {{ .Values.persistentVolumeClaim.mountPath | default "/tmp" }} +{{- end}} + {{- if .Values.ConfigMaps.enabled }} + {{- range .Values.ConfigMaps.maps }} + {{- if eq .type "volume"}} + {{- $cmName := .name -}} + {{- $cmMountPath := .mountPath -}} + {{- if eq .subPath false }} + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath }} + + {{- else }} + {{- range $k, $v := .data }} + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath }}/{{ $k}} + subPath: {{ $k}} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + + {{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{- if eq .type "volume"}} + {{- $cmName := .name -}} + {{- $cmMountPath := .mountPath -}} + {{- if eq .subPath false }} + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath }} + + {{- else }} + {{if (or (eq .externalType "ESO_GoogleSecretsManager") (eq .externalType "ESO_AWSSecretsManager") (eq .externalType "ESO_HashiCorpVault") (eq .externalType "ESO_AzureSecretsManager"))}} + {{- if and (.esoSubPath) (ne (len .esoSubPath) 0) }} + {{- range .esoSubPath }} + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath}}/{{ . }} + subPath: {{ . }} + {{- end }} + {{- else }} + {{- range .esoSecretData.esoData }} + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath}}/{{ .secretKey }} + subPath: {{ .secretKey }} + {{- end }} + {{- end }} + {{- else }} + {{- range $k, $v := .data }} # for others secrets the mount path will be .data[i].secretKey + - name: {{ $cmName | replace "." "-"}}-vol + mountPath: {{ $cmMountPath}}/{{ $k}} + subPath: {{ $k}} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- if and (eq (len .Values.volumes) 0) (eq ($hasPVCExists) false) (or (eq (.Values.ConfigSecrets.enabled) true) (eq (.Values.ConfigMaps.enabled) true)) (eq ($hasCMVolumeExists) false) (eq ($hasSecretVolumeExists) false) }} []{{- end }} + {{- if and (eq (len .Values.volumeMounts) 0) (eq ($hasPVCExists) false) (eq (.Values.ConfigSecrets.enabled) false) (eq (.Values.ConfigMaps.enabled) false) }} [] {{- end }} +{{- if $.Values.appMetrics }} + - name: envoy + image: {{ $.Values.envoyproxy.image | default "quay.io/devtron/envoy:v1.16.0"}} + {{- if $.Values.envoyproxy.lifecycle }} + lifecycle: +{{ toYaml .Values.envoyproxy.lifecycle | indent 12 -}} + {{- else if $.Values.containerSpec.lifecycle.enabled }} + lifecycle: + {{- if $.Values.containerSpec.lifecycle.preStop }} + preStop: +{{ toYaml $.Values.containerSpec.lifecycle.preStop | indent 12 -}} + {{- end }} + {{- end }} + resources: +{{ toYaml $.Values.envoyproxy.resources | trim | indent 12 }} + ports: + - containerPort: 9901 + protocol: TCP + name: envoy-admin + {{- range $index, $element := .Values.ContainerPort }} + - name: envoy-{{ $element.name}} + containerPort: {{ $element.envoyPort | default (add 8790 $index) }} + protocol: TCP + {{- end }} + command: ["/usr/local/bin/envoy"] + args: ["-c", "/etc/envoy-config/envoy-config.json", "-l", "info", "--log-format", "[METADATA][%Y-%m-%d %T.%e][%t][%l][%n] %v"] + volumeMounts: + - name: {{ $.Values.envoyproxy.configMapName | default "envoy-config-volume" }} + mountPath: /etc/envoy-config/ +{{- if $.Values.envoyproxy.readinessProbe}} + readinessProbe: +{{ toYaml $.Values.envoyproxy.readinessProbe | indent 12}} +{{- end }} +{{- if $.Values.envoyproxy.livenessProbe}} + livenessProbe: +{{ toYaml $.Values.envoyproxy.livenessProbe | indent 12}} +{{- end }} +{{- end}} +{{- if $.Values.containers }} +{{- range $i, $c := .Values.containers }} +{{- if .reuseContainerImage}} + - name: {{ $.Chart.Name }}-sidecontainer-{{ add1 $i }} + image: "{{ $.Values.server.deployment.image }}:{{ $.Values.server.deployment.image_tag }}" + imagePullPolicy: {{ $.Values.image.pullPolicy }} +{{- if .env }} + env: +{{ toYaml .env | indent 12 }} +{{- end }} + {{- if .envFrom }} + envFrom: +{{ toYaml .env | indent 12 }} +{{- end }} +{{- if .securityContext }} + securityContext: +{{ toYaml .securityContext | indent 12 }} +{{- end }} +{{- if .command}} + command: +{{ toYaml .command | indent 12 -}} +{{- end}} +{{- if .resizePolicy }} + resizePolicy: +{{ toYaml .resziePolicy | indent 12}} +{{- end }} +{{- if .resources}} + resources: +{{ toYaml .resources | indent 12 -}} +{{- end}} +{{- if .volumeMounts}} + volumeMounts: +{{ toYaml .volumeMounts | indent 12 -}} +{{- end}} +{{- else}} + - +{{ toYaml . | indent 10 }} +{{- end}} +{{- end}} +{{- end}} + + + volumes: + {{- if $.Values.appMetrics }} + - name: envoy-config-volume + configMap: + name: sidecar-config-{{ template ".Chart.Name .name" $ }} + {{- end }} +{{- with .Values.volumes }} +{{ toYaml . | trim | indent 8 }} +{{- end }} +{{- if .Values.persistentVolumeClaim.name }} + - name: {{.Values.persistentVolumeClaim.name}}-vol + persistentVolumeClaim: + claimName: {{.Values.persistentVolumeClaim.name }} +{{- end}} + {{- if .Values.ConfigMaps.enabled }} + {{- range .Values.ConfigMaps.maps }} + {{- if eq .type "volume"}} + - name: {{ .name | replace "." "-"}}-vol + configMap: + {{- if eq .external true }} + name: {{ .name }} + {{- else if eq .external false }} + name: {{ .name}}-{{ $.Values.app }} + {{- end }} + {{- if eq (len .filePermission) 0 }} + {{- else }} + defaultMode: {{ .filePermission}} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + + {{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{- if eq .type "volume"}} + - name: {{ .name | replace "." "-"}}-vol + secret: + {{- if eq .external true }} + secretName: {{ .name }} + {{- else if eq .external false }} + secretName: {{ .name}}-{{ $.Values.app }} + {{- end }} + {{- if eq (len .filePermission) 0 }} + {{- else }} + defaultMode: {{ .filePermission}} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- if and (eq (len .Values.volumes) 0) (eq ($hasPVCExists) false) (or (eq (.Values.ConfigSecrets.enabled) true) (eq (.Values.ConfigMaps.enabled) true)) (eq ($hasCMVolumeExists) false) (eq ($hasSecretVolumeExists) false) (eq (.Values.appMetrics) false) }} []{{- end }} + {{- if and (eq (len .Values.volumes) 0) (eq ($hasPVCExists) false) (eq (.Values.ConfigSecrets.enabled) false) (eq (.Values.ConfigMaps.enabled) false) (eq (.Values.appMetrics) false) }} [] {{- end }} + + revisionHistoryLimit: 3 +## pauseForSecondsBeforeSwitchActive: {{ $.Values.pauseForSecondsBeforeSwitchActive }} +# waitForSecondsBeforeScalingDown: {{ $.Values.waitForSecondsBeforeScalingDown }} + strategy: + {{- if eq .Values.deploymentType "ROLLING" }} + type: "RollingUpdate" + rollingUpdate: + maxSurge: {{ $.Values.deployment.strategy.rolling.maxSurge }} + maxUnavailable: {{ $.Values.deployment.strategy.rolling.maxUnavailable }} + {{- end }} + {{- if eq .Values.deploymentType "RECREATE" }} + type: "Recreate" + {{- end }} +{{- end }} + diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/externalsecrets.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/externalsecrets.yaml new file mode 100644 index 0000000000..efd291af5d --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/externalsecrets.yaml @@ -0,0 +1,76 @@ +{{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{if eq .external true }} + {{if (or (eq .externalType "ESO_GoogleSecretsManager") (eq .externalType "ESO_AWSSecretsManager") (eq .externalType "ESO_HashiCorpVault") (eq .externalType "ESO_AzureSecretsManager"))}} +{{- if .esoSecretData.secretStore }} +--- +apiVersion: external-secrets.io/v1beta1 +kind: SecretStore +metadata: + name: {{ .name}} + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} +spec: + provider: + {{- toYaml .esoSecretData.secretStore | nindent 4 }} +{{- end }} +--- +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: {{ .name }} + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} +spec: + {{- if .esoSecretData.refreshInterval }} + refreshInterval: {{ .esoSecretData.refreshInterval }} + {{- else }} + refreshInterval: 1h + {{- end}} + {{- if and .esoSecretData.secretStoreRef (not .esoSecretData.secretStore) }} + secretStoreRef: +{{ toYaml .esoSecretData.secretStoreRef | indent 4 }} + {{- else }} + secretStoreRef: + name: {{ .name}} + kind: SecretStore + {{- end }} + target: + name: {{ .name}} + {{- if .esoSecretData.template }} + template: + {{- toYaml .esoSecretData.template | nindent 6 }} + {{- end }} + creationPolicy: Owner + {{- if .esoSecretData.esoDataFrom }} + dataFrom: + {{- toYaml .esoSecretData.esoDataFrom | nindent 4 }} + {{- else }} + data: + {{- range .esoSecretData.esoData }} + - secretKey: {{ .secretKey }} + remoteRef: + key: {{ .key }} + {{- if .property }} + property: {{ .property }} + {{- end }} + {{- end}} +{{- end}} +{{- end}} +{{- end}} +{{- end}} +{{- end}} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/flagger.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/flagger.yaml new file mode 100644 index 0000000000..766098fb61 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/flagger.yaml @@ -0,0 +1,164 @@ +{{- if .Values.flaggerCanary.enabled }} +{{ if .Values.flaggerCanary.createIstioGateway.enabled -}} +{{- with .Values.flaggerCanary.createIstioGateway }} +apiVersion: networking.istio.io/v1beta1 +kind: Gateway +metadata: + name: {{ template ".Chart.Name .fullname" $ }}-istio-gateway + labels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} + {{- if .labels }} +{{ toYaml .labels | indent 4 }} + {{- end }} +{{- if .annotations }} + annotations: +{{ toYaml .annotations | indent 4 }} +{{- end }} +spec: + selector: + istio: ingressgateway + servers: + - port: + number: 80 + name: http + protocol: HTTP + hosts: + - {{ .host | quote -}} +{{- if .tls.enabled }} + tls: + httpsRedirect: true + - port: + number: 443 + name: https + protocol: HTTPS + hosts: + - {{ .host | quote }} + tls: + mode: SIMPLE + credentialName: {{ .tls.secretName }} +{{ end }} +{{ end }} +{{ end }} +{{ end }} +--- +{{- if .Values.flaggerCanary.enabled }} +{{- with .Values.flaggerCanary }} +apiVersion: flagger.app/v1beta1 +kind: Canary +metadata: + name: {{ template ".Chart.Name .fullname" $ }}-canary + labels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} + {{- if .labels }} +{{ toYaml .labels | indent 4 }} + {{- end }} +{{- if .annotations }} + annotations: +{{ toYaml .annotations | indent 4 }} +{{- end }} +spec: + targetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include ".Chart.Name .fullname" $ }} +{{- if $.Values.autoscaling.enabled }} + autoscalerRef: + apiVersion: autoscaling/v1 + kind: HorizontalPodAutoscaler + name: {{ template ".Chart.Name .fullname" $ }}-hpa +{{- end }} + service: + portDiscovery: {{ .portDiscovery }} + port: {{ .serviceport }} + targetPort: {{ .targetPort }} + {{- if .appProtocol }} + appProtocol: {{ .appProtocol }} + {{- end }} +{{- if $.Values.flaggerCanary.gatewayRefs }} + gatewayRefs: +{{ toYaml $.Values.flaggerCanary.gatewayRefs | indent 6 }} +{{- end }} + {{- if or .createIstioGateway.enabled .addOtherGateways }} + gateways: + {{- if .createIstioGateway.enabled }} + - {{ template ".Chart.Name .fullname" $ }}-istio-gateway + {{- end }} + {{- if .addOtherGateways }} + {{- range .addOtherGateways }} + - {{ . }} + {{- end }} + {{- end }} + {{- end }} + {{- if or .createIstioGateway.enabled .addOtherHosts }} + hosts: + {{- if .createIstioGateway.enabled }} + - {{ .createIstioGateway.host | quote }} + {{- end }} + {{- if .addOtherHosts }} + {{- range .addOtherHosts }} + - {{ . | quote }} + {{- end }} + {{- end }} + {{- end }} + {{- if .retries }} + retries: +{{ toYaml .retries | indent 6 }} + {{- end }} + {{- if .match }} + match: + {{- range .match }} + - uri: + prefix: {{ .uri.prefix }} + {{- end }} + {{- end }} + {{- if .rewriteUri }} + rewrite: + uri: {{ .rewriteUri }} + {{- end }} + {{- if .timeout }} + timeout: {{ .timeout }} + {{- end }} +{{- if $.Values.flaggerCanary.headers }} + headers: +{{ toYaml $.Values.flaggerCanary.headers | indent 6 }} +{{- end }} +{{- if $.Values.flaggerCanary.corsPolicy }} + corsPolicy: +{{ toYaml $.Values.flaggerCanary.corsPolicy | indent 6 }} +{{- end }} + analysis: + interval: {{ .analysis.interval }} + threshold: {{ .analysis.threshold }} + maxWeight: {{ .analysis.maxWeight }} + stepWeight: {{ .analysis.stepWeight }} + metrics: + - name: request-success-rate + threshold: {{ .thresholds.successRate }} + interval: 1m + - name: request-duration + threshold: {{ .thresholds.latency }} + interval: 1m + webhooks: + {{- if .loadtest.enabled }} + - name: load-test + url: {{ .loadtest.url }} + timeout: 5s + metadata: + cmd: "hey -z 1m -q 10 -c 2 http://{{ include ".Chart.Name .fullname" $ }}-canary.{{ $.Release.Namespace }}:{{ $.Values.flaggerCanary.targetPort }}/" + {{- end }} +{{- end }} +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/generic.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/generic.yaml new file mode 100644 index 0000000000..db95e84267 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/generic.yaml @@ -0,0 +1,4 @@ +{{- range .Values.rawYaml }} +--- +{{ toYaml . }} + {{- end -}} diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/hpa.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/hpa.yaml new file mode 100644 index 0000000000..fd7c7e3f60 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/hpa.yaml @@ -0,0 +1,177 @@ +{{- if $.Values.autoscaling.enabled }} +{{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.GitVersion }} +apiVersion: autoscaling/v2 +{{- else if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }} +apiVersion: autoscaling/v2beta2 +{{- else }} +apiVersion: autoscaling/v2beta1 +{{- end }} +kind: HorizontalPodAutoscaler +metadata: + {{- if $.Values.autoscaling.name }} + name: {{ $.Values.autoscaling.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" $ }}-hpa + {{- end }} + {{- if .Values.autoscaling.annotations }} + annotations: +{{ toYaml .Values.autoscaling.annotations | indent 4 }} + {{- end }} + labels: + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} + {{- if .Values.autoscaling.labels }} +{{ toYaml .Values.autoscaling.labels | indent 4 }} + {{- end }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include ".Chart.Name .fullname" $ }} + minReplicas: {{ $.Values.autoscaling.MinReplicas }} + maxReplicas: {{ $.Values.autoscaling.MaxReplicas }} + metrics: + {{- if $.Values.autoscaling.containerResource.enabled }} + {{- with $.Values.autoscaling.containerResource }} + {{- if .TargetCPUUtilizationPercentage }} + - type: ContainerResource + containerResource: + name: cpu + container: {{ $.Chart.Name }} + target: + type: Utilization + averageUtilization: {{ .TargetCPUUtilizationPercentage }} + {{- end}} + {{- if .TargetMemoryUtilizationPercentage }} + - type: ContainerResource + containerResource: + name: memory + container: {{ $.Chart.Name }} + target: + type: Utilization + averageUtilization: {{ .TargetMemoryUtilizationPercentage }} + {{- end}} + {{- end }} + {{- end }} + {{- if $.Values.autoscaling.TargetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + {{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }} + target: + type: Utilization + averageUtilization: {{ $.Values.autoscaling.TargetMemoryUtilizationPercentage }} + {{- else }} + targetAverageUtilization: {{ $.Values.autoscaling.TargetMemoryUtilizationPercentage }} + {{- end }} + {{- end }} + {{- if $.Values.autoscaling.TargetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + {{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }} + target: + type: Utilization + averageUtilization: {{ $.Values.autoscaling.TargetCPUUtilizationPercentage }} + {{- else }} + targetAverageUtilization: {{ $.Values.autoscaling.TargetCPUUtilizationPercentage }} + {{- end }} + {{- end }} + {{- if and $.Values.autoscaling.extraMetrics (semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion) }} + {{- toYaml $.Values.autoscaling.extraMetrics | nindent 2 }} + {{- end}} + {{- if and $.Values.autoscaling.behavior (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + behavior: + {{- toYaml $.Values.autoscaling.behavior | nindent 4 }} + {{- end }} + {{- end }} +{{- if and $.Values.secondaryWorkload.enabled $.Values.secondaryWorkload.autoscaling.enabled }} +--- +{{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.GitVersion }} +apiVersion: autoscaling/v2 +{{- else if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }} +apiVersion: autoscaling/v2beta2 +{{- else }} +apiVersion: autoscaling/v2beta1 +{{- end }} +kind: HorizontalPodAutoscaler +metadata: + name: {{ template ".Chart.Name .fullname" $ }}-{{ $.Values.secondaryWorkload.postfix | default "sec" }}-hpa + {{- if .Values.autoscaling.annotations }} + annotations: +{{ toYaml .Values.autoscaling.annotations | indent 4 }} + {{- end }} + {{- if .Values.autoscaling.labels }} + labels: +{{ toYaml .Values.autoscaling.labels | indent 4 }} + {{- end }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include ".Chart.Name .fullname" $ }}-{{ $.Values.secondaryWorkload.postfix | default "sec" }} + {{- with $.Values.secondaryWorkload }} + minReplicas: {{ .autoscaling.MinReplicas }} + maxReplicas: {{ .autoscaling.MaxReplicas }} + metrics: + {{- if .autoscaling.containerResource.enabled }} + {{- with .autoscaling.containerResource }} + {{- if .TargetCPUUtilizationPercentage }} + - type: ContainerResource + containerResource: + name: cpu + container: {{ $.Chart.Name }} + target: + type: Utilization + averageUtilization: {{ .TargetCPUUtilizationPercentage }} + {{- end}} + {{- if .TargetMemoryUtilizationPercentage }} + - type: ContainerResource + containerResource: + name: memory + container: {{ $.Chart.Name }} + target: + type: Utilization + averageUtilization: {{ .TargetMemoryUtilizationPercentage }} + {{- end}} + {{- end }} + {{- end }} + {{- if .autoscaling.TargetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + {{- if semverCompare ">=1.16-0" $.Capabilities.KubeVersion.GitVersion }} + target: + type: Utilization + averageUtilization: {{ .autoscaling.TargetMemoryUtilizationPercentage }} + {{- else }} + targetAverageUtilization: {{ .autoscaling.TargetMemoryUtilizationPercentage }} + {{- end }} + {{- end }} + {{- if .autoscaling.TargetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + {{- if semverCompare ">=1.16-0" $.Capabilities.KubeVersion.GitVersion }} + target: + type: Utilization + averageUtilization: {{ .autoscaling.TargetCPUUtilizationPercentage }} + {{- else }} + targetAverageUtilization: {{ .autoscaling.TargetCPUUtilizationPercentage }} + {{- end }} + {{- end }} + {{- if and .autoscaling.extraMetrics (semverCompare ">=1.16-0" $.Capabilities.KubeVersion.GitVersion) }} + {{- toYaml .autoscaling.extraMetrics | nindent 2 }} + {{- end}} + {{- if and .autoscaling.behavior (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + behavior: + {{- toYaml .autoscaling.behavior | nindent 4 }} + {{- end }} + {{- end }} + {{- end }} diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/ingress.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/ingress.yaml new file mode 100644 index 0000000000..d9a2543e98 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/ingress.yaml @@ -0,0 +1,188 @@ +{{ $svcName := include ".servicename" . }} +{{ $svcPort := (index .Values.ContainerPort 0).servicePort }} +{{- if $.Values.ingress.enabled -}} +{{- 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 }} +{{- if and .Values.ingressInternal.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingressInternal.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingressInternal.annotations "kubernetes.io/ingress.class" .Values.ingressInternal.className}} + {{- end }} +{{- 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: + {{- if $.Values.ingress.name }} + name: {{ $.Values.ingress.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" . }}-ingress + {{- end }} + namespace: {{ $.Values.NameSpace }} + labels: + app: {{ template ".Chart.Name .name" . }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" . }} + release: {{ .Release.Name }} +{{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} +{{- end }} + {{- if .Values.ingress.labels }} +{{ toYaml .Values.ingress.labels | indent 4 }} + {{- end }} +{{- if .Values.ingress.annotations }} + annotations: +{{ toYaml .Values.ingress.annotations | indent 4 }} +{{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + rules: + {{- if or .Values.ingress.host .Values.ingress.path }} + - host: {{ .Values.ingress.host }} + http: + paths: + - path: {{ .Values.ingress.path }} + {{- if (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ $.Values.ingress.pathType | default "ImplementationSpecific" }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $svcName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $svcName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- if and ($.Values.ingress.hosts) (not ($.Values.ingress.host )) }} + {{- range .Values.ingress.hosts }} + {{ $outer := . -}} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + {{- if (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ $outer.pathType | default "ImplementationSpecific" | quote }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $svcName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $svcName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- if .additionalBackends }} +{{ toYaml .additionalBackends | indent 10 }} + {{- end }} + + {{- end }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: +{{ toYaml .Values.ingress.tls | indent 4 }} + {{- end -}} +{{- end }} +{{- if $.Values.ingressInternal.enabled }} +--- +{{ 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: + {{- if $.Values.ingressInternal.name }} + name: {{ $.Values.ingressInternal.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" . }}-ingress-internal + {{- end }} + namespace: {{ $.Values.NameSpace }} + labels: + app: {{ template ".Chart.Name .name" . }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" . }} + release: {{ .Release.Name }} +{{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} +{{- end }} +{{- if .Values.ingressInternal.annotations }} + annotations: +{{ toYaml .Values.ingressInternal.annotations | indent 4 }} +{{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingressInternal.className }} + {{- end }} + rules: + {{- if or .Values.ingressInternal.host .Values.ingressInternal.path }} + - host: {{ .Values.ingressInternal.host }} + http: + paths: + - path: {{ .Values.ingressInternal.path }} + {{- if and .Values.ingressInternal.pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ $.Values.ingressInternal.pathType | default "Prefix" | quote }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $svcName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $svcName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- if and ($.Values.ingressInternal.hosts) (not ($.Values.ingressInternal.host )) }} + {{- range .Values.ingressInternal.hosts }} + {{ $outer := . -}} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + {{- if (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ $outer.pathType | default "ImplementationSpecific" | quote }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $svcName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $svcName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- if .additionalBackends }} +{{ toYaml .additionalBackends | indent 10 }} + {{- end }} + {{- end }} + {{- end }} + {{- if .Values.ingressInternal.tls }} + tls: +{{ toYaml .Values.ingressInternal.tls | indent 4 }} + {{- end -}} +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-authorizationpolicy.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-authorizationpolicy.yaml new file mode 100644 index 0000000000..8340555ff3 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-authorizationpolicy.yaml @@ -0,0 +1,41 @@ +{{- with .Values.istio }} +{{- if and .enable .authorizationPolicy.enabled }} +apiVersion: security.istio.io/v1beta1 +kind: AuthorizationPolicy +metadata: + {{- if .authorizationPolicy.name }} + name: {{ .authorizationPolicy.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" $ }} + {{- end }} + labels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} + {{- if .authorizationPolicy.labels }} +{{ toYaml .authorizationPolicy.labels | indent 4 }} + {{- end }} +{{- if .authorizationPolicy.annotations }} + annotations: +{{ toYaml .authorizationPolicy.annotations | indent 4 }} +{{- end }} +spec: + selector: + matchLabels: + app.kubernetes.io/name: {{ template ".Chart.Name .fullname" $ }} + action: {{ .authorizationPolicy.action }} +{{- if $.Values.istio.authorizationPolicy.provider }} + provider: +{{ toYaml $.Values.istio.authorizationPolicy.provider | indent 4 }} +{{- end }} +{{- if $.Values.istio.authorizationPolicy.rules }} + rules: +{{ toYaml $.Values.istio.authorizationPolicy.rules | indent 4 }} +{{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-destinationrule.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-destinationrule.yaml new file mode 100644 index 0000000000..4d06deb0b8 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-destinationrule.yaml @@ -0,0 +1,38 @@ +{{- with .Values.istio }} +{{- if and .enable .destinationRule.enabled }} +apiVersion: networking.istio.io/v1beta1 +kind: DestinationRule +metadata: + {{- if .destinationRule.name }} + name: {{ .destinationRule.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" $ }}-destinationrule + {{- end }} + labels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} + {{- if .destinationRule.labels }} +{{ toYaml .destinationRule.labels | indent 4 }} + {{- end }} +{{- if .destinationRule.annotations }} + annotations: +{{ toYaml .destinationRule.annotations | indent 4 }} +{{- end }} +spec: + host: "{{ include ".servicename" $ }}.{{ $.Release.Namespace }}.svc.cluster.local" +{{- if $.Values.istio.destinationRule.subsets }} + subsets: +{{ toYaml $.Values.istio.destinationRule.subsets | indent 4 }} +{{- end }} +{{- if $.Values.istio.destinationRule.trafficPolicy }} + trafficPolicy: +{{ toYaml $.Values.istio.destinationRule.trafficPolicy | indent 4 }} +{{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-gateway.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-gateway.yaml new file mode 100644 index 0000000000..b145d6c569 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-gateway.yaml @@ -0,0 +1,71 @@ +{{- if and .Values.istio.enable .Values.istio.gateway.enabled -}} +apiVersion: networking.istio.io/v1beta1 +kind: Gateway +metadata: + {{- if .Values.istio.gateway.name }} + name: {{ .Values.istio.gateway.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" $ }}-istio-gateway + {{- end }} + labels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} + {{- if $.Values.istio.gateway.labels }} +{{ toYaml $.Values.istio.gateway.labels | indent 4 }} + {{- end }} +{{- if $.Values.istio.gateway.annotations }} + annotations: +{{ toYaml $.Values.istio.gateway.annotations | indent 4 }} +{{- end }} +spec: +{{ with $.Values.istio.gateway }} + selector: + {{- if .selector }} + {{- toYaml .selector | nindent 4 }} + {{- else }} + istio: ingressgateway + {{- end }} + servers: + {{- if .servers }} + {{- toYaml .servers | nindent 2 }} + {{- else }} + - port: + number: 80 + name: http + protocol: HTTP + hosts: +{{- if .host }} + - {{ .host | quote -}} +{{- else if .hosts }} +{{- range .hosts }} + - {{ . | quote }} +{{- end }} +{{- end }} +{{- if .tls.enabled }} + tls: + httpsRedirect: true + - port: + number: 443 + name: https + protocol: HTTPS + hosts: +{{- if .host }} + - {{ .host | quote }} +{{- else if .hosts }} +{{- range .hosts }} + - {{ . | quote }} +{{- end }} +{{- end }} + tls: + mode: SIMPLE + credentialName: {{ .tls.secretName }} +{{ end }} +{{ end }} +{{ end }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-peerauthentication.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-peerauthentication.yaml new file mode 100644 index 0000000000..dedd971c6d --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-peerauthentication.yaml @@ -0,0 +1,40 @@ +{{- with .Values.istio }} +{{- if and .enable .peerAuthentication.enabled }} +apiVersion: security.istio.io/v1beta1 +kind: PeerAuthentication +metadata: + {{- if .peerAuthentication.name }} + name: {{ .peerAuthentication.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" $ }} + {{- end }} + labels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} + {{- if .peerAuthentication.labels }} +{{ toYaml .peerAuthentication.labels | indent 4 }} + {{- end }} +{{- if .peerAuthentication.annotations }} + annotations: +{{ toYaml .peerAuthentication.annotations | indent 4 }} +{{- end }} +spec: +{{- if .peerAuthentication.selector.enabled }} + selector: + matchLabels: + app.kubernetes.io/name: {{ template ".Chart.Name .fullname" $ }} +{{- end }} + mtls: + mode: {{ .peerAuthentication.mtls.mode }} +{{- if $.Values.istio.peerAuthentication.portLevelMtls }} + portLevelMtls: +{{ toYaml $.Values.istio.peerAuthentication.portLevelMtls | indent 4 }} +{{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-requestauthentication.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-requestauthentication.yaml new file mode 100644 index 0000000000..49bb89552d --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-requestauthentication.yaml @@ -0,0 +1,38 @@ +{{- with .Values.istio }} +{{- if and .enable .requestAuthentication.enabled }} +apiVersion: security.istio.io/v1beta1 +kind: RequestAuthentication +metadata: + {{- if .requestAuthentication.name }} + name: {{.requestAuthentication.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" $ }} + {{- end }} + labels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} + {{- if .requestAuthentication.labels }} +{{ toYaml .requestAuthentication.labels | indent 4 }} + {{- end }} +{{- if .requestAuthentication.annotations }} + annotations: +{{ toYaml .requestAuthentication.annotations | indent 4 }} +{{- end }} +spec: +{{- if .requestAuthentication.selector.enabled }} + selector: + matchLabels: + app.kubernetes.io/name: {{ template ".Chart.Name .fullname" $ }} +{{- end }} +{{- if $.Values.istio.requestAuthentication.jwtRules }} + jwtRules: +{{ toYaml $.Values.istio.requestAuthentication.jwtRules | indent 2 }} +{{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-virtualservice.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-virtualservice.yaml new file mode 100644 index 0000000000..32a3380228 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/istio-virtualservice.yaml @@ -0,0 +1,68 @@ +{{- with .Values.istio }} +{{- if and .enable .virtualService.enabled }} +apiVersion: networking.istio.io/v1beta1 +kind: VirtualService +metadata: + {{- if .virtualService.name }} + name: {{ .virtualService.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" $ }}-virtualservice + {{- end }} + labels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} + {{- if .virtualService.labels }} +{{ toYaml .virtualService.labels | indent 4 }} + {{- end }} +{{- if .virtualService.annotations }} + annotations: +{{ toYaml .virtualService.annotations | indent 4 }} +{{- end }} +spec: +{{- if or .gateway.enabled .virtualService.gateways }} + gateways: + {{- if .gateway.enabled }} + {{- if .gateway.name }} + - {{ .gateway.name }} + {{- else }} + - {{ template ".Chart.Name .fullname" $ }}-istio-gateway + {{- end }} + {{- end }} + {{- range .virtualService.gateways }} + - {{ . | quote }} + {{- end }} +{{- end }} +{{- if or .gateway.enabled .virtualService.hosts }} + hosts: + {{- if .gateway.enabled }} + {{- if .gateway.host }} + - {{ .gateway.host | quote }} + {{- else if .gateway.hosts }} +{{- range .gateway.hosts }} + - {{ . | quote }} +{{- end }} + {{- end }} + {{- end }} + {{- range .virtualService.hosts }} + - {{ . | quote }} + {{- end }} +{{- else }} + hosts: + {{- if $.Values.service.name }} + - {{ $.Values.service.name }}.{{ $.Release.Namespace }}.svc.cluster.local + {{- else }} + - "{{ include ".servicename" $ }}.{{ $.Release.Namespace }}.svc.cluster.local" + {{- end }} +{{- end }} +{{- if $.Values.istio.virtualService.http }} + http: +{{ toYaml $.Values.istio.virtualService.http | indent 4 }} +{{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/keda-autoscaling.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/keda-autoscaling.yaml new file mode 100644 index 0000000000..780afa73b1 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/keda-autoscaling.yaml @@ -0,0 +1,78 @@ +{{- if $.Values.kedaAutoscaling.enabled }} +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + {{- if $.Values.kedaAutoscaling.name }} + name: {{ $.Values.kedaAutoscaling.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" $ }}-keda + {{- end }} + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + release: {{ .Release.Name }} + {{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} + {{- end }} + {{- if .Values.kedaAutoscaling.labels }} +{{ toYaml .Values.kedaAutoscaling.labels | indent 4 }} + {{- end }} + {{- if .Values.kedaAutoscaling.annotations }} + annotations: +{{ toYaml .Values.kedaAutoscaling.annotations | indent 4 }} + {{- end }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include ".Chart.Name .fullname" $ }} +{{- if $.Values.kedaAutoscaling.envSourceContainerName }} + envSourceContainerName: {{ $.Values.kedaAutoscaling.envSourceContainerName }} +{{- end }} +{{- if $.Values.kedaAutoscaling.pollingInterval }} + pollingInterval: {{ $.Values.kedaAutoscaling.pollingInterval }} +{{- end }} +{{- if $.Values.kedaAutoscaling.cooldownPeriod }} + cooldownPeriod: {{ $.Values.kedaAutoscaling.cooldownPeriod }} +{{- end }} +{{- if $.Values.kedaAutoscaling.idleReplicaCount }} + idleReplicaCount: {{ $.Values.kedaAutoscaling.idleReplicaCount }} +{{- end }} + minReplicaCount: {{ $.Values.kedaAutoscaling.minReplicaCount }} + maxReplicaCount: {{ $.Values.kedaAutoscaling.maxReplicaCount }} +{{- if $.Values.kedaAutoscaling.fallback }} + fallback: +{{ toYaml $.Values.kedaAutoscaling.fallback | indent 4 }} +{{- end }} +{{- if $.Values.kedaAutoscaling.advanced }} + advanced: +{{ toYaml $.Values.kedaAutoscaling.advanced | indent 4 }} +{{- end }} + triggers: +{{ toYaml .Values.kedaAutoscaling.triggers | indent 2}} +{{- if $.Values.kedaAutoscaling.authenticationRef }} + authenticationRef: +{{ toYaml $.Values.kedaAutoscaling.authenticationRef | indent 6 }} +{{- end }} +--- +{{- if $.Values.kedaAutoscaling.triggerAuthentication.enabled }} +apiVersion: keda.sh/v1alpha1 +kind: TriggerAuthentication +metadata: + name: {{ $.Values.kedaAutoscaling.triggerAuthentication.name }} + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + {{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} + {{- end }} +spec: +{{ toYaml $.Values.kedaAutoscaling.triggerAuthentication.spec | indent 2 }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/metrics-service-monitor.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/metrics-service-monitor.yaml new file mode 100644 index 0000000000..fa5321d303 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/metrics-service-monitor.yaml @@ -0,0 +1,35 @@ +{{- if $.Values.appMetrics -}} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template ".Chart.Name .fullname" $ }} + labels: + app: {{ template ".Chart.Name .name" . }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" . }} + release: {{ .Values.prometheus.release }} +spec: + jobLabel: {{ template ".Chart.Name .name" $ }} + endpoints: + - port: envoy-admin + interval: 30s + path: /stats/prometheus + relabelings: + - action: replace + sourceLabels: + - __meta_kubernetes_pod_label_pod_template_hash + targetLabel: devtron_app_hash + selector: + matchLabels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + namespaceSelector: + matchNames: + - {{.Release.Namespace}} + podTargetLabels: + - appId + - envId + - devtron_app_hash +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/networkpolicy.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/networkpolicy.yaml new file mode 100644 index 0000000000..ee8bdaf8be --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/networkpolicy.yaml @@ -0,0 +1,52 @@ +{{- if .Values.networkPolicy.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + {{- if .Values.networkPolicy.name }} + name: {{ .Values.networkPolicy.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" $ }}-networkpolicy + {{- end }} + labels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} + {{- if $.Values.networkPolicy.labels }} +{{ toYaml $.Values.networkPolicy.labels | indent 4 }} + {{- end }} +{{- if $.Values.networkPolicy.annotations }} + annotations: +{{ toYaml $.Values.networkPolicy.annotations | indent 4 }} +{{- end }} +spec: + podSelector: +{{- if .podSelector.matchExpressions }} + matchExpressions: +{{ toYaml $.Values.networkPolicy.podSelector.matchExpressions | indent 6 }} +{{- end }} +{{- if .podSelector.matchLabels }} + matchLabels: +{{ toYaml $.Values.networkPolicy.podSelector.matchLabels | indent 6 }} +{{- else }} + matchLabels: + app: {{ template ".Chart.Name .name" $ }} + release: {{ $.Release.Name }} +{{- end }} +{{- if .policyTypes }} + policyTypes: +{{ toYaml $.Values.networkPolicy.policyTypes | indent 4 }} +{{- end }} +{{- if .ingress }} + ingress: +{{ toYaml $.Values.networkPolicy.ingress | indent 4 }} +{{- end }} +{{- if .egress }} + egress: +{{ toYaml $.Values.networkPolicy.ingress | indent 4}} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/persistent-volume-claim.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/persistent-volume-claim.yaml new file mode 100644 index 0000000000..bf4e6dfb71 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/persistent-volume-claim.yaml @@ -0,0 +1,24 @@ +{{- if .Values.persistentVolumeClaim.name }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{.Values.persistentVolumeClaim.name }} + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} +{{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} +{{- end }} +{{- with .Values.persistentVolumeClaim }} +spec: + accessModes: +{{- range .accessMode }} + - {{ . }} +{{- end }} + resources: + requests: + storage: {{ .storage | default "5Gi" }} + storageClassName: {{ .storageClassName | default "default" }} + volumeMode: {{ .volumeMode | default "Filesystem" }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/poddisruptionbudget.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/poddisruptionbudget.yaml new file mode 100644 index 0000000000..9094fd82e6 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/poddisruptionbudget.yaml @@ -0,0 +1,38 @@ +{{- if .Values.podDisruptionBudget }} +{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: policy/v1 +{{- else -}} +apiVersion: policy/v1beta1 +{{- end }} +kind: PodDisruptionBudget +metadata: + {{- if .Values.podDisruptionBudget.name }} + name: {{ .Values.podDisruptionBudget.name }} + {{- else }} + name: {{ include ".Chart.Name .fullname" $ }} + {{- end }} + labels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} + {{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} + {{- end }} +spec: + {{- if .Values.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.podDisruptionBudget.minAvailable }} + {{- end }} + {{- if .Values.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }} + {{- end }} + selector: + matchLabels: + {{- if .Values.customPodLabels }} +{{ toYaml .Values.customPodLabels | indent 6 }} + {{- else }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + {{- end }} + {{- end }} diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/pre-sync-job.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/pre-sync-job.yaml new file mode 100644 index 0000000000..54c9f636ee --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/pre-sync-job.yaml @@ -0,0 +1,29 @@ +{{- if $.Values.dbMigrationConfig.enabled }} +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ template ".Chart.Name .fullname" $ }}-migrator + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + annotations: + argocd.argoproj.io/hook: PreSync +# argocd.argoproj.io/hook-delete-policy: HookSucceeded +spec: + template: + spec: + containers: + - name: migrator + image: 686244538589.dkr.ecr.us-east-2.amazonaws.com/migrator:0.0.1-rc14 + env: + {{- range $.Values.dbMigrationConfig.envValues }} + - name: {{ .key}} + value: {{ .value | quote }} + {{- end}} + restartPolicy: Never + backoffLimit: 0 +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/prometheusrules.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/prometheusrules.yaml new file mode 100644 index 0000000000..c285de1388 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/prometheusrules.yaml @@ -0,0 +1,33 @@ +{{- if .Values.prometheusRule.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + {{- if .Values.prometheusRule.name }} + name: {{ .Values.prometheusRule.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" . }} + {{- end }} + {{- if .Values.prometheusRule.namespace }} + namespace: {{ .Values.prometheusRule.namespace }} + {{- end }} + labels: + kind: Prometheus + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ .Values.prometheus.release }} + {{- if .Values.prometheusRule.additionalLabels }} +{{ toYaml .Values.prometheusRule.additionalLabels | indent 4 }} + {{- end }} +spec: + {{- with .Values.prometheusRule.rules }} + groups: + {{- if $.Values.prometheusRule.name }} + - name: {{ $.Values.prometheusRule.name }} + {{- else }} + - name: {{ template ".Chart.Name .fullname" $ }} + {{- end }} + rules: {{- toYaml . | nindent 6 }} + {{- end }} + {{- end }} diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/secret.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/secret.yaml new file mode 100644 index 0000000000..5ac3ae1410 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/secret.yaml @@ -0,0 +1,84 @@ +{{- if $.Values.secret.enabled }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: app-secret + labels: + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} +type: Opaque +data: +{{ toYaml $.Values.secret.data | indent 2 }} +{{- end }} + + +{{- if .Values.ConfigSecrets.enabled }} + {{- range .Values.ConfigSecrets.secrets }} + {{if eq .external false}} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ .name}}-{{ $.Values.app }} + labels: + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + app: {{ template ".Chart.Name .name" $ }} + release: {{ $.Release.Name }} + chart: {{ template ".Chart.Name .chart" $ }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} +type: Opaque +data: +{{ toYaml .data | trim | indent 2 }} +{{- end}} + {{if eq .external true }} + {{if (or (eq .externalType "AWSSecretsManager") (eq .externalType "AWSSystemManager") (eq .externalType "HashiCorpVault"))}} +--- +apiVersion: kubernetes-client.io/v1 +kind: ExternalSecret +metadata: + name: {{ .name}} +{{- if $.Values.appLabels }} + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} +spec: + {{- if .roleARN }} + roleArn: .roleARN + {{- end}} + {{- if eq .externalType "AWSSecretsManager"}} + backendType: secretsManager + {{- end}} + {{- if eq .externalType "AWSSystemManager"}} + backendType: systemManager + {{- end}} + {{- if eq .externalType "HashiCorpVault"}} + backendType: vault + {{- end}} + data: + {{- range .secretData }} + - key: {{.key}} + name: {{.name}} + {{- if .property }} + property: {{.property}} + {{- end}} + isBinary: {{.isBinary}} + {{- end}} + {{- end}} + {{- end}} + {{- end}} + {{- end}} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/service.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/service.yaml new file mode 100644 index 0000000000..14e1a7c37a --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/service.yaml @@ -0,0 +1,106 @@ +{{- if .Values.service.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ template ".servicename" . }} + labels: + app: {{ template ".Chart.Name .name" . }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" . }} + release: {{ .Release.Name }} +{{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} +{{- end }} +{{- if .Values.service.annotations }} + annotations: +{{ toYaml .Values.service.annotations | indent 4 }} +{{- end}} +spec: + type: {{ .Values.service.type | default "ClusterIP" }} +{{- if (and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerSourceRanges )}} + loadBalancerSourceRanges: + {{- range .Values.service.loadBalancerSourceRanges }} + - {{ . }} + {{- end }} +{{- end }} + ports: + {{- range .Values.ContainerPort }} + {{- if .servicePort }} + - port: {{ .servicePort }} + {{- else }} + - port: {{ .port }} + {{- end }} + {{- if .targetPort }} + targetPort: {{ .targetPort }} + {{- else if $.Values.appMetrics }} + targetPort: envoy-{{ .name }} + {{- else }} + targetPort: {{ .name }} + {{- end }} + protocol: {{ .protocol | default "TCP" }} + {{- if (and (eq $.Values.service.type "NodePort") .nodePort ) }} + nodePort: {{ .nodePort }} + {{- end }} + name: {{ .name }} + {{- end }} + {{- if $.Values.appMetrics }} + - port: 9901 + name: envoy-admin + {{- end }} + selector: + {{- if .Values.customPodLabels }} +{{ toYaml .Values.customPodLabels | indent 4 }} + {{- else }} + app: {{ template ".Chart.Name .name" . }} + {{- end }} +{{- if .Values.service.sessionAffinity.enabled }} + sessionAffinity: ClientIP +{{- end }} +{{- if .Values.service.sessionAffinityConfig }} + sessionAffinityConfig: +{{ toYaml .Values.service.sessionAffinityConfig | indent 4 }} +{{- end }} +{{- if eq .Values.deploymentType "BLUE-GREEN" }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ template ".previewservicename" . }} + labels: + app: {{ template ".Chart.Name .name" . }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" . }} + release: {{ .Release.Name }} +spec: + type: ClusterIP + ports: + {{- range .Values.ContainerPort }} + {{- if .servicePort }} + - port: {{ .servicePort }} + {{- else }} + - port: {{ .port }} + {{- end }} + {{- if .targetPort }} + targetPort: {{ .targetPort }} + {{- else if $.Values.appMetrics }} + targetPort: envoy-{{ .name }} + {{- else }} + targetPort: {{ .name }} + {{- end }} + protocol: TCP + name: {{ .name }} + {{- end }} + {{- if $.Values.appMetrics }} + - port: 9901 + name: envoy-admin + {{- end }} + selector: + {{- if .Values.customPodLabels }} +{{ toYaml .Values.customPodLabels | indent 4 }} + {{- else }} + app: {{ template ".Chart.Name .name" . }} + {{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/serviceaccount.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/serviceaccount.yaml new file mode 100644 index 0000000000..f337548e94 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/serviceaccount.yaml @@ -0,0 +1,21 @@ +{{- if $.Values.serviceAccount }} +{{- if $.Values.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "serviceAccountName" . }} + labels: + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} +{{- if .Values.podLabels }} +{{ toYaml .Values.podLabels | indent 4 }} + {{- end }} + {{- if .Values.serviceAccount.annotations }} + annotations: +{{ toYaml .Values.serviceAccount.annotations | indent 4 }} + {{- end }} +{{- end -}} +{{- end -}} diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/servicemonitor.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/servicemonitor.yaml new file mode 100644 index 0000000000..9b920388d2 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/servicemonitor.yaml @@ -0,0 +1,117 @@ +{{ $serviceMonitorEnabled := include "serviceMonitorEnabled" . }} +{{- if eq "true" $serviceMonitorEnabled -}} +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + {{- if .Values.servicemonitor.name }} + name: {{ .Values.servicemonitor.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" . }}-sm + {{- end }} + labels: + kind: Prometheus + app: {{ template ".Chart.Name .name" . }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" . }} + release: {{ .Values.prometheus.release }} + {{- if .Values.servicemonitor.additionalLabels }} +{{ toYaml .Values.servicemonitor.additionalLabels | indent 4 }} + {{- end }} + {{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} + {{- end }} +spec: + endpoints: + {{- range .Values.ContainerPort }} + {{- if .servicemonitor }} + {{- if .servicemonitor.enabled}} + {{- if .servicemonitor.targetPort }} + - targetPort: {{ .servicemonitor.targetPort }} + {{- else if .servicePort }} + - port: {{ .name }} + {{- end }} + {{- if .servicemonitor.path }} + path: {{ .servicemonitor.path}} + {{- end }} + {{- if .servicemonitor.scheme }} + scheme: {{ .servicemonitor.scheme}} + {{- end }} + {{- if .servicemonitor.interval }} + interval: {{ .servicemonitor.interval}} + {{- end }} + {{- if .servicemonitor.scrapeTimeout }} + scrapeTimeout: {{ .servicemonitor.scrapeTimeout | quote }} + {{- end }} + {{- if .servicemonitor.basicAuth }} + basicAuth: + {{- toYaml .servicemonitor.basicAuth | nindent 8 }} + {{- end }} + {{- if .servicemonitor.insecureTLS }} + tlsConfig: + insecureSkipVerify: true + {{- else if .servicemonitor.tlsConfig }} + tlsConfig: + {{- toYaml .servicemonitor.tlsConfig | nindent 8 }} + {{- end }} + {{- if .servicemonitor.metricRelabelings}} + metricRelabelings: +{{toYaml .servicemonitor.metricRelabelings | indent 8 }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- range .Values.containers }} + {{- range .ports }} + {{- if .servicemonitor }} + {{- if .servicemonitor.enabled}} + {{- if .servicemonitor.targetPort }} + - targetPort: {{ .servicemonitor.targetPort }} + {{- else if .servicePort }} + - port: {{ .name }} + {{- end }} + {{- if .servicemonitor.path }} + path: {{ .servicemonitor.path}} + {{- end }} + {{- if .servicemonitor.scheme }} + scheme: {{ .servicemonitor.scheme}} + {{- end }} + {{- if .servicemonitor.interval }} + interval: {{ .servicemonitor.interval}} + {{- end }} + {{- if .servicemonitor.scrapeTimeout }} + scrapeTimeout: {{ .servicemonitor.scrapeTimeout}} + {{- end }} + {{- if .servicemonitor.basicAuth }} + basicAuth: + {{- toYaml .servicemonitor.basicAuth | nindent 8 }} + {{- end }} + {{- if .servicemonitor.insecureTLS }} + tlsConfig: + insecureSkipVerify: true + {{- else if .servicemonitor.tlsConfig }} + tlsConfig: + {{- toYaml .servicemonitor.tlsConfig | nindent 8 }} + {{- end }} + {{- if .servicemonitor.metricRelabelings}} + metricRelabelings: +{{toYaml .servicemonitor.metricRelabelings | indent 8 }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- if .Values.servicemonitor.namespaceSelector }} + namespaceSelector: + matchNames: + {{- toYaml .Values.servicemonitor.namespaceSelector | nindent 6 }} + {{- end }} + selector: + matchLabels: + {{- if .Values.servicemonitor.matchLabels }} + {{- toYaml .Values.servicemonitor.matchLabels | nindent 6 }} + {{- else }} + app: {{ template ".Chart.Name .name" $ }} +{{- end }} +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/sidecar-configmap.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/sidecar-configmap.yaml new file mode 100644 index 0000000000..cf32679409 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/sidecar-configmap.yaml @@ -0,0 +1,169 @@ +{{- if .Values.appMetrics }} +apiVersion: v1 +kind: ConfigMap +metadata: + creationTimestamp: 2019-08-12T18:38:34Z + name: sidecar-config-{{ template ".Chart.Name .name" $ }} +data: + envoy-config.json: | + { + "stats_config": { + "use_all_default_tags": false, + "stats_tags": [ + { + "tag_name": "cluster_name", + "regex": "^cluster\\.((.+?(\\..+?\\.svc\\.cluster\\.local)?)\\.)" + }, + { + "tag_name": "tcp_prefix", + "regex": "^tcp\\.((.*?)\\.)\\w+?$" + }, + { + "tag_name": "response_code", + "regex": "_rq(_(\\d{3}))$" + }, + { + "tag_name": "response_code_class", + "regex": ".*_rq(_(\\dxx))$" + }, + { + "tag_name": "http_conn_manager_listener_prefix", + "regex": "^listener(?=\\.).*?\\.http\\.(((?:[_.[:digit:]]*|[_\\[\\]aAbBcCdDeEfF[:digit:]]*))\\.)" + }, + { + "tag_name": "http_conn_manager_prefix", + "regex": "^http\\.(((?:[_.[:digit:]]*|[_\\[\\]aAbBcCdDeEfF[:digit:]]*))\\.)" + }, + { + "tag_name": "listener_address", + "regex": "^listener\\.(((?:[_.[:digit:]]*|[_\\[\\]aAbBcCdDeEfF[:digit:]]*))\\.)" + }, + { + "tag_name": "mongo_prefix", + "regex": "^mongo\\.(.+?)\\.(collection|cmd|cx_|op_|delays_|decoding_)(.*?)$" + } + ], + "stats_matcher": { + "inclusion_list": { + "patterns": [ + { + "regex": ".*_rq_\\dxx$" + }, + { + "regex": ".*_rq_time$" + }, + { + "regex": "cluster.*" + }, + ] + } + } + }, + "admin": { + "access_log_path": "/dev/null", + "address": { + "socket_address": { + "address": "0.0.0.0", + "port_value": 9901 + } + } + }, + "static_resources": { + "clusters": [ + {{- range $index, $element := .Values.ContainerPort }} + { + "name": "{{ $.Values.app }}-{{ $index }}", + "type": "STATIC", + "connect_timeout": "0.250s", + "lb_policy": "ROUND_ROBIN", +{{- if $element.idleTimeout }} + "common_http_protocol_options": { + "idle_timeout": {{ $element.idleTimeout | quote }} + }, +{{- end }} +{{- if or $element.useHTTP2 $element.useGRPC }} + "http2_protocol_options": {}, +{{- end }} +{{- if and (not $element.useGRPC) (not $element.supportStreaming) }} + "max_requests_per_connection": "1", +{{- end }} + "load_assignment": { + "cluster_name": "9", + "endpoints": { + "lb_endpoints": [ + { + "endpoint": { + "address": { + "socket_address": { + "protocol": "TCP", + "address": "127.0.0.1", + "port_value": {{ $element.port }} + } + } + } + } + ] + } + } + }, + {{- end }} + ], + "listeners":[ + {{- range $index, $element := .Values.ContainerPort }} + { + "address": { + "socket_address": { + "protocol": "TCP", + "address": "0.0.0.0", + "port_value": {{ $element.envoyPort | default (add 8790 $index) }} + } + }, + "filter_chains": [ + { + "filters": [ + { + "name": "envoy.filters.network.http_connection_manager", + "config": { + "codec_type": "AUTO", + "stat_prefix": "stats", + "route_config": { + "virtual_hosts": [ + { + "name": "backend", + "domains": [ + "*" + ], + "routes": [ + { + "match": { + "prefix": "/" + }, + "route": { +{{- if $element.supportStreaming }} + "timeout": "0s", +{{- end }} +{{- if and ($element.envoyTimeout) (not $element.supportStreaming) }} + "timeout": "{{ $element.envoyTimeout }}", +{{- end }} + "cluster": "{{ $.Values.app }}-{{ $index }}" + } + } + ] + } + ] + }, + "http_filters": { + "name": "envoy.filters.http.router" + } + } + } + ] + } + ] + }, + {{- end }} + ] + } + } +--- +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/vertical-pod-autoscaler.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/vertical-pod-autoscaler.yaml new file mode 100644 index 0000000000..ffbf24d823 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/vertical-pod-autoscaler.yaml @@ -0,0 +1,34 @@ +{{ $VerticalPodAutoScalingEnabled := include "VerticalPodAutoScalingEnabled" . }} +{{- if eq "true" $VerticalPodAutoScalingEnabled -}} +apiVersion: autoscaling.k8s.io/v1 +kind: VerticalPodAutoscaler +metadata: + {{- if .Values.verticalPodScaling.name }} + name: {{ .Values.verticalPodScaling.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" . }}-vpa + {{- end }} + labels: + kind: Prometheus + app: {{ template ".Chart.Name .name" . }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" . }} + release: {{ .Values.prometheus.release }} + {{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} + {{- end }} +spec: +{{- if .Values.verticalPodScaling.resourcePolicy }} + resourcePolicy: +{{ toYaml .Values.verticalPodScaling.resourcePolicy}} +{{- end }} +{{- if .Values.verticalPodScaling.updatePolicy }} + updatePolicy: +{{ toYaml .Values.verticalPodScaling.updatePolicy}} +{{- end }} + targetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include ".Chart.Name .fullname" $ }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/winter-soldier.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/winter-soldier.yaml new file mode 100644 index 0000000000..314f0c6db0 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/templates/winter-soldier.yaml @@ -0,0 +1,45 @@ +{{- if .Values.winterSoldier.enabled }} +apiVersion: {{ $.Values.winterSoldier.apiVersion }} +kind: Hibernator +metadata: + {{- if .Values.winterSoldier.name }} + name: {{ .Values.winterSoldier.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" $ }}-hibernator + {{- end }} + labels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} +{{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} +{{- end }} + {{- if .Values.winterSoldier.labels }} +{{ toYaml .Values.winterSoldier.labels | indent 4 }} + {{- end }} +{{- if .Values.winterSoldier.annotations }} + annotations: +{{ toYaml .Values.winterSoldier.annotations | indent 4 }} +{{- end }} +spec: + timeRangesWithZone: +{{ toYaml $.Values.winterSoldier.timeRangesWithZone | indent 4}} + selectors: + - inclusions: + - objectSelector: + name: {{ include ".Chart.Name .fullname" $ }} + type: {{ .Values.winterSoldier.type | quote }} + fieldSelector: +{{toYaml $.Values.winterSoldier.fieldSelector | indent 14 }} + namespaceSelector: + name: {{ $.Release.Namespace }} + exclusions: [] + action: {{ $.Values.winterSoldier.action }} + {{- if eq .Values.winterSoldier.action "scale" }} + {{- if .Values.winterSoldier.targetReplicas }} + targetReplicas: {{ $.Values.winterSoldier.targetReplicas }} + {{- end }} + {{- end }} +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/test-values.json b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/test-values.json new file mode 100644 index 0000000000..a26806cb91 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/test-values.json @@ -0,0 +1,292 @@ +{ + "ConfigMaps": { + "enabled": true, + "maps": [ + { + "data": { + "a": "b" + }, + "esoSecretData": {}, + "external": false, + "externalType": "", + "filePermission": "", + "mountPath": "", + "name": "abc", + "roleARN": "", + "subPath": false, + "type": "environment" + } + ] + }, + "ConfigSecrets": { + "enabled": true, + "secrets": [ + { + "data": { + "access-key": "QUtJQVdQVENFV0w1Wk4zVFBSRzY=", + "secret-access-key": "dkJ1bXRJL1YyZFUrQmVrSnM4QkVsblJnQzlRbEZueVZqL0dEdUc4Ng==" + }, + "esoSecretData": {}, + "external": false, + "externalType": "", + "filePermission": "", + "mountPath": "", + "name": "auth-aws", + "roleARN": "", + "subPath": false, + "type": "environment" + }, + { + "esoSecretData": { + "esoData": [ + { + "key": "ajay-secret-aws", + "property": "mob", + "secretKey": "mymob" + }, + { + "key": "ajay-secret-aws", + "property": "pin", + "secretKey": "mypin" + } + ], + "secretStore": { + "aws": { + "auth": { + "secretRef": { + "accessKeyIDSecretRef": { + "key": "access-key", + "name": "auth-aws-1" + }, + "secretAccessKeySecretRef": { + "key": "secret-access-key", + "name": "auth-aws-1" + } + } + }, + "region": "ap-south-1", + "service": "SecretsManager" + } + } + }, + "external": true, + "externalType": "ESO_AWSSecretsManager", + "filePermission": "", + "mountPath": "", + "name": "external-secret-aws", + "roleARN": "", + "subPath": false, + "type": "environment" + } + ] + }, + "ContainerPort": [ + { + "envoyPort": 8799, + "idleTimeout": "1800s", + "name": "app", + "port": 80, + "servicePort": 80, + "supportStreaming": false, + "useHTTP2": false + } + ], + "EnvVariables": [], + "GracePeriod": 30, + "LivenessProbe": { + "Path": "", + "command": [], + "failureThreshold": 3, + "httpHeaders": [], + "initialDelaySeconds": 20, + "periodSeconds": 10, + "port": 8080, + "scheme": "", + "successThreshold": 1, + "tcp": false, + "timeoutSeconds": 5 + }, + "MaxSurge": 1, + "MaxUnavailable": 0, + "MinReadySeconds": 60, + "ReadinessProbe": { + "Path": "", + "command": [], + "failureThreshold": 3, + "httpHeaders": [], + "initialDelaySeconds": 20, + "periodSeconds": 10, + "port": 8080, + "scheme": "", + "successThreshold": 1, + "tcp": false, + "timeoutSeconds": 5 + }, + "Spec": { + "Affinity": { + "Values": "nodes", + "key": "" + } + }, + "app": "1", + "appLabels": {}, + "appMetrics": false, + "args": { + "enabled": false, + "value": [ + "/bin/sh", + "-c", + "touch /tmp/healthy; sleep 30; rm -rf /tmp/healthy; sleep 600" + ] + }, + "autoscaling": { + "MaxReplicas": 2, + "MinReplicas": 1, + "TargetCPUUtilizationPercentage": 90, + "TargetMemoryUtilizationPercentage": 80, + "annotations": {}, + "behavior": {}, + "enabled": false, + "extraMetrics": [], + "labels": {} + }, + "command": { + "enabled": false, + "value": [], + "workingDir": {} + }, + "containerSecurityContext": {}, + "containers": [], + "dbMigrationConfig": { + "enabled": false + }, + "deployment": { + "strategy": { + "blueGreen": { + "autoPromotionEnabled": false, + "autoPromotionSeconds": 30, + "previewReplicaCount": 1, + "scaleDownDelaySeconds": 30 + } + } + }, + "deploymentType": "BLUE-GREEN", + "env": "1", + "envoyproxy": { + "configMapName": "", + "image": "quay.io/devtron/envoy:v1.14.1", + "resources": { + "limits": { + "cpu": "50m", + "memory": "50Mi" + }, + "requests": { + "cpu": "50m", + "memory": "50Mi" + } + } + }, + "hostAliases": [], + "image": { + "pullPolicy": "IfNotPresent" + }, + "imagePullSecrets": [], + "ingress": { + "annotations": {}, + "className": "", + "enabled": false, + "hosts": [ + { + "host": "chart-example1.local", + "pathType": "ImplementationSpecific", + "paths": [ + "/example1" + ] + } + ], + "labels": {}, + "tls": [] + }, + "ingressInternal": { + "annotations": {}, + "className": "", + "enabled": false, + "hosts": [ + { + "host": "chart-example1.internal", + "pathType": "ImplementationSpecific", + "paths": [ + "/example1" + ] + }, + { + "host": "chart-example2.internal", + "pathType": "ImplementationSpecific", + "paths": [ + "/example2", + "/example2/healthz" + ] + } + ], + "tls": [] + }, + "initContainers": [], + "kedaAutoscaling": { + "advanced": {}, + "authenticationRef": {}, + "enabled": false, + "envSourceContainerName": "", + "maxReplicaCount": 2, + "minReplicaCount": 1, + "triggerAuthentication": { + "enabled": false, + "name": "", + "spec": {} + }, + "triggers": [] + }, + "pauseForSecondsBeforeSwitchActive": 30, + "pipelineName": "cd-1-fpji", + "podAnnotations": {}, + "podLabels": {}, + "podSecurityContext": {}, + "prometheus": { + "release": "monitoring" + }, + "rawYaml": [], + "releaseVersion": "6", + "replicaCount": 1, + "resources": { + "limits": { + "cpu": "0.05", + "memory": "50Mi" + }, + "requests": { + "cpu": "0.01", + "memory": "10Mi" + } + }, + "secret": { + "data": {}, + "enabled": false + }, + "server": { + "deployment": { + "image": "aju121/test12", + "image_tag": "63118bf2-1-1" + } + }, + "service": { + "annotations": {}, + "loadBalancerSourceRanges": [], + "type": "ClusterIP" + }, + "servicemonitor": { + "additionalLabels": {} + }, + "tolerations": [], + "topologySpreadConstraints": [], + "volumeMounts": [], + "volumes": [], + "waitForSecondsBeforeScalingDown": 30 +} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/test_values.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/test_values.yaml new file mode 100644 index 0000000000..48e62037f6 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/test_values.yaml @@ -0,0 +1,782 @@ +# Default values for myapp. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +kedaAutoscaling: + enabled: true + envSourceContainerName: "" # Optional. Default: .spec.template.spec.containers[0] + cooldownPeriod: 300 # Optional. Default: 300 seconds + minReplicaCount: 1 + maxReplicaCount: 2 + idleReplicaCount: 0 # Optional. Must be less than minReplicaCount + pollingInterval: 30 # Optional. Default: 30 seconds + # The fallback section is optional. It defines a number of replicas to fallback to if a scaler is in an error state. + fallback: {} # Optional. Section to specify fallback options + # failureThreshold: 3 # Mandatory if fallback section is included + # replicas: 6 + advanced: {} + # horizontalPodAutoscalerConfig: # Optional. Section to specify HPA related options + # behavior: # Optional. Use to modify HPA's scaling behavior + # scaleDown: + # stabilizationWindowSeconds: 300 + # policies: + # - type: Percent + # value: 100 + # periodSeconds: 15 + triggers: + - type: kubernetes-workload + name: trig_one + metadata: + podSelector: 'pod=workload-test' + - type: metrics-api + name: trig_two + metadata: + url: "https://mockbin.org/bin/336a8d99-9e09-4f1f-979d-851a6d1b1423" + valueLocation: "tasks" + + triggerAuthentication: + enabled: true + name: "trigger-test" + spec: {} + authenticationRef: {} + +deploymentLabels: + name: kunalverma + Company: Devtron + Job: DevRel + +deploymentAnnotations: + name: kunalverma + Company: Devtron + Job: DevRel + +containerSpec: + lifecycle: + enabled: true + preStop: + exec: + command: ["sleep","10"] + postStart: + httpGet: + host: example.com + path: /example + port: 90 + +imagePullSecrets: + - test1 + - test2 +replicaCount: 1 +MinReadySeconds: 5 +MaxSurge: 1 +MaxUnavailable: 0 +GracePeriod: 30 +ContainerPort: + - name: app + port: 8080 + servicePort: 80 + envoyTimeout: 15 + targetPort: 8080 + envoyPort: 8799 + useHTTP2: false + supportStreaming: false + idleTimeout: 1800s + servicemonitor: + enabled: true + path: /abc + scheme: 'http' + interval: 30s + scrapeTimeout: 20s + metricRelabelings: + - sourceLabels: [namespace] + regex: '(.*)' + replacement: myapp + targetLabel: target_namespace + + - name: app1 + port: 8090 + targetPort: 1234 + servicePort: 8080 + useGRPC: true + servicemonitor: + enabled: true + - name: app2 + port: 8091 + servicePort: 8081 + useGRPC: true + +pauseForSecondsBeforeSwitchActive: 30 +waitForSecondsBeforeScalingDown: 30 +autoPromotionSeconds: 30 + +Spec: + Affinity: + Key: + # Key: kops.k8s.io/instancegroup + Values: + + +image: + pullPolicy: IfNotPresent + +autoscaling: + enabled: true + MinReplicas: 1 + MaxReplicas: 2 + TargetCPUUtilizationPercentage: 90 + TargetMemoryUtilizationPercentage: 80 + behavior: {} +# scaleDown: +# stabilizationWindowSeconds: 300 +# policies: +# - type: Percent +# value: 100 +# periodSeconds: 15 +# scaleUp: +# stabilizationWindowSeconds: 0 +# policies: +# - type: Percent +# value: 100 +# periodSeconds: 15 +# - type: Pods +# value: 4 +# periodSeconds: 15 +# selectPolicy: Max + + extraMetrics: [] +# - external: +# metricName: pubsub.googleapis.com|subscription|num_undelivered_messages +# metricSelector: +# matchLabels: +# resource.labels.subscription_id: echo-read +# targetAverageValue: "2" +# type: External +# + +secret: + enabled: false + +service: + type: ClusterIP + # name: "1234567890123456789012345678901234567890123456789012345678901234567890" + annotations: {} + # test1: test2 + # test3: test4 + +istio: + enable: true + gateway: + enabled: true + labels: {} + annotations: {} + # host: example.com + hosts: + - "example4.com" + tls: + enabled: true + secretName: example-tls-secret + virtualService: + enabled: true + labels: {} + annotations: {} + gateways: [] + hosts: + - example1.local + http: + # - match: + # - uri: + # prefix: /v1 + # - uri: + # prefix: /v2 + # rewriteUri: / + # timeout: 12 + # headers: + # request: + # add: + # x-some-header: "value" + # retries: + # attempts: 2 + # perTryTimeout: 3s + # route: + # - destination: + # host: service1 + # port: 80 + # - route: + # - destination: + # host: service2 + +flaggerCanary: + enabled: false + labels: {} + annotations: {} + createIstioGateway: + enabled: false + labels: {} + annotations: {} + host: example.com + tls: + enabled: false + secretName: example-tls-secret + # Istio gateways (optional) + addOtherGateways: [] + # Istio virtual service host names (optional) + addOtherHosts: [] + # Istio gateway refs (optional) + gatewayRefs: + # - name: istio-gateway + # namespace: istio-system + #service port + port: 80 + #containerPort + targetPort: 8080 + # discover all port open in container + portDiscovery: false + # application protocol (optional) + appProtocol: + # Istio retry policy (optional) + retries: + # attempts: 3 + # perTryTimeout: 1s + # retryOn: "gateway-error,connect-failure,refused-stream" + # HTTP match conditions (optional) + match: + - uri: + prefix: / + # HTTP rewrite (optional) + rewriteUri: + # timeout (optional) + timeout: + # Add headers (optional) + headers: + # request: + # add: + # x-some-header: "value" + # cross-origin resource sharing policy (optional) + corsPolicy: + # allowOrigin: + # - example.com + # allowMethods: + # - GET + # allowCredentials: false + # allowHeaders: + # - x-some-header + # maxAge: 24h + analysis: + # schedule interval (default 60s) + interval: 5s + # max number of failed metric checks before rollback + threshold: 10 + # max traffic percentage routed to canary + # percentage (0-100) + maxWeight: 50 + # canary increment step + # percentage (0-100) + stepWeight: 5 + thresholds: + # minimum req success rate (non 5xx responses) + # percentage (0-100) + successRate: 90 + # maximum req duration P99 + # milliseconds + latency: 500 + loadtest: + enabled: true + # load tester address + url: http://flagger-loadtester.test/ + +server: + deployment: + image_tag: 1-95af053 + image: "" +deploymentType: "RECREATE" + +topologySpreadConstraints: + - maxSkew: 1 + topologyKey: zone + whenUnsatisfiable: DoNotSchedule + autoLabelSelector: true + customLabelSelector: + foo: bar + +EnvVariables: + - name: FLASK_ENV + value: qa + +LivenessProbe: + Path: / + port: 8080 + initialDelaySeconds: 20 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + failureThreshold: 3 + httpHeaders: + - name: Custom-Header + value: abc + - name: Custom-Header2 + value: xyz + +ReadinessProbe: + Path: / + port: 8080 + initialDelaySeconds: 20 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + failureThreshold: 3 + httpHeaders: + - name: Custom-Header + value: abc + +StartupProbe: + Path: "/" + port: 8080 + initialDelaySeconds: 20 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + failureThreshold: 3 + httpHeaders: [] + command: [] + tcp: false + +prometheus: + release: monitoring + +servicemonitor: + additionalLabels: {} + +prometheusRule: + enabled: true + additionalLabels: {} + namespace: "" + rules: + # These are just examples rules, please adapt them to your needs + - alert: TooMany500s + expr: 100 * ( sum( nginx_ingress_controller_requests{status=~"5.+"} ) / sum(nginx_ingress_controller_requests) ) > 5 + for: 1m + labels: + severity: critical + annotations: + description: Too many 5XXs + summary: More than 5% of the all requests did return 5XX, this require your attention + - alert: TooMany400s + expr: 100 * ( sum( nginx_ingress_controller_requests{status=~"4.+"} ) / sum(nginx_ingress_controller_requests) ) > 5 + for: 1m + labels: + severity: critical + annotations: + description: Too many 4XXs + summary: More than 5% of the all requests did return 4XX, this require your attention + + +ingress: + enabled: true + className: nginx + annotations: {} +# nginx.ingress.kubernetes.io/rewrite-target: / +# nginx.ingress.kubernetes.io/ssl-redirect: "false" +# kubernetes.io/ingress.class: nginx +# kubernetes.io/tls-acme: "true" +# nginx.ingress.kubernetes.io/canary: "true" +# nginx.ingress.kubernetes.io/canary-weight: "10" +# Old Ingress Format +# host: "ingress-example.com" +# path: "/app" + +# New Ingress Format + hosts: + - host: chart-example1.local + pathType: "ImplementationSpecific" + paths: + - /example1 + + - host: chart-example2.local + pathType: "ImplementationSpecific" + paths: + - /example2 + - /example2/healthz + additionalBackends: + - path: /example1 + pathType: "ImplementationSpecific" + backend: + service: + name: test-service + port: + number: 80 + + tls: [] +### Legacy Ingress Format ## +# host: abc.com +# path: "/" +# pathType: "ImplementationSpecific" + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +ingressInternal: + enabled: true + className: nginx-internal + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # nginx.ingress.kubernetes.io/canary: "true" + # nginx.ingress.kubernetes.io/canary-weight: "10" + hosts: + - host: chart-example1.internal + pathType: "ImplementationSpecific" + paths: + - /example1 + additionalBackends: + - path: /internal + pathType: "ImplementationSpecific" + backend: + service: + name: test-service-internal + port: + number: 80 + - path: /internal-01 + pathType: "ImplementationSpecific" + backend: + service: + name: test-service-internal + port: + number: 80 + - host: chart-example2.internal + pathType: "ImplementationSpecific" + paths: + - /example2 + - /example2/healthz + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +winterSoldier: + apiVersion: pincher.devtron.ai/v1alpha1 + enabled: true + annotations: {} + labels: {} + type: Deployment + timeRangesWithZone: + timeZone: "Asia/Kolkata" + timeRanges: + - timeFrom: 00:00 + timeTo: 23:59:59 + weekdayFrom: Sat + weekdayTo: Sun + - timeFrom: 00:00 + timeTo: 08:00 + weekdayFrom: Mon + weekdayTo: Fri + - timeFrom: 20:00 + timeTo: 23:59:59 + weekdayFrom: Mon + weekdayTo: Fri + action: scale + targetReplicas: [1,1,1] + fieldSelector: + - AfterTime(AddTime(ParseTime({{metadata.creationTimestamp}}, '2006-01-02T15:04:05Z'), '5m'), Now()) + + +dbMigrationConfig: + enabled: false + +command: + workingDir: /app + enabled: false + value: ["ls"] + +args: + enabled: false + value: [] + +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: 1 + memory: 200Mi + requests: + cpu: 0.10 + memory: 100Mi + +volumeMounts: [] +# - name: log-volume +# mountPath: /var/log + +volumes: [] +# - name: log-volume +# emptyDir: {} + + +nodeSelector: {} + + +#used for deployment algo selection +orchestrator.deploymant.algo: 1 + +ConfigMaps: + enabled: false + maps: [] +# - name: config-map-1 +# type: environment +# external: false +# data: +# key1: key1value-1 +# key2: key2value-1 +# key3: key3value-1 +# - name: config-map-2 +# type: volume +# external: false +# mountPath: /etc/config/2 +# filePermission: 0400 +# data: +# key1: | +# club : manchester utd +# nation : england +# key2: abc-2 +# key3: abc-2 +# - name: config-map-3 +# type: environment +# external: true +# mountPath: /etc/config/3 +# data: [] +# - name: config-map-4 +# type: volume +# external: true +# mountPath: /etc/config/4 +# data: [] + + +ConfigSecrets: + enabled: true + secrets: + - name: config-secret-1 + type: environment + external: false + externalType: AWSSecretsManager + esoSecretData: + secretStore: + aws: + service: SecretsManager + region: us-east-1 + auth: + secretRef: + accessKeyIDSecretRef: + name: awssm-secret + key: access-key + secretAccessKeySecretRef: + name: awssm-secret + key: secret-access-key + esoData: + - secretKey: prod-mysql-password + key: secrets/prod-mysql-secrets + property: prodPassword + - secretKey: prod-mysql-password + key: secrets/prod-mysql-secrets + property: prodPassword + - secretKey: prod-mysql-password + key: secrets/prod-mysql-secrets + property: prodPassword + - secretKey: prod-mysql-password + key: secrets/prod-mysql-secrets + property: prodPassword + data: + key1: key1value-1 + key2: key2value-1 + key3: key3value-1 + - name: config-secret-2 + type: environment + external: false + externalType: ESO_HashiCorpVault + esoSecretData: + secretStore: + vault: + server: "http://my.vault.server:8200" + path: "secret" + version: "v2" + auth: + tokenSecretRef: + name: vault-token + key: token + esoData: + - secretKey: prod-mysql-password + key: secrets/prod-mysql-secrets + property: prodPassword + - secretKey: prod-mysql-password + key: secrets/prod-mysql-secrets + property: prodPassword + - secretKey: prod-mysql-password + key: secrets/prod-mysql-secrets + property: prodPassword + date: + key1: key1value-1 + key2: key2value-1 + key3: key3value-1 + +# - name: config-secret-2 +# type: volume +# external: false +# mountPath: /etc/config/2 +# data: +# key1: | +# club : manchester utd +# nation : england +# key2: abc-2 + + +initContainers: + ## Additional init containers to run before the Scheduler pods. + ## for example, be used to run a sidecar that chown Logs storage . + - command: ["sh", "-c", "chown -R 1000:1000 logs"] + reuseContainerImage: true + volumeMounts: + - mountPath: /usr/local/airflow/logs + name: logs-data + securityContext: + privileged: true + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 2000 + - name: init-migrate + image: busybox:latest + command: ["sh", "-c", "chown -R 1000:1000 logs"] + volumeMounts: + - mountPath: /usr/local/airflow/logs + name: logs-data + securityContext: + capabilities: + drop: + - ALL + +containers: + # Additional init containers to run before the Scheduler pods. + # for example, be used to run a sidecar that chown Logs storage . + - name: volume-mount-hack + image: busybox + command: ["sh", "-c", "chown -R 1000:1000 logs"] + volumeMounts: + - mountPath: /usr/local/airflow/logs + name: logs-data + + +rawYaml: + - apiVersion: v1 + kind: Service + metadata: + annotations: + labels: + app: sample-metrics-app + name: sample-metrics-app + namespace: default + spec: + ports: + - name: web + port: 80 + protocol: TCP + targetPort: 8080 + selector: + app: sample-metrics-app + sessionAffinity: None + type: ClusterIP + - apiVersion: v1 + kind: Service + metadata: + annotations: + labels: + app: sample-metrics-app + name: sample-metrics-app + namespace: default + spec: + ports: + - name: web + port: 80 + protocol: TCP + targetPort: 8080 + selector: + app: sample-metrics-app + sessionAffinity: None + type: ClusterIP + +# If you need to provide some extra specs for main container which are not included by default in deployment template +# then provide them here +containerExtraSpecs: {} + +# If you need to provide some extra specs for pod which are not included by default in deployment template +# then provide them here +podExtraSpecs: {} + +envoyproxy: + image: docker.io/envoyproxy/envoy:v1.16.0 + configMapName: "" + lifecycle: {} + resources: + limits: + cpu: 50m + memory: 50Mi + requests: + cpu: 50m + memory: 50Mi + +podDisruptionBudget: + minAvailable: 1 + maxUnavailable: 1 + + # Node tolerations for server scheduling to nodes with taints + # Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ +# + +tolerations: + - key: "key" + operator: "Equal|Exists" + value: "value" + effect: "NoSchedule|PreferNoSchedule|NoExecute(1.6 only)" + +appMetrics: true +serviceAccount: + ## @param serviceAccount.create Enable creation of ServiceAccount for pods + ## + create: false + ## @param serviceAccount.name The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the `.Chart.Name .fullname` template + name: "test1" + ## @param serviceAccount.annotations Annotations for service account. Evaluated as a template. + ## Only used if `create` is `true`. + ## + annotations: + kubernetes.io/service-account.name: build-robot +containerSecurityContext: + allowPrivilegeEscalation: false +privileged: true +hostAliases: [] +# - ip: "127.0.0.1" +# hostnames: +# - "foo.local" + + +affinity: + enabled: false + values: + podAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: security + operator: In + values: + - S1 + topologyKey: topology.kubernetes.io/zone + +secondaryWorkload: + enabled: false + postfix: "od" + replicaCount: 1 + affinity: {} + tolerations: [] + autoscaling: + enabled: true + MinReplicas: 1 + MaxReplicas: 2 + TargetCPUUtilizationPercentage: 90 + TargetMemoryUtilizationPercentage: 80 \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/values.yaml b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/values.yaml new file mode 100644 index 0000000000..da8c45271f --- /dev/null +++ b/scripts/devtron-reference-helm-charts/gpu-workload-4-21-0/values.yaml @@ -0,0 +1,726 @@ +# Default values for myapp. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 +MinReadySeconds: 5 +MaxSurge: 1 +MaxUnavailable: 0 +GracePeriod: 30 +ContainerPort: + - name: app + port: 8080 + servicePort: 80 + envoyPort: 8799 + envoyTimeout: 15s + useHTTP2: false + supportStreaming: false + idleTimeout: 1800s + protocol: TCP +# servicemonitor: +# enabled: true +# path: /abc +# scheme: 'http' +# interval: 30s +# scrapeTimeout: 20s +# metricRelabelings: +# - sourceLabels: [namespace] +# regex: '(.*)' +# replacement: myapp +# targetLabel: target_namespace + + - name: app1 + port: 8090 + servicePort: 8080 + useGRPC: true + +pauseForSecondsBeforeSwitchActive: 30 +waitForSecondsBeforeScalingDown: 30 +autoPromotionSeconds: 30 + +Spec: + Affinity: + Key: "" +# Key: kops.k8s.io/instancegroup + Values: "" + +affinity: {} + +image: + pullPolicy: IfNotPresent + +restartPolicy: Always + +ambassadorMapping: + enabled: false + # labels: + # key1: value1 + # prefix: / + # ambassadorId: 1234 + # hostname: devtron.example.com + # rewrite: /foo/ + # retryPolicy: + # retry_on: "5xx" + # num_retries: 10 + # cors: + # origins: http://foo.example,http://bar.example + # methods: POST, GET, OPTIONS + # headers: Content-Type + # credentials: true + # exposed_headers: X-Custom-Header + # max_age: "86400" + # weight: 10 + # method: GET + # extraSpec: + # method_regex: true + # headers: + # x-quote-mode: backend + # x-random-header: devtron + # tls: + # context: httpd-context + # create: true + # secretName: httpd-secret + # hosts: + # - anything.example.info + # - devtron.example.com + # extraSpec: + # min_tls_version: v1.2 + +autoscaling: + enabled: false + MinReplicas: 1 + MaxReplicas: 2 + annotations: {} + labels: {} + behavior: {} + containerResource: + enabled: false +# scaleDown: +# stabilizationWindowSeconds: 300 +# policies: +# - type: Percent +# value: 100 +# periodSeconds: 15 +# scaleUp: +# stabilizationWindowSeconds: 0 +# policies: +# - type: Percent +# value: 100 +# periodSeconds: 15 +# - type: Pods +# value: 4 +# periodSeconds: 15 +# selectPolicy: Max + extraMetrics: [] +# - external: +# metricName: pubsub.googleapis.com|subscription|num_undelivered_messages +# metricSelector: +# matchLabels: +# resource.labels.subscription_id: echo-read +# targetAverageValue: "2" +# type: External +# + +kedaAutoscaling: + enabled: false + envSourceContainerName: "" # Optional. Default: .spec.template.spec.containers[0] + cooldownPeriod: 300 # Optional. Default: 300 seconds + minReplicaCount: 1 + maxReplicaCount: 2 + idleReplicaCount: 0 # Optional. Must be less than minReplicaCount + pollingInterval: 30 # Optional. Default: 30 seconds + # The fallback section is optional. It defines a number of replicas to fallback to if a scaler is in an error state. + fallback: {} # Optional. Section to specify fallback options + # failureThreshold: 3 # Mandatory if fallback section is included + # replicas: 6 + advanced: {} + # horizontalPodAutoscalerConfig: # Optional. Section to specify HPA related options + # behavior: # Optional. Use to modify HPA's scaling behavior + # scaleDown: + # stabilizationWindowSeconds: 300 + # policies: + # - type: Percent + # value: 100 + # periodSeconds: 15 + triggers: [] + triggerAuthentication: + enabled: false + name: "" + spec: {} + authenticationRef: {} + +# kedaHttpScaledObject: +# enabled: false +# minReplicaCount: 1 +# maxReplicaCount: 2 +# targetPendingRequests: +# scaledownPeriod: +# servicePort: 80 # port of the service (required) + +secret: + enabled: false + +service: + type: ClusterIP + enabled: true +# name: "1234567890123456789012345678901234567890123456789012345678901234567890" + annotations: {} + # test1: test2 + # test3: test4 + sessionAffinity: + enabled: false + +istio: + enable: false + gateway: + enabled: false + labels: {} + annotations: {} + host: "" + tls: + enabled: false + secretName: "" + virtualService: + enabled: false + labels: {} + annotations: {} + gateways: [] + hosts: [] + http: [] + # - match: + # - uri: + # prefix: /v1 + # - uri: + # prefix: /v2 + # timeout: 12 + # headers: + # request: + # add: + # x-some-header: "value" + # retries: + # attempts: 2 + # perTryTimeout: 3s + destinationRule: + enabled: false + labels: {} + annotations: {} + subsets: [] + trafficPolicy: {} + peerAuthentication: + enabled: false + labels: {} + annotations: {} + selector: + enabled: false + mtls: + mode: "" + portLevelMtls: {} + requestAuthentication: + enabled: false + labels: {} + annotations: {} + selector: + enabled: false + jwtRules: [] + authorizationPolicy: + enabled: false + labels: {} + annotations: {} + action: + provider: {} + rules: [] + +flaggerCanary: + enabled: false + labels: {} + annotations: {} + createIstioGateway: + enabled: false + labels: {} + annotations: {} + host: "" + tls: + enabled: false + secretName: "" + # Istio gateways (optional) + addOtherGateways: [] + # Istio virtual service host names (optional) + addOtherHosts: [] + # Istio gateway refs (optional) + gatewayRefs: + # - name: istio-gateway + # namespace: istio-system + #service port + serviceport: 8080 + #containerPort + targetPort: 8080 + # discover all port open in container + portDiscovery: true + # application protocol (optional) + appProtocol: + # Istio retry policy (optional) + retries: + attempts: 3 + perTryTimeout: 1s + retryOn: "gateway-error,connect-failure,refused-stream" + # HTTP match conditions (optional) + match: + - uri: + prefix: / + # HTTP rewrite (optional) + rewriteUri: / + # timeout (optional) + timeout: + # Add headers (optional) + headers: + # request: + # add: + # x-some-header: "value" + # cross-origin resource sharing policy (optional) + corsPolicy: + # allowOrigin: + # - example.com + # allowMethods: + # - GET + # allowCredentials: false + # allowHeaders: + # - x-some-header + # maxAge: 24h + analysis: + # schedule interval (default 60s) + interval: 15s + # max number of failed metric checks before rollback + threshold: 5 + # max traffic percentage routed to canary + # percentage (0-100) + maxWeight: 50 + # canary increment step + # percentage (0-100) + stepWeight: 5 + thresholds: + # minimum req success rate (non 5xx responses) + # percentage (0-100) + successRate: 90 + # maximum req duration P99 + # milliseconds + latency: 500 + loadtest: + enabled: true + # load tester address + url: http://flagger-loadtester.istio-system/ + + +server: + deployment: + image_tag: 1-95af053 + image: "" + +EnvVariablesFromFieldPath: [] +# - name: POD_NAME +# fieldPath: metadata.name + +EnvVariables: [] + # - name: FLASK_ENV + # value: qa + +EnvVariablesFromSecretKeys: [] + # - name: ENV_NAME + # secretName: SECRET_NAME + # keyName: SECRET_KEY + +EnvVariablesFromConfigMapKeys: [] + # - name: ENV_NAME + # configMapName: CONFIG_MAP_NAME + # keyName: CONFIG_MAP_KEY + +LivenessProbe: + Path: "" + port: 8080 + initialDelaySeconds: 20 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + failureThreshold: 3 + scheme: "" + httpHeaders: [] +# - name: Custom-Header +# value: abc + grpc: {} + + +ReadinessProbe: + Path: "" + port: 8080 + initialDelaySeconds: 20 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + failureThreshold: 3 + scheme: "" + httpHeaders: [] +# - name: Custom-Header +# value: abc + grpc: {} + + +StartupProbe: + Path: "" + port: 8080 + initialDelaySeconds: 20 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + failureThreshold: 3 + httpHeaders: [] + command: [] + tcp: false + grpc: {} + + +prometheus: + release: monitoring + +servicemonitor: + additionalLabels: {} + + +prometheusRule: + enabled: false + additionalLabels: {} + namespace: "" +# rules: +# # These are just examples rules, please adapt them to your needs +# - alert: TooMany500s +# expr: 100 * ( sum( nginx_ingress_controller_requests{status=~"5.+"} ) / sum(nginx_ingress_controller_requests) ) > 5 +# for: 1m +# labels: +# severity: critical +# annotations: +# description: Too many 5XXs +# summary: More than 5% of the all requests did return 5XX, this require your attention +# - alert: TooMany400s +# expr: 100 * ( sum( nginx_ingress_controller_requests{status=~"4.+"} ) / sum(nginx_ingress_controller_requests) ) > 5 +# for: 1m +# labels: +# severity: critical +# annotations: +# description: Too many 4XXs +# summary: More than 5% of the all requests did return 4XX, this require your attention +# + +ingress: + enabled: false + className: "" + labels: {} + annotations: {} +# nginx.ingress.kubernetes.io/rewrite-target: / +# nginx.ingress.kubernetes.io/ssl-redirect: "false" +# kubernetes.io/ingress.class: nginx +# kubernetes.io/tls-acme: "true" +# nginx.ingress.kubernetes.io/canary: "true" +# nginx.ingress.kubernetes.io/canary-weight: "10" + + hosts: + - host: chart-example1.local + pathType: "ImplementationSpecific" + paths: + - /example1 + - host: chart-example2.local + pathType: "ImplementationSpecific" + paths: + - /example2 + - /example2/healthz + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +ingressInternal: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # nginx.ingress.kubernetes.io/canary: "true" + # nginx.ingress.kubernetes.io/canary-weight: "10" + + hosts: + - host: chart-example1.internal + pathType: "ImplementationSpecific" + paths: + - /example1 + - host: chart-example2.internal + pathType: "ImplementationSpecific" + paths: + - /example2 + - /example2/healthz + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +winterSoldier: + enabled: false + apiVersion: pincher.devtron.ai/v1alpha1 + labels: {} + annotations: {} + type: Deployment + timeRangesWithZone: {} + # timeZone: "Asia/Kolkata" + # timeRanges: [] + action: sleep + targetReplicas: [] + fieldSelector: [] + # - AfterTime(AddTime(ParseTime({{metadata.creationTimestamp}}, '2006-01-02T15:04:05Z'), '5m'), Now()) + +networkPolicy: + enabled: false + annotations: {} + labels: {} + podSelector: + matchExpressions: [] + matchLabels: {} + policyTypes: [] + ingress: [] + egress: [] + +dbMigrationConfig: + enabled: false + +command: + enabled: false + value: [] + +args: + enabled: false + value: [] + +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:'. + +gpu: + enabled: false + provider: "nvidia.com/gpu" + resources: + limits: 1 + requests: 1 + +volumeMounts: [] +# - name: log-volume +# mountPath: /var/log + +volumes: [] +# - name: log-volume +# emptyDir: {} + + +nodeSelector: {} + +# If you need to provide some extra specs for pod which are not included by default in deployment template +# then provide them here +podExtraSpecs: {} + +# If you need to provide some extra specs for main container which are not included by default in deployment template +# then provide them here +containerExtraSpecs: {} + +#used for deployment algo selection +orchestrator.deploymant.algo: 1 + +ConfigMaps: + enabled: false + maps: [] +# - name: config-map-1 +# type: environment +# external: false +# data: +# key1: key1value-1 +# key2: key2value-1 +# key3: key3value-1 +# - name: config-map-2 +# type: volume +# external: false +# mountPath: /etc/config/2 +# data: +# key1: | +# club : manchester utd +# nation : england +# key2: abc-2 +# key3: abc-2 +# - name: config-map-3 +# type: environment +# external: true +# mountPath: /etc/config/3 +# data: [] +# - name: config-map-4 +# type: volume +# external: true +# mountPath: /etc/config/4 +# data: [] + + +ConfigSecrets: + enabled: false + secrets: [] + # data: + # key1: key1value-1 + # key2: key2value-1 + # key3: key3value-1 +# - name: config-secret-2 +# type: volume +# external: false +# mountPath: /etc/config/2 +# data: +# key1: | +# club : manchester utd +# nation : england +# key2: abc-2 + + +initContainers: [] + + ## Additional init containers to run before the Scheduler pods. + ## for example, be used to run a sidecar that chown Logs storage . + # volumeMounts: + # - mountPath: /usr/local/airflow/logs + # name: logs-data + # # Uncomment below line ONLY IF you want to reuse the container image. + # # This will assign your application's docker image to init container. + # reuseContainerImage: true + +containers: [] + ## Additional init containers to run before the Scheduler pods. + ## for example, be used to run a sidecar that chown Logs storage . + +rawYaml: [] +# - apiVersion: v1 +# kind: Service +# metadata: +# annotations: +# labels: +# app: sample-metrics-app +# name: sample-metrics-app +# namespace: default +# spec: +# ports: +# - name: web +# port: 80 +# protocol: TCP +# targetPort: 8080 +# selector: +# app: sample-metrics-app +# sessionAffinity: None +# type: ClusterIP +# - apiVersion: v1 +# kind: Service +# metadata: +# annotations: +# labels: +# app: sample-metrics-app +# name: sample-metrics-app +# namespace: default +# spec: +# ports: +# - name: web +# port: 80 +# protocol: TCP +# targetPort: 8080 +# selector: +# app: sample-metrics-app +# sessionAffinity: None +# type: ClusterIP + +topologySpreadConstraints: [] + # - maxSkew: 1 + # topologyKey: zone + # whenUnsatisfiable: DoNotSchedule + # autoLabelSelector: true + # minDomain: 1 + # nodeTaintsPolicy: Honor + +envoyproxy: + image: docker.io/envoyproxy/envoy:v1.16.0 + lifecycle: {} + configMapName: "" + resources: + limits: + cpu: 50m + memory: 50Mi + requests: + cpu: 50m + memory: 50Mi + +containerSpec: + lifecycle: + enabled: false + preStop: {} +# exec: +# command: ["sleep","10"] + postStart: {} +# httpGet: +# host: example.com +# path: /example +# port: 90 + +podDisruptionBudget: {} +# minAvailable: 1 +# maxUnavailable: 1 + + ## Node tolerations for server scheduling to nodes with taints + ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + ## + +podSecurityContext: {} + # runAsUser: 1000 + # runAsGroup: 3000 + # fsGroup: 2000 + +containerSecurityContext: {} + # allowPrivilegeEscalation: false +## Pods Service Account +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ +## +serviceAccount: + ## @param serviceAccount.create Enable creation of ServiceAccount for pods + ## + create: false + ## @param serviceAccount.name The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the `.Chart.Name .fullname` template + name: "" + ## @param serviceAccount.annotations Annotations for service account. Evaluated as a template. + ## Only used if `create` is `true`. + ## + annotations: {} + +tolerations: [] + # - key: "key" + # operator: "Equal|Exists" + # value: "value" + # effect: "NoSchedule|PreferNoSchedule|NoExecute(1.6 only)" + +imagePullSecrets: [] + # - test1 + # - test2 +persistentVolumeClaim: {} + +verticalPodScaling: + enabled: false + +customPodLabels: {} + +secondaryWorkload: + enabled: false + Spec: + Affinity: + Key: "" + Values: "" + replicaCount: 1 + affinity: {} + tolerations: [] + autoscaling: + enabled: false + containerResource: + enabled: false \ No newline at end of file diff --git a/scripts/sql/33503700_gpu_workload_chart.down.sql b/scripts/sql/33503700_gpu_workload_chart.down.sql new file mode 100644 index 0000000000..d4fe449995 --- /dev/null +++ b/scripts/sql/33503700_gpu_workload_chart.down.sql @@ -0,0 +1,3 @@ +DELETE FROM global_strategy_metadata_chart_ref_mapping WHERE chart_ref_id=(select id from chart_ref where version='4.21.0' and name='GPU-Workload'); + +DELETE FROM "public"."chart_ref" WHERE ("location" = 'gpu-workload-4-21-0' AND "version" = '4.21.0'); \ No newline at end of file diff --git a/scripts/sql/33503700_gpu_workload_chart.up.sql b/scripts/sql/33503700_gpu_workload_chart.up.sql new file mode 100644 index 0000000000..18d1ed0987 --- /dev/null +++ b/scripts/sql/33503700_gpu_workload_chart.up.sql @@ -0,0 +1,9 @@ +INSERT INTO "public"."chart_ref" ("name","location", "version", "deployment_strategy_path","is_default", "active", "created_on", "created_by", "updated_on", "updated_by") VALUES + ('GPU-Workload','gpu-workload-4-21-0', '4.21.0','pipeline-values.yaml','f', 't', 'now()', 1, 'now()', 1); + +INSERT INTO global_strategy_metadata_chart_ref_mapping ("global_strategy_metadata_id", "chart_ref_id", "active", "created_on", "created_by", "updated_on", "updated_by","default") +VALUES (1,(select id from chart_ref where version='4.21.0' and name='GPU-Workload'), true, now(), 1, now(), 1,true), +(4,(select id from chart_ref where version='4.21.0' and name='GPU-Workload'), true, now(), 1, now(), 1,false); + +INSERT INTO chart_ref_metadata("chart_name","chart_description") VALUES +('GPU-Workload','GPU Workload Charts to enable the deployment of GPU workloads on Kubernetes Clusters.'); \ No newline at end of file diff --git a/scripts/sql/33603700_cronjob_job_1-6-0.down.sql b/scripts/sql/33603700_cronjob_job_1-6-0.down.sql new file mode 100644 index 0000000000..9a5a3abc5a --- /dev/null +++ b/scripts/sql/33603700_cronjob_job_1-6-0.down.sql @@ -0,0 +1,3 @@ +DELETE FROM global_strategy_metadata_chart_ref_mapping WHERE chart_ref_id=(select id from chart_ref where version='1.6.0' and name ='Job & CronJob'); + +DELETE FROM "public"."chart_ref" WHERE ("location" = 'cronjob-chart_1-6-0' AND "version" = '1.6.0'); diff --git a/scripts/sql/33603700_cronjob_job_1-6-0.up.sql b/scripts/sql/33603700_cronjob_job_1-6-0.up.sql new file mode 100644 index 0000000000..f1c8863d4d --- /dev/null +++ b/scripts/sql/33603700_cronjob_job_1-6-0.up.sql @@ -0,0 +1,19 @@ +-- First, safely insert the chart reference if it doesn't already exist. +INSERT INTO "public"."chart_ref" ("location", "version", "is_default", "active", "created_on", "created_by", "updated_on", "updated_by", "name", "deployment_strategy_path") +SELECT 'cronjob-chart_1-6-0', '1.6.0', 'f', 't', 'now()', 1, 'now()', 1, 'Job & CronJob', 'pipeline-values.yaml' +WHERE NOT EXISTS ( + SELECT 1 FROM "public"."chart_ref" WHERE "location" = 'cronjob-chart_1-6-0' +); + +-- Next, safely insert the mapping if it doesn't already exist. +INSERT INTO "public"."global_strategy_metadata_chart_ref_mapping" ("global_strategy_metadata_id", "chart_ref_id", "active", "default", "created_on", "created_by", "updated_on", "updated_by") +SELECT + (SELECT "id" FROM "public"."global_strategy_metadata" WHERE "name" = 'ROLLING'), + (SELECT "id" FROM "public"."chart_ref" WHERE "location" = 'cronjob-chart_1-6-0'), + true, true, 'now()', 1, 'now()', 1 +WHERE NOT EXISTS ( + SELECT 1 + FROM "public"."global_strategy_metadata_chart_ref_mapping" + WHERE "global_strategy_metadata_id" = (SELECT "id" FROM "public"."global_strategy_metadata" WHERE "name" = 'ROLLING') + AND "chart_ref_id" = (SELECT "id" FROM "public"."chart_ref" WHERE "location" = 'cronjob-chart_1-6-0') +); diff --git a/vendor/github.com/devtron-labs/common-lib/informer/bean.go b/vendor/github.com/devtron-labs/common-lib/informer/bean.go index 38aed85afc..9601f6f8f5 100644 --- a/vendor/github.com/devtron-labs/common-lib/informer/bean.go +++ b/vendor/github.com/devtron-labs/common-lib/informer/bean.go @@ -17,12 +17,15 @@ package informer const ( - ClusterModifyEventSecretType = "cluster.request/modify" - ClusterActionAdd = "add" - ClusterActionUpdate = "update" - ClusterActionDelete = "delete" - SecretFieldAction = "action" - SecretFieldClusterId = "cluster_id" + ClusterModifyEventSecretType = "cluster.request/modify" + ClusterModifyEventSecretTypeKey = "type" + ClusterActionAdd = "add" + ClusterActionUpdate = "update" + ClusterActionDelete = "delete" + CmFieldAction = "action" + CmFieldClusterId = "cluster_id" + ClusterModifyEventCmLabelKeyValue = "type=devtron.ai-cluster-request-modify" + ClusterModifyEventCmLabelValue = "devtron.ai-cluster-request-modify" ) const ( diff --git a/vendor/github.com/devtron-labs/common-lib/utils/k8s/K8sService.go b/vendor/github.com/devtron-labs/common-lib/utils/k8s/K8sService.go index e055c1cbb1..c8f583ff30 100644 --- a/vendor/github.com/devtron-labs/common-lib/utils/k8s/K8sService.go +++ b/vendor/github.com/devtron-labs/common-lib/utils/k8s/K8sService.go @@ -19,6 +19,7 @@ package k8s import ( "context" "flag" + "github.com/devtron-labs/common-lib/utils/k8s/configMap" "go.uber.org/zap" "io" batchV1 "k8s.io/api/batch/v1" @@ -76,7 +77,9 @@ type K8sService interface { PatchConfigMap(namespace string, clusterConfig *ClusterConfig, name string, data map[string]interface{}) (*v1.ConfigMap, error) UpdateConfigMap(namespace string, cm *v1.ConfigMap, client *v12.CoreV1Client) (*v1.ConfigMap, error) CreateConfigMap(namespace string, cm *v1.ConfigMap, client *v12.CoreV1Client) (*v1.ConfigMap, error) + CreateConfigMapObject(name, namespace string, client *v12.CoreV1Client, opts ...configMap.ConfigMapOption) (*v1.ConfigMap, error) GetConfigMap(namespace string, name string, client *v12.CoreV1Client) (*v1.ConfigMap, error) + DeleteConfigMap(namespace string, name string, client *v12.CoreV1Client) error GetConfigMapWithCtx(ctx context.Context, namespace string, name string, client *v12.CoreV1Client) (*v1.ConfigMap, error) GetNsIfExists(namespace string, client *v12.CoreV1Client) (ns *v1.Namespace, exists bool, err error) CreateNsIfNotExists(namespace string, clusterConfig *ClusterConfig) (ns *v1.Namespace, nsCreated bool, err error) diff --git a/vendor/github.com/devtron-labs/common-lib/utils/k8s/K8sUtil.go b/vendor/github.com/devtron-labs/common-lib/utils/k8s/K8sUtil.go index ac38ea06e8..f621257bd3 100644 --- a/vendor/github.com/devtron-labs/common-lib/utils/k8s/K8sUtil.go +++ b/vendor/github.com/devtron-labs/common-lib/utils/k8s/K8sUtil.go @@ -24,6 +24,7 @@ import ( "github.com/devtron-labs/common-lib/utils" http2 "github.com/devtron-labs/common-lib/utils/http" "github.com/devtron-labs/common-lib/utils/k8s/commonBean" + "github.com/devtron-labs/common-lib/utils/k8s/configMap" "io" "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes/scheme" @@ -237,6 +238,27 @@ func (impl *K8sServiceImpl) CreateConfigMap(namespace string, cm *v1.ConfigMap, } } +func (impl *K8sServiceImpl) CreateConfigMapObject(name, namespace string, client *v12.CoreV1Client, opts ...configMap.ConfigMapOption) (*v1.ConfigMap, error) { + configMap := &v1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + }, + } + for _, option := range opts { + option(configMap) + } + return impl.CreateConfigMap(namespace, configMap, client) +} + +func (impl *K8sServiceImpl) DeleteConfigMap(namespace string, name string, client *v12.CoreV1Client) error { + err := client.ConfigMaps(namespace).Delete(context.Background(), name, metav1.DeleteOptions{}) + if err != nil { + impl.logger.Errorw("error in deleting cm", "namespace", namespace, "err", err) + return err + } + return nil +} + func (impl *K8sServiceImpl) UpdateConfigMap(namespace string, cm *v1.ConfigMap, client *v12.CoreV1Client) (*v1.ConfigMap, error) { cm, err := client.ConfigMaps(namespace).Update(context.Background(), cm, metav1.UpdateOptions{}) if err != nil { diff --git a/vendor/github.com/devtron-labs/common-lib/utils/k8s/configMap/Options.go b/vendor/github.com/devtron-labs/common-lib/utils/k8s/configMap/Options.go new file mode 100644 index 0000000000..20cca36d16 --- /dev/null +++ b/vendor/github.com/devtron-labs/common-lib/utils/k8s/configMap/Options.go @@ -0,0 +1,43 @@ +package configMap + +import ( + v1 "k8s.io/api/core/v1" +) + +type ConfigMapOption func(*v1.ConfigMap) + +// WithLabels adds labels to a ConfigMap +func WithLabels(labels map[string]string) ConfigMapOption { + return func(cm *v1.ConfigMap) { + if labels != nil && len(labels) > 0 { + cm.ObjectMeta.Labels = labels + } + } +} + +// WithAnnotations adds annotations to a ConfigMap +func WithAnnotations(annotations map[string]string) ConfigMapOption { + return func(cm *v1.ConfigMap) { + if annotations != nil && len(annotations) > 0 { + cm.ObjectMeta.Annotations = annotations + } + } +} + +// WithData adds string data to a ConfigMap +func WithData(data map[string]string) ConfigMapOption { + return func(cm *v1.ConfigMap) { + if data != nil && len(data) > 0 { + cm.Data = data + } + } +} + +// WithBinaryData adds binary data to a ConfigMap +func WithBinaryData(binaryData map[string][]byte) ConfigMapOption { + return func(cm *v1.ConfigMap) { + if binaryData != nil && len(binaryData) > 0 { + cm.BinaryData = binaryData + } + } +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 0f09a9e4ec..83b9ec4ba3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -523,7 +523,7 @@ github.com/davecgh/go-spew/spew # github.com/deckarep/golang-set v1.8.0 ## explicit; go 1.17 github.com/deckarep/golang-set -# github.com/devtron-labs/authenticator v0.4.35-0.20240809073103-6e11da8083f8 => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250605114955-3c18ccee2f64 +# github.com/devtron-labs/authenticator v0.4.35-0.20240809073103-6e11da8083f8 => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250609102534-69e3ce614c73 ## explicit; go 1.24.0 github.com/devtron-labs/authenticator/apiToken github.com/devtron-labs/authenticator/client @@ -531,7 +531,7 @@ github.com/devtron-labs/authenticator/jwt github.com/devtron-labs/authenticator/middleware github.com/devtron-labs/authenticator/oidc github.com/devtron-labs/authenticator/password -# github.com/devtron-labs/common-lib v0.18.1-0.20241001061923-eda545dc839e => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250605114955-3c18ccee2f64 +# github.com/devtron-labs/common-lib v0.18.1-0.20241001061923-eda545dc839e => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250609102534-69e3ce614c73 ## explicit; go 1.24.0 github.com/devtron-labs/common-lib/async github.com/devtron-labs/common-lib/blob-storage @@ -555,6 +555,7 @@ github.com/devtron-labs/common-lib/utils/grpc github.com/devtron-labs/common-lib/utils/http github.com/devtron-labs/common-lib/utils/k8s github.com/devtron-labs/common-lib/utils/k8s/commonBean +github.com/devtron-labs/common-lib/utils/k8s/configMap github.com/devtron-labs/common-lib/utils/k8s/health github.com/devtron-labs/common-lib/utils/k8sObjectsUtil github.com/devtron-labs/common-lib/utils/registry @@ -2568,5 +2569,5 @@ xorm.io/xorm/log xorm.io/xorm/names xorm.io/xorm/schemas xorm.io/xorm/tags -# github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250605114955-3c18ccee2f64 -# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250605114955-3c18ccee2f64 +# github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250609102534-69e3ce614c73 +# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250609102534-69e3ce614c73