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

Refactor service-ca and payload config controller (part 2) #293

Merged
merged 3 commits into from Jul 8, 2020

Conversation

mfojtik
Copy link
Member

@mfojtik mfojtik commented Jun 29, 2020

Follow-up for #292

This continue to split the main operator loop. In this iteration the "block 2" is pushed into its own controller.

@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 Jun 29, 2020
@mfojtik
Copy link
Member Author

mfojtik commented Jun 29, 2020

/retest

@mfojtik mfojtik changed the title WIP: Refactor service-ca controller WIP: Refactor service-ca and cli config controller Jun 29, 2020
Copy link
Member

@stlaz stlaz left a comment

Choose a reason for hiding this comment

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

first, faster pass

pkg/controllers/serviceca/service_ca_controller.go Outdated Show resolved Hide resolved
pkg/controllers/serviceca/service_ca_controller.go Outdated Show resolved Hide resolved
@mfojtik mfojtik force-pushed the refactor-serviceca branch 2 times, most recently from 5fa4ef7 to 1d61807 Compare June 30, 2020 07:12
@mfojtik mfojtik changed the title WIP: Refactor service-ca and cli config controller WIP: Refactor service-ca and cli config controller (part 2) Jun 30, 2020
@mfojtik
Copy link
Member Author

mfojtik commented Jun 30, 2020

PullBuilderImageFailed: Failed pulling builder image.

/retest

// knownConditionNames lists all condition types used by this controller.
// These conditions are operated and defaulted by this controller.
// Any new condition used by this controller sync() loop should be listed here.
var knownConditionNames = sets.NewString(
Copy link
Contributor

Choose a reason for hiding this comment

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

you're going to all the trouble of splitting bits out and still have three conditions? That seems weird.

Copy link
Member Author

Choose a reason for hiding this comment

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

now there is more than three :-)

if err != nil {
return nil, []operatorv1.OperatorCondition{
{
Type: "CLIConfigDegraded",
Copy link
Contributor

@deads2k deads2k Jun 30, 2020

Choose a reason for hiding this comment

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

This isn't related to the CLI. You want this degraded message to point to where the customer should look for a fix or what the impact of the failure is. In this case, OAuthServerIngressDegraded?

Copy link
Member Author

Choose a reason for hiding this comment

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

@deads2k the result of this controller sync loop is "v4-0-config-system-cliconfig

Copy link
Member Author

Choose a reason for hiding this comment

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

i mean i'm open for suggestions of the name for this controller :-)

@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 4, 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 7, 2020
@mfojtik mfojtik changed the title WIP: Refactor service-ca and cli config controller (part 2) Refactor service-ca and cli config controller (part 2) Jul 7, 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 7, 2020
@openshift-ci-robot
Copy link
Contributor

@mfojtik: mfojtik unauthorized: /override is restricted to Repo administrators, approvers in top level OWNERS file.

In response to this:

/override ci/prow/e2e-aws
/override ci/prow/e2e-aws-console-login
/override ci/prow/e2e-aws-operator
/override ci/prow/e2e-aws-upgrade

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mfojtik mfojtik force-pushed the refactor-serviceca branch 2 times, most recently from 886464f to 783e137 Compare July 7, 2020 12:58
@mfojtik
Copy link
Member Author

mfojtik commented Jul 7, 2020

/retest

2 similar comments
@mfojtik
Copy link
Member Author

mfojtik commented Jul 7, 2020

/retest

@mfojtik
Copy link
Member Author

mfojtik commented Jul 7, 2020

/retest

Copy link
Member

@stlaz stlaz left a comment

Choose a reason for hiding this comment

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

bunch of comments, I am not sure I like different controllers setting similarly-named conditions when they're unable to deal with the same resources

pkg/controllers/serviceca/service_ca_controller.go Outdated Show resolved Hide resolved
foundConditions := []operatorv1.OperatorCondition{}

// make sure we create the service before we start asking about service certs
if _, err := c.serviceLister.Services("openshift-authentication").Get("oauth-openshift"); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean to go degraded when the service gets removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

i would go Degraded in any error case here, service removed is one of them? do you think we need to handle 404 differently?

Copy link
Member

Choose a reason for hiding this comment

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

right, I originally thought this controller attempted to sync the service itself as well, but that's done elsewhere.

pkg/operator2/oauth.go Show resolved Hide resolved
pkg/controllers/serviceca/service_ca_controller.go Outdated Show resolved Hide resolved
pkg/controllers/cliconfig/cli_config_controller.go Outdated Show resolved Hide resolved
pkg/controllers/cliconfig/cli_config_controller.go Outdated Show resolved Hide resolved
pkg/controllers/cliconfig/cli_config_controller.go Outdated Show resolved Hide resolved
pkg/controllers/cliconfig/cli_config_controller.go Outdated Show resolved Hide resolved
Comment on lines 273 to 323
cliConfigBytes, err := runtime.Encode(encoder, cliConfig)
if err != nil {
return []operatorv1.OperatorCondition{
{
Type: "OAuthConfigDegraded",
Status: operatorv1.ConditionTrue,
Reason: "EncodeFailed",
Message: fmt.Sprintf("Failed to encode CLI config: %v", err),
},
}
}

observedConfig, err := grabPrefixedConfig(operatorConfig.Spec.ObservedConfig.Raw, configobservation.OAuthServerConfigPrefix)
if err != nil {
return []operatorv1.OperatorCondition{
{
Type: "OAuthConfigDegraded",
Status: operatorv1.ConditionTrue,
Reason: "GetOAuthServerConfigFailed",
Message: fmt.Sprintf("Unable to get oauth-server configuration: %v", err),
},
}
}

completeConfigBytes, err := resourcemerge.MergePrunedProcessConfig(&osinv1.OsinServerConfig{}, nil, cliConfigBytes, observedConfig, operatorConfig.Spec.UnsupportedConfigOverrides.Raw)
if err != nil {
return []operatorv1.OperatorCondition{
{
Type: "OAuthConfigDegraded",
Status: operatorv1.ConditionTrue,
Reason: "MergeConfigFailed",
Message: fmt.Sprintf("Failed to merge config with unsupportedConfigOverrides: %v", err),
},
}
}

expectedCLIConfig := getCliConfigMap(completeConfigBytes)

_, _, err = resourceapply.ApplyConfigMap(c.configMaps, recorder, expectedCLIConfig)
if err != nil {
return []operatorv1.OperatorCondition{
{
Type: "OAuthConfigDegraded",
Status: operatorv1.ConditionTrue,
Reason: "ApplyFailed",
Message: fmt.Sprintf("Failed to apply CLI configuration %q: %v", expectedCLIConfig.Name, err),
},
}
}

return nil
Copy link
Member

Choose a reason for hiding this comment

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

the actual logic gets covered up by construction of the conditions :/ I can try to deal with this in a follow-up

@mfojtik
Copy link
Member Author

mfojtik commented Jul 8, 2020

/retest

@mfojtik mfojtik changed the title Refactor service-ca and cli config controller (part 2) Refactor service-ca and payload config controller (part 2) Jul 8, 2020
@stlaz
Copy link
Member

stlaz commented Jul 8, 2020

/lgtm

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mfojtik, stlaz

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 lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 8, 2020
@mfojtik
Copy link
Member Author

mfojtik commented Jul 8, 2020

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@mfojtik
Copy link
Member Author

mfojtik commented Jul 8, 2020

/retest

@openshift-merge-robot openshift-merge-robot merged commit 721d9f5 into openshift:master Jul 8, 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

6 participants