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

start using the CCO config object #227

Merged
merged 2 commits into from
Jul 29, 2020

Conversation

joelddiaz
Copy link
Contributor

@joelddiaz joelddiaz commented Jul 15, 2020

  1. to determine whether CCO is in manual/disabled mode (old configmap is deprecated and the new config object takes precedence)
  2. to bypass permissions checking when annotating the cloud secret (AWS-only presently)
  3. update role to grant access to read the config
  4. copy generated config CRD from openshift/api into manifests so that it gets registered
  5. update clusteroperator status reporting for bad modes (and conflicting legacy settings and new modes)

Also consolidate scheme registration.
Fix conditions merging to not drop old conditions when new StatusHandler has no conditions to set.
Fix fallout from that fix where StatusHandlers registered during tests were stacking up and interfering with each other.

@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 Jul 15, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 15, 2020
@joelddiaz
Copy link
Contributor Author

/hold
this PR depends on openshift/api#692

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 15, 2020
@joelddiaz joelddiaz mentioned this pull request Jul 17, 2020
9 tasks
@joelddiaz
Copy link
Contributor Author

/test e2e-aws-upgrade

@joelddiaz joelddiaz requested a review from staebler July 22, 2020 16:58
@joelddiaz
Copy link
Contributor Author

@staebler PTAL, this set of changes is the minimal set (IMO) to get CCO to read/respect the new operator config

The other PR will handle making the operator config required for runtime operation and handling the bootstrap mode behavior

pkg/operator/secretannotator/aws/reconciler.go Outdated Show resolved Hide resolved
pkg/operator/secretannotator/aws/reconciler.go Outdated Show resolved Hide resolved
pkg/operator/secretannotator/aws/reconciler.go Outdated Show resolved Hide resolved
pkg/operator/secretannotator/aws/reconciler.go Outdated Show resolved Hide resolved
pkg/operator/secretannotator/aws/reconciler.go Outdated Show resolved Hide resolved
pkg/operator/secretannotator/aws/reconciler.go Outdated Show resolved Hide resolved
pkg/util/scheme.go Outdated Show resolved Hide resolved
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 23, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 23, 2020
Copy link
Contributor

@staebler staebler left a comment

Choose a reason for hiding this comment

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

The bones of this look sound.

pkg/azure/actuator.go Outdated Show resolved Hide resolved
pkg/operator/constants/constants.go Outdated Show resolved Hide resolved
pkg/operator/utils/utils.go Outdated Show resolved Hide resolved
pkg/operator/secretannotator/aws/reconciler.go Outdated Show resolved Hide resolved
pkg/operator/secretannotator/aws/reconciler.go Outdated Show resolved Hide resolved
@@ -36,6 +37,11 @@ var (
statusHandlers = []StatusHandler{}
)

// ClearHandlers so that test cases don't endlessly add handlers
Copy link
Contributor

Choose a reason for hiding this comment

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

This may lead to some flaky tests since tests should be able to be run in parallel.

pkg/operator/secretannotator/azure/status.go Outdated Show resolved Hide resolved
pkg/operator/secretannotator/status/status.go Outdated Show resolved Hide resolved
pkg/operator/secretannotator/status/status.go Show resolved Hide resolved
pkg/operator/secretannotator/aws/reconciler.go Outdated Show resolved Hide resolved
@joelddiaz
Copy link
Contributor Author

@staebler addressed everything except the registering/clearing of the status handlers. Need to think about that one.

pkg/cmd/operator/cmd.go Outdated Show resolved Hide resolved
pkg/operator/secretannotator/aws/reconciler.go Outdated Show resolved Hide resolved
pkg/operator/secretannotator/status/status.go Outdated Show resolved Hide resolved
pkg/operator/secretannotator/status/status.go Outdated Show resolved Hide resolved
@@ -129,6 +144,17 @@ func (r *ReconcileCloudCredSecret) Reconcile(request reconcile.Request) (reconci
}

func (r *ReconcileCloudCredSecret) validateCloudCredsSecret(secret *corev1.Secret) error {
// We only support passthrough so make sure the operator mode is either unset or "passthrough"
Copy link
Contributor

Choose a reason for hiding this comment

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

Thought it worth mentioning that the installer will not allow the mode to be set to "passthrough". Of course, the user can set the mode directly in the config CR afterwards.

if err != nil {
return err
}
if mode != "" && mode != operatorv1.CloudCredentialsModePassthrough {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not something that we should tackle for this PR, but this is also something that should cause the operator to be degraded.

if err != nil {
logger.WithError(err).Error("error checking if operator is disabled")
return reconcile.Result{}, err
} else if conflict {
logger.Error("configuration conflict betwen legacy configmap and operator config")
return reconcile.Result{}, fmt.Errorf("configuration conflict")
} else if operatorIsDisabled {
} else if mode == operatorv1.CloudCredentialsModeManual {
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't need to change it, but I find the else distracting. There is no need for it to be an else since each of the previous blocks return from the function.

mode, conflict, err := ...
if err != nil {
   ...
}
if conflict {
   ...
}
if mode == operatatorv1.CloudCredentialsModeManual {
   ...
}

if err != nil {
mc.log.WithError(err).Error("failed to determine whether CCO is disabled")
return
}
ccoDisabled := mode == operatorv1.CloudCredentialsModeManual
Copy link
Contributor

Choose a reason for hiding this comment

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

Also not something to change now, but we should make an effort in the future to remove the "disabled" concept from the CCO and replace it with "manual mode".

Copy link
Contributor

@staebler staebler left a comment

Choose a reason for hiding this comment

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

This looks good. Let's squash it down and wait for the api changes to merge.

@joelddiaz
Copy link
Contributor Author

/retest

Pull in updated openshift/api with CCO config CRD.

manual overide vendor of openshift/api

move to client-go 0.19.0-rc.2
vendor controller-runtime as github.com/joelanford/controller-runtime@k8s-1.19
pull master branch for openshift/library-go and openshift/client-go
- [x] to determine whether CCO is in manual/disabled mode
- [x] to bypass permissions checking when annotating the cloud secret (AWS/Azure/GCP)
- [x] update role to grant access to read the config
- [x] copy generated CRD from openshift/api into manifests so that it gets applied
- [x] add clusteroperator status reporting for bad modes (and conflicting legacy settings and new modes).

Fix conditions merging to not drop old conditions when new StatusHandler has no conditions to set.
Fix fallout from that fix where StatusHandlers registered during tests were stacking up and interfering with each other.
Copy link
Contributor

@staebler staebler left a comment

Choose a reason for hiding this comment

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

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: joelddiaz, staebler

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

@joelddiaz joelddiaz changed the title WIP: start using the CCO config object start using the CCO config object Jul 29, 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 Jul 29, 2020
@joelddiaz
Copy link
Contributor Author

/unhold
openshift/api#692 merged

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 29, 2020
@openshift-merge-robot openshift-merge-robot merged commit caef52c into openshift:master Jul 29, 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.

4 participants