Skip to content

Commit 4469d4e

Browse files
prankul88k8s-ci-robot
authored andcommitted
Generate seperate multi-node and single-node yaml (#476)
* Generate seperate multi-node and single-node yaml Updated documentation * Update controlplane and machinedeployment.yaml * Update generate.sh with upstream Cluster-API repo
1 parent 554994e commit 4469d4e

File tree

15 files changed

+222
-35
lines changed

15 files changed

+222
-35
lines changed

docs/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ To successfully run a Kubernetes cluster in OpenStack, you will need to configur
3434

3535
## Cluster and machines YAML files
3636

37-
After running `examples/generate.sh` the YAML files will be created in `examples/_out` (or your custom output folder). This files contain configuration on what OpenStack elements to use to create the cluster on, and which cluster components to create. However the template is incomplete and needs to be filled in. The following sections explain some more details about what can be configured.
37+
After running `examples/generate.sh` the YAML files will be created in your custom output folder. This files contain configuration on what OpenStack elements to use to create the cluster on, and which cluster components to create. However the template is incomplete and needs to be filled in. The following sections explain some more details about what can be configured.
3838

3939
## Private Network
4040

examples/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ For convenience, a script is provided which generates example YAMLs. The generat
2727
```
2828
cd examples
2929
export CLUSTER_NAME=<cluster-name>
30-
./generate.sh [options] <path/to/clouds.yaml> <openstack-cloud> [output folder]
30+
./generate.sh [options] <path/to/clouds.yaml> <openstack-cloud> <output folder> [single/multi-node]
3131
```
3232

3333
`<clouds.yaml>` is a YAML configuration file for Openstack, for more details refer to [OpenStack client configuration files](https://docs.openstack.org/python-openstackclient/latest/configuration/index.html#configuration-files).
@@ -51,7 +51,9 @@ export CLUSTER_NAME=<cluster-name>
5151
In case your OpenStack cluster endpoint is using SSL and the cert is signed by an unknown CA, a specific CA certificate
5252
can be provided via the cacert field.
5353

54-
`[output folder]` is where the YAML files will be stored, by default it's `_out`.
54+
`<output folder>` is where the YAML files will be stored.
55+
56+
`[single/multi-node]` is for the control plane preference, by default it's `single-node` .
5557

5658
## Manual Modification
5759

examples/cluster/cluster.yaml renamed to examples/cluster/multi-node/cluster.yaml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ spec:
1111
pods:
1212
cidrBlocks: ["192.168.0.0/16"]
1313
serviceDomain: "cluster.local"
14-
# multi-node control-plane:
15-
# * Disable the apiServerPort property
16-
# single-node control-plane:
17-
# * Enable the apiServerPort property
18-
apiServerPort: <disable when multi-node control-plane>
1914
infrastructureRef:
2015
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2
2116
kind: OpenStackCluster
@@ -33,12 +28,6 @@ spec:
3328
name: cloud-config
3429
namespace: ${CLUSTER_NAME}
3530
nodeCidr: <node-cidr>
36-
# multi-node control-plane:
37-
# * Enable the following section to use a Loadbalancer
38-
# which is required for multi-node control plane
39-
# single-node control-plane:
40-
# * Disable the following section to deploy a single node
41-
# control plane
4231
managedAPIServerLoadBalancer: true
4332
apiServerLoadBalancerFloatingIP: <loadbalancer floating ip>
4433
apiServerLoadBalancerPort: 6443
@@ -54,3 +43,4 @@ spec:
5443
managedSecurityGroups: false
5544
disablePortSecurity: true
5645
disableServerTags: true
46+
useOctavia: true
File renamed without changes.
File renamed without changes.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
apiVersion: cluster.x-k8s.io/v1alpha2
3+
kind: Cluster
4+
metadata:
5+
name: ${CLUSTER_NAME}
6+
namespace: ${CLUSTER_NAME}
7+
spec:
8+
clusterNetwork:
9+
services:
10+
cidrBlocks: ["10.96.0.0/12"]
11+
pods:
12+
cidrBlocks: ["192.168.0.0/16"]
13+
serviceDomain: "cluster.local"
14+
apiServerPort: 6443
15+
infrastructureRef:
16+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2
17+
kind: OpenStackCluster
18+
name: ${CLUSTER_NAME}
19+
namespace: ${CLUSTER_NAME}
20+
---
21+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2
22+
kind: OpenStackCluster
23+
metadata:
24+
name: ${CLUSTER_NAME}
25+
namespace: ${CLUSTER_NAME}
26+
spec:
27+
cloudName: $CLOUD
28+
cloudsSecret:
29+
name: cloud-config
30+
namespace: ${CLUSTER_NAME}
31+
nodeCidr: <node-cidr>
32+
managedAPIServerLoadBalancer: false
33+
dnsNameservers: []
34+
# multi-node control-plane:
35+
# * externalNetworkId is required for:
36+
# * creating routers
37+
# * creating floating ips
38+
# * creating load balancer
39+
externalNetworkId: <external-network-id>
40+
managedSecurityGroups: false
41+
disablePortSecurity: true
42+
disableServerTags: true
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
namespace: ${CLUSTER_NAME}
4+
resources:
5+
- cluster.yaml
6+
configurations:
7+
- kustomizeconfig.yaml
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace:
2+
- kind: Cluster
3+
group: cluster.x-k8s.io
4+
version: v1alpha2
5+
path: spec/infrastructureRef/namespace
6+
create: true

examples/controlplane/controlplane.yaml renamed to examples/controlplane/multi-node/controlplane.yaml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ spec:
3333
image: <Image Name>
3434
sshKeyName: cluster-api-provider-openstack
3535
availabilityZone: nova
36-
# multi-node control-plane:
37-
# * Disable the floatingIP property
38-
# single-node control-plane:
39-
# * Enable the floatingIP property
40-
#floatingIP: <floating IP>
4136
cloudName: $CLOUD
4237
cloudsSecret:
4338
name: cloud-config
@@ -77,12 +72,7 @@ spec:
7772
cloud-provider: openstack
7873
cloud-config: /etc/kubernetes/cloud.conf
7974
clusterConfiguration:
80-
# multi-node control-plane:
81-
# * Configure the floating ip of the loadbalancer
82-
# single-node control-plane:
83-
# * Configure the floating ip of the (only) control
84-
# plane node
85-
controlPlaneEndpoint: "<floating ip>:6443"
75+
controlPlaneEndpoint: "<loadbalancer ip>:6443"
8676
kubernetesVersion: 1.15.0
8777
imageRepository: k8s.gcr.io
8878
apiServer:
File renamed without changes.

0 commit comments

Comments
 (0)