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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement packages cluster spec #5031

Merged
merged 2 commits into from Feb 24, 2023

Conversation

TerryHowe
Copy link
Contributor

No description provided.

@eks-distro-bot eks-distro-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 21, 2023
@TerryHowe TerryHowe force-pushed the implement-packages-cluster-spec branch from 4b8d731 to 3bc942d Compare February 21, 2023 21:54
@codecov
Copy link

codecov bot commented Feb 21, 2023

Codecov Report

Merging #5031 (b0de835) into main (b977b6d) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #5031      +/-   ##
==========================================
+ Coverage   72.07%   72.13%   +0.05%     
==========================================
  Files         421      421              
  Lines       34396    34466      +70     
==========================================
+ Hits        24792    24862      +70     
  Misses       8085     8085              
  Partials     1519     1519              
Impacted Files Coverage 螖
pkg/curatedpackages/packagecontrollerclient.go 98.88% <100.00%> (+0.30%) 猬嗭笍
pkg/dependencies/factory.go 73.30% <100.00%> (+0.03%) 猬嗭笍
.../api/v1alpha1/tinkerbelltemplateconfig_defaults.go 100.00% <0.00%> (酶)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -72,7 +72,7 @@ func installPackageController(ctx context.Context) error {
}

curatedpackages.PrintLicense()
err = ctrlClient.EnableCuratedPackages(ctx)
err = ctrlClient.EnableCuratedPackages(ctx, &clusterSpec.Cluster.Spec)
Copy link
Member

Choose a reason for hiding this comment

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

I think injecting this into ctrlClient will make this so much easier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


if clusterSpec.Packages.Controller != nil {
result += "controller:\n"
result += formatYamlLine(" ", "digest", clusterSpec.Packages.Controller.Digest)
Copy link
Member

Choose a reason for hiding this comment

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

Is the goal to return a yaml formatted controller config? Maybe yaml marshaller will come in handy here?

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 tried taht, but this approach was much easier to understand and test.

Copy link
Member

Choose a reason for hiding this comment

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

I have used the yaml marshall's functionality and it was easy to understand and also test. We can sync up offline.

@TerryHowe
Copy link
Contributor Author

/test eks-anywhere-e2e-presubmit

1 similar comment
@TerryHowe
Copy link
Contributor Author

/test eks-anywhere-e2e-presubmit

}

// GetPackageControllerConfiguration returns the default kubernetes version for a Cluster.
func GetPackageControllerConfiguration(clusterSpec *v1alpha1.ClusterSpec) (result string, err error) {
Copy link
Member

Choose a reason for hiding this comment

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

I would recommend moving this method to pkgControllerClient since functionally this method is dealing with a packagecontroller.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -149,7 +161,7 @@ func newPackageControllerTests(t *testing.T) []*packageControllerTest {
kubectl: k,
chartInstaller: ci,
command: curatedpackages.NewPackageControllerClient(
ci, k, clusterName, kubeConfig, chartDev,
ci, k, clusterName, nil, kubeConfig, chartDev,
Copy link
Member

Choose a reason for hiding this comment

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

From usage, looks like clusterSpec is not used by all. Should we make it an option in PCC?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is only used in the generate yaml method. I don't want to create one for tests that don't use it.

Copy link
Member

Choose a reason for hiding this comment

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

What I am referring to is in the NewPackageControllerClient should we make the clusterSpec a PackageControllerClientOpt so that you don't need to pass the nil everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oooh

}

if clusterSpec.Packages.Controller != nil {
result += "controller:\n"
Copy link
Member

Choose a reason for hiding this comment

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

I am still not comfortable with custom parsing instead of using the classic yaml marshaller but if you think this is the better way, I guess it is fine then.

@TerryHowe TerryHowe force-pushed the implement-packages-cluster-spec branch from 1c6104b to cb64580 Compare February 24, 2023 19:34
@TerryHowe TerryHowe force-pushed the implement-packages-cluster-spec branch from cb64580 to 0cc7185 Compare February 24, 2023 19:35
@a-cool-train
Copy link
Member

/approve
/lgtm

@eks-distro-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: a-cool-train

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 032e92a into aws:main Feb 24, 2023
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.

None yet

3 participants