Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add deploy helm playbook #348

Merged
merged 5 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/stable-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 0 additions & 11 deletions charts/helm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 .
58 changes: 58 additions & 0 deletions charts/helm/README.md
Original file line number Diff line number Diff line change
@@ -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"` | |

2 changes: 1 addition & 1 deletion charts/helm/templates/playbook.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.playbook.enable }}
{{- if .Values.playbook.enabled }}
---
apiVersion: mission-control.flanksource.com/v1
kind: Playbook
Expand Down
122 changes: 122 additions & 0 deletions charts/helm/values.schema.deref.json
Original file line number Diff line number Diff line change
@@ -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"
}
4 changes: 2 additions & 2 deletions charts/helm/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 2 additions & 6 deletions charts/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ scraper:
# items:
# type: string
# @schema
charts:
charts:
- flanksource/mission-control-agent
- flanksource/mission-control-argocd
- flanksource/mission-control-flux
Expand Down Expand Up @@ -46,10 +46,6 @@ scraper:
- bitnami/sonarqube
- bitnami/oauth2-proxy





# @schema
# required: false
# type: object
Expand Down Expand Up @@ -80,6 +76,6 @@ playbook:
# required: false
# type: boolean
# @schema
enable: true
enabled: true

name: "install-helm-chart"
30 changes: 30 additions & 0 deletions charts/playbooks-kubernetes/Makefile
Original file line number Diff line number Diff line change
@@ -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 .
35 changes: 35 additions & 0 deletions charts/playbooks-kubernetes/README.md
Original file line number Diff line number Diff line change
@@ -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 | | |
17 changes: 17 additions & 0 deletions charts/playbooks-kubernetes/README.md.tpl
Original file line number Diff line number Diff line change
@@ -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" . }}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ spec:
runsOn:
- {{` "{{- if .agent }}{{.agent.id}}{{ else }}local{{ end }}" `}}
configs:
- types:
- agent: all
types:
- Kubernetes::Cluster
actions:
- name: Delete pods
Expand Down
Loading
Loading