项目作者: bsgrigorov

项目描述 :
Helm Operator in a Helm Chart
高级语言: Makefile
项目地址: git://github.com/bsgrigorov/helm-operator.git
创建时间: 2021-06-10T22:47:50Z
项目社区:https://github.com/bsgrigorov/helm-operator

开源协议:MIT License

下载


Docker
Artifact Hub

Helm Operator

Helm operator is a helm based operator using the Operator SDK.

The operator takes CRDs crds and charts from helm-charts and when a user creates a Custom Resource defined by the CRDs the operator deployes the corresponding helm chart.

Installation

Make your code changes and create a PR.

Testing

Using a test cluster

If adding new CRDs or charts in helm-charts make sure to build the new docker image and push it to your docker registry.

  1. docker-compose build
  2. docker push bgrigorov/helm-operator:test

Setup your KUBECONFIG env var and install the helm-operator helm chart

  1. helm upgrade -i helm-operator charts/ -f charts/values.test.yaml

Local

  1. If you wish to run operator locally, install the crds manually

    1. kubectl apply -f charts/templates/crds/
  2. Set your KUBECONFIG env variable

  3. Then you can run the operator with either docker-compose up -d or make run.

Testing the managed helm charts

Install the helm-chart managed by the operator

  1. helm upgrade -i pgexp helm-charts/myexporter/ -f helm-charts/myexporter/values.test.yaml

Navigate to localhost:8080/metrics to see the exposed metrics. You can also connect to the mock DB that is running inside a sidecar container in the exporter pod and run some queries.

Creating Custom Resources

  1. kubectl apply -f samples/myexporter.yaml
  2. kubectl get pgx

Adding new CRDs

  1. Define and add your CRD in crds.
  2. Add resources to role.
  3. Add the corresponding helm chart in helm-charts. Make sure the names match.
  4. Add a sample in samples.
  5. Add watcher to watches.yaml.

Github Pages Website

  1. helm lint chart/
  2. helm package chart/
  3. helm repo index --url https://bsgrigorov.github.io/helm-operator/ .

Add the package and index.yaml to branch gh-pages, commit and push.

TODO

Add github workflow files for pushing docker images and helm charts