-
Notifications
You must be signed in to change notification settings - Fork 603
✨ WIP: Initial dedicated hosts implementation #5398
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
Draft
faermanj
wants to merge
16
commits into
kubernetes-sigs:main
Choose a base branch
from
faermanj:feat-dedicated-hosts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
f75994c
initial dedicated hosts implementation
faermanj 23dc5a5
fixed lint
faermanj 3a290e3
fixed lint
faermanj 056bf1a
Merge branch 'kubernetes-sigs:main' into feat-dedicated-hosts
faermanj 9f35668
initial dedicated hosts test file (copy from quick test)
faermanj ad92efd
added dedicated hosts to test resource
faermanj 1efaead
Merge branch 'kubernetes-sigs:main' into feat-dedicated-hosts
faermanj a946d2d
wip
faermanj d79ca9c
Extracting resource allocation to aws.go
faermanj 2ded58e
Co-working session
faermanj b014af4
proper test naming
faermanj 879a600
fixed namespace
faermanj 17d9a21
Adding host allocation and passing to ConfigClusterInput
faermanj ba06d82
Allocated host id
faermanj 614f013
changed wrong test
faermanj 8736786
logging allocated id
faermanj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
//go:build e2e | ||
// +build e2e | ||
|
||
/* | ||
Copyright 2025 The Kubernetes Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package unmanaged | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/gofrs/flock" | ||
"github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
corev1 "k8s.io/api/core/v1" | ||
|
||
"sigs.k8s.io/cluster-api-provider-aws/v2/test/e2e/shared" | ||
capi_e2e "sigs.k8s.io/cluster-api/test/e2e" | ||
) | ||
|
||
// setupNamespace initializes the namespace for the test. | ||
func setupNamespace(ctx context.Context, e2eCtx *shared.E2EContext) *corev1.Namespace { | ||
Expect(e2eCtx.Environment.BootstrapClusterProxy).ToNot(BeNil(), "Invalid argument. BootstrapClusterProxy can't be nil") | ||
return shared.SetupSpecNamespace(ctx, "capa-dedicate-host", e2eCtx) | ||
} | ||
|
||
// setupRequiredResources allocates the required resources for the test. | ||
func setupRequiredResources(e2eCtx *shared.E2EContext) *shared.TestResource { | ||
requiredResources := &shared.TestResource{ | ||
EC2Normal: 2 * e2eCtx.Settings.InstanceVCPU, | ||
IGW: 1, | ||
NGW: 1, | ||
VPC: 1, | ||
ClassicLB: 1, | ||
EIP: 3, | ||
EventBridgeRules: 50, | ||
} | ||
requiredResources.WriteRequestedResources(e2eCtx, "capa-dedicated-hosts-test") | ||
|
||
Expect(shared.AcquireResources(requiredResources, ginkgo.GinkgoParallelProcess(), flock.New(shared.ResourceQuotaFilePath))).To(Succeed()) | ||
return requiredResources | ||
} | ||
|
||
// releaseResources releases the resources allocated for the test. | ||
func releaseResources(requiredResources *shared.TestResource, e2eCtx *shared.E2EContext) { | ||
shared.ReleaseResources(requiredResources, ginkgo.GinkgoParallelProcess(), flock.New(shared.ResourceQuotaFilePath)) | ||
} | ||
|
||
// runQuickStartSpec executes the QuickStartSpec test. | ||
func runQuickStartSpec(e2eCtx *shared.E2EContext) { | ||
capi_e2e.QuickStartSpec(context.TODO(), func() capi_e2e.QuickStartSpecInput { | ||
return capi_e2e.QuickStartSpecInput{ | ||
E2EConfig: e2eCtx.E2EConfig, | ||
ClusterctlConfigPath: e2eCtx.Environment.ClusterctlConfigPath, | ||
BootstrapClusterProxy: e2eCtx.Environment.BootstrapClusterProxy, | ||
ArtifactFolder: e2eCtx.Settings.ArtifactFolder, | ||
SkipCleanup: e2eCtx.Settings.SkipCleanup, | ||
} | ||
}) | ||
} | ||
|
||
// cleanupNamespace cleans up the namespace and dumps resources. | ||
func cleanupNamespace(ctx context.Context, namespace *corev1.Namespace, e2eCtx *shared.E2EContext) { | ||
shared.DumpSpecResourcesAndCleanup(ctx, "", namespace, e2eCtx) | ||
} | ||
|
||
var _ = ginkgo.Context("[unmanaged] [dedicated-host]", func() { | ||
var ( | ||
namespace *corev1.Namespace | ||
ctx context.Context | ||
requiredResources *shared.TestResource | ||
dedicatedHostID string | ||
) | ||
|
||
ginkgo.BeforeEach(func() { | ||
ctx = context.TODO() | ||
namespace = setupNamespace(ctx, e2eCtx) | ||
dedicatedHostID, _ = shared.GetDedicatedHost(e2eCtx) | ||
}) | ||
|
||
ginkgo.Describe("Running the dedicated-hosts spec", func() { | ||
ginkgo.BeforeEach(func() { | ||
requiredResources = setupRequiredResources(e2eCtx) | ||
// e2eCtx.Settings.DedicatedHostID = dedicatedHostID | ||
}) | ||
|
||
ginkgo.It("should run the QuickStartSpec", func() { | ||
runQuickStartSpec(e2eCtx) | ||
}) | ||
|
||
ginkgo.AfterEach(func() { | ||
shared.DeleteDedicatedHost(e2eCtx, dedicatedHostID) | ||
releaseResources(requiredResources, e2eCtx) | ||
}) | ||
}) | ||
|
||
ginkgo.AfterEach(func() { | ||
cleanupNamespace(ctx, namespace, e2eCtx) | ||
}) | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.7/.schema/devbox.schema.json", | ||
"packages": [ | ||
"[email protected]", | ||
"kind@latest", | ||
"docker@latest", | ||
"jq@latest", | ||
|
@@ -11,7 +10,8 @@ | |
"tilt@latest", | ||
"awscli2@latest", | ||
"direnv@latest", | ||
"kustomize@latest" | ||
"[email protected]", | ||
"[email protected]" | ||
], | ||
"shell": { | ||
"init_hook": [ | ||
|
@@ -27,4 +27,4 @@ | |
] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.