Skip to content

Conversation

@deads2k
Copy link
Contributor

@deads2k deads2k commented Oct 13, 2017

This bumps the vendored level of kube for some changes we need, then updates the templates to wire the admission hook (note that this requires patches apiserver-side), and sets up the apiserver to accept our input.

Scheme: Scheme,
ParameterCodec: metav1.ParameterCodec,
NegotiatedSerializer: Codecs,
SubresourceGroupVersionKind: map[string]schema.GroupVersionKind{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smarterclayton this tricks the REST handler code into decoding the object we want, but it is a side-effect, not intent. I think we should officially allow the intent.

StdOut: out,
StdErr: errOut,
}
o.RecommendedOptions.Etcd = nil
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @sttts

}

admittingObjectName := &NamedThing{}
err := json.Unmarshal(admissionReview.Spec.Object.Raw, admittingObjectName)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't use a normal metadata path because the admission webhook is broken.

return nil, errors.NewBadRequest(err.Error())
}

if len(admittingObjectName.Name) == 0 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fail closed on empty name. might be generated later, but this fails anyway.

return admissionReview, nil
}

if admittingObjectName.Name == "fail-me" {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

proof that it works. To be updated later

@deads2k
Copy link
Contributor Author

deads2k commented Oct 16, 2017

@dgoodwin let's get this closed off so I can tidy and plumb a client config in a smaller pull. We'll finally be to the meat.

Copy link
Contributor

@dgoodwin dgoodwin left a comment

Choose a reason for hiding this comment

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

Assuming todo's and tests to be addressed later this looks ok to me so far.

@deads2k deads2k merged commit def6cb7 into openshift:master Oct 16, 2017
openshift-merge-robot added a commit to openshift/origin that referenced this pull request Oct 17, 2017
Automatic merge from submit-queue (batch tested with PRs 16861, 16438).

make webhook admission kind of work

This is done to support openshift/kubernetes-namespace-reservation#3 .  It contains multiple fixes needed to make webhooks run at all.  In addition, it changes validation rules and admission handling until we get changes like kubernetes/kubernetes#53826 into the API.  

This affects handling and compatibility of an alpha feature.

@dgoodwin @abhgupta be ready for upgrade pain in this area.
@bparees I turned this on in cluster-up.  Surgery was relatively minor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants