Skip to content

Commit 5b3514d

Browse files
committedOct 17, 2022
Create new cluster
1 parent 735260f commit 5b3514d

25 files changed

+159
-9
lines changed
 

‎eksctl-clusters/apps/core/core-kustomization.yaml-template ‎eksctl-clusters/apps/common/common-kustomization.yaml-template

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
33
kind: Kustomization
44
metadata:
5-
name: core
5+
name: common
66
namespace: flux-system
77
spec:
88
interval: 30s
99
sourceRef:
1010
kind: GitRepository
1111
name: flux-system
12-
path: ./eksctl-clusters/apps/core
12+
path: ./eksctl-clusters/apps/common
1313
prune: true
1414
validation: client

‎eksctl-clusters/apps/enterprise/policy-agent/policy-agent.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ spec:
3939
# storageClassName: standard
4040

4141
config:
42-
accountId: "${CLUSTER_NAME}-user"
43-
clusterId: "${CLUSTER_NAME}"
42+
accountId: "cluster-user"
43+
clusterId: "cluster"
4444

4545
aupolicydit:
4646
# Disable audit functionality
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
3+
kind: Kustomization
4+
metadata:
5+
name: flagger
6+
namespace: flux-system
7+
spec:
8+
interval: 30s
9+
sourceRef:
10+
kind: GitRepository
11+
name: flux-system
12+
path: ./eksctl-clusters/apps/flagger
13+
prune: true
14+
validation: client
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
apiVersion: eksctl.io/v1alpha5
2+
kind: ClusterConfig
3+
4+
metadata:
5+
name: gaa
6+
region: eu-north-1
7+
version: "1.23"
8+
tags:
9+
environment: "gaa"
10+
delete-after: "15"
11+
12+
iam:
13+
withOIDC: true
14+
serviceRoleARN: "arn:aws:iam::894516026745:role/WeaveEksClusterRole"
15+
serviceAccounts:
16+
- metadata:
17+
name: kustomize-controller
18+
namespace: flux-system
19+
attachPolicyARNs:
20+
- "arn:aws:iam::894516026745:policy/WeaveSopsKmsDecrypt"
21+
roleName: eksctl-gaa-sops-decrypt-role
22+
roleOnly: true
23+
24+
# Enable private access to the API server.
25+
vpc:
26+
clusterEndpoints:
27+
privateAccess: true
28+
publicAccess: true
29+
30+
nodeGroups:
31+
- name: gaa-ng-1
32+
instanceType: t3.large
33+
minSize: 2
34+
maxSize: 2
35+
desiredCapacity: 2
36+
volumeSize: 10
37+
privateNetworking: true
38+
tags:
39+
environment: "gaa"
40+
delete-after: "15"
41+
propagateASGTags: true
42+
iam:
43+
instanceProfileARN: "arn:aws:iam::894516026745:instance-profile/WeaveEksWorkerNodeRole"
44+
45+
gitops:
46+
flux:
47+
gitProvider: github
48+
flags:
49+
owner: "weaveworks"
50+
repository: "clusters-config"
51+
private: "true"
52+
branch: "cluster-gaa"
53+
namespace: "flux-system"
54+
path: "eksctl-clusters/clusters/gaa"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
3+
kind: Kustomization
4+
metadata:
5+
name: common
6+
namespace: flux-system
7+
spec:
8+
interval: 30s
9+
sourceRef:
10+
kind: GitRepository
11+
name: flux-system
12+
path: ./eksctl-clusters/apps/common
13+
prune: true
14+
validation: client
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
3+
kind: Kustomization
4+
metadata:
5+
name: enterprise
6+
namespace: flux-system
7+
spec:
8+
interval: 30s
9+
sourceRef:
10+
kind: GitRepository
11+
name: flux-system
12+
path: ./eksctl-clusters/apps/enterprise
13+
prune: true
14+
validation: client
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
3+
kind: Kustomization
4+
metadata:
5+
name: flagger
6+
namespace: flux-system
7+
spec:
8+
interval: 30s
9+
sourceRef:
10+
kind: GitRepository
11+
name: flux-system
12+
path: ./eksctl-clusters/apps/flagger
13+
prune: true
14+
validation: client

‎eksctl-clusters/clusters/gaa/flux-system/gotk-components.yaml

Whitespace-only changes.

‎eksctl-clusters/clusters/gaa/flux-system/gotk-sync.yaml

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- gotk-components.yaml
5+
- gotk-sync.yaml
6+
patches:
7+
- patch: |
8+
apiVersion: v1
9+
kind: ServiceAccount
10+
metadata:
11+
name: kustomize-controller
12+
annotations:
13+
eks.amazonaws.com/role-arn: arn:aws:iam::894516026745:role/eksctl-gaa-sops-decrypt-role
14+
target:
15+
kind: ServiceAccount
16+
name: kustomize-controller
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
2+
kind: Kustomization
3+
metadata:
4+
name: shared-secrets
5+
namespace: flux-system
6+
spec:
7+
interval: 10m0s
8+
sourceRef:
9+
kind: GitRepository
10+
name: flux-system
11+
path: ./eksctl-clusters/shared-secrets
12+
prune: true
13+
validation: client
14+
decryption:
15+
provider: sops

‎eksctl-clusters/scripts/request-cluster.sh

+14-5
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ usage() {
1010
echo "Usage: $0 --cluster-name <CLUSTER_NAME> \\"
1111
echo " $blnk [--cluster-version <CLUSTER_VERSION>] \\"
1212
echo " $blnk [--weave-mode <enterprise|core|none> {default core}]"
13+
echo " $blnk [--enable-flagger]"
1314
echo " $blnk [--delete-after {default 15}]"
1415
echo " $blnk [-h|--help]"
1516

1617
echo
1718
echo " --cluster-name CLUSTER_NAME -- Set cluster name"
1819
echo " --cluster-version CLUSTER_VERSION -- Set cluster version (default: 1.23)"
1920
echo " --weave-mode <enterprise|core|none> -- Select between installing WGE, WG-Core, or not install any (enterprise|core|none)"
21+
echo " --enable-flagger -- Flagger will be installed on the cluster"
2022
echo " --delete-after -- Cluster will be auto deleted after this number of days (default: 15)"
2123
echo " -h|--help -- Print this help message and exit"
2224

@@ -26,6 +28,7 @@ usage() {
2628
defaults(){
2729
export CLUSTER_VERSION="1.23"
2830
export WW_MODE="core"
31+
export ENABLE_FLAGGER="false"
2932
export DELETE_AFTER="15"
3033
}
3134

@@ -50,13 +53,16 @@ flags(){
5053
exit 1
5154
fi
5255
;;
56+
--enable-flagger)
57+
export ENABLE_FLAGGER="true"
58+
;;
5359
--delete-after)
5460
shift
5561
export DELETE_AFTER="$1"
5662
# Check that delete-after is only numbers
5763
if [[ ! "${DELETE_AFTER}" =~ ^[0-9]+$ ]]
5864
then
59-
echo "Invalid value of --delete-after. It should containes only numbers"
65+
echo -e "${ERROR} Invalid value of --delete-after. It should contain only numbers"
6066
exit 1
6167
fi
6268
;;
@@ -132,9 +138,9 @@ ${SED_} 's/${BRANCH_NAME}/'"${BRANCH_NAME}"'/g' ${EKS_CLUSTER_CONFIG_FILE}
132138
${SED_} 's/${DELETE_AFTER}/'"${DELETE_AFTER}"'/g' ${EKS_CLUSTER_CONFIG_FILE}
133139
echo -e "${SUCCESS} '${EKS_CLUSTER_CONFIG_FILE}' is created successfully."
134140

135-
# Copy core apps to cluster dir
136-
echo "Copying apps-core templates..."
137-
cp -r ${PARENT_DIR}/apps/core/core-kustomization.yaml-template ${CLUSTER_DIR}/core-kustomization.yaml
141+
# Copy common apps to cluster dir
142+
echo "Copying apps-common templates..."
143+
cp -r ${PARENT_DIR}/apps/common/common-kustomization.yaml-template ${CLUSTER_DIR}/common-kustomization.yaml
138144

139145
# Copy WGE/WG-Core files
140146
case $WW_MODE in
@@ -152,7 +158,10 @@ case $WW_MODE in
152158
enterprise)
153159
echo "Copying WGE templates..."
154160
cp -r ${PARENT_DIR}/apps/enterprise/enterprise-kustomization.yaml-template ${CLUSTER_DIR}/enterprise-kustomization.yaml
155-
${SED_} 's/${CLUSTER_NAME}/'"${CLUSTER_NAME}"'/g' ${PARENT_DIR}/apps/enterprise/policy-agent/policy-agent.yaml
161+
if [ $ENABLE_FLAGGER == "true" ]
162+
then
163+
cp -r ${PARENT_DIR}/apps/flagger/flagger-kustomization.yaml-template ${CLUSTER_DIR}/flagger-kustomization.yaml
164+
fi
156165
;;
157166
none)
158167
echo -e "${WARNING} Neither WG-Core nor WGE will be installed. Cluster will be provisioned with Flux only!"

0 commit comments

Comments
 (0)
Please sign in to comment.