Skip to content

Commit

Permalink
Merge pull request Mirantis#234 from squizzi/hosted-docs
Browse files Browse the repository at this point in the history
Improve hosted docs with 'gotemplate' example to make configuring the deployment.yaml less tedious
  • Loading branch information
squizzi authored Sep 4, 2024
2 parents 5683fbf + 7ef21bd commit 3c842b4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
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 @@ -71,9 +71,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

0 comments on commit 3c842b4

Please sign in to comment.