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

Improve hosted docs with 'gotemplate' example to make configuring the deployment.yaml less tedious #234

Merged
merged 1 commit into from
Sep 4, 2024
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
36 changes: 34 additions & 2 deletions docs/aws/hosted-control-plane.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ The networking resources in AWS which are needed for a managed cluster can be
reused with a management cluster.

If you deployed your AWS Kubernetes cluster using Cluster API Provider AWS (CAPA)
you can obtain all the necessary data with the commands below:
you can obtain all the necessary data with the commands below or use the
template found below in the
[HMC Deployment manifest generation](#hmc-deployment-manifest-generation) section.

**VPC ID**

Expand Down Expand Up @@ -76,4 +78,34 @@ With all the collected data your `Deployment` manifest will look similar to this
- sg-0e000000000000000
```

*Note: in this example we're using us-west-1 region, but you should use the region of your VPC*
> [!NOTE]
> In this example we're using the `us-west-1` region, but you should use the region of your VPC.

## HMC Deployment manifest generation

Grab the following `Deployment` manifest template and save it to a file named `deployment.yaml.tpl`:

```yaml
apiVersion: hmc.mirantis.com/v1alpha1
kind: Deployment
metadata:
name: aws-hosted-cp
spec:
template: aws-hosted-cp
config:
vpcID: "{{.spec.network.vpc.id}}"
region: "{{.spec.region}}"
subnets:
- id: "{{(index .spec.network.subnets 0).resourceID}}"
availabilityZone: "{{(index .spec.network.subnets 0).availabilityZone}}"
amiID: ami-0bf2d31c356e4cb25
instanceType: t3.medium
securityGroupIDs:
- "{{.status.networkStatus.securityGroups.node.id}}"
```

Then run the following command to create the `deployment.yaml`:

```
kubectl get awscluster cluster -o go-template="$(cat deployment.yaml.tpl)" > deployment.yaml
```
4 changes: 2 additions & 2 deletions docs/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ export KUBECONFIG=~/.kube/config

> [!NOTE]
> If you encounter any errors in the output of `clusterctl describe cluster` inspect the logs of the
> `cluster-api-provider-aws-controller-manager` with:
> `capa-controller-manager` with:
> ```
> kubectl logs -n hmc-system deploy/cluster-api-provider-aws-controller-manager
> kubectl logs -n hmc-system deploy/capa-controller-manager
> ```
> This may help identify any potential issues with deployment of the AWS infrastructure.

Expand Down