Skip to content
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

MGMT-15971: Create ManagedCluster CR so that the hub will show up as "Ready" in MCE #5575

Merged
merged 1 commit into from Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/main.go
Expand Up @@ -164,7 +164,7 @@ var Options struct {
PreprovisioningImageControllerConfig controllers.PreprovisioningImageControllerConfig
BMACConfig controllers.BMACConfig
EnableLocalClusterImport bool `envconfig:"ENABLE_LOCAL_CLUSTER_IMPORT" default:"true"`
LocalClusterImportNamespace string `envconfig:"LOCAL_CLUSTER_IMPORT_NAMESPACE" default:"local-agent-cluster"`
LocalClusterImportNamespace string `envconfig:"LOCAL_CLUSTER_IMPORT_NAMESPACE" default:"local-cluster"`

// Directory containing pre-generated TLS certs/keys for the ephemeral installer
ClusterTLSCertOverrideDir string `envconfig:"EPHEMERAL_INSTALLER_CLUSTER_TLS_CERTS_OVERRIDE_DIR" default:""`
Expand Down
10 changes: 5 additions & 5 deletions pkg/localclusterimport/import_local_cluster.go
Expand Up @@ -94,7 +94,7 @@ func (i *LocalClusterImport) createAgentClusterInstall(numberOfControlPlaneNodes
UserManagedNetworking: &userManagedNetworkingActive,
},
ClusterDeploymentRef: v1.LocalObjectReference{
Name: i.localClusterNamespace + "-cluster-deployment",
Name: i.localClusterNamespace,
},
ImageSetRef: &hivev1.ClusterImageSetReference{
Name: "local-cluster-image-set",
Expand All @@ -105,7 +105,7 @@ func (i *LocalClusterImport) createAgentClusterInstall(numberOfControlPlaneNodes
},
}
agentClusterInstall.Namespace = i.localClusterNamespace
agentClusterInstall.Name = i.localClusterNamespace + "-cluster-install"
agentClusterInstall.Name = i.localClusterNamespace
err := i.clusterImportOperations.CreateAgentClusterInstall(agentClusterInstall)
if err != nil {
i.log.Errorf("could not create AgentClusterInstall due to error %s", err.Error())
Expand Down Expand Up @@ -141,7 +141,7 @@ func (i *LocalClusterImport) createClusterDeployment(pullSecret *v1.Secret, dns
AdminKubeconfigSecretRef: v1.LocalObjectReference{Name: fmt.Sprintf("%s-admin-kubeconfig", i.localClusterNamespace)},
},
ClusterInstallRef: &hivev1.ClusterInstallLocalReference{
Name: i.localClusterNamespace + "-cluster-install",
Name: i.localClusterNamespace,
Group: "extensions.hive.openshift.io",
Kind: "AgentClusterInstall",
Version: "v1beta1",
Expand All @@ -158,9 +158,9 @@ func (i *LocalClusterImport) createClusterDeployment(pullSecret *v1.Secret, dns
},
},
}
clusterDeployment.Name = i.localClusterNamespace + "-cluster-deployment"
clusterDeployment.Name = i.localClusterNamespace
clusterDeployment.Namespace = i.localClusterNamespace
clusterDeployment.Spec.ClusterName = i.localClusterNamespace + "-cluster-deployment"
clusterDeployment.Spec.ClusterName = i.localClusterNamespace
clusterDeployment.Spec.BaseDomain = dns.Spec.BaseDomain
agentClusterInstallOwnerRef := metav1.OwnerReference{
Kind: "AgentServiceConfig",
Expand Down
10 changes: 5 additions & 5 deletions pkg/localclusterimport/import_local_cluster_test.go
Expand Up @@ -259,7 +259,7 @@ var _ = Describe("ImportLocalCluster", func() {
UserManagedNetworking: &userManagedNetworkingActive,
},
ClusterDeploymentRef: v1.LocalObjectReference{
Name: localClusterNamespace + "-cluster-deployment",
Name: localClusterNamespace,
},
ImageSetRef: &hivev1.ClusterImageSetReference{
Name: "local-cluster-image-set",
Expand All @@ -270,7 +270,7 @@ var _ = Describe("ImportLocalCluster", func() {
},
}
agentClusterInstall.Namespace = localClusterNamespace
agentClusterInstall.Name = localClusterNamespace + "-cluster-install"
agentClusterInstall.Name = localClusterNamespace
return agentClusterInstall
}

Expand Down Expand Up @@ -298,7 +298,7 @@ var _ = Describe("ImportLocalCluster", func() {
AdminKubeconfigSecretRef: v1.LocalObjectReference{Name: fmt.Sprintf("%s-admin-kubeconfig", localClusterNamespace)},
},
ClusterInstallRef: &hivev1.ClusterInstallLocalReference{
Name: localClusterNamespace + "-cluster-install",
Name: localClusterNamespace,
Group: "extensions.hive.openshift.io",
Kind: "AgentClusterInstall",
Version: "v1beta1",
Expand All @@ -315,9 +315,9 @@ var _ = Describe("ImportLocalCluster", func() {
},
},
}
clusterDeployment.Name = localClusterNamespace + "-cluster-deployment"
clusterDeployment.Name = localClusterNamespace
clusterDeployment.Namespace = localClusterNamespace
clusterDeployment.Spec.ClusterName = localClusterNamespace + "-cluster-deployment"
clusterDeployment.Spec.ClusterName = localClusterNamespace
clusterDeployment.Spec.BaseDomain = "foobar.local"
//
// Adding this ownership reference to ensure we can submit clusterDeployment without ManagedClusterSet/join permission
Expand Down