Skip to content

Commit 3261114

Browse files
committed
Update docs for VPC integration & releasing
1 parent 4befde1 commit 3261114

File tree

3 files changed

+222
-13
lines changed

3 files changed

+222
-13
lines changed

docs/book/src/clustercloudstack/configuration.md

+82-8
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ The cluster configuration file can be generated by using [`clusterctl generate c
44
This command actually uses [a template file][template-file] and replaces the values surrounded by `${}` with environment variables.
55
You have to set all required environment variables in advance. The following sections explain some more details about what should be configured.
66

7-
Note: You can also use [template files][template-file] by manually replacing values in copies of the template file.
8-
97
```bash
108
clusterctl generate cluster capi-quickstart \
119
--kubernetes-version v1.21.3 \
@@ -14,9 +12,25 @@ clusterctl generate cluster capi-quickstart \
1412
> capi-quickstart.yaml
1513
```
1614

17-
Note: additional template files are provided, offering capabilities beyond the default template file. These can be
18-
utilized via the *clusterctl --flavor* parameter. Additional environment variables are often required by these templates.
19-
See clusterctl documentation for further details about *flavors*.
15+
You can also use [template files][template-file] by manually replacing values in copies of the template file.
16+
17+
18+
> **Note**
19+
>
20+
> Additional template files are provided, offering capabilities beyond the default template file. These can be
21+
> utilized via the *clusterctl --flavor* parameter. Additional environment variables are often required by these templates.
22+
> The following flavors are supported as of now:
23+
> - *managed-ssh*
24+
> - *ssh-material*
25+
> - *with-disk-offering*
26+
> - *with-existing-vpc-network*
27+
> - *with-kube-vip*
28+
>
29+
> To check the available variables for a flavor, execute the following command:
30+
> ```bash
31+
> clusterctl generate cluster capi-quickstart --flavor <flavor> --list-variables
32+
> ```
33+
> See clusterctl documentation for further details about *flavors*.
2034
2135
In order to fetch the configuration parameters via the terminal, please install [cmk][cmk-download] and [jq][jq-download]
2236
@@ -60,15 +74,73 @@ cmk list zones listall=true | jq '.zone[] | {name, id}'
6074
#### Network
6175
6276
The network must be declared as an environment variable `CLOUDSTACK_NETWORK_NAME` and is a mandatory parameter.
63-
As of now, only isolated and shared networks are supported.
77+
As of now, only isolated and shared networks are supported. The isolated network can also be part of a VPC.
78+
79+
If the specified network does not exist, a new isolated network will be created. The newly created network will have a default egress firewall policy that allows all TCP, UDP and ICMP traffic from the cluster to the outside world. If the network is part of a VPC, the VPC will also be created if it does not exist.
6480
65-
If the specified network does not exist, a new isolated network will be created. The newly created network will have a default egress firewall policy that allows all TCP, UDP and ICMP traffic from the cluster to the outside world.
81+
If the offerings are not specified, the default offerings will be used.
6682
6783
The list of networks for the specific zone can be fetched using the cmk cli as follows :
6884
```
6985
cmk list networks listall=true zoneid=<zoneid> | jq '.network[] | {name, id, type}'
7086
```
7187
88+
The list of VPCs for the specific zone can be fetched using the cmk cli as follows :
89+
```
90+
cmk list vpcs listall=true zoneid=<zoneid> | jq '.vpc[] | {name, id}'
91+
```
92+
93+
The user can configure the network offering and VPC offering for the isolated network as follows:
94+
95+
```yaml
96+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
97+
kind: CloudStackCluster
98+
metadata:
99+
name: capc-cluster
100+
namespace: default
101+
spec:
102+
controlPlaneEndpoint:
103+
host: 10.0.58.19
104+
port: 6443
105+
failureDomains:
106+
- acsEndpoint:
107+
name: secret1
108+
namespace: default
109+
name: fd1
110+
zone:
111+
name: cloudstack-zone
112+
network:
113+
name: cloudstack-network
114+
offering: custom-network-offering
115+
gateway: 10.0.0.1
116+
netmask: 255.255.255.0
117+
vpc:
118+
name: cloudstack-vpc
119+
offering: custom-vpc-offering
120+
cidr: 10.0.0.0/16
121+
```
122+
123+
If the network already exists, offering, gateway and netmask will be ignored.
124+
Similarly, if the VPC already exists, offering and cidr will be ignored.
125+
126+
##### VPC
127+
128+
If you want to use an existing network inside a VPC, you can specify the flavor as `with-existing-vpc-network` while
129+
generating the cluster configuration file and set the `CLOUDSTACK_VPC_NAME` environment variable to the name of the VPC.
130+
131+
```bash
132+
clusterctl generate cluster capc-cluster --flavor with-existing-vpc-network > capc-cluster-spec.yaml
133+
```
134+
135+
##### Shared or Routed Networks
136+
137+
For shared or routed networks, the user will need to use [kube-vip][kube-vip] to configure the VIP on the nodes as part of the
138+
KubeadmControlPlane spec. You can specify the flavor as `with-kube-vip` while generating the cluster configuration file.
139+
140+
```bash
141+
clusterctl generate cluster capc-cluster --flavor with-kube-vip > capc-cluster-spec.yaml
142+
```
143+
72144
#### CloudStack Endpoint Credentials Secret (*optional for provided templates when used with provided getting-started process*)
73145
74146
A reference to a Kubernetes Secret containing a YAML object containing credentials for accessing a particular CloudStack
@@ -159,6 +231,7 @@ The project name can be specified by adding the `CloudStackCluster.spec.project`
159231
The list of projects can be fetched using the cmk cli as follows :
160232
```
161233
cmk list projects listall=true | jq '.project[] | {name, id}'
234+
```
162235
163236
## Cluster Level Configurations
164237
@@ -292,4 +365,5 @@ TODO / Add feature
292365
[jq-download]: https://stedolan.github.io/jq/
293366
[prebuilt-images]: http://packages.shapeblue.com/cluster-api-provider-cloudstack/images/
294367
[template-file]: https://github.com/kubernetes-sigs/cluster-api-provider-cloudstack/blob/main/templates/cluster-template.yaml
295-
[failure-domain-api]: https://github.com/kubernetes-sigs/cluster-api-provider-cloudstack/blob/main/api/v1beta2/cloudstackfailuredomain_types.go
368+
[failure-domain-api]: https://github.com/kubernetes-sigs/cluster-api-provider-cloudstack/blob/main/api/v1beta2/cloudstackfailuredomain_types.go
369+
[kube-vip]: https://kube-vip.io/

docs/book/src/development/releasing.md

+12-5
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,23 @@
88
- [gcloud][gcloud-install]
99

1010
2. Set up and log in to gcloud by running `gcloud init`
11-
> In order to publish any artifact, you need to be a member of the [k8s-infra-staging-capi-cloudstack][k8s-infra-staging-capi-cloudstack] group
11+
> **Note**
12+
>
13+
> In order to publish any artifact, you need to be a member of the [k8s-infra-staging-capi-cloudstack][k8s-infra-staging-capi-cloudstack] group
1214
1315
## Creating only the docker container
1416

1517
If you would just like to build only the docker container and upload it rather than creating a release, you can run the following command :
16-
```
18+
```bash
1719
REGISTRY=<your custom registry> IMAGE_NAME=<your custom image name> TAG=<your custom tag> make docker-build
1820
```
1921
It defaults to `gcr.io/k8s-staging-capi-cloudstack/capi-cloudstack-controller:dev`
2022

2123

2224
## Creating a new release
2325

24-
Run the following command to create the new release artifacts as well as publish them to the upstream gcr.io repository :
25-
```
26+
Run the following command to create the new release artifacts as well as publish them to the upstream gcr.io repository:
27+
```bash
2628
RELEASE_TAG=<your custom tag> make release-staging
2729
```
2830

@@ -31,9 +33,14 @@ Create the necessary release in GitHub along with the following artifacts ( foun
3133
- infrastructure-components.yaml
3234
- cluster-template*.yaml
3335

36+
> **Note**
37+
>
38+
> - The `RELEASE_TAG` should be in the format of `v<major>.<minor>.<patch>`. For example, `v0.6.0`
39+
> - For RC releases, the `RELEASE_TAG` should be in the format of `v<major>.<minor>.<patch>-rc<rc-number>`. For example, `v0.6.0-rc1`
40+
> - Before creating the release, ensure that the `metadata.yaml` file is updated with the latest release information.
3441
3542

3643
[docker-install]: https://www.docker.com/
3744
[go]: https://golang.org/doc/install
3845
[gcloud-install]: https://cloud.google.com/sdk/docs/install
39-
[k8s-infra-staging-capi-cloudstack]: https://github.com/kubernetes/k8s.io/blob/main/groups/sig-cluster-lifecycle/groups.yaml#L106
46+
[k8s-infra-staging-capi-cloudstack]: https://github.com/kubernetes/k8s.io/blob/main/groups/sig-cluster-lifecycle/groups.yaml#L106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
apiVersion: cluster.x-k8s.io/v1beta1
3+
kind: Cluster
4+
metadata:
5+
name: ${CLUSTER_NAME}
6+
spec:
7+
clusterNetwork:
8+
pods:
9+
cidrBlocks:
10+
- 192.168.0.0/16
11+
serviceDomain: "cluster.local"
12+
infrastructureRef:
13+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
14+
kind: CloudStackCluster
15+
name: ${CLUSTER_NAME}
16+
controlPlaneRef:
17+
kind: KubeadmControlPlane
18+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
19+
name: ${CLUSTER_NAME}-control-plane
20+
---
21+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
22+
kind: CloudStackCluster
23+
metadata:
24+
name: ${CLUSTER_NAME}
25+
spec:
26+
syncWithACS: ${CLOUDSTACK_SYNC_WITH_ACS=false}
27+
controlPlaneEndpoint:
28+
host: ${CLUSTER_ENDPOINT_IP}
29+
port: ${CLUSTER_ENDPOINT_PORT=6443}
30+
failureDomains:
31+
- name: ${CLOUDSTACK_FD1_NAME=failure-domain-1}
32+
acsEndpoint:
33+
name: ${CLOUDSTACK_FD1_SECRET_NAME=cloudstack-credentials}
34+
namespace: ${CLOUDSTACK_FD1_SECRET_NAMESPACE=default}
35+
zone:
36+
name: ${CLOUDSTACK_ZONE_NAME}
37+
network:
38+
name: ${CLOUDSTACK_NETWORK_NAME}
39+
vpc:
40+
name: ${CLOUDSTACK_VPC_NAME}
41+
---
42+
kind: KubeadmControlPlane
43+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
44+
metadata:
45+
name: "${CLUSTER_NAME}-control-plane"
46+
spec:
47+
kubeadmConfigSpec:
48+
initConfiguration:
49+
nodeRegistration:
50+
name: '{{ local_hostname }}'
51+
kubeletExtraArgs:
52+
provider-id: "cloudstack:///'{{ ds.meta_data.instance_id }}'"
53+
joinConfiguration:
54+
nodeRegistration:
55+
name: '{{ local_hostname }}'
56+
kubeletExtraArgs:
57+
provider-id: "cloudstack:///'{{ ds.meta_data.instance_id }}'"
58+
preKubeadmCommands:
59+
- swapoff -a
60+
machineTemplate:
61+
infrastructureRef:
62+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
63+
kind: CloudStackMachineTemplate
64+
name: "${CLUSTER_NAME}-control-plane"
65+
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
66+
version: ${KUBERNETES_VERSION}
67+
---
68+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
69+
kind: CloudStackMachineTemplate
70+
metadata:
71+
name: ${CLUSTER_NAME}-control-plane
72+
spec:
73+
template:
74+
spec:
75+
offering:
76+
name: ${CLOUDSTACK_CONTROL_PLANE_MACHINE_OFFERING}
77+
template:
78+
name: ${CLOUDSTACK_TEMPLATE_NAME}
79+
---
80+
apiVersion: cluster.x-k8s.io/v1beta1
81+
kind: MachineDeployment
82+
metadata:
83+
name: "${CLUSTER_NAME}-md-0"
84+
spec:
85+
clusterName: "${CLUSTER_NAME}"
86+
replicas: ${WORKER_MACHINE_COUNT}
87+
selector:
88+
matchLabels: null
89+
template:
90+
spec:
91+
clusterName: "${CLUSTER_NAME}"
92+
version: "${KUBERNETES_VERSION}"
93+
bootstrap:
94+
configRef:
95+
name: "${CLUSTER_NAME}-md-0"
96+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
97+
kind: KubeadmConfigTemplate
98+
infrastructureRef:
99+
name: "${CLUSTER_NAME}-md-0"
100+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
101+
kind: CloudStackMachineTemplate
102+
---
103+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
104+
kind: CloudStackMachineTemplate
105+
metadata:
106+
name: ${CLUSTER_NAME}-md-0
107+
spec:
108+
template:
109+
spec:
110+
offering:
111+
name: ${CLOUDSTACK_WORKER_MACHINE_OFFERING}
112+
template:
113+
name: ${CLOUDSTACK_TEMPLATE_NAME}
114+
---
115+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
116+
kind: KubeadmConfigTemplate
117+
metadata:
118+
name: ${CLUSTER_NAME}-md-0
119+
spec:
120+
template:
121+
spec:
122+
joinConfiguration:
123+
nodeRegistration:
124+
name: '{{ local_hostname }}'
125+
kubeletExtraArgs:
126+
provider-id: "cloudstack:///'{{ ds.meta_data.instance_id }}'"
127+
preKubeadmCommands:
128+
- swapoff -a

0 commit comments

Comments
 (0)