Skip to content

Commit

Permalink
HCCO: Use cpo manifests for references
Browse files Browse the repository at this point in the history
Currently, the hcco redefines some manifests owned by the CPO. The
content of the two must be the same, otherwise things won't work.

Reference the CPO manifests instead to clarify this dependency.
  • Loading branch information
alvaroaleman committed Aug 3, 2022
1 parent aadcf32 commit 7e073e3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,3 @@ func IngressDefaultIngressControllerCert() *corev1.Secret {
},
}
}

func IngressCert(ns string) *corev1.Secret {
return &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "ingress-crt",
Namespace: ns,
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ func OAuthCABundle() *corev1.ConfigMap {
}
}

func OpenShiftOAuthServerCert(ns string) *corev1.Secret {
return &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "oauth-server-crt",
Namespace: ns,
},
}
}

func OAuthServerChallengingClient() *oauthv1.OAuthClient {
return &oauthv1.OAuthClient{
ObjectMeta: metav1.ObjectMeta{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ func (r *reconciler) reconcileIngressController(ctx context.Context, hcp *hyperv
errs = append(errs, fmt.Errorf("failed to reconcile default ingress controller: %w", err))
}

sourceCert := manifests.IngressCert(hcp.Namespace)
sourceCert := cpomanifests.IngressCert(hcp.Namespace)
if err := r.cpClient.Get(ctx, client.ObjectKeyFromObject(sourceCert), sourceCert); err != nil {
errs = append(errs, fmt.Errorf("failed to get ingress cert (%s/%s) from control plane: %w", sourceCert.Namespace, sourceCert.Name, err))
} else {
Expand Down Expand Up @@ -761,7 +761,7 @@ func secretHash(data []byte) string {
}

func (r *reconciler) reconcileOAuthServingCertCABundle(ctx context.Context, hcp *hyperv1.HostedControlPlane) error {
oauthServingCert := manifests.OpenShiftOAuthServerCert(hcp.Namespace)
oauthServingCert := cpomanifests.OpenShiftOAuthServerCert(hcp.Namespace)
if err := r.cpClient.Get(ctx, client.ObjectKeyFromObject(oauthServingCert), oauthServingCert); err != nil {
return fmt.Errorf("cannot get oauth serving cert: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

hyperv1 "github.com/openshift/hypershift/api/v1alpha1"
cpomanifests "github.com/openshift/hypershift/control-plane-operator/controllers/hostedcontrolplane/manifests"
"github.com/openshift/hypershift/control-plane-operator/hostedclusterconfigoperator/api"
"github.com/openshift/hypershift/control-plane-operator/hostedclusterconfigoperator/controllers/resources/manifests"
"github.com/openshift/hypershift/support/globalconfig"
Expand Down Expand Up @@ -148,7 +149,7 @@ func fakeHCP() *hyperv1.HostedControlPlane {
}

func fakeIngressCert() *corev1.Secret {
s := manifests.IngressCert("bar")
s := cpomanifests.IngressCert("bar")
s.Data = map[string][]byte{
"tls.crt": []byte("12345"),
"tls.key": []byte("12345"),
Expand Down Expand Up @@ -201,7 +202,7 @@ func fakeKubeadminPasswordSecret() *corev1.Secret {
}

func fakeOAuthServingCert() *corev1.Secret {
s := manifests.OpenShiftOAuthServerCert("bar")
s := cpomanifests.OpenShiftOAuthServerCert("bar")
s.Data = map[string][]byte{"tls.crt": []byte("test")}
return s
}
Expand Down

0 comments on commit 7e073e3

Please sign in to comment.