File tree Expand file tree Collapse file tree 6 files changed +74
-2
lines changed
examples/capi-quick-start Expand file tree Collapse file tree 6 files changed +74
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,22 @@ To create the ClusterClass and it's Templates with this runtime extension enable
29
29
kubectl apply --server-side -f examples/capi-quick-start/docker-cluster-class.yaml
30
30
```
31
31
32
+ If creating an AWS cluster using the files in ` examples/ ` , you will also need to create a secret with your AWS credentials:
33
+
34
+ ``` shell
35
+ kubectl apply --server-side -f - << EOF
36
+ apiVersion: v1
37
+ kind: Secret
38
+ metadata:
39
+ name: "aws-quick-start-creds"
40
+ namespace: capa-system
41
+ stringData:
42
+ AccessKeyID: ${AWS_ACCESS_KEY_ID}
43
+ SecretAccessKey: ${AWS_SECRET_ACCESS_KEY}
44
+ SessionToken: ${AWS_SESSION_TOKEN}
45
+ EOF
46
+ ```
47
+
32
48
To create a cluster, update ` clusterConfig ` variable and run:
33
49
34
50
``` shell
Original file line number Diff line number Diff line change 39
39
infrastructureCluster : true
40
40
description : aws region to target for cluster creation
41
41
name : region
42
+ - definitions :
43
+ - jsonPatches :
44
+ - op : add
45
+ path : /spec/template/spec/identityRef
46
+ valueFrom :
47
+ template : |
48
+ kind: AWSClusterStaticIdentity
49
+ name: {{ .builtin.cluster.name }}
50
+ selector :
51
+ apiVersion : infrastructure.cluster.x-k8s.io/v1beta2
52
+ kind : AWSClusterTemplate
53
+ matchResources :
54
+ infrastructureCluster : true
55
+ description : AWSClusterStaticIdentity identityRef to use when creating the cluster
56
+ name : identityRef
42
57
variables :
43
58
- name : region
44
59
schema :
Original file line number Diff line number Diff line change 28
28
- class : default-worker
29
29
name : md-0
30
30
replicas : 1
31
+ ---
32
+ apiVersion : infrastructure.cluster.x-k8s.io/v1beta1
33
+ kind : AWSClusterStaticIdentity
34
+ metadata :
35
+ labels :
36
+ cluster.x-k8s.io/provider : aws
37
+ name : aws-quick-start
38
+ spec :
39
+ allowedNamespaces :
40
+ list :
41
+ - default
42
+ secretRef : aws-quick-start-creds
Original file line number Diff line number Diff line change
1
+ # Copyright 2023 D2iQ, Inc. All rights reserved.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ ---
5
+ apiVersion : infrastructure.cluster.x-k8s.io/v1beta1
6
+ kind : AWSClusterStaticIdentity
7
+ metadata :
8
+ name : " quick-start"
9
+ spec :
10
+ secretRef : aws-quick-start-creds
11
+ allowedNamespaces :
12
+ list :
13
+ - " default"
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ kind: Kustomization
6
6
7
7
resources:
8
8
- https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/download/${CAPA_VERSION}/cluster-template-simple-clusterclass.yaml
9
+ - AWSClusterStaticIdentity.yaml
9
10
10
11
namePrefix: aws-
11
12
@@ -61,6 +62,21 @@ patches:
61
62
matchResources:
62
63
infrastructureCluster: true
63
64
description: aws region to target for cluster creation
65
+ - name: identityRef
66
+ definitions:
67
+ - jsonPatches:
68
+ - op: add
69
+ path: /spec/template/spec/identityRef
70
+ valueFrom:
71
+ template: |
72
+ kind: AWSClusterStaticIdentity
73
+ name: {{ .builtin.cluster.name }}
74
+ selector:
75
+ apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
76
+ kind: AWSClusterTemplate
77
+ matchResources:
78
+ infrastructureCluster: true
79
+ description: AWSClusterStaticIdentity identityRef to use when creating the cluster
64
80
- op: "add"
65
81
path: "/spec/variables"
66
82
value:
Original file line number Diff line number Diff line change @@ -19,6 +19,6 @@ mkdir -p examples/capi-quick-start
19
19
kustomize build ./hack/examples |
20
20
tee >( gojq --yaml-input --yaml-output ' . | select(.metadata.labels["cluster.x-k8s.io/provider"] == "docker" and .kind != "Cluster")' > examples/capi-quick-start/docker-cluster-class.yaml) \
21
21
>( gojq --yaml-input --yaml-output ' . | select(.metadata.labels["cluster.x-k8s.io/provider"] == "docker" and .kind == "Cluster")' > examples/capi-quick-start/docker-cluster.yaml) \
22
- >( gojq --yaml-input --yaml-output ' . | select(.metadata.labels["cluster.x-k8s.io/provider"] == "aws" and .kind != "Cluster")' > examples/capi-quick-start/aws-cluster-class.yaml) \
23
- >( gojq --yaml-input --yaml-output ' . | select(.metadata.labels["cluster.x-k8s.io/provider"] == "aws" and .kind == "Cluster")' > examples/capi-quick-start/aws-cluster.yaml) \
22
+ >( gojq --yaml-input --yaml-output ' . | select(.metadata.labels["cluster.x-k8s.io/provider"] == "aws" and ( .kind != "Cluster" and .kind != "AWSClusterStaticIdentity") )' > examples/capi-quick-start/aws-cluster-class.yaml) \
23
+ >( gojq --yaml-input --yaml-output ' . | select(.metadata.labels["cluster.x-k8s.io/provider"] == "aws" and ( .kind == "Cluster" or .kind == "AWSClusterStaticIdentity") )' > examples/capi-quick-start/aws-cluster.yaml) \
24
24
> /dev/null
You can’t perform that action at this time.
0 commit comments