Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standartize env variable in all documentation #545

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions docs/book/src/01_user/01_getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,13 @@ providers:
url: "https://github.com/rancher/cluster-api-provider-rke2/releases/${VERSION}/control-plane-components.yaml"
type: "ControlPlaneProvider"
```
> NOTE: Due to some issue related to how `CAPD` creates Load Balancer healthchecks, it is necessary to use a fork of `CAPD` by providing in the above configuration file the following :

```yaml
- name: "docker"
url: "https://github.com/belgaied2/cluster-api/releases/v1.3.3-cabpr-fix/infrastructure-components.yaml"
type: "InfrastructureProvider"
```

This configuration tells clusterctl where to look for provider manifests in order to deploy provider components in the management cluster.

The next step is to run the `clusterctl init` command:

```bash
clusterctl init --bootstrap rke2 --control-plane rke2 --infrastructure docker:v1.3.3-cabpr-fix
clusterctl init --bootstrap rke2 --control-plane rke2
```

This should output something similar to the following:
Expand All @@ -110,20 +103,20 @@ There are some sample cluster templates available under the `examples` folder. T

For this `Getting Started` section, we will be using the `docker` samples available under `examples/docker/online-default` folder. This folder contains a YAML template file called `cluster-template.yaml` which contains environment variable placeholders which can be substituted using the [envsubst](https://github.com/a8m/envsubst/releases) tool. We will use `clusterctl` to generate the manifests from these template files.
Set the following environment variables:
- CABPR_NAMESPACE
- NAMESPACE
- CLUSTER_NAME
- CABPR_CP_REPLICAS
- CABPR_WK_REPLICAS
- CONTROL_PLANE_MACHINE_COUNT
- WORKER_MACHINE_COUNT
- KUBERNETES_VERSION
- KIND_IMAGE_VERSION

for example:

```bash
export CABPR_NAMESPACE=example
export NAMESPACE=example
export CLUSTER_NAME=capd-rke2-test
export CABPR_CP_REPLICAS=3
export CABPR_WK_REPLICAS=2
export CONTROL_PLANE_MACHINE_COUNT=3
export WORKER_MACHINE_COUNT=2
export KUBERNETES_VERSION=v1.30.3
export KIND_IMAGE_VERSION=v1.30.3
```
Expand Down Expand Up @@ -220,17 +213,17 @@ If you are interested in leveraging this functionality, you can refer to the exa

As with other sample templates, you will need to set a number environment variables:
- CLUSTER_NAME
- CABPR_CP_REPLICAS
- CABPR_WK_REPLICAS
- CONTROL_PLANE_MACHINE_COUNT
- WORKER_MACHINE_COUNT
- KUBERNETES_VERSION
- KIND_IP

for example:

```bash
export CLUSTER_NAME=capd-rke2-clusterclass
export CABPR_CP_REPLICAS=3
export CABPR_WK_REPLICAS=2
export CONTROL_PLANE_MACHINE_COUNT=3
export WORKER_MACHINE_COUNT=2
export KUBERNETES_VERSION=v1.30.3
export KIND_IP=192.168.20.20
```
Expand Down
14 changes: 7 additions & 7 deletions docs/book/src/02_topics/01_air-gapped-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ RKE2 supports Air-Gapped installation using :
- 2 methods for actual RKE2 installation after the node is prepared: Manual deployment, and Using `install.sh` from `https://get.rke2.io`.


## Methods supported by CABPR (Cluster API Provider RKE2)
## Methods supported by CAPRKE2 (Cluster API Provider RKE2)

In choosing between the RKE2 Air-Gapped cluster creation modes above, CABPR has chosen the best tradeoff in terms of simplicity, usability and limitation of dependencies.
In choosing between the RKE2 Air-Gapped cluster creation modes above, CAPRKE2 has chosen the best tradeoff in terms of simplicity, usability and limitation of dependencies.

### Node preparation

The method that is supported by CABPR is the Tarball on the node using custom images. The reasons behind this choice include:
The method that is supported by CAPRKE2 is the Tarball on the node using custom images. The reasons behind this choice include:

- No dependency on the environments' network infrastructure and Image Registry, and the registry approach does not exempt from needing to use a custom image anyway.

Expand All @@ -28,13 +28,13 @@ The method that is supported by CABPR is the Tarball on the node using custom im

### RKE2 deployment

