Skip to content

Commit

Permalink
Fix proxy configuration for airgapped environments
Browse files Browse the repository at this point in the history
  • Loading branch information
ahreehong authored and eks-distro-pr-bot committed Mar 29, 2024
1 parent d043e02 commit 9166ce3
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/helm/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ func (f *ClientFactory) Get(ctx context.Context, clus *anywherev1.Cluster) (Clie
}

r := registrymirror.FromCluster(managmentCluster)
helmClient := f.builder.BuildHelm(WithRegistryMirror(r), WithInsecure())
p := managmentCluster.ProxyConfiguration()
helmClient := f.builder.BuildHelm(WithRegistryMirror(r), WithInsecure(), WithProxyConfig(p))

if r != nil && managmentCluster.RegistryAuth() {
if err := helmClient.RegistryLogin(ctx, r.BaseRegistry, rUsername, rPassword); err != nil {
Expand Down
19 changes: 18 additions & 1 deletion test/e2e/airgap.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const (
bundleReleasePathFromArtifacts = "./eks-anywhere-downloads/bundle-release.yaml"
)

// runAirgapConfigFlow run airgap deployment but allow bootstrap cluster to access local peers.
// runAirgapConfigFlow runs an airgap deployment workflow with a registry mirror configuration,
// and allows bootstrap cluster to access local peers
func runAirgapConfigFlow(test *framework.ClusterE2ETest, localCIDRs string) {
test.GenerateClusterConfig()
test.DownloadArtifacts()
Expand All @@ -39,6 +40,22 @@ func runAirgapConfigFlow(test *framework.ClusterE2ETest, localCIDRs string) {
test.DeleteCluster()
}

// runAirgapConfigProxyFlow runs an airgapped deployment workflow with a proxy configuration,
// and allows bootstrap cluster to access local peers.
func runAirgapConfigProxyFlow(test *framework.ClusterE2ETest, localCIDRs string) {
test.GenerateClusterConfig()
test.DownloadArtifacts()
test.ExtractDownloadedArtifacts()
test.AirgapDockerContainers(localCIDRs)
test.CreateAirgappedUser(localCIDRs)
test.AssertAirgappedNetwork()
test.CreateCluster(
framework.WithSudo(airgapUsername),
framework.WithBundlesOverride(bundleReleasePathFromArtifacts), // generated by ExtractDownloadArtifacts
)
test.DeleteCluster()
}

func runTinkerbellAirgapConfigFlow(test *framework.ClusterE2ETest, localCIDRs, kubeVersion string) {
test.DownloadArtifacts()
test.ExtractDownloadedArtifacts()
Expand Down
22 changes: 22 additions & 0 deletions test/e2e/cloudstack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3565,6 +3565,28 @@ func TestCloudStackKubernetes126RedhatAirgappedRegistryMirror(t *testing.T) {
runAirgapConfigFlow(test, "10.0.0.1/8")
}

func TestCloudStackKubernetes128RedhatAirgappedProxy(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewCloudStack(t,
framework.WithCloudStackRedhat9Kubernetes128(),
framework.WithCloudStackFillers(
framework.RemoveAllCloudStackAzs(),
framework.UpdateAddCloudStackAz3(),
),
),
framework.WithClusterFiller(
api.WithStackedEtcdTopology(),
api.WithControlPlaneCount(1),
api.WithWorkerNodeCount(1),
),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube128)),
framework.WithProxy(framework.CloudstackProxyRequiredEnvVars),
)

runAirgapConfigProxyFlow(test, "10.0.0.1/8")
}

// Workload API
func TestCloudStackMulticlusterWorkloadClusterAPI(t *testing.T) {
cloudstack := framework.NewCloudStack(t)
Expand Down
15 changes: 15 additions & 0 deletions test/e2e/vsphere_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4417,6 +4417,7 @@ func TestVSphereUpgradeKubernetesCiliumUbuntuGitHubFluxAPI(t *testing.T) {
test.DeleteManagementCluster()
}

// Airgapped tests
func TestVSphereKubernetes128UbuntuAirgappedRegistryMirror(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
Expand Down Expand Up @@ -4445,6 +4446,20 @@ func TestVSphereKubernetes129UbuntuAirgappedRegistryMirror(t *testing.T) {
runAirgapConfigFlow(test, "195.18.0.1/16,196.18.0.1/16")
}

func TestVSphereKubernetes129UbuntuAirgappedProxy(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewVSphere(t, framework.WithUbuntu129(), framework.WithPrivateNetwork()),
framework.WithClusterFiller(api.WithControlPlaneCount(1)),
framework.WithClusterFiller(api.WithWorkerNodeCount(1)),
framework.WithClusterFiller(api.WithExternalEtcdTopology(1)),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube129)),
framework.WithProxy(framework.VsphereProxyRequiredEnvVars),
)

runAirgapConfigProxyFlow(test, "195.18.0.1/16,196.18.0.1/16")
}

func TestVSphereKubernetesUbuntu128EtcdEncryption(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
Expand Down

0 comments on commit 9166ce3

Please sign in to comment.