diff --git a/addons.yaml b/addons.yaml index cba4271..3a64d5e 100644 --- a/addons.yaml +++ b/addons.yaml @@ -22,8 +22,14 @@ microk8s-addons: supported_architectures: - arm64 - amd64 + - name: "sb-flux" + description: "Flux helm controller" + version: "1.0.0" + check_status: "deployment.apps/helm-controller" + supported_architectures: + - arm64 + - amd64 -#TODO: kpack #TODO: flux #TODO: cluster issuer, clusterstore, default regcreds #TODO: shapeblock operator diff --git a/addons/sb-flux/disable b/addons/sb-flux/disable new file mode 100755 index 0000000..cacd3e6 --- /dev/null +++ b/addons/sb-flux/disable @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 + +import click +import os +import subprocess + +KUBECTL = os.path.expandvars("$SNAP/microk8s-kubectl.wrapper") +HELM = os.path.expandvars("$SNAP/microk8s-helm3.wrapper") + +@click.command() +def main(): + click.echo("Disabling Flux helm controller") + subprocess.run([HELM, "delete", "helm-operator", "--namespace", "flux"]) + click.echo("Disabled Flux helm controller") + +if __name__ == "__main__": + main() diff --git a/addons/sb-flux/enable b/addons/sb-flux/enable new file mode 100755 index 0000000..fb51aec --- /dev/null +++ b/addons/sb-flux/enable @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 + +import os +import subprocess + +import click + +KUBECTL = os.path.expandvars("$SNAP/microk8s-kubectl.wrapper") +HELM = os.path.expandvars("$SNAP/microk8s-helm3.wrapper") +MICROK8S_STATUS = os.path.expandvars("$SNAP/microk8s-status.wrapper") +MICROK8S_ENABLE = os.path.expandvars("$SNAP/microk8s-enable.wrapper") + +@click.command() +def main(): + args = [] + args.extend(["--set", "imageautomationcontroller.create=false"]) + args.extend(["--set", "imagereflectorcontroller.create=false"]) + args.extend(["--set", "kustomizecontroller.create=false"]) + + subprocess.run([HELM, "repo", "add", "flux", + "https://fluxcd-community.github.io/helm-charts"]) + subprocess.run([HELM, "repo", "update"]) + subprocess.run([HELM, "install", "helm-operator", "flux/flux2", "--create-namespace", "--namespace", "flux", *args]) + click.echo("Enabled Flux helm controller") + +if __name__ == "__main__": + main()