The method that is supported by CABPR for RKE2 deployment is by using the `install.sh` approach, described [here](https://docs.rke2.io/install/airgap#rke2-installsh-script-install). This approach is used because it automates a number of tasks needed for RKE2 to be deployed, like creating file hierarchy, unpacking Tarball, and creating `systemd` service units.
The method that is supported by CAPRKE2 for RKE2 deployment is by using the `install.sh` approach, described [here](https://docs.rke2.io/install/airgap#rke2-installsh-script-install). This approach is used because it automates a number of tasks needed for RKE2 to be deployed, like creating file hierarchy, unpacking Tarball, and creating `systemd` service units.

Since these tasks might change in the future, we prefer to rely on the upstream script from RKE2, available in the latest valid version at: https://get.rke2.io .

## Pre-requisites on base image

Considering the above tradeoffs, base images used for Air-Gapped need to comply to some pre-requisites in order to work with CABPR. This sections list these pre-requisites:
Considering the above tradeoffs, base images used for Air-Gapped need to comply to some pre-requisites in order to work with CAPRKE2. This sections list these pre-requisites:

- Support and presence of `cloud-init` (ignition bootstrapping is also on the roadmap)

Expand All @@ -49,8 +49,8 @@ Considering the above tradeoffs, base images used for Air-Gapped need to comply
- Previous pre-requisites should be built into an machine image, for instance, for instance a container image for CAPD or an AMI for AWS EC2. Each Infrastructure provider has its own way of defining machine images.


### Configuration of CABPR for Air-Gapped use
### Configuration of CAPRKE2 for Air-Gapped use

In order to deploy RKE2 Clusters in Air-Gapped mode using CABPR, you need to set the fields `spec.agentConfig.airGapped` for the RKE2ControlPlane object and `spec.template.spec.agentConfig.airGapped` for RKE2ConfigTemplate object to `true`.
In order to deploy RKE2 Clusters in Air-Gapped mode using CAPRKE2, you need to set the fields `spec.agentConfig.airGapped` for the RKE2ControlPlane object and `spec.template.spec.agentConfig.airGapped` for RKE2ConfigTemplate object to `true`.

You can check a reference implementation for CAPD [here](https://github.com/rancher/cluster-api-provider-rke2/tree/main/examples/docker/air-gapped) including configuration for CAPD custom image.
2 changes: 1 addition & 1 deletion examples/docker/air-gapped/image-building/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Air-Gapped CAPD image building for CABPR
# Air-Gapped CAPD image building for CAPRKE2

## Needed Artifacts for RKE2 Air Gapped Installation

Expand Down
26 changes: 13 additions & 13 deletions examples/docker/air-gapped/rke2-sample.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apiVersion: v1
kind: Namespace
metadata:
name: ${CABPR_NAMESPACE}
name: ${NAMESPACE}
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
name: ${CLUSTER_NAME}
spec:
clusterNetwork:
Expand All @@ -30,7 +30,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerCluster
metadata:
name: ${CLUSTER_NAME}
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
spec:
loadBalancer:
customHAProxyConfigTemplateRef:
Expand All @@ -40,9 +40,9 @@ apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: RKE2ControlPlane
metadata:
name: ${CLUSTER_NAME}-control-plane
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
spec:
replicas: ${CABPR_CP_REPLICAS}
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
version: ${KUBERNETES_VERSION}+rke2r1
agentConfig:
airGapped: true
Expand All @@ -64,7 +64,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerMachineTemplate
metadata:
name: controlplane
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
spec:
template:
spec:
Expand All @@ -74,10 +74,10 @@ apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: worker-md-0
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
spec:
clusterName: ${CLUSTER_NAME}
replicas: ${CABPR_WK_REPLICAS}
replicas: ${WORKER_MACHINE_COUNT}
selector:
matchLabels:
cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME}
Expand All @@ -90,18 +90,18 @@ spec:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: RKE2ConfigTemplate
name: ${CLUSTER_NAME}-agent
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerMachineTemplate
name: worker
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerMachineTemplate
metadata:
name: worker
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
spec:
template:
spec:
Expand All @@ -110,7 +110,7 @@ spec:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: RKE2ConfigTemplate
metadata:
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
name: ${CLUSTER_NAME}-agent
spec:
template:
Expand All @@ -125,7 +125,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: ${CLUSTER_NAME}-lb-config
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
data:
value: |-
# generated by kind
Expand Down
26 changes: 13 additions & 13 deletions examples/docker/cis-profile/rke2-sample.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apiVersion: v1
kind: Namespace
metadata:
name: ${CABPR_NAMESPACE}
name: ${NAMESPACE}
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
name: ${CLUSTER_NAME}
spec:
clusterNetwork:
Expand All @@ -30,7 +30,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerCluster
metadata:
name: ${CLUSTER_NAME}
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
spec:
loadBalancer:
customHAProxyConfigTemplateRef:
Expand All @@ -40,9 +40,9 @@ apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: RKE2ControlPlane
metadata:
name: ${CLUSTER_NAME}-control-plane
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
spec:
replicas: ${CABPR_CP_REPLICAS}
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
version: ${KUBERNETES_VERSION}+rke2r1
serverConfig:
kubeAPIServer:
Expand All @@ -60,7 +60,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerMachineTemplate
metadata:
name: controlplane
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
spec:
template:
spec: {}
Expand All @@ -69,10 +69,10 @@ apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: worker-md-0
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
spec:
clusterName: ${CLUSTER_NAME}
replicas: ${CABPR_WK_REPLICAS}
replicas: ${WORKER_MACHINE_COUNT}
selector:
matchLabels:
cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME}
Expand All @@ -85,26 +85,26 @@ spec:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: RKE2ConfigTemplate
name: ${CLUSTER_NAME}-agent
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerMachineTemplate
name: worker
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerMachineTemplate
metadata:
name: worker
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
spec:
template:
spec: {}
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: RKE2ConfigTemplate
metadata:
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
name: ${CLUSTER_NAME}-agent
spec:
template:
Expand All @@ -116,7 +116,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: ${CLUSTER_NAME}-lb-config
namespace: ${CABPR_NAMESPACE}
namespace: ${NAMESPACE}
data:
value: |-
# generated by kind
Expand Down
4 changes: 2 additions & 2 deletions examples/docker/clusterclass/rke2-sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ spec:
version: ${KUBERNETES_VERSION}+rke2r1
controlPlane:
metadata: {}
replicas: ${CABPR_CP_REPLICAS}
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
workers:
machineDeployments:
- class: default-worker
name: md-0
replicas: ${CABPR_WK_REPLICAS}
replicas: ${WORKER_MACHINE_COUNT}
variables:
- name: dockerKindImage
value: kindest/node:${KUBERNETES_VERSION}
Expand Down
Loading
Loading