Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

feat: set default instance type for aws cp and worker nodes #51

Open
wants to merge 96 commits into
base: main
Choose a base branch
from

Conversation

supershal
Copy link

What problem does this PR solve?:

  • sets defaults for aws nodes CP: m5.xlarge and Workers: m5.2xlarge
  • sets PLACEHOLDER value as defaults in AWSMachineTemplates because instanceType field is required by CAPA.
  • sets instance type as required field in the schema since CAREN will be using the default if not provided by the user.
  • update existing unit tests to use default schema

NOTE
Once this PR is finalized, I will create follow up PR to set instance profile and some other changes in the API types that would ensure that it creates variable schema from the object instead of creating new one.

Which issue(s) this PR fixes:
Fixes # nutanix-cloud-native#485

How Has This Been Tested?:

Tried to test locally using make e2e-test E2E_LABEL='provider:AWS && cni:Cilium' but local environment timed outs during initializations. Looking into fixing local environment (colima +docker +kind on mac)

Tested manually be creating AWS cluster.

  • aws-quick-start cluster class has following
 instanceType:
                      default: m5.xlarge
                      description: The AWS instance type to use for the cluster Machines
                      type: string
                  required:
                  - instanceType

and workers

                instanceType:
                  default: m5.2xlarge
                  description: The AWS instance type to use for the cluster Machines
                  type: string
              required:
              - instanceType

Created AWS cluster without adding instanceType variable, CAREN patched AWSMachineTemplate with default instanceType.

Special notes for your reviewer:

The approach taken in this PR will be used as guide to set default for other variables.

jimmidyson and others added 30 commits March 21, 2024 12:30
Missed when reorganising example kustomizations in previous PR.
- Defines a cluster-level variable for defining one or more users
- Patches bootstrap templates for control plane and worker node pools
  with user configuration
Co-authored-by: Faiq <faiq.raza@nutanix.com>
Signed-off-by: Deepak Muley <deepak.muley@nutanix.com>
Without this, defaults declared in the JSON schema are not included in validation
steps, which can lead to invalid failures, while also not allowing for tests that
target defaults.
Fix typo in lockPassword logic, and add unit test
feat: Add examples for Nutanix provider
Add unit test for empty hashed password
Change Sudo field from pointer to value

The zero value (empty string) is not valid, so the field does not need
to be a pointer.
Explain why we do not validate hashed password input
Explain why we do not validate sudo input
Also deploy infra provider versions that match the API.
CPI is a term unique to the vSphere CCM.
Renaming to the more generic "CCM".
dkoshkin and others added 14 commits April 9, 2024 08:35
* refactor: combine PC host and port into a single url var

This makes it simpler for clients to provide a single input field
and not have to do any parsing to split the hostname and port.
It also allows us to use API validation for bad input.

* fixup! refactor: combine PC host and port into a single url var

* fixup! refactor: combine PC host and port into a single url var

* fixup! refactor: combine PC host and port into a single url var
The existing code created a ClusterResourceSet with the user provided Secret.
However, that won't work unless that Secret has an embedded Secret in it.
* ci: adds tooling to create configmap

* feat: use a configmap to get helmchart info

* fix: precommit issues

* fix: typo in cilium

* fix: remove workspace files

* build: template name for configmap

* refactor: names for helm chart info getter

* refactor: use nutanix-storage name instead of nutnaix-csi

* refactor: move to globaloptions

* fix: adds snapshot to helm config

* fix: comments after review

* fix: adds a warning and removes ebs csi

* fix: typo

* fix: adds missing script file

* fix: precommit
* feat: Add patch to configure containerd metrics
This makes the deployment consistent as well as avoiding issues when providers
are in the middle of a release.
* build: remove nutanix CCM from examples

* build: add scripts to sync Nutanix CCM manifests

* build: add CCM addon var to Nutanix examples

* feat: deploy Nutanix CCM addon

Aligns the method of deploying the CCM with all other addons.

* fixup! build: add scripts to sync Nutanix CCM manifests

* fixup! feat: deploy Nutanix CCM addon

* build: remove unused CRS tooling for Nutanix CCM

The CRS strategy is not supported for the Nutanix CCM,
removing it until we actually need it.
Copy link
Collaborator

@dkoshkin dkoshkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

api/v1alpha1/aws_node_types.go Outdated Show resolved Hide resolved
Copy link

@faiq faiq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elegant solution.

Comment on lines 60 to 63
instanceType := InstanceType("")
if a.InstanceType != nil {
instanceType = *a.InstanceType
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
instanceType := InstanceType("")
if a.InstanceType != nil {
instanceType = *a.InstanceType
}
instanceType := ptr.Deref(a.InstanceType, "")

OpenAPIV3Schema: clusterv1.JSONSchemaProps{
Type: "string",
Description: "The AWS instance type to use for the cluster Machines",
Default: variables.MustMarshal(string(i)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Default: variables.MustMarshal(string(i)),
Default: variables.MustMarshal(i),

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants