-
Notifications
You must be signed in to change notification settings - Fork 850
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5336 from pkprzekwas/eks-prow-build-cluster-gitops
eks-prow-build-cluster: GitOps proposal
- Loading branch information
Showing
30 changed files
with
10,901 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
infra/aws/terraform/prow-build-cluster/hack/flux-update.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Copyright 2023 The Kubernetes Authors. | ||
# | ||
# 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. | ||
|
||
#!/usr/bin/env bash | ||
set -xeuo pipefail | ||
|
||
# TODO(pkprzekwas): point at k8s.io main | ||
github_org=pkprzekwas | ||
github_repo=k8s.io | ||
github_branch=eks-prow-build-cluster-gitops | ||
|
||
if ! command -v flux &> /dev/null | ||
then | ||
echo "flux could not be found" | ||
exit 2 | ||
fi | ||
|
||
script_root=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P) | ||
|
||
function boilerplate() { | ||
cat ${script_root}/../../../../../hack/boilerplate/boilerplate.sh.txt | sed -e "s/\<YEAR\>/$(date +'%Y')/" | ||
echo "# Code generated by make flux-update. DO NOT EDIT." | ||
} | ||
|
||
resources_dir=${script_root}/../resources | ||
|
||
# Generate all FluxCD resources. | ||
# gotk stands for GitOpsToolKit (https://fluxcd.io/flux/components/) | ||
boilerplate > ${resources_dir}/flux-system/gotk-components.yaml | ||
flux install --export >> ${resources_dir}/flux-system/gotk-components.yaml | ||
|
||
# sync_interval determines Flux Source Controller sync interval. | ||
# (https://github.com/fluxcd/source-controller) | ||
sync_interval=5m | ||
|
||
boilerplate > ${resources_dir}/flux-system/flux-source-git-k8s.io.yaml | ||
flux create source git k8s-io \ | ||
--url=https://github.com/${github_org}/k8s.io \ | ||
--branch=${github_branch} \ | ||
--interval=${sync_interval} \ | ||
--export >> ${resources_dir}/flux-system/flux-source-git-k8s.io.yaml | ||
|
||
boilerplate > ${resources_dir}/flux-system/flux-source-helm-eks-charts.yaml | ||
flux create source helm eks-charts \ | ||
--url=https://aws.github.io/eks-charts \ | ||
--interval=${sync_interval} \ | ||
--export >> ${resources_dir}/flux-system/flux-source-helm-eks-charts.yaml | ||
|
||
boilerplate > ${resources_dir}/kube-system/flux-hr-node-termination-handler.yaml | ||
flux create hr node-termination-handler \ | ||
--source=HelmRepository/eks-charts.flux-system \ | ||
--namespace=kube-system \ | ||
--chart=aws-node-termination-handler \ | ||
--chart-version=0.21.0 \ | ||
--interval=${sync_interval} \ | ||
--export >> ${resources_dir}/kube-system/flux-hr-node-termination-handler.yaml | ||
|
||
# This list contains names of folders inside ./resources directory | ||
# that are used for generating FluxCD kustomizations. | ||
kustomizations=( | ||
boskos | ||
flux-system | ||
kube-system | ||
monitoring | ||
node-problem-detector | ||
rbac | ||
test-pods | ||
external-secrets | ||
) | ||
|
||
# Code below is used to figure out a relative path of | ||
# resources dir in relation to the root dir of git repo. | ||
pushd ${resources_dir} > /dev/null | ||
resources_git_repo_path=$(git rev-parse --show-prefix) | ||
popd > /dev/null | ||
|
||
for k in "${kustomizations[@]}"; do | ||
boilerplate > ${resources_dir}/flux-system/flux-ks-${k}.yaml | ||
flux create kustomization ${k} \ | ||
--source=GitRepository/k8s-io.flux-system \ | ||
--path=${resources_git_repo_path}/${k} \ | ||
--interval=5m \ | ||
--prune \ | ||
--export >> ${resources_dir}/flux-system/flux-ks-${k}.yaml | ||
done |
17 changes: 17 additions & 0 deletions
17
infra/aws/terraform/prow-build-cluster/resources/external-secrets/namespace.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright 2023 The Kubernetes Authors. | ||
# | ||
# 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. | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: external-secrets |
29 changes: 29 additions & 0 deletions
29
infra/aws/terraform/prow-build-cluster/resources/flux-system/flux-ks-boskos.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2023 The Kubernetes Authors. | ||
# | ||
# 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. | ||
|
||
# Code generated by make flux-update. DO NOT EDIT. | ||
--- | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1 | ||
kind: Kustomization | ||
metadata: | ||
name: boskos | ||
namespace: flux-system | ||
spec: | ||
interval: 5m0s | ||
path: ./infra/aws/terraform/prow-build-cluster/resources/boskos | ||
prune: true | ||
sourceRef: | ||
kind: GitRepository | ||
name: k8s-io | ||
namespace: flux-system |
29 changes: 29 additions & 0 deletions
29
infra/aws/terraform/prow-build-cluster/resources/flux-system/flux-ks-external-secrets.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2023 The Kubernetes Authors. | ||
# | ||
# 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. | ||
|
||
# Code generated by make flux-update. DO NOT EDIT. | ||
--- | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1 | ||
kind: Kustomization | ||
metadata: | ||
name: external-secrets | ||
namespace: flux-system | ||
spec: | ||
interval: 5m0s | ||
path: ./infra/aws/terraform/prow-build-cluster/resources/external-secrets | ||
prune: true | ||
sourceRef: | ||
kind: GitRepository | ||
name: k8s-io | ||
namespace: flux-system |
29 changes: 29 additions & 0 deletions
29
infra/aws/terraform/prow-build-cluster/resources/flux-system/flux-ks-flux-system.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2023 The Kubernetes Authors. | ||
# | ||
# 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. | ||
|
||
# Code generated by make flux-update. DO NOT EDIT. | ||
--- | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1 | ||
kind: Kustomization | ||
metadata: | ||
name: flux-system | ||
namespace: flux-system | ||
spec: | ||
interval: 5m0s | ||
path: ./infra/aws/terraform/prow-build-cluster/resources/flux-system | ||
prune: true | ||
sourceRef: | ||
kind: GitRepository | ||
name: k8s-io | ||
namespace: flux-system |
29 changes: 29 additions & 0 deletions
29
infra/aws/terraform/prow-build-cluster/resources/flux-system/flux-ks-kube-system.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2023 The Kubernetes Authors. | ||
# | ||
# 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. | ||
|
||
# Code generated by make flux-update. DO NOT EDIT. | ||
--- | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1 | ||
kind: Kustomization | ||
metadata: | ||
name: kube-system | ||
namespace: flux-system | ||
spec: | ||
interval: 5m0s | ||
path: ./infra/aws/terraform/prow-build-cluster/resources/kube-system | ||
prune: true | ||
sourceRef: | ||
kind: GitRepository | ||
name: k8s-io | ||
namespace: flux-system |
Oops, something went wrong.