From 7ef21bd57f1e7c48a6c021383a0ecdb618e8fd8c Mon Sep 17 00:00:00 2001 From: Kyle Squizzato Date: Tue, 27 Aug 2024 06:56:35 -0700 Subject: [PATCH] Use gotemplate to make populating documented aws-hosted-cp easier Signed-off-by: Kyle Squizzato --- docs/aws/hosted-control-plane.md | 36 ++++++++++++++++++++++++++++++-- docs/dev.md | 4 ++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/docs/aws/hosted-control-plane.md b/docs/aws/hosted-control-plane.md index 7fbd8b765..58b0be221 100644 --- a/docs/aws/hosted-control-plane.md +++ b/docs/aws/hosted-control-plane.md @@ -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** @@ -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 +``` diff --git a/docs/dev.md b/docs/dev.md index 279de0270..4acf6648f 100644 --- a/docs/dev.md +++ b/docs/dev.md @@ -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.