-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2757 from chrischdi/ipam-e2e-test
🌱 test/e2e: implement e2e test for IPAM
- Loading branch information
Showing
13 changed files
with
194 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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 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 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
37 changes: 37 additions & 0 deletions
37
test/e2e/data/infrastructure-vsphere/main/ipam/ipam-patch.yaml
This file contains 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,37 @@ | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: VSphereMachineTemplate | ||
metadata: | ||
name: '${CLUSTER_NAME}' | ||
namespace: '${NAMESPACE}' | ||
spec: | ||
template: | ||
spec: | ||
network: | ||
devices: | ||
- addressesFromPools: | ||
- apiGroup: ipam.cluster.x-k8s.io | ||
kind: InClusterIPPool | ||
name: ${CLUSTER_NAME} | ||
nameservers: | ||
# Note: using 8.8.8.8 may require to set an IP as VSPHERE_SERVER | ||
- ${IPAM_NAMESERVER:-8.8.8.8} | ||
networkName: '${VSPHERE_NETWORK}' | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: VSphereMachineTemplate | ||
metadata: | ||
name: '${CLUSTER_NAME}-worker' | ||
namespace: '${NAMESPACE}' | ||
spec: | ||
template: | ||
spec: | ||
network: | ||
devices: | ||
- addressesFromPools: | ||
- apiGroup: ipam.cluster.x-k8s.io | ||
kind: InClusterIPPool | ||
name: ${CLUSTER_NAME} | ||
nameservers: | ||
# Note: using 8.8.8.8 may require to set an IP as VSPHERE_SERVER | ||
- ${IPAM_NAMESERVER:-8.8.8.8} | ||
networkName: '${VSPHERE_NETWORK}' |
12 changes: 12 additions & 0 deletions
12
test/e2e/data/infrastructure-vsphere/main/ipam/ippool.yaml
This file contains 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,12 @@ | ||
--- | ||
apiVersion: ipam.cluster.x-k8s.io/v1alpha2 | ||
kind: InClusterIPPool | ||
metadata: | ||
name: ${CLUSTER_NAME} | ||
namespace: ${NAMESPACE} | ||
spec: | ||
prefix: ${IPAM_PREFIX:-24} | ||
gateway: ${IPAM_GATEWAY} | ||
addresses: | ||
- ${IPAM_IP_1} | ||
- ${IPAM_IP_2} |
7 changes: 7 additions & 0 deletions
7
test/e2e/data/infrastructure-vsphere/main/ipam/kustomization.yaml
This file contains 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,7 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ../base | ||
- ippool.yaml | ||
patchesStrategicMerge: | ||
- ipam-patch.yaml |
This file contains 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,12 @@ | ||
# maps release series of major.minor to cluster-api contract version | ||
# the contract version may change between minor or major versions, but *not* | ||
# between patch versions. | ||
# | ||
# update this file only when a new major or minor version is released | ||
apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3 | ||
kind: Metadata | ||
releaseSeries: | ||
- major: 0 | ||
minor: 1 | ||
contract: v1beta1 | ||
|
This file contains 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 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,48 @@ | ||
/* | ||
Copyright 2024 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 e2e | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
"k8s.io/utils/ptr" | ||
capi_e2e "sigs.k8s.io/cluster-api/test/e2e" | ||
) | ||
|
||
var _ = Describe("ClusterClass Creation using Cluster API quick-start test and IPAM Provider [ClusterClass]", func() { | ||
const specName = "ipam-cluster-class" | ||
Setup(specName, func(testSpecificClusterctlConfigPathGetter func() string) { | ||
capi_e2e.QuickStartSpec(ctx, func() capi_e2e.QuickStartSpecInput { | ||
return capi_e2e.QuickStartSpecInput{ | ||
E2EConfig: e2eConfig, | ||
ClusterctlConfigPath: testSpecificClusterctlConfigPathGetter(), | ||
BootstrapClusterProxy: bootstrapClusterProxy, | ||
ArtifactFolder: artifactFolder, | ||
SkipCleanup: skipCleanup, | ||
Flavor: ptr.To("ipam"), | ||
ControlPlaneMachineCount: ptr.To[int64](1), | ||
WorkerMachineCount: ptr.To[int64](1), | ||
} | ||
}) | ||
}, | ||
// Set the WithGateway option to write the gateway ip address to the variable. | ||
// This variable is required for creating the InClusterIPPool for the ipam provider. | ||
WithGateway("IPAM_GATEWAY"), | ||
// Claim two IPs from the CI's IPAM provider to use in the InClusterIPPool of | ||
// the ipam provider. The IPs then get claimed during provisioning to configure | ||
// static IPs for the control-plane and worker node. | ||
WithIP("IPAM_IP_1"), WithIP("IPAM_IP_2")) | ||
}) |
This file contains 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 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 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 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