deploy flux helm-operator to cluster

This commit is contained in:
Julian Tölle 2020-05-20 01:21:44 +02:00
parent 0f007bfea3
commit 36b4fe6a6e
4 changed files with 48 additions and 4 deletions

View file

@ -0,0 +1,5 @@
#!/bin/bash
MANIFEST_FILE=https://raw.githubusercontent.com/fluxcd/helm-operator/${version}/deploy/crds.yaml
K3S_MANIFEST_FOLDER=${k3s_manifest_folder}
curl -sfL $MANIFEST_FILE > $K3S_MANIFEST_FOLDER/helm-operator-crds.yml

View file

@ -0,0 +1,13 @@
---
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
name: helm-operator
namespace: kube-system
spec:
chart: helm-operator
repo: https://charts.fluxcd.io
version: ${version}
targetNamespace: flux
set:
helm.versions: v3

View file

@ -21,6 +21,16 @@ locals {
version = var.flux_version
git_url = var.flux_git_url
})
manifest_helm_operator_crds = templatefile("${path.module}/files/k8s-apps/helm-operator-crds.sh", {
version = var.helm_operator_version
k3s_manifest_folder = local.k3s_manifest_folder
})
manifest_helm_operator = templatefile("${path.module}/files/k8s-apps/helm-operator.yaml", {
version = var.helm_operator_version
})
}
resource null_resource install_manifests {
@ -28,10 +38,12 @@ resource null_resource install_manifests {
server_id = hcloud_server.server.id
# File hashes to trigger on update
hcloud_csi_driver = sha256(local.manifest_hcloud_csi_driver)
cert_manager_crds = sha256(local.manifest_cert_manager_crds)
cert_manager = sha256(local.manifest_cert_manager)
flux = sha256(local.manifest_flux)
hcloud_csi_driver = sha256(local.manifest_hcloud_csi_driver)
cert_manager_crds = sha256(local.manifest_cert_manager_crds)
cert_manager = sha256(local.manifest_cert_manager)
flux = sha256(local.manifest_flux)
helm_operator_crds = sha256(local.manifest_helm_operator_crds)
helm_operator = sha256(local.manifest_helm_operator)
}
connection {
@ -49,6 +61,10 @@ resource null_resource install_manifests {
inline = [local.manifest_cert_manager_crds]
}
provisioner remote-exec {
inline = [local.manifest_helm_operator_crds]
}
provisioner file {
content = local.manifest_cert_manager
destination = "${local.k3s_manifest_folder}/cert-manager.yaml"
@ -58,5 +74,10 @@ resource null_resource install_manifests {
content = local.manifest_flux
destination = "${local.k3s_manifest_folder}/flux.yaml"
}
provisioner file {
content = local.manifest_helm_operator
destination = "${local.k3s_manifest_folder}/helm-operator.yaml"
}
}

View file

@ -74,3 +74,8 @@ variable flux_version {
variable flux_git_url {
type = string
}
variable helm_operator_version {
type = string
default = "v1.0.1"
}