Skip to content

Commit

Permalink
Merge pull request openshift#1600 from openshift-cherrypick-robot/che…
Browse files Browse the repository at this point in the history
…rry-pick-1593-to-ocm-2.4

[ocm-2.4] Set dnsZone.Spec.Azure.CloudName when creating dnsZone.
  • Loading branch information
openshift-merge-robot authored Oct 28, 2021
2 parents f82b7d8 + e590afb commit 6c9c8e4
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,7 @@ func (r *ReconcileClusterDeployment) createManagedDNSZone(cd *hivev1.ClusterDepl
dnsZone.Spec.Azure = &hivev1.AzureDNSZoneSpec{
CredentialsSecretRef: cd.Spec.Platform.Azure.CredentialsSecretRef,
ResourceGroupName: cd.Spec.Platform.Azure.BaseDomainResourceGroupName,
CloudName: cd.Spec.Platform.Azure.CloudName,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/openshift/hive/apis"
hivev1 "github.com/openshift/hive/apis/hive/v1"
hivev1aws "github.com/openshift/hive/apis/hive/v1/aws"
"github.com/openshift/hive/apis/hive/v1/azure"
"github.com/openshift/hive/apis/hive/v1/baremetal"
hiveintv1alpha1 "github.com/openshift/hive/apis/hiveinternal/v1alpha1"
"github.com/openshift/hive/pkg/constants"
Expand Down Expand Up @@ -751,6 +752,63 @@ func TestClusterDeploymentReconcile(t *testing.T) {
assert.True(t, zone.Spec.PreserveOnDelete, "PreserveOnDelete did not transfer to DNSZone")
},
},
{
name: "Create DNSZone with Azure CloudName",
existing: []runtime.Object{
func() *hivev1.ClusterDeployment {
baseCD := testClusterDeployment()
baseCD.Labels[hivev1.HiveClusterPlatformLabel] = "azure"
baseCD.Labels[hivev1.HiveClusterRegionLabel] = "usgovvirginia"
baseCD.Spec.Platform.AWS = nil
baseCD.Spec.Platform.Azure = &azure.Platform{
CredentialsSecretRef: corev1.LocalObjectReference{
Name: "azure-credentials",
},
Region: "usgovvirginia",
CloudName: azure.USGovernmentCloud,
BaseDomainResourceGroupName: "os4-common",
}
baseCD.Spec.ManageDNS = true
baseCD.Spec.PreserveOnDelete = true
return testClusterDeploymentWithInitializedConditions(baseCD)
}(),
testSecret(corev1.SecretTypeDockerConfigJson, pullSecretSecret, corev1.DockerConfigJsonKey, "{}"),
testSecret(corev1.SecretTypeDockerConfigJson, constants.GetMergedPullSecretName(testClusterDeployment()), corev1.DockerConfigJsonKey, "{}"),
},
validate: func(c client.Client, t *testing.T) {
zone := getDNSZone(c)
require.NotNil(t, zone, "dns zone should exist")
assert.Equal(t, azure.USGovernmentCloud, zone.Spec.Azure.CloudName, "CloudName did not transfer to DNSZone")
},
},
{
name: "Create DNSZone without Azure CloudName",
existing: []runtime.Object{
func() *hivev1.ClusterDeployment {
baseCD := testClusterDeployment()
baseCD.Labels[hivev1.HiveClusterPlatformLabel] = "azure"
baseCD.Labels[hivev1.HiveClusterRegionLabel] = "eastus"
baseCD.Spec.Platform.AWS = nil
baseCD.Spec.Platform.Azure = &azure.Platform{
CredentialsSecretRef: corev1.LocalObjectReference{
Name: "azure-credentials",
},
Region: "eastus",
BaseDomainResourceGroupName: "os4-common",
}
baseCD.Spec.ManageDNS = true
baseCD.Spec.PreserveOnDelete = true
return testClusterDeploymentWithInitializedConditions(baseCD)
}(),
testSecret(corev1.SecretTypeDockerConfigJson, pullSecretSecret, corev1.DockerConfigJsonKey, "{}"),
testSecret(corev1.SecretTypeDockerConfigJson, constants.GetMergedPullSecretName(testClusterDeployment()), corev1.DockerConfigJsonKey, "{}"),
},
validate: func(c client.Client, t *testing.T) {
zone := getDNSZone(c)
require.NotNil(t, zone, "dns zone should exist")
assert.Equal(t, azure.CloudEnvironment(""), zone.Spec.Azure.CloudName, "CloudName incorrectly set for DNSZone")
},
},
{
name: "Update DNSZone when PreserveOnDelete changes",
existing: []runtime.Object{
Expand Down

0 comments on commit 6c9c8e4

Please sign in to comment.