k8s/io/kubernetes/pkg/admission.Attributes 示例代码

2022-03-03

以下示例是关于golang中包含admission.Attributes用法的示例代码,想了解admission.Attributes的具体用法?admission.Attributes怎么用?admission.Attributes使用的例子?那么可以参考以下10个相关示例代码来学习它的具体使用方法。

示例1:
gc_admission.go开发语言: Go项目名称: ddysher代码行数: 270
81
82func (a *gcPermissionsEnforcement) Admit(attributes admission.Attributes) (err error) {
83	// // if the request is in the whitelist, we skip mutation checks for this resource.
167// resources, so multiple DeleteAttribute might be returned.
168func (a *gcPermissionsEnforcement) ownerRefToDeleteAttributeRecords(ref metav1.OwnerReference, attributes admission.Attributes) ([]authorizer.AttributesRecord, error) {
169	var ret []authorizer.AttributesRecord
示例2:
admission.go开发语言: Go项目名称: ddysher代码行数: 249
91// Function to call on webhook failure; behavior determined by defaultAllow flag
92func (a *imagePolicyWebhook) webhookError(pod *api.Pod, attributes admission.Attributes, err error) error {
93	if err != nil {
110
111func (a *imagePolicyWebhook) Admit(attributes admission.Attributes) (err error) {
112	// Ignore all calls to subresources or resources other than pods.
148
149func (a *imagePolicyWebhook) admitPod(pod *api.Pod, attributes admission.Attributes, review *v1alpha1.ImageReview) error {
150	cacheKey, err := json.Marshal(review.Spec)
示例3:
rules_test.go开发语言: Go项目名称: ddysher代码行数: 300
28	rule    adreg.RuleWithOperations
29	match   []admission.Attributes
30	noMatch []admission.Attributes
33
34func a(group, version, resource, subresource, name string, operation admission.Operation) admission.Attributes {
35	return admission.NewAttributesRecord(
44
45func attrList(a ...admission.Attributes) []admission.Attributes {
46	return a
示例4:
gc_admission.go开发语言: Go项目名称: detiber代码行数: 270
81
82func (a *gcPermissionsEnforcement) Admit(attributes admission.Attributes) (err error) {
83	// // if the request is in the whitelist, we skip mutation checks for this resource.
167// resources, so multiple DeleteAttribute might be returned.
168func (a *gcPermissionsEnforcement) ownerRefToDeleteAttributeRecords(ref metav1.OwnerReference, attributes admission.Attributes) ([]authorizer.AttributesRecord, error) {
169	var ret []authorizer.AttributesRecord
示例5:
admission.go开发语言: Go项目名称: detiber代码行数: 249
91// Function to call on webhook failure; behavior determined by defaultAllow flag
92func (a *imagePolicyWebhook) webhookError(pod *api.Pod, attributes admission.Attributes, err error) error {
93	if err != nil {
110
111func (a *imagePolicyWebhook) Admit(attributes admission.Attributes) (err error) {
112	// Ignore all calls to subresources or resources other than pods.
148
149func (a *imagePolicyWebhook) admitPod(pod *api.Pod, attributes admission.Attributes, review *v1alpha1.ImageReview) error {
150	cacheKey, err := json.Marshal(review.Spec)
示例6:
rules_test.go开发语言: Go项目名称: detiber代码行数: 300
28	rule    adreg.RuleWithOperations
29	match   []admission.Attributes
30	noMatch []admission.Attributes
33
34func a(group, version, resource, subresource, name string, operation admission.Operation) admission.Attributes {
35	return admission.NewAttributesRecord(
44
45func attrList(a ...admission.Attributes) []admission.Attributes {
46	return a
示例7:
controller.go开发语言: Go项目名称: ddysher代码行数: 638
44	// The default implementation process related operations in chunks when possible.
45	Evaluate(a admission.Attributes) error
46}
75type admissionWaiter struct {
76	attributes admission.Attributes
77	finished   chan struct{}
96
97func newAdmissionWaiter(a admission.Attributes) *admissionWaiter {
98	return &admissionWaiter{
368// that capture what the usage would be if the request succeeded.  It return an error if there is insufficient quota to satisfy the request
369func (e *quotaEvaluator) checkRequest(quotas []api.ResourceQuota, a admission.Attributes) ([]api.ResourceQuota, error) {
370	namespace := a.GetNamespace()
517
518func (e *quotaEvaluator) Evaluate(a admission.Attributes) error {
519	e.init.Do(func() {
示例8:
controller.go开发语言: Go项目名称: detiber代码行数: 638
44	// The default implementation process related operations in chunks when possible.
45	Evaluate(a admission.Attributes) error
46}
75type admissionWaiter struct {
76	attributes admission.Attributes
77	finished   chan struct{}
96
97func newAdmissionWaiter(a admission.Attributes) *admissionWaiter {
98	return &admissionWaiter{
368// that capture what the usage would be if the request succeeded.  It return an error if there is insufficient quota to satisfy the request
369func (e *quotaEvaluator) checkRequest(quotas []api.ResourceQuota, a admission.Attributes) ([]api.ResourceQuota, error) {
370	namespace := a.GetNamespace()
517
518func (e *quotaEvaluator) Evaluate(a admission.Attributes) error {
519	e.init.Do(func() {
示例9:
admission.go开发语言: Go项目名称: ddysher代码行数: 214
84
85func (c *nodePlugin) Admit(a admission.Attributes) error {
86	nodeName, isNode := c.nodeIdentifier.NodeIdentity(a.GetUserInfo())
116
117func (c *nodePlugin) admitPod(nodeName string, a admission.Attributes) error {
118	switch a.GetOperation() {
178
179func (c *nodePlugin) admitPodStatus(nodeName string, a admission.Attributes) error {
180	switch a.GetOperation() {
197
198func (c *nodePlugin) admitNode(nodeName string, a admission.Attributes) error {
199	requestedName := a.GetName()
示例10:
admission.go开发语言: Go项目名称: detiber代码行数: 214
84
85func (c *nodePlugin) Admit(a admission.Attributes) error {
86	nodeName, isNode := c.nodeIdentifier.NodeIdentity(a.GetUserInfo())
116
117func (c *nodePlugin) admitPod(nodeName string, a admission.Attributes) error {
118	switch a.GetOperation() {
178
179func (c *nodePlugin) admitPodStatus(nodeName string, a admission.Attributes) error {
180	switch a.GetOperation() {
197
198func (c *nodePlugin) admitNode(nodeName string, a admission.Attributes) error {
199	requestedName := a.GetName()

本文地址:https://www.itbaoku.cn/snippets/415570.html