├── README.md ├── deploy └── podinfo.yaml └── install.sh /README.md: -------------------------------------------------------------------------------- 1 | # Deliverybot GitOps example 2 | 3 | This example sets up a GitHub repository as a source of truth for [Flux][flux] 4 | to read and to apply manifests into your Kubernetes cluster. It also has a 5 | corresponding GitHub action which can push manifests to this repository to 6 | deploy your code. 7 | 8 | This brings the benefits of GitOps together with the ease of managing deployment 9 | automation with Deliverybot. Click a button and watch manifests be updated and 10 | deployed to your Kubernetes cluster! 11 | 12 | ![Flux diagram](https://deliverybot.dev/assets/images/integrations/flux.svg) 13 | 14 | **This is currently in beta and the API around this may change.** 15 | 16 | ## Getting started 17 | 18 | Requires `cfssl` to be installed along with `helm` and `kubectl`. 19 | 20 | 1. Copy this repository to your organization. 21 | 22 | 2. Run the [`./install.sh`](install.sh) script to setup FluxCD or follow this 23 | guide [here][flux-guide]. 24 | 25 | ```bash 26 | GIT_REPO=git@github.com:myrepo/example-gitops.git GIT_PATH=deploy NAMESPACE=kube-system ./install.sh 27 | ``` 28 | 29 | 3. Create a new repository to emulate an application that you want to deploy to 30 | Kubernetes and install the GitOps action https://github.com/deliverybot/gitops 31 | 32 | 4. [Install the repository][deliverybot] on Deliverybot. 33 | 34 | 4. Trigger a deployment and watch the action push a change to your flux repo! 35 | 36 | [flux]: https://fluxcd.io 37 | [flux-guide]: https://docs.fluxcd.io/projects/helm-operator/en/latest/tutorials/get-started.html 38 | [deliverybot]: https://github.com/apps/deliverybot/installations/new 39 | -------------------------------------------------------------------------------- /deploy/podinfo.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: flux.weave.works/v1beta1 2 | kind: HelmRelease 3 | metadata: 4 | name: podinfo-dev 5 | namespace: kubernetes-guide 6 | spec: 7 | releaseName: podinfo-dev 8 | chart: 9 | git: git@github.com:fluxcd/helm-operator-get-started 10 | path: charts/podinfo 11 | ref: master 12 | values: 13 | image: stefanprodan/podinfo:dev-kb9lm91e 14 | replicaCount: 1 15 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Call with GIT_REPO GIT_PATH NAMESPACE 3 | 4 | set -e 5 | cd $(mktemp -d) 6 | 7 | export TILLER_HOSTNAME=tiller-deploy.${NAMESPACE} 8 | export TILLER_SERVER=server 9 | export USER_NAME=flux-helm-operator 10 | 11 | 12 | ## Create tls using cfssl: 13 | # Provides a secure helm installation. 14 | 15 | mkdir tls 16 | pushd tls 17 | 18 | # Prep the configuration 19 | echo '{"CN":"CA","key":{"algo":"rsa","size":4096}}' | cfssl gencert -initca - | cfssljson -bare ca - 20 | echo '{"signing":{"default":{"expiry":"43800h","usages":["signing","key encipherment","server auth","client auth"]}}}' > ca-config.json 21 | 22 | # Create the tiller certificate 23 | echo '{"CN":"'$TILLER_SERVER'","hosts":[""],"key":{"algo":"rsa","size":4096}}' | cfssl gencert \ 24 | -config=ca-config.json -ca=ca.pem \ 25 | -ca-key=ca-key.pem \ 26 | -hostname="$TILLER_HOSTNAME" - | cfssljson -bare $TILLER_SERVER 27 | 28 | # Create a client certificate 29 | echo '{"CN":"'$USER_NAME'","hosts":[""],"key":{"algo":"rsa","size":4096}}' | cfssl gencert \ 30 | -config=ca-config.json -ca=ca.pem -ca-key=ca-key.pem \ 31 | -hostname="$TILLER_HOSTNAME" - | cfssljson -bare $USER_NAME 32 | 33 | popd 34 | 35 | 36 | ## Create the RBAC configuration for Tiller: 37 | # Includes rbac for a client service-account. 38 | 39 | cat > rbac-config.yaml <