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

Admission webhoooks #1436

Merged
merged 2 commits into from
Apr 17, 2020
Merged

Conversation

awgreene
Copy link
Member

@awgreene awgreene commented Apr 8, 2020

This PR introduces OLM support for validating and mutating admission
webhooks by updating the ClusterServiceVersion CRD to include a
WebhooksDefinitions array. In the current iteration, OLM supports
cycling the CA Certs required for webhooks.

@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 Apr 8, 2020
@@ -45,6 +47,14 @@ func NewInstallStrategyDeploymentClient(opClient operatorclient.ClientInterface,
}
}

func (c *InstallStrategyDeploymentClientForNamespace) GetOpClient() operatorclient.ClientInterface {
Copy link
Member Author

Choose a reason for hiding this comment

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

Should be cleaned up in refactor.

return c.opClient
}

func (c *InstallStrategyDeploymentClientForNamespace) GetOpLister() operatorlister.OperatorLister {
Copy link
Member Author

Choose a reason for hiding this comment

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

Should be cleaned up in refactor.

pkg/controller/operators/olm/apiservices.go Outdated Show resolved Hide resolved
pkg/controller/install/apiservice.go Outdated Show resolved Hide resolved
@awgreene awgreene force-pushed the admission-webhoooks branch 2 times, most recently from 77bc8a4 to 2c60954 Compare April 8, 2020 22:17
Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

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

Two suggestions

pkg/controller/install/webhook.go Show resolved Hide resolved
pkg/controller/operators/olm/operator.go Outdated Show resolved Hide resolved
@awgreene awgreene force-pushed the admission-webhoooks branch 4 times, most recently from ec8d5e3 to 2c029d5 Compare April 9, 2020 01:00
@ecordell ecordell mentioned this pull request Apr 10, 2020
5 tasks
@jmazzitelli
Copy link
Contributor

How will this be exposed to Ansible operators?

@awgreene
Copy link
Member Author

/retest

1 similar comment
@awgreene
Copy link
Member Author

/retest

@awgreene
Copy link
Member Author

/retest

The following tests failed but ran locally

creation with dependencies [It]
image update [It]

@awgreene
Copy link
Member Author

/retest

@ecordell
Copy link
Member

ecordell commented Apr 13, 2020

How will this be exposed to Ansible operators?

That's probably a question for operator-sdk. This is for packaging / installing an admission webhook with your operator, and doesn't have any opinions about how the webhook is implemented. @jmazzitelli

@awgreene awgreene changed the title WIP: Admission webhoooks Admission webhoooks Apr 13, 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 Apr 13, 2020
@@ -163,6 +246,7 @@ type ClusterServiceVersionSpec struct {
Maturity string
CustomResourceDefinitions CustomResourceDefinitions
APIServiceDefinitions APIServiceDefinitions
WebhookDefinitions []WebhookDescription
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: the slice should be []WebhookDefinitions ?

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 wanted to keep it similar to APIServiceDefinitions, I'm not opposed to changing the variable (API) name though.

@@ -191,6 +276,8 @@ type ClusterServiceVersionSpec struct {
CustomResourceDefinitions CustomResourceDefinitions `json:"customresourcedefinitions,omitempty"`
APIServiceDefinitions APIServiceDefinitions `json:"apiservicedefinitions,omitempty"`
// +listType=set
WebhookDefinitions []WebhookDescription `json:"webhookdefinitions,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: the slice should be []WebhookDefinitions ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@ecordell ecordell 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 really good, and I think you've set it up well for the planned refactoring to these parts.

I left a few comments for small things, the only thing that I'm concerned about addressing is the 0.14.2 release (should be my first comment in this review)

deploy/ocp/manifests/latest Outdated Show resolved Hide resolved
pkg/controller/install/caresources.go Outdated Show resolved Hide resolved
previousStrategy: previousStrategy,
templateAnnotations: templateAnnotations,
initializers: initializers,
apiServiceDescriptions: apiDescs,
Copy link
Member

Choose a reason for hiding this comment

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

refactor suggestion: is there a way we can model the apidescriptions/webhookdescriptions as just more initializer functions?

pkg/controller/install/webhook.go Show resolved Hide resolved
@@ -1366,6 +1367,14 @@ func (a *Operator) transitionCSVState(in v1alpha1.ClusterServiceVersion) (out *v
return
}

// Check if Webhooks have valid rules
for _, desc := range out.Spec.WebhookDefinitions {
if syncError = install.ValidWebhookRules(desc.Rules); syncError != nil {
Copy link
Member

Choose a reason for hiding this comment

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

future nit: we should tie these validations to the the validation library used in opm

pkg/controller/operators/olm/operator_test.go Outdated Show resolved Hide resolved
test/e2e/csv_e2e_test.go Show resolved Hide resolved
@awgreene
Copy link
Member Author

/test e2e-gcp

@awgreene
Copy link
Member Author

/retest

3 similar comments
@awgreene
Copy link
Member Author

/retest

@awgreene
Copy link
Member Author

/retest

@awgreene
Copy link
Member Author

/retest

@openshift-bot
Copy link
Contributor

/retest

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

2 similar comments
@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@awgreene
Copy link
Member Author

/retest

@awgreene awgreene closed this Apr 16, 2020
@awgreene awgreene reopened this Apr 16, 2020
@awgreene
Copy link
Member Author

Closed and reopened to kick off tests after another PR was merged.

@awgreene
Copy link
Member Author

/retest

3 similar comments
@awgreene
Copy link
Member Author

/retest

@awgreene
Copy link
Member Author

/retest

@awgreene
Copy link
Member Author

/retest

This commit introduces a change that moves the APIService install logic
to the installer.
This commit introduces OLM support for validating and mutating admission
webhooks by updating the ClusterServiceVersion CRD to include a
WebhooksDefinitions array. In the current iteration, OLM supports
cycling the CA Certs required for webhooks.
@openshift-ci-robot
Copy link
Collaborator

New changes are detected. LGTM label has been removed.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Apr 16, 2020
@awgreene
Copy link
Member Author

/retest

2 similar comments
@awgreene
Copy link
Member Author

/retest

@awgreene
Copy link
Member Author

/retest

@openshift-ci-robot
Copy link
Collaborator

@awgreene: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-gcp 468d1f6 link /test e2e-gcp
ci/prow/e2e-gcp-upgrade 468d1f6 link /test e2e-gcp-upgrade

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@awgreene awgreene merged commit 3854141 into operator-framework:master Apr 17, 2020
@awgreene
Copy link
Member Author

Passing e2e-aws, e2e-gcp is broken right now - manually merging as a result

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants