flux infra & app kustomizations
GITHUB SCM + FLUX CLI
# BOOTSTRAP GITHUB
export KUBECONFIG=<KUBECONFIG>
export GITHUB_TOKEN=<TOKEN>
flux bootstrap github \
--owner=stuttgart-things \
--repository=stuttgart-things \
--path=clusters/dev-cluster
FLUX APPS REPO (KUBECTL)
kubectl apply -f - <<EOF
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: flux-apps
namespace: flux-system
spec:
interval: 1m0s
ref:
tag: v1.0.0
url: https://github.com/stuttgart-things/flux.git
EOF
ADD w/ KUBECTL (TESTING)
kubectl apply -f - <<EOF
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: tekton
namespace: flux-system
spec:
interval: 1h
retryInterval: 1m
timeout: 5m
sourceRef:
kind: GitRepository
name: flux-apps
path: ./apps/tekton
prune: true
wait: true
postBuild:
substitute:
TEKTON_NAMESPACE: tekton-pipelines
TEKTON_PIPELINE_NAMESPACE: tektoncd
TEKTON_VERSION: v0.60.4
EOF
ADD w/ GIT
- Create (single or --- seperated) yaml-files on cluster Folder (e.g. clusters/dev-cluster)
- Examples:
# cat clusters/dev-cluster/app-repo.yaml
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: flux-apps
namespace: flux-system
spec:
interval: 1m0s
ref:
tag: v1.0.0
url: https://github.com/stuttgart-things/flux.git
# cat clusters/dev-cluster/apps.yaml
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: tekton
namespace: flux-system
spec:
interval: 1h
retryInterval: 1m
timeout: 5m
sourceRef:
kind: GitRepository
name: flux-apps
path: ./apps/tekton
prune: true
wait: true
postBuild:
substitute:
TEKTON_NAMESPACE: tekton-pipelines
TEKTON_PIPELINE_NAMESPACE: tektoncd
TEKTON_VERSION: v0.60.4
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: crossplane
namespace: flux-system
#.....
APACHE 2.0
Copyright 2023 patrick hermann.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Patrick Hermann, stuttgart-things 11/2024