diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6fd0811..3718a45 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,6 +30,7 @@ jobs: prometheus: charts/prometheus/** playbooks-kubernetes: charts/playbooks-kubernetes/** playbooks-flux: charts/playbooks-flux/** + helm: charts/helm/** # Job to build and test each of modified packages build: diff --git a/.github/workflows/stable-release.yml b/.github/workflows/stable-release.yml index cdc314b..56767c7 100644 --- a/.github/workflows/stable-release.yml +++ b/.github/workflows/stable-release.yml @@ -3,21 +3,22 @@ on: workflow_dispatch: inputs: chart: - description: 'Chart name' + description: "Chart name" required: true type: choice options: - - argocd - - aws - - azure - - kubernetes - - mission-control - - flux - - mongo-atlas - - postgres - - prometheus - - playbooks-kubernetes - - playbooks-flux + - argocd + - aws + - azure + - kubernetes + - mission-control + - flux + - mongo-atlas + - postgres + - prometheus + - playbooks-kubernetes + - playbooks-flux + - helm jobs: release: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 093f4a5..1cfcb35 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,6 +28,7 @@ jobs: prometheus: charts/prometheus/** playbooks-kubernetes: charts/playbooks-kubernetes/** playbooks-flux: charts/playbooks-flux/** + helm: charts/helm/** # Job to build and test each of modified packages test: diff --git a/charts/helm/Makefile b/charts/helm/Makefile index 925abdd..24836aa 100644 --- a/charts/helm/Makefile +++ b/charts/helm/Makefile @@ -8,11 +8,6 @@ $(LOCALBIN): values.schema.json: .bin/helm-schema .bin/helm-schema -r -f values.yaml - -.PHONY: chart -chart: values.schema.deref.json README.md - - .PHONY: README.md README.md: .bin/helm-docs .bin/helm-docs -t README.md.tpl @@ -26,12 +21,6 @@ README.md: .bin/helm-docs test -s $(LOCALBIN)/helm-schema || \ GOBIN=$(LOCALBIN) go install github.com/dadav/helm-schema/cmd/helm-schema@latest -.phony: values.schema.deref.json -values.schema.deref.json: values.schema.json - npm i @apidevtools/json-schema-ref-parser - npx @digitak/esrun ../../deref.ts | jq > values.schema.deref.json - - .PHONY: lint lint: chart ct lint --charts . diff --git a/charts/helm/README.md b/charts/helm/README.md new file mode 100644 index 0000000..e6ee978 --- /dev/null +++ b/charts/helm/README.md @@ -0,0 +1,58 @@ +# mission-control-helm + +![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) + +A Helm chart for the Helm bundle of Flanksource Mission Control + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| Flanksource | | | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| fullnameOverride | string | `""` | | +| git.connection | string | `""` | | +| git.type | string | `"github"` | | +| git.url | string | `""` | | +| labels | object | `{}` | | +| nameOverride | string | `""` | | +| playbook.enabled | bool | `true` | | +| playbook.name | string | `"install-helm-chart"` | | +| scraper.charts[0] | string | `"flanksource/mission-control-agent"` | | +| scraper.charts[10] | string | `"flanksource/mission-control-prometheus"` | | +| scraper.charts[11] | string | `"bitnami/postgresql"` | | +| scraper.charts[12] | string | `"bitnami/postgresql-ha"` | | +| scraper.charts[13] | string | `"bitnami/mysql"` | | +| scraper.charts[14] | string | `"bitnami/rabbitmq"` | | +| scraper.charts[15] | string | `"bitnami/kafka"` | | +| scraper.charts[16] | string | `"bitnami/mongodb"` | | +| scraper.charts[17] | string | `"bitnami/keycloak"` | | +| scraper.charts[18] | string | `"bitnami/minio"` | | +| scraper.charts[19] | string | `"bitnami/opensearch"` | | +| scraper.charts[1] | string | `"flanksource/mission-control-argocd"` | | +| scraper.charts[20] | string | `"bitnami/jaeger"` | | +| scraper.charts[21] | string | `"bitnami/harbor"` | | +| scraper.charts[22] | string | `"bitnami/memcached"` | | +| scraper.charts[23] | string | `"bitnami/cert-manager"` | | +| scraper.charts[24] | string | `"bitnami/external-secrets"` | | +| scraper.charts[25] | string | `"bitnami/clickhouse"` | | +| scraper.charts[26] | string | `"bitnami/jupyterhub"` | | +| scraper.charts[27] | string | `"bitnami/grafana-operator"` | | +| scraper.charts[28] | string | `"bitnami/argo-cd"` | | +| scraper.charts[29] | string | `"bitnami/sonarqube"` | | +| scraper.charts[2] | string | `"flanksource/mission-control-flux"` | | +| scraper.charts[30] | string | `"bitnami/oauth2-proxy"` | | +| scraper.charts[3] | string | `"flanksource/mission-control-aws"` | | +| scraper.charts[4] | string | `"flanksource/mission-control-azure"` | | +| scraper.charts[5] | string | `"flanksource/mission-control-flux"` | | +| scraper.charts[6] | string | `"flanksource/mission-control-mongo-atlas"` | | +| scraper.charts[7] | string | `"flanksource/mission-control-playbooks-flux"` | | +| scraper.charts[8] | string | `"flanksource/mission-control-playbooks-kubernetes"` | | +| scraper.charts[9] | string | `"flanksource/mission-control-postgres"` | | +| scraper.name | string | `"helm-chart-scraper"` | | +| scraper.schedule | string | `"@every 1d"` | | + diff --git a/charts/helm/templates/playbook.yaml b/charts/helm/templates/playbook.yaml index 32d5d42..edc3c34 100644 --- a/charts/helm/templates/playbook.yaml +++ b/charts/helm/templates/playbook.yaml @@ -1,4 +1,4 @@ -{{- if .Values.playbook.enable }} +{{- if .Values.playbook.enabled }} --- apiVersion: mission-control.flanksource.com/v1 kind: Playbook diff --git a/charts/helm/values.schema.deref.json b/charts/helm/values.schema.deref.json new file mode 100644 index 0000000..b84ff88 --- /dev/null +++ b/charts/helm/values.schema.deref.json @@ -0,0 +1,122 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false, + "properties": { + "fullnameOverride": { + "default": "", + "required": [], + "title": "fullnameOverride", + "type": "string" + }, + "git": { + "additionalProperties": false, + "properties": { + "connection": { + "default": "", + "required": [], + "title": "connection", + "type": "string" + }, + "type": { + "default": "github", + "description": "url: https://github.com/flanksource/demo-gitops.git", + "required": [], + "title": "type", + "type": "string" + }, + "url": { + "default": "", + "required": [], + "title": "url", + "type": "string" + } + }, + "required": [], + "title": "git", + "type": "object" + }, + "global": { + "description": "Global values are values that can be accessed from any chart or subchart by exactly the same name.", + "required": [], + "title": "global", + "type": "object" + }, + "labels": { + "additionalProperties": false, + "required": [], + "title": "labels", + "type": "object" + }, + "nameOverride": { + "default": "", + "description": "yaml-language-server: $schema=values.schema.json", + "required": [], + "title": "nameOverride", + "type": "string" + }, + "playbook": { + "additionalProperties": false, + "description": "install a playbook that allows installation of scraped helm charts into a namespace", + "properties": { + "enabled": { + "default": true, + "required": [], + "title": "enabled", + "type": "boolean" + }, + "name": { + "default": "install-helm-chart", + "required": [], + "title": "name", + "type": "string" + } + }, + "required": [ + "name" + ], + "title": "playbook", + "type": "object" + }, + "scraper": { + "additionalProperties": false, + "properties": { + "charts": { + "items": { + "required": [], + "type": "string" + }, + "required": [], + "title": "charts", + "type": "array" + }, + "name": { + "default": "helm-chart-scraper", + "required": [], + "title": "name", + "type": "string" + }, + "schedule": { + "default": "@every 1d", + "required": [], + "title": "schedule", + "type": "string" + } + }, + "required": [ + "name", + "schedule", + "charts" + ], + "title": "scraper", + "type": "object" + } + }, + "required": [ + "nameOverride", + "fullnameOverride", + "labels", + "scraper", + "playbook" + ], + "type": "object" +} diff --git a/charts/helm/values.schema.json b/charts/helm/values.schema.json index b55a7c7..a50d00a 100644 --- a/charts/helm/values.schema.json +++ b/charts/helm/values.schema.json @@ -58,10 +58,10 @@ "additionalProperties": false, "description": "install a playbook that allows installation of scraped helm charts into a namespace", "properties": { - "enable": { + "enabled": { "default": true, "required": [], - "title": "enable", + "title": "enabled", "type": "boolean" }, "name": { diff --git a/charts/helm/values.yaml b/charts/helm/values.yaml index 0eacb89..547bdcd 100644 --- a/charts/helm/values.yaml +++ b/charts/helm/values.yaml @@ -13,7 +13,7 @@ scraper: # items: # type: string # @schema - charts: + charts: - flanksource/mission-control-agent - flanksource/mission-control-argocd - flanksource/mission-control-flux @@ -46,10 +46,6 @@ scraper: - bitnami/sonarqube - bitnami/oauth2-proxy - - - - # @schema # required: false # type: object @@ -80,6 +76,6 @@ playbook: # required: false # type: boolean # @schema - enable: true + enabled: true name: "install-helm-chart" diff --git a/charts/playbooks-kubernetes/Makefile b/charts/playbooks-kubernetes/Makefile new file mode 100644 index 0000000..76dab79 --- /dev/null +++ b/charts/playbooks-kubernetes/Makefile @@ -0,0 +1,30 @@ +LOCALBIN ?= $(shell pwd)/.bin + +$(LOCALBIN): + mkdir -p .bin + +.PHONY: values.schema.json +values.schema.json: .bin/helm-schema + .bin/helm-schema -r -f values.yaml + + +.PHONY: chart +chart: values.schema.json README.md + + +.PHONY: README.md +README.md: .bin/helm-docs + .bin/helm-docs -t README.md.tpl + +.bin/helm-docs: + test -s $(LOCALBIN)/helm-docs || \ + GOBIN=$(LOCALBIN) go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest + +.bin/helm-schema: + test -s $(LOCALBIN)/helm-schema || \ + GOBIN=$(LOCALBIN) go install github.com/dadav/helm-schema/cmd/helm-schema@latest + + +.PHONY: lint +lint: chart + ct lint --charts . diff --git a/charts/playbooks-kubernetes/README.md b/charts/playbooks-kubernetes/README.md new file mode 100644 index 0000000..6843d0f --- /dev/null +++ b/charts/playbooks-kubernetes/README.md @@ -0,0 +1,35 @@ +# mission-control-playbooks-kubernetes + +Flanksource Mission Control Playbooks that interact directly with the Kubernetes API + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| delete.types[0] | string | `"Kubernetes::Pod"` | | +| delete.types[1] | string | `"Kubernetes::Deployment"` | | +| delete.types[2] | string | `"Kubernetes::Statefulset"` | | +| delete.types[3] | string | `"Kubernetes::ReplicaSet"` | | +| delete.types[4] | string | `"Kubernetes::Job"` | | +| delete.types[5] | string | `"Kubernetes::CronJob"` | | +| delete.types[6] | string | `"Kubernetes::DaemonSet"` | | +| delete.types[7] | string | `"Kubernetes::ConfigMap"` | | +| playbooks.cleanupFailedPods | bool | `true` | | +| playbooks.createDeployment | bool | `true` | | +| playbooks.delete | bool | `true` | | +| playbooks.deployHelmChart | bool | `true` | | +| playbooks.enabled | bool | `true` | | +| playbooks.ignoreChanges | bool | `true` | | +| playbooks.logs | bool | `true` | | +| playbooks.podSnapshot | bool | `false` | | +| playbooks.requestNamespaceAccess | bool | `true` | | +| playbooks.restart | bool | `true` | | +| playbooks.scale | bool | `true` | | +| playbooks.updateImage | bool | `true` | | +| playbooks.updateResources | bool | `true` | | + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| Flanksource | | | diff --git a/charts/playbooks-kubernetes/README.md.tpl b/charts/playbooks-kubernetes/README.md.tpl new file mode 100644 index 0000000..c4d8a87 --- /dev/null +++ b/charts/playbooks-kubernetes/README.md.tpl @@ -0,0 +1,17 @@ +{{ template "chart.header" . }} +{{ template "chart.deprecationWarning" . }} + +{{ template "chart.description" . }} + +{{ template "chart.homepageLine" . }} + + +{{ template "chart.sourcesSection" . }} + +{{ template "chart.requirementsSection" . }} + +{{ template "chart.valuesSection" . }} + +{{ template "helm-docs.versionFooter" . }} + +{{ template "chart.maintainersSection" . }} diff --git a/charts/playbooks-kubernetes/templates/cleanup-failed-pods.yaml b/charts/playbooks-kubernetes/templates/cleanup-failed-pods.yaml index 3a5b12d..4778aab 100644 --- a/charts/playbooks-kubernetes/templates/cleanup-failed-pods.yaml +++ b/charts/playbooks-kubernetes/templates/cleanup-failed-pods.yaml @@ -14,7 +14,8 @@ spec: runsOn: - {{` "{{- if .agent }}{{.agent.id}}{{ else }}local{{ end }}" `}} configs: - - types: + - agent: all + types: - Kubernetes::Cluster actions: - name: Delete pods diff --git a/charts/playbooks-kubernetes/templates/create-deployment.yaml b/charts/playbooks-kubernetes/templates/create-deployment.yaml index 38d9d4f..a312366 100644 --- a/charts/playbooks-kubernetes/templates/create-deployment.yaml +++ b/charts/playbooks-kubernetes/templates/create-deployment.yaml @@ -19,7 +19,8 @@ spec: label: Container Image configs: - - types: + - agent: all + types: - Kubernetes::Namespace actions: - name: Create Deployment diff --git a/charts/playbooks-kubernetes/templates/delete.yaml b/charts/playbooks-kubernetes/templates/delete.yaml index ce5ffb2..33a7048 100644 --- a/charts/playbooks-kubernetes/templates/delete.yaml +++ b/charts/playbooks-kubernetes/templates/delete.yaml @@ -12,7 +12,8 @@ spec: category: Kubernetes description: Deletes the resource configs: - - types: + - agent: all + types: {{- range $k := .Values.delete.types }} - {{$k}} {{- end }} diff --git a/charts/playbooks-kubernetes/templates/deploy-helm-chart.yaml b/charts/playbooks-kubernetes/templates/deploy-helm-chart.yaml new file mode 100644 index 0000000..45b4275 --- /dev/null +++ b/charts/playbooks-kubernetes/templates/deploy-helm-chart.yaml @@ -0,0 +1,38 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/flanksource/duty/main/schema/openapi/playbook.schema.json + +{{- if and .Values.playbooks.enabled .Values.playbooks.deployHelmChart }} +--- +apiVersion: mission-control.flanksource.com/v1 +kind: Playbook +metadata: + name: kubernetes-deploy-helm-chart +spec: + title: Deploy Helm Chart + icon: helm + category: Kubernetes + description: Deploy Helm Chart + parameters: + - label: Helm Repository + name: repo + + - name: chart + label: Helm Chart + + - label: "" + name: values + properties: + size: large + type: code + + configs: + - types: + - Kubernetes::Namespace + actions: + - name: Create Deployment + exec: + script: | + # gotemplate: left-delim=$[[ right-delim=]] + helm repo add $[[.params.chart]] $[[.params.repo]] + helm repo update + helm install $[[.params.chart]] -n $[[.config.name]] +{{- end}} diff --git a/charts/playbooks-kubernetes/templates/ignore.yaml b/charts/playbooks-kubernetes/templates/ignore.yaml index 8df1237..1e82314 100644 --- a/charts/playbooks-kubernetes/templates/ignore.yaml +++ b/charts/playbooks-kubernetes/templates/ignore.yaml @@ -105,7 +105,8 @@ spec: name: Ignore Resources category: Kubernetes configs: - - types: + - agent: all + types: - Kubernetes::Pod - Kubernetes::Deployment - Kubernetes::Statefulset diff --git a/charts/playbooks-kubernetes/templates/kubectl-logs.yaml b/charts/playbooks-kubernetes/templates/kubectl-logs.yaml index 8e21f5a..788587d 100644 --- a/charts/playbooks-kubernetes/templates/kubectl-logs.yaml +++ b/charts/playbooks-kubernetes/templates/kubectl-logs.yaml @@ -1,109 +1,110 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/flanksource/duty/main/schema/openapi/playbook.schema.json -{{- if and .Values.playbooks.enabled .Values.playbooks.logs }} -apiVersion: mission-control.flanksource.com/v1 -kind: Playbook -metadata: - name: kubernetes-logs -spec: - runsOn: - - {{` "{{- if .agent }}{{.agent.id}}{{else}}local{{end}}" `}} - actions: - - name: Kubectl Logs - exec: - script: | - # gotemplate: left-delim=$[[ right-delim=]] - - left="{""{" - right="}""}" - - - function template() { - local -n outvar=$1 - outvar="$left $2 $right" - } - - - ns=" -n $[[.config.tags.namespace]]" - type="$[[.config.type]]" - name="$[[.config.name]]" - template pod "color .PodColor .PodName" - template namespace "colorBlue .Namespace" - template container "color .ContainerColor .ContainerName" - template msg ".Message" - template nl '"\n"' - selector="" - echo $pod $container $msg> msg.tpl - stern="stern --color always --container-state all --no-follow --since $[[.params.since]] --tail $[[.params.lines]]" - fblog="fblog -p" - cmd="" - case $type in - Kubernetes::Namespace) - selector="-n $name '.*'" - echo $namespace/$pod $msg > msg.tpl - ;; - Kubernetes::Pod) - selector="$name $ns" - echo $container $msg > msg.tpl - ;; - Kubernetes::Node) - selector="--node $name $ns" - ;; - *) - type="$[[ strings.ToLower (index ( split .config.type "::") 1) ]]" - selector="$type/$name $ns" - ;; - esac - echo $cmd - if [[ "$[[.params.jsonLogs]]" == "true" ]]; then - $stern $selector | fblog -p - else - $stern $selector -T msg.tpl - fi - category: Kubernetes - configs: - - types: - - Kubernetes::Pod - - Kubernetes::Deployment - - Kubernetes::Statefulset - - Kubernetes::Namespace - - Kubernetes::ReplicaSet - - Kubernetes::Job - - Kubernetes::Node - - Kubernetes::Service - - Kubernetes::DaemonSet - icon: kubernetes - parameters: - - default: 1h - label: Since - name: since - properties: - options: - - label: 5m - value: 5m - - label: 15m - value: 15m - - label: 1h - value: 1h - - label: 2h - value: 2h - - label: 4h - value: 4h - - label: 8h - value: 8h - - label: 12h - value: 12h - - label: 1d - value: 24h - - label: 3d - value: 72h - type: list - - default: "5000" - label: Max Lines - name: lines - type: text - - name: jsonLogs - label: JSON Logs - type: checkbox - title: Logs -{{- end }} - +# yaml-language-server: $schema=https://raw.githubusercontent.com/flanksource/duty/main/schema/openapi/playbook.schema.json +{{- if and .Values.playbooks.enabled .Values.playbooks.logs }} +apiVersion: mission-control.flanksource.com/v1 +kind: Playbook +metadata: + name: kubernetes-logs +spec: + runsOn: + - {{` "{{- if .agent }}{{.agent.id}}{{else}}local{{end}}" `}} + actions: + - name: Kubectl Logs + exec: + script: | + # gotemplate: left-delim=$[[ right-delim=]] + + left="{""{" + right="}""}" + + + function template() { + local -n outvar=$1 + outvar="$left $2 $right" + } + + + ns=" -n $[[.config.tags.namespace]]" + type="$[[.config.type]]" + name="$[[.config.name]]" + template pod "color .PodColor .PodName" + template namespace "colorBlue .Namespace" + template container "color .ContainerColor .ContainerName" + template msg ".Message" + template nl '"\n"' + selector="" + echo $pod $container $msg> msg.tpl + stern="stern --color always --container-state all --no-follow --since $[[.params.since]] --tail $[[.params.lines]]" + fblog="fblog -p" + cmd="" + case $type in + Kubernetes::Namespace) + selector="-n $name '.*'" + echo $namespace/$pod $msg > msg.tpl + ;; + Kubernetes::Pod) + selector="$name $ns" + echo $container $msg > msg.tpl + ;; + Kubernetes::Node) + selector="--node $name $ns" + ;; + *) + type="$[[ strings.ToLower (index ( split .config.type "::") 1) ]]" + selector="$type/$name $ns" + ;; + esac + echo $cmd + if [[ "$[[.params.jsonLogs]]" == "true" ]]; then + $stern $selector | fblog -p + else + $stern $selector -T msg.tpl + fi + category: Kubernetes + configs: + - agent: all + types: + - Kubernetes::Pod + - Kubernetes::Deployment + - Kubernetes::Statefulset + - Kubernetes::Namespace + - Kubernetes::ReplicaSet + - Kubernetes::Job + - Kubernetes::Node + - Kubernetes::Service + - Kubernetes::DaemonSet + icon: kubernetes + parameters: + - default: 1h + label: Since + name: since + properties: + options: + - label: 5m + value: 5m + - label: 15m + value: 15m + - label: 1h + value: 1h + - label: 2h + value: 2h + - label: 4h + value: 4h + - label: 8h + value: 8h + - label: 12h + value: 12h + - label: 1d + value: 24h + - label: 3d + value: 72h + type: list + - default: "5000" + label: Max Lines + name: lines + type: text + - name: jsonLogs + label: JSON Logs + type: checkbox + title: Logs +{{- end }} + diff --git a/charts/playbooks-kubernetes/templates/pod-snapshot.yaml b/charts/playbooks-kubernetes/templates/pod-snapshot.yaml index 1ac520e..317969c 100644 --- a/charts/playbooks-kubernetes/templates/pod-snapshot.yaml +++ b/charts/playbooks-kubernetes/templates/pod-snapshot.yaml @@ -12,7 +12,8 @@ spec: description: Takes a snapshot of a pod (logs, manifest and events) icon: add-snapshot configs: - - types: + - agent: all + types: - Kubernetes::Pod actions: - name: Take snapshot diff --git a/charts/playbooks-kubernetes/templates/request-namespace-access.yaml b/charts/playbooks-kubernetes/templates/request-namespace-access.yaml index 75a13a9..1d7f65b 100644 --- a/charts/playbooks-kubernetes/templates/request-namespace-access.yaml +++ b/charts/playbooks-kubernetes/templates/request-namespace-access.yaml @@ -41,7 +41,8 @@ spec: - types: - Kubernetes::ClusterRole configs: - - types: + - agent: all + types: - Kubernetes::Namespace actions: - name: Create RoleBinding diff --git a/charts/playbooks-kubernetes/templates/restart.yaml b/charts/playbooks-kubernetes/templates/restart.yaml index cd70fd7..7bc2d37 100644 --- a/charts/playbooks-kubernetes/templates/restart.yaml +++ b/charts/playbooks-kubernetes/templates/restart.yaml @@ -11,7 +11,8 @@ spec: icon: reload category: Kubernetes configs: - - types: + - agent: all + types: - Kubernetes::Deployment - Kubernetes::Statefulset - Kubernetes::DaemonSet diff --git a/charts/playbooks-kubernetes/templates/scale.yaml b/charts/playbooks-kubernetes/templates/scale.yaml index a6cb973..85de4ed 100644 --- a/charts/playbooks-kubernetes/templates/scale.yaml +++ b/charts/playbooks-kubernetes/templates/scale.yaml @@ -11,7 +11,8 @@ spec: icon: scale-out category: Kubernetes configs: - - types: + - agent: all + types: - Kubernetes::Deployment - Kubernetes::StatefulSet parameters: diff --git a/charts/playbooks-kubernetes/templates/update-image.yaml b/charts/playbooks-kubernetes/templates/update-image.yaml index 13993a5..aab3949 100644 --- a/charts/playbooks-kubernetes/templates/update-image.yaml +++ b/charts/playbooks-kubernetes/templates/update-image.yaml @@ -11,7 +11,8 @@ spec: icon: docker category: Kubernetes configs: - - types: + - agent: all + types: - Kubernetes::Deployment - Kubernetes::StatefulSet - Kubernetes::DaemonSet diff --git a/charts/playbooks-kubernetes/templates/update-resource.yaml b/charts/playbooks-kubernetes/templates/update-resource.yaml index 808e19a..594dc99 100644 --- a/charts/playbooks-kubernetes/templates/update-resource.yaml +++ b/charts/playbooks-kubernetes/templates/update-resource.yaml @@ -10,7 +10,8 @@ spec: icon: scale-up category: Kubernetes configs: - - types: + - agent: all + types: - Kubernetes::Deployment - Kubernetes::StatefulSet - Kubernetes::DaemonSet @@ -18,26 +19,26 @@ spec: - name: cpu_request label: CPU properties: - colSpan: 3 + colSpan: 4 type: millicores default: '$( .config.config | jq ".spec.template.spec.containers[0].resources.requests.cpu" | default "" )' - name: cpu_limit properties: - colSpan: 3 + colSpan: 4 label: Limit type: millicores default: '$( .config.config | jq ".spec.template.spec.containers[0].resources.limits.cpu" | default "")' - name: memory_request label: Memory properties: - colSpan: 3 + colSpan: 4 type: bytes default: '$( .config.config | jq ".spec.template.spec.containers[0].resources.requests.memory" | default "" )' - name: memory_limit label: Memory Limit properties: - colSpan: 3 + colSpan: 4 type: bytes default: '$( .config.config | jq ".spec.template.spec.containers[0].resources.limits.memory" | default "")' diff --git a/charts/playbooks-kubernetes/values.schema.json b/charts/playbooks-kubernetes/values.schema.json new file mode 100644 index 0000000..99af4dc --- /dev/null +++ b/charts/playbooks-kubernetes/values.schema.json @@ -0,0 +1,170 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false, + "properties": { + "delete": { + "additionalProperties": false, + "properties": { + "types": { + "items": { + "anyOf": [ + { + "required": [], + "type": "string" + }, + { + "required": [], + "type": "string" + }, + { + "required": [], + "type": "string" + }, + { + "required": [], + "type": "string" + }, + { + "required": [], + "type": "string" + }, + { + "required": [], + "type": "string" + }, + { + "required": [], + "type": "string" + }, + { + "required": [], + "type": "string" + } + ], + "required": [] + }, + "required": [], + "title": "types", + "type": "array" + } + }, + "required": [ + "types" + ], + "title": "delete", + "type": "object" + }, + "global": { + "description": "Global values are values that can be accessed from any chart or subchart by exactly the same name.", + "required": [], + "title": "global", + "type": "object" + }, + "playbooks": { + "additionalProperties": false, + "properties": { + "cleanupFailedPods": { + "default": true, + "required": [], + "title": "cleanupFailedPods", + "type": "boolean" + }, + "createDeployment": { + "default": true, + "required": [], + "title": "createDeployment", + "type": "boolean" + }, + "delete": { + "default": true, + "required": [], + "title": "delete", + "type": "boolean" + }, + "deployHelmChart": { + "default": true, + "required": [], + "title": "deployHelmChart", + "type": "boolean" + }, + "enabled": { + "default": true, + "description": "If this is set to false, no playbooks will be created", + "required": [], + "title": "enabled", + "type": "boolean" + }, + "ignoreChanges": { + "default": true, + "required": [], + "title": "ignoreChanges", + "type": "boolean" + }, + "logs": { + "default": true, + "required": [], + "title": "logs", + "type": "boolean" + }, + "podSnapshot": { + "default": false, + "required": [], + "title": "podSnapshot", + "type": "boolean" + }, + "requestNamespaceAccess": { + "default": true, + "required": [], + "title": "requestNamespaceAccess", + "type": "boolean" + }, + "restart": { + "default": true, + "required": [], + "title": "restart", + "type": "boolean" + }, + "scale": { + "default": true, + "required": [], + "title": "scale", + "type": "boolean" + }, + "updateImage": { + "default": true, + "required": [], + "title": "updateImage", + "type": "boolean" + }, + "updateResources": { + "default": true, + "required": [], + "title": "updateResources", + "type": "boolean" + } + }, + "required": [ + "enabled", + "createDeployment", + "logs", + "delete", + "ignoreChanges", + "cleanupFailedPods", + "podSnapshot", + "requestNamespaceAccess", + "restart", + "scale", + "updateImage", + "updateResources", + "deployHelmChart" + ], + "title": "playbooks", + "type": "object" + } + }, + "required": [ + "playbooks", + "delete" + ], + "type": "object" +} \ No newline at end of file diff --git a/charts/playbooks-kubernetes/values.yaml b/charts/playbooks-kubernetes/values.yaml index ad21b52..d62c0de 100644 --- a/charts/playbooks-kubernetes/values.yaml +++ b/charts/playbooks-kubernetes/values.yaml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=values.schema.json playbooks: # If this is set to false, no playbooks will be created enabled: true @@ -12,6 +13,7 @@ playbooks: scale: true updateImage: true updateResources: true + deployHelmChart: true delete: types: