Skip to content

Commit 9e22cd5

Browse files
committed
fixup! only call setup function in BeforeClusterCreate
1 parent 11b1d4c commit 9e22cd5

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

pkg/handlers/generic/lifecycle/registry/cncfdistribution/handler.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ func New(
6464
}
6565
}
6666

67+
// Setup ensures any pre-requisites for the CNCF Distribution registry addon are met.
68+
// It is expected to be called before the cluster is created.
69+
// Specifically, it ensures that the CA secret for the registry is created in the cluster's namespace.
6770
func (n *CNCFDistribution) Setup(
6871
ctx context.Context,
6972
_ v1alpha1.RegistryAddon,
@@ -82,23 +85,13 @@ func (n *CNCFDistribution) Setup(
8285
return nil
8386
}
8487

88+
// Apply applies the CNCF Distribution registry addon to the cluster.
8589
func (n *CNCFDistribution) Apply(
8690
ctx context.Context,
8791
_ v1alpha1.RegistryAddon,
8892
cluster *clusterv1.Cluster,
8993
log logr.Logger,
9094
) error {
91-
log.Info("Copying TLS Certificate for CNCF Distribution registry to remote cluster")
92-
// Ensure the CA secret exists and is up to date in the cluster's namespace before trying to use it.
93-
err := utils.EnsureCASecretForCluster(
94-
ctx,
95-
n.client,
96-
cluster,
97-
)
98-
if err != nil {
99-
return fmt.Errorf("failed to ensure CA secret for CNCF Distribution registry addon: %w", err)
100-
}
101-
10295
// Copy the TLS secret to the remote cluster.
10396
serviceIP, err := utils.ServiceIPForCluster(cluster)
10497
if err != nil {

pkg/handlers/generic/lifecycle/registry/handler.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ func (r *RegistryHandler) BeforeClusterUpgrade(
9292
resp *runtimehooksv1.BeforeClusterUpgradeResponse,
9393
) {
9494
commonResponse := &runtimehooksv1.CommonResponse{}
95-
r.setup(ctx, &req.Cluster, commonResponse)
9695
r.apply(ctx, &req.Cluster, commonResponse)
9796
resp.Status = commonResponse.GetStatus()
9897
resp.Message = commonResponse.GetMessage()

0 commit comments

Comments
 (0)