-
Notifications
You must be signed in to change notification settings - Fork 295
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
Add logic to build cluster.Spec from cluster #2402
Conversation
/hold |
Codecov Report
@@ Coverage Diff @@
## main aws/eks-anywhere#2402 +/- ##
==========================================
+ Coverage 56.25% 56.52% +0.26%
==========================================
Files 304 305 +1
Lines 24689 24773 +84
==========================================
+ Hits 13889 14002 +113
+ Misses 9507 9475 -32
- Partials 1293 1296 +3
Continue to review full report at Codecov.
|
74cc71c
to
02ce1cd
Compare
1c2d9f5
to
277e13c
Compare
709b6d1
to
0f03aef
Compare
168b38d
to
b4bf2a1
Compare
@@ -131,6 +132,59 @@ func TestNewSpecValid(t *testing.T) { | |||
validateSpecFromSimpleBundle(t, gotSpec) | |||
} | |||
|
|||
func TestNewSpecFromClusterConfigTinkerbellValid(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only added this to meet the coverage minimun (because the test was missing), I didn't touch this functionality
@@ -283,3 +337,46 @@ func TestBundlesRefDefaulter(t *testing.T) { | |||
}) | |||
} | |||
} | |||
|
|||
func TestBuildSpecFromBundles(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, added for coverage diff min
} | ||
|
||
// init does the basic initialization with the provided necessary api objects | ||
func (s *Spec) init(config *Config, bundles *v1alpha1.Bundles, versionsBundle *v1alpha1.VersionsBundle, eksdRelease *eksdv1alpha1.Release) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this piece to a separate method so it can be reused by NewSpecFromClusterConfig
and BuildSpec
|
||
"github.com/aws/eks-anywhere/pkg/api/v1alpha1" | ||
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a bunch of package renames to follow our latest convention and because it was getting confusing with the old names
@@ -22,6 +22,9 @@ type EksdReleaseFetch func(ctx context.Context, name, namespace string) (*eksdv1 | |||
|
|||
type OIDCFetch func(ctx context.Context, name, namespace string) (*v1alpha1.OIDCConfig, error) | |||
|
|||
// BuildSpec constructs a cluster.Spec for a eks-a cluster by retrieving all | |||
// necessary objects using fetch methods | |||
// This is deprecated in favour of BuildSpec | |||
func BuildSpecForCluster(ctx context.Context, cluster *v1alpha1.Cluster, bundlesFetch BundlesFetch, eksdReleaseFetch EksdReleaseFetch, gitOpsFetch GitOpsFetch, fluxConfigFetch FluxConfigFetch, oidcFetch OIDCFetch) (*Spec, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should get rid of this method now that we have the builder that uses a client. But I would leave that refactor for later to not blow up this PR
/unhold |
New changes are detected. LGTM label has been removed. |
68dd3d9
to
42e6a36
Compare
/approve |
[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 |
Issue #, if available: part of https://github.com/aws/eks-anywhere-internal/issues/1184 and #1109
Description of changes:
Builds (fully) a
cluster.Spec
using a kubernetes client:cluster.Config
with the default builderPlease, look at comments in PR for more localized explanations.
Testing (if applicable):
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.