Skip to content

Commit

Permalink
Merge pull request openshift#1645 from alvaroaleman/use-references
Browse files Browse the repository at this point in the history
HCCO: Use cpo manifests for references
  • Loading branch information
openshift-ci[bot] authored Aug 5, 2022
2 parents 0d33e66 + 7e073e3 commit 2fcc930
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 @@ -626,7 +626,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 @@ -790,7 +790,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 2fcc930

Please sign in to comment.