diff --git a/README.md b/README.md index e1142b13f1103c8d30de9ca55ee5aa38abd49600..3a862e12d973a99a5d72e13c1e816aa62aced797 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,13 @@ -# custom-flux-example +# Example repository for customizing a Stackspin cluster -Example boilerplate for a custom f[lux](https://fluxcd.io/) repository which can be added to a [Stackspin](https://stackspin.net) cluster. -The main use-case is to add additional applications which are not integrated into Stackspin (yet). +Example boilerplate for a custom [flux](https://fluxcd.io/) repository +which can be added to a [Stackspin](https://stackspin.net) cluster. +The main use-case is to add additional applications +which are not integrated into Stackspin (yet). -For a more advanced example repo see the [flux2-kustomize-helm-example](https://github.com/fluxcd/flux2-kustomize-helm-example) repo. +For a more advanced example +see the [flux2-kustomize-helm-example](https://github.com/fluxcd/flux2-kustomize-helm-example) +repository. This repo's directory structure is similar to the `flux2-kustomize-helm-example` one. @@ -24,12 +28,13 @@ basic/install.sh List the resource created by this flux repo: ```sh -kubectl -n flux-system get gitrepositories -kubectl -n flux-system get kustomizations -kubectl -n example get helmreleases +kubectl -n example-basic get gitrepositories +kubectl -n example-basic get kustomizations +kubectl -n example-basic get helmreleases +kubectl -n example-basic get pods ``` -Show output of the one and only app applied, [podinfo](https://github.com/stefanprodan/podinfo) +Show output of the single app applied, [podinfo](https://github.com/stefanprodan/podinfo) ```sh curl --resolve podinfo.local:80:CLUSTER_IPV4_ADDRESS http://podinfo.local @@ -37,6 +42,8 @@ curl --resolve podinfo.local:80:CLUSTER_IPV4_ADDRESS http://podinfo.local ## What's next ? +There are two ways of using a custom flux + * Fork this repo to a private git remote (Github, Gitab, etc.) * Configure flux to use ssh instead of https for cloning * Add private ssh key for git pulling to flux diff --git a/basic/apps/example/podinfo-release.yaml b/basic/apps/example/podinfo-release.yaml index 18e9a8112075801e9d206798ce9234e30bd72c30..3601a2e9b0ed9a6c1b11db6c26894dc4d592054c 100644 --- a/basic/apps/example/podinfo-release.yaml +++ b/basic/apps/example/podinfo-release.yaml @@ -13,7 +13,7 @@ spec: sourceRef: kind: HelmRepository name: podinfo - namespace: flux-system + namespace: example-basic interval: 60m # Default values # https://github.com/stefanprodan/podinfo/blob/master/charts/podinfo/values.yaml diff --git a/basic/clusters/production/apps-kustomization.yaml b/basic/clusters/production/apps-kustomization.yaml index f56ccd9c1b154e9e81aad05af9ecfb69bceebe91..8d6cd128d6020384da0e5bf00e0249e47218dc4c 100644 --- a/basic/clusters/production/apps-kustomization.yaml +++ b/basic/clusters/production/apps-kustomization.yaml @@ -1,13 +1,13 @@ apiVersion: kustomize.toolkit.fluxcd.io/v1beta1 kind: Kustomization metadata: - name: custom-apps-basic - namespace: flux-system + name: examle-apps + namespace: example-basic spec: interval: 24h sourceRef: kind: GitRepository - name: custom-flux-example + name: stackspin-flux-example path: ./basic/apps prune: true validation: client diff --git a/basic/clusters/production/infrastructure-kustomization.yaml b/basic/clusters/production/infrastructure-kustomization.yaml index cdcb38608e62a655d8b6320c15ae23712e8a97c6..d3fe50101fe3c58d8acc97e9d6c5374eb99f9ee0 100644 --- a/basic/clusters/production/infrastructure-kustomization.yaml +++ b/basic/clusters/production/infrastructure-kustomization.yaml @@ -1,13 +1,13 @@ apiVersion: kustomize.toolkit.fluxcd.io/v1beta1 kind: Kustomization metadata: - name: custom-infrastructure-basic - namespace: flux-system + name: example-infrastructure + namespace: example-basic spec: interval: 24h sourceRef: kind: GitRepository - name: custom-flux-example + name: stackspin-flux-example path: ./basic/infrastructure prune: true validation: client diff --git a/basic/infrastructure/sources/podinfo-hr.yaml b/basic/infrastructure/sources/podinfo-hr.yaml index 806b27eefb591c05fc766b73684d943b352d58c0..37f4a6688265b3b366add1fcab8b4804c29ba338 100644 --- a/basic/infrastructure/sources/podinfo-hr.yaml +++ b/basic/infrastructure/sources/podinfo-hr.yaml @@ -2,7 +2,7 @@ apiVersion: source.toolkit.fluxcd.io/v1beta1 kind: HelmRepository metadata: name: podinfo - namespace: flux-system + namespace: example-basic spec: interval: 1h url: https://stefanprodan.github.io/podinfo diff --git a/basic/install.sh b/basic/install.sh index 2cb03be8d1122ba98e852b1e2c9b1fa51758e900..1146c4e4fc385210b8506233aace9ad8e6c81e5f 100755 --- a/basic/install.sh +++ b/basic/install.sh @@ -1,14 +1,16 @@ #!/usr/bin/env bash -echo "Creating / updating gitRepository custom-flux-example-basic in namespace flux-system" -flux create source git custom-flux-example \ - --url=https://open.greenhost.net/stackspin/custom-flux-example.git \ +echo "Creating / updating gitRepository stackspin-flux-example-basic in namespace example-basic" +flux create source git stackspin-flux-example \ + --namespace=example-basic \ + --url=https://open.greenhost.net/stackspin/stackspin-flux-example.git \ --branch=main \ --interval=1h -echo "Creating / updating kustomization custom-flux-example-basic in namespace flux-system" -flux create kustomization custom-flux-example-basic \ - --source=GitRepository/custom-flux-example \ +echo "Creating / updating kustomization stackspin-flux-example-basic in namespace example-basic" +flux create kustomization stackspin-flux-example-basic \ + --namespace=example-basic \ + --source=GitRepository/stackspin-flux-example \ --path="./basic/clusters/production/" \ --prune=true \ --interval=1h