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

Status handling for RouteHealth #399

Merged
merged 1 commit into from Mar 23, 2020

Conversation

jhadvig
Copy link
Member

@jhadvig jhadvig commented Mar 23, 2020

Rework of #334

/assign @benjaminapetersen

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 23, 2020
@jhadvig jhadvig force-pushed the route-health branch 2 times, most recently from 66ff13d to a23ec0b Compare March 23, 2020 13:05
@jhadvig jhadvig changed the title [WIP] Status handling for RouteHealth Status handling for RouteHealth Mar 23, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 23, 2020
pkg/api/api.go Outdated

const (
DefaultIngressCertFilePath = "/var/default-ingress-cert/ca-bundle.crt"
OAuthEndpointCAFilePath = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused?

caCertPool = x509.NewCertPool()
}

trustedCA, tcaErr := co.configMapClient.ConfigMaps(api.OpenShiftConsoleNamespace).Get(api.TrustedCAConfigMapName, metav1.GetOptions{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to have a cached client here (if it isn't already).


trustedCA, tcaErr := co.configMapClient.ConfigMaps(api.OpenShiftConsoleNamespace).Get(api.TrustedCAConfigMapName, metav1.GetOptions{})
if tcaErr != nil {
klog.V(4).Infof("failed to GET configmap %s in %s (synced from %ss)", api.TrustedCAConfigMapName, api.OpenShiftConsoleNamespace, api.OpenShiftConfigManagedNamespace)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this true? The trusted-CAs should be retrieved by having a CM be injected by the network-operator rather than being synced.

caCertPool.AppendCertsFromPEM([]byte(trustedCABundle))

ingressCA, icaErr := co.configMapClient.ConfigMaps(api.OpenShiftConsoleNamespace).Get(api.DefaultIngressCertConfigMapName, metav1.GetOptions{})
if icaErr != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for _, cmName := range []string{api.TrustedCAConfigMapName, api.DefaultIngressCertConfigMapName} {
    cm, err := co.configMapClient.ConfigMaps(api.OpenShiftConsoleNamespace).Get(cmName, metav1.GetOptions{})
    if err != nil {
        klog.V(4).Infof("failed to GET configmap %s / %s ", api.OpenShiftConsoleNamespace, cmName)
    }
    caCertPool.AppendCertsFromPEM([]byte(cm.Data["ca.crt"]))
}

or you may consider mounting the configmaps

}

func (co *consoleOperator) getCA() (*x509.CertPool, error) {
caCertPool, _ := x509.SystemCertPool()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the trusted-ca bundle should contain all the certificates necessary to communicate with the outer world so you may omit this or mount it to the operator

return nil, tcaErr
}
trustedCABundle := trustedCA.Data[api.TrustedCABundleKey]
caCertPool.AppendCertsFromPEM([]byte(trustedCABundle))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a debug log if AppendCertsFromPEM returns false

@jhadvig
Copy link
Member Author

jhadvig commented Mar 23, 2020

@stlaz comments addressed. Thanks !

@@ -61,6 +65,7 @@ func (co *consoleOperator) sync_v400(updatedOperatorConfig *operatorv1.Console,
if rtErr != nil {
return rtErr
}
co.CheckRouteHealth(updatedOperatorConfig, rt)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm inclined to move this to the route controller here:

https://github.com/openshift/console-operator/blob/master/pkg/console/controllers/route/controller.go#L109

After the sync.

@jhadvig
Copy link
Member Author

jhadvig commented Mar 23, 2020

@benjaminapetersen comments addressed! PTAL

@jhadvig
Copy link
Member Author

jhadvig commented Mar 23, 2020

/retest

1 similar comment
@jhadvig
Copy link
Member Author

jhadvig commented Mar 23, 2020

/retest

Copy link
Contributor

@benjaminapetersen benjaminapetersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 23, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: benjaminapetersen, jhadvig

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 23, 2020
@openshift-merge-robot openshift-merge-robot merged commit a4e651e into openshift:master Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants