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

Defining new types for Cloudstack AvailabilityZone development #2412

Merged
merged 27 commits into from
Jun 27, 2022

Conversation

maxdrib
Copy link
Contributor

@maxdrib maxdrib commented Jun 15, 2022

Issue #, if available:
#2406

Description of changes:
This PR introduces the new types as described in the Design PR #2399 for supporting running Cloudstack clusters across availability zones. We will preserve the old types as well and introduce a transformer to convert the old types to the new ones once the internal logic is migrated to use the new fields.

Generated files with make generate-manifests, make generate, and make release-manifests

Testing (if applicable):
Unit tests all pass

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@eks-distro-bot eks-distro-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 15, 2022
@codecov
Copy link

codecov bot commented Jun 15, 2022

Codecov Report

Merging #2412 (2c76dbb) into main (ae02a54) will increase coverage by 0.02%.
The diff coverage is 85.10%.

@@            Coverage Diff             @@
##             main    #2412      +/-   ##
==========================================
+ Coverage   57.21%   57.24%   +0.02%     
==========================================
  Files         310      310              
  Lines       25308    25447     +139     
==========================================
+ Hits        14481    14567      +86     
- Misses       9505     9553      +48     
- Partials     1322     1327       +5     
Impacted Files Coverage Δ
...g/api/v1alpha1/cloudstackdatacenterconfig_types.go 55.81% <85.10%> (+16.78%) ⬆️
...roviders/tinkerbell/hardware/catalogue_hardware.go 92.30% <0.00%> (-4.99%) ⬇️
pkg/providers/tinkerbell/tinkerbell.go 32.02% <0.00%> (-2.67%) ⬇️
pkg/dependencies/factory.go 54.57% <0.00%> (-0.35%) ⬇️
pkg/curatedpackages/reader.go 0.00% <0.00%> (ø)
internal/pkg/api/tinkerbell.go 0.00% <0.00%> (ø)
pkg/providers/vsphere/vsphere.go 64.36% <0.00%> (ø)
pkg/providers/tinkerbell/stack/stack.go 83.33% <0.00%> (+0.18%) ⬆️
pkg/diagnostics/analyzers.go 44.17% <0.00%> (+0.91%) ⬆️
pkg/providers/tinkerbell/template.go 31.17% <0.00%> (+2.81%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae02a54...2c76dbb. Read the comment docs.

@maxdrib maxdrib requested review from wanyufe and wongni June 15, 2022 20:10
Copy link
Contributor

@wongni wongni left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Member

@g-gaston g-gaston left a comment

Choose a reason for hiding this comment

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

Looks good
Should we wait to merge this? I believe it will break main for cloudstack, right?

pkg/api/v1alpha1/cloudstackdatacenterconfig_types.go Outdated Show resolved Hide resolved
pkg/api/v1alpha1/cloudstackdatacenterconfig_types.go Outdated Show resolved Hide resolved
pkg/api/v1alpha1/cloudstackdatacenterconfig_types.go Outdated Show resolved Hide resolved
@maxdrib maxdrib requested review from g-gaston and wongni June 20, 2022 14:59
@maxdrib
Copy link
Contributor Author

maxdrib commented Jun 22, 2022

/test eks-anywhere-e2e-presubmit

@maxdrib maxdrib changed the title Defining new types for Cloudstack multiendpoint development Defining new types for Cloudstack AvailabilityZone development Jun 22, 2022
@maxdrib
Copy link
Contributor Author

maxdrib commented Jun 22, 2022

/test eks-anywhere-e2e-presubmit

v.Spec.AvailabilityZones = make([]CloudStackAvailabilityZone, 0, len(v.Spec.Zones))
for index, csZone := range v.Spec.Zones {
az := CloudStackAvailabilityZone{
Name: fmt.Sprintf("availability-zone-%d", index),
Copy link
Contributor Author

@maxdrib maxdrib Jun 24, 2022

Choose a reason for hiding this comment

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

this is subject to change pending alignment with CAPC for backwards compatibility on existing clusters

@@ -29,14 +31,15 @@ type CloudStackDatacenterConfigSpec struct {
// Domain contains a grouping of accounts. Domains usually contain multiple accounts that have some logical relationship to each other and a set of delegated administrators with some authority over the domain and its subdomains
// This field is considered as a fully qualified domain name which is the same as the domain path without "ROOT/" prefix. For example, if "foo" is specified then a domain with "ROOT/foo" domain path is picked.
// The value "ROOT" is a special case that points to "the" ROOT domain of the CloudStack. That is, a domain with a path "ROOT/ROOT" is not allowed.
//
Domain string `json:"domain"`
Domain string `json:"domain,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

do we want to add the deprecated note to each field?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We will add that after we've migrated EKS-A internally to using the new fields. Prior to that, the linter throws a ton of errors for using deprecated fields which will slow down our reviews :(


To add more detail to the credential ref, we will continue to accept a base64 encoded ini file as input from the customer when running eks-a. However,
in order to avoid taking a dependency on a meaningless section of a transient file, we will modify EKS-A to also create the secrets to be used by CAPC.
These secrets will be generated from the ini file provided by customer and applied to the cluster. CAPC will then proceed to take ownership of them as
Copy link
Member

Choose a reason for hiding this comment

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

does it mean every time we pass an updated ini and run upgrade cmd, eks-a creates a new secret and update the CredentialRef to point to the new secret? what happens to the old unused secrets?

@maxdrib maxdrib requested review from jiayiwang7 and g-gaston June 24, 2022 16:08

In a multi-endpoint Cloudstack cluster, each endpoint may have its own credentials. We propose that Cloudstack credentials will be passed in via environment variable in the same way as they are currently,
only as a list corresponding to AvailabilityZones. Currently, these credentials are passed in via environment variable, which contains a base64 encoded .ini file that looks like
only as a list corresponding to some k8s secrets which will be generated. Currently, these credentials are passed in via environment variable, which contains a base64 encoded .ini file that looks like
Copy link
Member

Choose a reason for hiding this comment

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

It's K8s instead of k8s :)

We are also exploring converting the ini file to a yaml input file which contains a list of credentials and their associated endpoints. Either way, this environment variable would
be passed along to CAPC and used by the CAPC controller just like it is currently.
The secrets will be managed by EKS-A insofar that they can be created but not updated. If users want to update an existing secret, they will have to
do so manually both in the k8s secret object, as well as the local ini file prior to running upgrade. We can also add a warning if there is a discrepancy in secret contents between the k8s object and the ini file.
Copy link
Member

Choose a reason for hiding this comment

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

K8s. warning or error out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd prefer error initially and if that's a problem we can relax the constraint.

designs/cloudstack-multiple-endpoints.md Outdated Show resolved Hide resolved
Co-authored-by: Guillermo Gaston <guillermogastonlorente@gmail.com>
@g-gaston
Copy link
Member

/lgtm
/approve

@eks-distro-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: g-gaston

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@eks-distro-bot eks-distro-bot merged commit 6bf35f8 into aws:main Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants