From 9bd18ff778b9f155a79f9bb1fc5151ae8e2b68e2 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Tue, 11 May 2021 04:26:39 +0500 Subject: [PATCH] Test ix-chart dynamic rendering --- charts/test-ix-chart/2105.0.0/.helmignore | 23 + charts/test-ix-chart/2105.0.0/Chart.lock | 6 + charts/test-ix-chart/2105.0.0/Chart.yaml | 28 ++ charts/test-ix-chart/2105.0.0/README.md | 117 +++++ charts/test-ix-chart/2105.0.0/app-readme.md | 4 + .../2105.0.0/charts/common-2104.0.0.tgz | Bin 0 -> 4287 bytes .../2105.0.0/default_values.yaml | 37 ++ charts/test-ix-chart/2105.0.0/questions.yaml | 469 ++++++++++++++++++ .../2105.0.0/templates/NOTES.txt | 2 + .../2105.0.0/templates/_containers.tpl | 77 +++ .../2105.0.0/templates/_helpers.tpl | 71 +++ .../2105.0.0/templates/_networking.tpl | 10 + .../2105.0.0/templates/_volumes.tpl | 38 ++ .../2105.0.0/templates/_workload.tpl | 141 ++++++ .../templates/external-interfaces.yaml | 9 + .../2105.0.0/templates/service.yaml | 20 + .../templates/tests/deployment-check.yaml | 17 + .../2105.0.0/templates/workload.yaml | 14 + .../test-ix-chart/2105.0.0/test_values.yaml | 38 ++ charts/test-ix-chart/2105.0.0/values.yaml | 0 charts/test-ix-chart/item.yaml | 2 + 21 files changed, 1123 insertions(+) create mode 100644 charts/test-ix-chart/2105.0.0/.helmignore create mode 100644 charts/test-ix-chart/2105.0.0/Chart.lock create mode 100644 charts/test-ix-chart/2105.0.0/Chart.yaml create mode 100644 charts/test-ix-chart/2105.0.0/README.md create mode 100644 charts/test-ix-chart/2105.0.0/app-readme.md create mode 100644 charts/test-ix-chart/2105.0.0/charts/common-2104.0.0.tgz create mode 100644 charts/test-ix-chart/2105.0.0/default_values.yaml create mode 100644 charts/test-ix-chart/2105.0.0/questions.yaml create mode 100644 charts/test-ix-chart/2105.0.0/templates/NOTES.txt create mode 100644 charts/test-ix-chart/2105.0.0/templates/_containers.tpl create mode 100644 charts/test-ix-chart/2105.0.0/templates/_helpers.tpl create mode 100644 charts/test-ix-chart/2105.0.0/templates/_networking.tpl create mode 100644 charts/test-ix-chart/2105.0.0/templates/_volumes.tpl create mode 100644 charts/test-ix-chart/2105.0.0/templates/_workload.tpl create mode 100644 charts/test-ix-chart/2105.0.0/templates/external-interfaces.yaml create mode 100644 charts/test-ix-chart/2105.0.0/templates/service.yaml create mode 100644 charts/test-ix-chart/2105.0.0/templates/tests/deployment-check.yaml create mode 100644 charts/test-ix-chart/2105.0.0/templates/workload.yaml create mode 100644 charts/test-ix-chart/2105.0.0/test_values.yaml create mode 100644 charts/test-ix-chart/2105.0.0/values.yaml create mode 100644 charts/test-ix-chart/item.yaml diff --git a/charts/test-ix-chart/2105.0.0/.helmignore b/charts/test-ix-chart/2105.0.0/.helmignore new file mode 100644 index 0000000000..0e8a0eb36f --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/test-ix-chart/2105.0.0/Chart.lock b/charts/test-ix-chart/2105.0.0/Chart.lock new file mode 100644 index 0000000000..faa4f024ec --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../library/common/2104.0.0 + version: 2104.0.0 +digest: sha256:f0aa221073aafcc5e1602c2a9acb1a508ce72f6847c33dd4a9f9fe10017d5009 +generated: "2021-04-08T16:09:30.065733+05:00" diff --git a/charts/test-ix-chart/2105.0.0/Chart.yaml b/charts/test-ix-chart/2105.0.0/Chart.yaml new file mode 100644 index 0000000000..abbbd7f4a0 --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/Chart.yaml @@ -0,0 +1,28 @@ +apiVersion: v2 +name: test-ix-chart +description: A Helm chart for deploying simple workloads Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 2105.0.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +appVersion: v1 +dependencies: + - name: common + repository: file://../../../library/common/2104.0.0 + version: 2104.0.0 + diff --git a/charts/test-ix-chart/2105.0.0/README.md b/charts/test-ix-chart/2105.0.0/README.md new file mode 100644 index 0000000000..ed5e97a908 --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/README.md @@ -0,0 +1,117 @@ +# iX Chart + +iX-chart is a chart designed to let user deploy a docker image in a TrueNAS SCALE kubernetes cluster. +It provides a mechanism to specify workload type, add external host interfaces in the pods, configure volumes and allocate host resources to the workload. + +This chart will deploy a docker image as a kubernetes workload allowing user to configure the workload deployment / management. + +## Introduction + +iX-chart is designed for simple single docker image deployments. + +## Configuration + +The following table lists the configurable parameters of the iX chart and +their default values. + +| Parameter | Description | Default | +|:-------------------------------|:----------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------| +| `workloadType` | Specify type of workload to deploy | `Deployment` | +| `cronSchedule` | Specify schedule for cronjob if `workloadType` is `CronJob`. | `{"minute": "5", "hour": "*", "dom": "*", "month": "*", "dow": "*"}` | +| `image.repository` | The image repository to pull from | `debian` | +| `image.tag` | The image tag to pull from | `latest` | +| `image.pullPolicy` | Image pull policy | `IfNotPresent` | +| `updateStrategy` | Upgrade Policy | `RollingUpdate` | +| `jobRestartPolicy` | Restart Policy for job type workload ( only applicable if `workloadType` is `Job`/`CronJob` | `OnFailure` | +| `containerCommand` | Commands to execute inside container overriding image CMD default | `null` | +| `containerArgs` | Specify arguments for container command | `null` | +| `containerEnvironmentVariables`| Container Environment Variables | `null` | +| `externalInterfaces` | Add external interfaces in the pod | `null` | +| `dnsPolicy` | Specify DNS Policy for pod | `Default` | +| `dnsConfig` | Specify custom DNS configuration which will be applied to the pod | `{"nameservers": [], "searches": []}` | +| `hostNetwork` | Use host network for workload ( similar to docker host networking ) | `false` | +| `hostPortsList` | Specify ports of host and workload to forward traffic from host port to workload port. | `null` | +| `portForwardingList` | Specify ports of node and workload to forward traffic from node port to workload port | `null` | +| `hostPathVolumes` | Specify host paths to be used as hostpath volumes for the workload | `null` | +| `volumes` | Specify `ix_volumes` | `null` | +| `livenessProbe` | Configure Liveness Probe for workload | `null` | +| `gpuConfiguration` | Allocate GPU to workload ( if available ) | `{}` | + + +## Persistence + +Chart release iX chart offers 2 ways to have persistent storage: + +1) `hostPathVolumes` +2) `volumes` + +For (1), they are kubernetes host path volumes which the user can assign to the workload with RO/RW permissions. + +(2) is a host path volume as well but it operates differently then (1) in terms of where it lives and how it's lifecycle is tied to the chart release. +For (2), users specify where they would like persistent storage in the workload and a dataset name ( it should be unique per each chart release ), based on this input, +system will create a dataset and then use it as a host path volume for the workload. During upgrades, snapshot will be taken for these volumes and on rollback users can subsequently +restore the snapshots hence the data. +When a chart release will be deleted, all (2) volumes data will be deleted unlike (1) ( until of course they are not in the chart release's dataset path ). + +## Recommended Persistence Configuration Examples + +The following is a recommended configuration example for creating ix volumes + +``` +"volumes": [ + { + "datasetName": "ix_volume1", + "mountPath": "/mount_test1" + }, + { + "datasetName": "ix_volume2", + "mountPath": "/mount_test2" + } +] + +``` + +`mountPath` refers to the path inside the pod. + +--- + +The following is a recommended configuration example for `hostPathVolumes` + +``` +"hostPathVolumes": [ + { + "hostPath": "/mnt/pool/test_dir", + "mountPath": "/test_dir", + "readOnly": true + }, + { + "hostPath": "/mnt/pool/test_file", + "mountPath": "/test_file", + "readOnly": true + } +] +``` + +## External Interfaces Configuration Examples + +``` +"externalInterfaces": [ + { + "hostInterface": "ens3", + "ipam": {"type": "dhcp"} + }, + { + "hostInterface": "br0", + "ipam": { + "type": "static", + "staticIPConfigurations": ["192.168.0.120/24"], + "staticRoutes": [ + {"destination": "0.0.0.0/0", "gateway": "192.168.0.1"} + ] + } + } +] +``` + +The first entry in the above configuration example will add an external interface in the pod using macvlan with `ipam` being set to `dhcp`. +Second entry will add an external interface in the pod using `bridge` and using static IP configuration for the external interface. diff --git a/charts/test-ix-chart/2105.0.0/app-readme.md b/charts/test-ix-chart/2105.0.0/app-readme.md new file mode 100644 index 0000000000..ab8d09d1e6 --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/app-readme.md @@ -0,0 +1,4 @@ +# iX-Chart + +iX-chart is a chart designed to let user deploy a docker image in a TrueNAS SCALE kubernetes cluster. +It provides a mechanism to specify workload type, add external host interfaces in the pods, configure volumes and allocate host resources to the workload. diff --git a/charts/test-ix-chart/2105.0.0/charts/common-2104.0.0.tgz b/charts/test-ix-chart/2105.0.0/charts/common-2104.0.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..83d4f734c9cb497b62f758d4e60ba089837585c8 GIT binary patch literal 4287 zcmV;w5J2xAiwG0|00000|0w_~VMtOiV@ORlOnEsqVl!4SWK%V1T2nbTPgYhoO;>Dc zVQyr3R8em|NM&qo0PH<$Z`-(*{j6VcR_)*>-HGftPO=Cvz-E)&nV_9CXtKR`uvi4N zMB8j+QY9&;-cI(nU+^VS4?og0ZaXzUv=&7k9+Ky!a}Jr9O(u+XPR5AKXoe=~voBw| z-EQ}w-`D?lyWRT#-Cno*Y`5Rt+uJ|r@AVI!b$5IHgWYG)eF9t>B^MI$XWd7SRiE5< zQcyljQO?A~s-A9bT{@U`dvqZiBn5>K)eNh~@y0`n<}F^XfBQyIzZ z(IR0P|Mw4fYy5xE?{D~jE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kJ%D;A zDl{M&==IXGgn=RmHYEv87AM($ZNlD^l}fw(myDwk?%bd(yE4C@@cxH>Z}+fy|JNq} zb1lVY!fOeRvg{p8^9lZ)<<#ExwLJ1~i6wH*PJCPib52hjjPT1Fs5P7`=4pLCO6k<= zd_mm)&gl+io&O9k&~&16=jx41IE71JeNE{O5vIz(PqzIasH!hkw|NSqIBm1Ep>=ln zS(CK5`*WhOyF_wqUMN^amAe3}Ku6?*vfe(F{VH$Ua^siVa_4HHi{|@#H&1eRf?zke-VaZzdeZJv+J z5F#HPwb;FU)HrC`Hb#OZ5;pIHUxU{az#gXOsW8o>KKqD~+rbit#g$kA>_WAb}HL6s&?;?5ti*_0)_aB_KZj3@@Bn zP|fdChLWfKoU}`XyZK*XIHz-IX;l3^FDmNR!73!_im+Pl%l&>tn&tm!jME7jQO5C? zA7d&1H{$=j!|vw(m$j7VaEYYEoN7m(p#ZoWV+wdX zAjUXNVU)6g$web{^fPdrB1xv$$dR%h(Ij{d6psu)Z)F@0$w!=+zx42L+Y#u$NWiG> zsZfFpb4UrrQ4pP8-CRk=aqt}MZDsFHt{@>?1ks4dj{eu6A4G%y;~o94s~C?u>L2$g zrnFN68ld<#&tOROalc61Wx>m6fNq1Ak({XCjFVCD^8bV9@D6dpaslV3XCjC)&feo# z1`$ax>X_!7y$_o@RUXK;RT zb$$H$_1P($p1(aixqkh}%a?()JX6BU{RtvAA~6iGyu;XBetP>K;y=f1 zV(*O+5d^^%p)m#oDbvvp^8$t}P1&99Bb0gIgpDWm*yalfRdQvX*ZAL_zTUIh<3;S(59J zja^W4`HhXt2si5@S#*rk408c@V-k-cMzpxqNis&d+7jr003nDjhp}g literal 0 HcmV?d00001 diff --git a/charts/test-ix-chart/2105.0.0/default_values.yaml b/charts/test-ix-chart/2105.0.0/default_values.yaml new file mode 100644 index 0000000000..af4b34a1d5 --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/default_values.yaml @@ -0,0 +1,37 @@ +# Default values for ix-chart. + +image: + repository: debian + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "latest" + +# Restart / Update policy +updateStrategy: RollingUpdate + +# Container CMD / entrypoint +containerCommand: [] +containerArgs: [] +containerEnvironmentVariables: [] + +# Network related configuration +externalInterfaces: [] +portForwardingList: [] +hostNetwork: false +dnsPolicy: Default +dnsConfig: + nameservers: [] + searches: [] + +# Storage related configuration +hostPathVolumes: [] +volumes: [] + +# Probes +# Liveness Probe +livenessProbe: null + +# Workload type +workloadType: "Deployment" + +gpuConfiguration: {} diff --git a/charts/test-ix-chart/2105.0.0/questions.yaml b/charts/test-ix-chart/2105.0.0/questions.yaml new file mode 100644 index 0000000000..d2e34c3a9d --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/questions.yaml @@ -0,0 +1,469 @@ +groups: + - name: "Container Images" + description: "Image to be used for container" + - name: "Container Entrypoint" + description: "Configuration of the executable that will be run when the container is started" + - name: "Container Environment Variables" + description: "Set the environment that will be visible to the container" + - name: "Networking" + description: "Configure networking for container" + - name: "Port Forwarding" + description: "Configure ports to forward to workload" + - name: "Storage" + description: "Persist and share data that is separate from the lifecycle of the container" + - name: "Health Check" + description: "Define mechanism to periodically probe the container to ensure it's functioning as desired" + - name: "Workload Details" + description: "Configure how workload should be deployed" + - name: "Scaling/Upgrade Policy" + description: "Configure how pods are replaced when configuration is upgraded" + - name: "Restart Policy" + description: "Configure when pod should be restarted in case of failure" + - name: "Resource Reservation" + description: "Specify resources to be allocated to workload" + +questions: + # Workload type + - variable: workloadType + description: "Please specify type of workload to deploy" + label: "Workload Type" + group: "Workload Details" + schema: + type: string + hidden: true + default: "Deployment" + required: true + enum: + - value: "Deployment" + description: "Deploy a Deployment workload" + - value: "Job" + description: "Deploy job workload" + - value: "CronJob" + description: "Deploy cronjob workload" + + # Cronjob schedule + - variable: cronSchedule + label: "Cron Schedule" + group: "Workload Details" + schema: + hidden: true + type: cron + show_if: [["workloadType", "=", "CronJob"]] + default: + minute: "5" + + # Image related + - variable: image + description: "Docker Image Details" + label: "Docker Image" + group: "Container Images" + schema: + type: dict + required: true + attrs: + - variable: repository + description: "Docker image repository" + label: "Image repository" + schema: + type: string + required: true + - variable: tag + description: "Tag to use for specified image" + label: "Image Tag" + schema: + type: string + default: "latest" + - variable: pullPolicy + description: "Docker Image Pull Policy" + label: "Image Pull Policy" + schema: + type: string + default: "IfNotPresent" + enum: + - value: "IfNotPresent" + description: "Only pull image if not present on host" + - value: "Always" + description: "Always pull image even if present on host" + - value: "Never" + description: "Never pull image even if it's not present on host" + + # Update strategy + - variable: updateStrategy + description: "Upgrade Policy" + label: "Update Strategy" + group: "Scaling/Upgrade Policy" + schema: + type: string + show_if: [["workloadType", "=", "Deployment"]] + default: "RollingUpdate" + enum: + - value: "RollingUpdate" + description: "Create new pods and then kill old ones" + - value: "Recreate" + description: "Kill existing pods before creating new ones" + + # Restart Policy + - variable: jobRestartPolicy + description: "Restart Policy for workload" + label: "Restart Policy" + group: "Restart Policy" + schema: + hidden: true + type: string + default: "OnFailure" + show_if: [["workloadType", "!=", "Deployment"]] + enum: + - value: "OnFailure" + description: "Only restart job if it fails" + - value: "Never" + description: "Never restart job even if it fails" + + # Configurable CMD / Entrypoint / Environment Variables + - variable: containerCommand + description: "Commands to execute inside container overriding image CMD default" + label: "Container CMD" + group: "Container Entrypoint" + schema: + type: list + items: + - variable: command + description: "Container Command" + label: "Command" + schema: + type: string + - variable: containerArgs + description: "Specify arguments for container command" + label: "Container Args" + group: "Container Entrypoint" + schema: + type: list + items: + - variable: arg + description: "Container Arg" + label: "Arg" + schema: + type: string + - variable: containerEnvironmentVariables + description: "Container Environment Variables" + label: "Container Environment Variables" + group: "Container Environment Variables" + schema: + type: list + items: + - variable: environmentVariable + description: "Container Environment Variable" + label: "Container Environment Variable" + schema: + type: dict + attrs: + - variable: name + description: "Environment Variable Name" + label: "Environment Variable Name" + schema: + type: string + required: true + - variable: value + description: "Environment Variable Value" + label: "Environment Variable Value" + schema: + type: string + required: true + + # Networking options + - variable: externalInterfaces + description: "Add External Interfaces" + label: "Add external Interfaces" + group: "Networking" + schema: + type: list + items: + - variable: interfaceConfiguration + description: "Interface Configuration" + label: "Interface Configuration" + schema: + type: dict + $ref: + - "normalize/interfaceConfiguration" + attrs: + - variable: hostInterface + description: "Please specify host interface" + label: "Host Interface" + schema: + type: string + required: true + $ref: + - "definitions/interface" + - variable: ipam + description: "Define how IP Address will be managed" + label: "IP Address Management" + schema: + type: dict + required: true + attrs: + - variable: type + description: "Specify type for IPAM" + label: "IPAM Type" + schema: + type: string + required: true + enum: + - value: "dhcp" + description: "Use DHCP" + - value: "static" + description: "Use static IP" + show_subquestions_if: "static" + subquestions: + - variable: staticIPConfigurations + label: "Static IP Addresses" + schema: + type: list + items: + - variable: staticIP + label: "Static IP" + schema: + type: ipaddr + cidr: true + - variable: staticRoutes + label: "Static Routes" + schema: + type: list + items: + - variable: staticRouteConfiguration + label: "Static Route Configuration" + schema: + type: dict + attrs: + - variable: destination + label: "Destination" + schema: + type: ipaddr + cidr: true + required: true + - variable: gateway + label: "Gateway" + schema: + type: ipaddr + cidr: false + required: true + + - variable: dnsPolicy + label: "DNS Policy" + description: "Default behaviour is where Pod inherits the name resolution configuration from the node that the pods run on, if None is specified, It allows a Pod to ignore DNS settings from the Kubernetes environment." + group: "Networking" + schema: + type: string + default: "Default" + enum: + - value: "Default" + description: "Use Default DNS Policy" + - value: "None" + description: "Ignore DNS settings from the Kubernetes cluster" + - variable: dnsConfig + label: "DNS Configuration" + group: "Networking" + description: "Specify custom DNS configuration which will be applied to the pod" + schema: + type: dict + attrs: + - variable: nameservers + label: "Nameservers" + schema: + default: [] + type: list + items: + - variable: nameserver + label: "Nameserver" + schema: + type: string + - variable: searches + label: "Searches" + schema: + default: [] + type: list + items: + - variable: search + label: "Search Entry" + schema: + type: string + + - variable: hostNetwork + label: "Provide access to node network namespace for the workload" + group: "Networking" + schema: + type: boolean + default: false + + - variable: hostPortsList + label: "Specify host ports for the workload" + description: "Only use host ports if scaling of a workload is not required" + group: "Networking" + schema: + show_if: [["updateStrategy", "=", "Recreate"]] + type: list + hidden: true + items: + - variable: hostPortConfiguration + label: "Host Port Configuration" + schema: + type: dict + attrs: + - variable: containerPort + label: "Container Port" + schema: + type: string + required: true + - variable: hostPort + label: "Host Port" + schema: + type: string + required: true + + - variable: portForwardingList + label: "Specify Node ports to forward to workload" + group: "Port Forwarding" + description: "Specify ports of node and workload to forward traffic from node port to workload port" + schema: + type: list + items: + - variable: portForwarding + label: "Port Forwarding Configuration" + schema: + type: dict + attrs: + - variable: containerPort + label: "Container Port" + schema: + type: int + required: true + - variable: nodePort + label: "Node Port" + schema: + type: int + required: true + min: 9000 + max: 65535 + - variable: protocol + label: "Protocol" + schema: + type: string + default: "TCP" + enum: + - value: "TCP" + description: "TCP Protocol" + - value: "UDP" + description: "UDP Protocol" + + # Storage Options + # Host path based volumes + - variable: hostPathVolumes + label: "Host Path Volumes" + group: "Storage" + schema: + type: list + items: + - variable: hostPathConfiguration + label: "Host Path Configuration" + schema: + type: dict + attrs: + - variable: hostPath + label: "Host Path" + schema: + type: hostpath + required: true + - variable: mountPath + label: "Mount Path" + description: "Path where host path will be mounted inside the pod" + schema: + type: path + required: true + - variable: readOnly + label: "Read Only" + schema: + type: boolean + default: false + + # Volumes + - variable: volumes + label: "Volumes" + group: "Storage" + schema: + type: list + items: + - variable: volume + label: "Volume" + schema: + type: dict + $ref: + - "normalize/ixVolume" + attrs: + - variable: mountPath + label: "Mount Path" + description: "Path where the volume will be mounted inside the pod" + schema: + type: path + required: true + - variable: datasetName + label: "Dataset Name" + schema: + type: string + required: true + + # Pod Probes + # Liveness Probe + - variable: livenessProbe + label: "Liveness Probe" + description: "Configure Liveness Probe" + group: "Health Check" + schema: + hidden: true + type: dict + default: null + "null": true + attrs: + - variable: command + label: "Liveness command" + description: "Specify a command to determine liveness of pod" + schema: + type: list + required: true + items: + - variable: commandArg + label: "Command Arg" + schema: + type: string + - variable: initialDelaySeconds + label: "Seconds Delay" + description: "Seconds to delay the first liveness probe" + schema: + type: int + default: 5 + - variable: periodSeconds + label: "Period Seconds" + description: "Specify number of seconds to run liveness probe" + schema: + type: int + default: 10 + + # Specify GPU configuration + - variable: gpuConfiguration + label: "GPU Configuration" + group: "Resource Reservation" + schema: + type: dict + $ref: + - "definitions/gpuConfiguration" + attrs: [] + + - variable: securityContext + label: "Security Context" + group: "Workload Details" + schema: + type: dict + attrs: + - variable: privileged + label: "Privileged Mode" + description: "Determines if any container in a pod can enable privileged mode. By default a container is not allowed to access any devices on the host, but a 'privileged' container is given access to all devices on the host. This allows the container nearly all the same access as processes running on the host." + schema: + type: boolean + default: false diff --git a/charts/test-ix-chart/2105.0.0/templates/NOTES.txt b/charts/test-ix-chart/2105.0.0/templates/NOTES.txt new file mode 100644 index 0000000000..c3b3453e34 --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/templates/NOTES.txt @@ -0,0 +1,2 @@ +1. Get the application URL by running these commands: + diff --git a/charts/test-ix-chart/2105.0.0/templates/_containers.tpl b/charts/test-ix-chart/2105.0.0/templates/_containers.tpl new file mode 100644 index 0000000000..e07bb9160c --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/templates/_containers.tpl @@ -0,0 +1,77 @@ +{{/* +Container Command +*/}} +{{- define "containerCommand" }} +{{- if .Values.containerCommand }} +command: + {{- range .Values.containerCommand }} + - {{ . | quote}} + {{- end }} +{{- end }} +{{- end }} + +{{/* +Container Args +*/}} +{{- define "containerArgs" }} +{{- if .Values.containerArgs }} +args: + {{- range .Values.containerArgs }} + - {{ . | quote}} + {{- end }} +{{- end }} +{{- end }} + +{{/* +Container Environment Variables +*/}} +{{- define "containerEnvVariables" }} +{{- if .Values.containerEnvironmentVariables }} +env: + {{- range .Values.containerEnvironmentVariables }} + - name: {{ .name | quote }} + value: {{ .value | quote }} + {{- end }} +{{- end }} +{{- end }} + +{{/* +Container Liveness Probe +*/}} +{{- define "containerLivenssProbe" }} +{{- if .Values.livenessProbe }} +livenessProbe: + exec: + command: + {{ toYaml .Values.livenessProbe.command | indent 16 }} + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.periodSeconds }} +{{- end }} +{{- end }} + +{{/* +Container Ports +*/}} +{{- define "containerPorts" }} +{{- if or .Values.portForwardingList .Values.hostPortsList }} +ports: + {{- range $index, $config := .Values.portForwardingList }} + - containerPort: {{ $config.containerPort }} + {{- end }} + {{- range $index, $config := .Values.hostPortsList }} + - containerPort: {{ $config.containerPort }} + hostPort: {{ $config.hostPort }} + {{- end }} +{{- end }} +{{- end }} + +{{/* +Container Resource Configuration +*/}} +{{- define "containerResourceConfiguration" }} +{{- if .Values.gpuConfiguration }} +resources: + limits: + {{- toYaml .Values.gpuConfiguration | nindent 4 }} +{{- end }} +{{- end }} diff --git a/charts/test-ix-chart/2105.0.0/templates/_helpers.tpl b/charts/test-ix-chart/2105.0.0/templates/_helpers.tpl new file mode 100644 index 0000000000..3d22e96fac --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/templates/_helpers.tpl @@ -0,0 +1,71 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "ix-chart.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "ix-chart.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 "ix-chart.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "ix-chart.labels" -}} +helm.sh/chart: {{ include "ix-chart.chart" . }} +{{ include "ix-chart.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "ix-chart.selectorLabels" -}} +app.kubernetes.io/name: {{ include "ix-chart.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "ix-chart.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "ix-chart.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + + +{{/* +Convert cron schema object to cron format +*/}} +{{- define "cronExpression" }} +{{- printf "%s %s %s %s %s " .minute .hour .dom .month .dow }} +{{- end }} diff --git a/charts/test-ix-chart/2105.0.0/templates/_networking.tpl b/charts/test-ix-chart/2105.0.0/templates/_networking.tpl new file mode 100644 index 0000000000..79a1a325d1 --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/templates/_networking.tpl @@ -0,0 +1,10 @@ +{{/* +DNS Configuration +*/}} +{{- define "dnsConfiguration" }} +dnsPolicy: {{ .Values.dnsPolicy }} +{{- if .Values.dnsConfig }} +dnsConfig: + {{- toYaml .Values.dnsConfig | nindent 2 }} +{{- end }} +{{- end }} diff --git a/charts/test-ix-chart/2105.0.0/templates/_volumes.tpl b/charts/test-ix-chart/2105.0.0/templates/_volumes.tpl new file mode 100644 index 0000000000..ff54f173eb --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/templates/_volumes.tpl @@ -0,0 +1,38 @@ +{{/* +Volumes Configuration +*/}} +{{- define "volumeConfiguration" }} +{{- if or .Values.ixVolumes .Values.hostPathVolumes }} +volumes: +{{- range $index, $hostPathConfiguration := .Values.hostPathVolumes }} + - name: ix-host-path-{{ $.Release.Name }}-{{ $index }} + hostPath: + path: {{ $hostPathConfiguration.hostPath }} +{{- end }} +{{- range $index, $hostPathConfiguration := .Values.ixVolumes }} +{{ $dsName := base $hostPathConfiguration.hostPath }} + - name: ix-host-volume-{{ $.Release.Name }}-{{ $dsName }} + hostPath: + path: {{ $hostPathConfiguration.hostPath }} +{{- end }} +{{- end }} +{{- end }} + + +{{/* +Volume Mounts Configuration +*/}} +{{- define "volumeMountsConfiguration" }} +{{- if or .Values.hostPathVolumes .Values.ixVolumes }} +volumeMounts: + {{- range $index, $hostPathConfiguration := .Values.hostPathVolumes }} + - mountPath: {{ $hostPathConfiguration.mountPath }} + name: ix-host-path-{{ $.Release.Name }}-{{ $index }} + readOnly: {{ $hostPathConfiguration.readOnly }} + {{- end }} + {{- range $index, $hostPathConfiguration := .Values.volumes }} + - mountPath: {{ $hostPathConfiguration.mountPath }} + name: ix-host-volume-{{ $.Release.Name }}-{{ $hostPathConfiguration.datasetName }} + {{- end }} +{{- end }} +{{- end }} diff --git a/charts/test-ix-chart/2105.0.0/templates/_workload.tpl b/charts/test-ix-chart/2105.0.0/templates/_workload.tpl new file mode 100644 index 0000000000..344adeda74 --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/templates/_workload.tpl @@ -0,0 +1,141 @@ +{{/* +Check if workload type is a deployment +*/}} +{{- define "workloadIsDeployment" }} +{{- if eq .Values.workloadType "Deployment" }} +{{- true -}} +{{- else }} +{{- false -}} +{{- end }} +{{- end }} + +{{/* +Check if workload type is a cronjob +*/}} +{{- define "workloadIsCronJob" }} +{{- if eq .Values.workloadType "CronJob" }} +{{- true -}} +{{- else }} +{{- false -}} +{{- end }} +{{- end }} + +{{/* +Get API Version based on workload type +*/}} +{{- define "apiVersion" -}} +{{- if eq (include "workloadIsDeployment" .) "true" }} +{{- printf "apps/v1" }} +{{- else if eq (include "workloadIsCronJob" .) "true" }} +{{- printf "batch/v1beta1" }} +{{- else }} +{{- printf "batch/v1" }} +{{- end }} +{{- end }} + + +{{/* +Get Restart policy based on workload type +*/}} +{{- define "restartPolicy" -}} +{{- if eq (include "workloadIsDeployment" .) "true" }} +{{- print "Always" }} +{{- else }} +{{- printf "%s" .Values.jobRestartPolicy }} +{{- end }} +{{- end }} + + +{{/* +Pod specification +*/}} +{{- define "podSepc" }} +restartPolicy: {{ template "restartPolicy" . }} +hostNetwork: {{ .Values.hostNetwork }} +containers: +- name: {{ .Chart.Name }} + {{- include "volumeMountsConfiguration" . | indent 2}} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default "latest" }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- include "containerCommand" . | indent 2 }} + {{- include "containerArgs" . | indent 2 }} + {{- include "containerEnvVariables" . | indent 2 }} + {{- include "containerLivenssProbe" . | indent 2 }} + {{- include "containerPorts" . | indent 2 }} + {{- include "containerResourceConfiguration" . | indent 2 }} +{{- include "volumeConfiguration" . }} +{{- include "dnsConfiguration" . }} +{{- end }} + + +{{/* +Annotations for workload +*/}} +{{- define "workloadAnnotations" }} +rollme: {{ randAlphaNum 5 | quote }} +{{- if .Values.ixExternalInterfacesConfigurationNames }} +k8s.v1.cni.cncf.io/networks: {{ join ", " .Values.ixExternalInterfacesConfigurationNames }} +{{- end }} +{{- end }} + + +{{/* +Metadata for workload +*/}} +{{- define "commonMetadataWorkload" }} +labels: + {{- include "ix-chart.selectorLabels" . | nindent 2 }} +annotations: + {{- include "workloadAnnotations" . | nindent 2 }} +{{- end }} + +{{/* +Deployment Spec +*/}} +{{- define "deploymentSpec" }} +strategy: + {{- if and (eq .Values.updateStrategy "RollingUpdate") .Values.hostPortsList }} + {{- fail "RollingUpdate is not allowed when host ports are specified" }} + {{- end }} + type: {{ .Values.updateStrategy }} +selector: + matchLabels: + {{- include "ix-chart.selectorLabels" . | nindent 4 }} +template: + metadata: + {{ include "commonMetadataWorkload" . | nindent 4 }} + spec: + {{- include "podSepc" . | indent 4 }} +{{- end }} + + +{{/* +Job Spec Common +*/}} +{{- define "jobSpecCommon" }} +metadata: + {{ include "commonMetadataWorkload" . | nindent 4 }} +spec: + {{- include "podSepc" . | indent 2 }} +{{- end }} + + +{{/* +Job Spec +*/}} +{{- define "jobSpec" }} +template: +{{ include "jobSpecCommon" . | nindent 2 }} +{{- end }} + +{{/* +CronJob Spec +*/}} +{{- define "cronJobSpec" }} +schedule: {{ include "cronExpression" .Values.cronSchedule | quote }} +jobTemplate: + spec: + {{ include "jobSpec" . | nindent 4 }} +{{- end }} diff --git a/charts/test-ix-chart/2105.0.0/templates/external-interfaces.yaml b/charts/test-ix-chart/2105.0.0/templates/external-interfaces.yaml new file mode 100644 index 0000000000..f68c46f6b1 --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/templates/external-interfaces.yaml @@ -0,0 +1,9 @@ +{{- range $index, $iface := .Values.ixExternalInterfacesConfiguration }} +--- +apiVersion: "k8s.cni.cncf.io/v1" +kind: NetworkAttachmentDefinition +metadata: + name: ix-{{ $.Release.Name }}-{{ $index }} +spec: + config: '{{ $iface }}' +{{- end }} diff --git a/charts/test-ix-chart/2105.0.0/templates/service.yaml b/charts/test-ix-chart/2105.0.0/templates/service.yaml new file mode 100644 index 0000000000..b2e472f256 --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/templates/service.yaml @@ -0,0 +1,20 @@ +{{- if .Values.portForwardingList }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "ix-chart.fullname" . }} + labels: + {{- include "ix-chart.labels" . | nindent 4 }} +spec: + type: NodePort + ports: + {{- range $index, $config := .Values.portForwardingList }} + - port: {{ $config.containerPort }} + targetPort: {{ $config.containerPort }} + protocol: {{ $config.protocol }} + nodePort: {{ $config.nodePort }} + name: ix-{{ $.Release.Name }}-{{ $config.nodePort }}-{{ $index }} + {{- end }} + selector: + {{- include "ix-chart.selectorLabels" . | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/charts/test-ix-chart/2105.0.0/templates/tests/deployment-check.yaml b/charts/test-ix-chart/2105.0.0/templates/tests/deployment-check.yaml new file mode 100644 index 0000000000..465a2bd1fd --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/templates/tests/deployment-check.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ .Release.Name }}-deployment-test" + annotations: + "helm.sh/hook": test +spec: + containers: + - name: {{ .Release.Name }}-deployment-test + image: "busybox" + command: + - nc + args: + - "-vz" + - "{{ include "ix-chart.fullname" . }}" + - "80" + restartPolicy: Never diff --git a/charts/test-ix-chart/2105.0.0/templates/workload.yaml b/charts/test-ix-chart/2105.0.0/templates/workload.yaml new file mode 100644 index 0000000000..98df32b18a --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/templates/workload.yaml @@ -0,0 +1,14 @@ +apiVersion: {{ template "apiVersion" . }} +kind: {{ .Values.workloadType }} +metadata: + name: {{ include "ix-chart.fullname" . }} + labels: + {{- include "ix-chart.labels" . | nindent 4 }} +spec: + {{- if eq (include "workloadIsDeployment" .) "true" }} + {{ include "deploymentSpec" . | nindent 2 }} + {{- else if eq (include "workloadIsCronJob" .) "true" }} + {{ include "cronJobSpec" . | nindent 2 }} + {{- else }} + {{ include "jobSpec" . | nindent 2 }} + {{- end }} diff --git a/charts/test-ix-chart/2105.0.0/test_values.yaml b/charts/test-ix-chart/2105.0.0/test_values.yaml new file mode 100644 index 0000000000..6ba83274f8 --- /dev/null +++ b/charts/test-ix-chart/2105.0.0/test_values.yaml @@ -0,0 +1,38 @@ +# Default values for ix-chart. + +image: + repository: nginx + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: latest + +# Restart / Update policy +updateStrategy: RollingUpdate + +# Container CMD / entrypoint +containerCommand: [] +containerArgs: [] +containerEnvironmentVariables: [] + +# Network related configuration +externalInterfaces: [] +portForwardingList: [{"containerPort": 80, "nodePort": 32000}] +hostPortsList: [] +hostNetwork: false +dnsPolicy: Default +dnsConfig: + nameservers: [] + searches: [] + +# Storage related configuration +hostPathVolumes: [] +volumes: [] + +# Probes +# Liveness Probe +livenessProbe: null + +# Workload type +workloadType: "Deployment" + +gpuConfiguration: {} diff --git a/charts/test-ix-chart/2105.0.0/values.yaml b/charts/test-ix-chart/2105.0.0/values.yaml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/charts/test-ix-chart/item.yaml b/charts/test-ix-chart/item.yaml new file mode 100644 index 0000000000..2a60e83cc4 --- /dev/null +++ b/charts/test-ix-chart/item.yaml @@ -0,0 +1,2 @@ +categories: + - generic