diff --git a/go.mod b/go.mod index 9ec90db9c97..d0e94d724c1 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( k8s.io/code-generator v0.25.4 k8s.io/klog v1.0.0 k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 - knative.dev/pkg v0.0.0-20221011175852-714b7630a836 + knative.dev/pkg v0.0.0-20221209013515-911b435f02a1 sigs.k8s.io/yaml v1.3.0 ) @@ -45,7 +45,7 @@ require ( github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20221030203717-1711cefd7eec github.com/letsencrypt/boulder v0.0.0-20221109233200-85aa52084eaf github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 - k8s.io/utils v0.0.0-20221012122500-cfd413dd9e85 + k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 ) require ( @@ -180,9 +180,9 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 - k8s.io/apiextensions-apiserver v0.25.2 // indirect - k8s.io/gengo v0.0.0-20220613173612-397b4ae3bce7 // indirect - k8s.io/klog/v2 v2.80.1 // indirect + k8s.io/apiextensions-apiserver v0.25.4 // indirect + k8s.io/gengo v0.0.0-20221011193443-fad74ee6edd9 // indirect + k8s.io/klog/v2 v2.80.2-0.20221028030830-9ae4992afb54 // indirect sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect ) diff --git a/go.sum b/go.sum index 69675080bf5..1bbc8166d44 100644 --- a/go.sum +++ b/go.sum @@ -1616,6 +1616,8 @@ k8s.io/api v0.25.4 h1:3YO8J4RtmG7elEgaWMb4HgmpS2CfY1QlaOz9nwB+ZSs= k8s.io/api v0.25.4/go.mod h1:IG2+RzyPQLllQxnhzD8KQNEu4c4YvyDTpSMztf4A0OQ= k8s.io/apiextensions-apiserver v0.25.2 h1:8uOQX17RE7XL02ngtnh3TgifY7EhekpK+/piwzQNnBo= k8s.io/apiextensions-apiserver v0.25.2/go.mod h1:iRwwRDlWPfaHhuBfQ0WMa5skdQfrE18QXJaJvIDLvE8= +k8s.io/apiextensions-apiserver v0.25.4 h1:7hu9pF+xikxQuQZ7/30z/qxIPZc2J1lFElPtr7f+B6U= +k8s.io/apiextensions-apiserver v0.25.4/go.mod h1:bkSGki5YBoZWdn5pWtNIdGvDrrsRWlmnvl9a+tAw5vQ= k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc= @@ -1641,6 +1643,8 @@ k8s.io/cri-api v0.20.6/go.mod h1:ew44AjNXwyn1s0U4xCKGodU7J1HzBeZ1MpGrpa5r8Yc= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20220613173612-397b4ae3bce7 h1:RGb68G3yotdQggcyenx9y0+lnVJCXXcLa6geXOMlf5o= k8s.io/gengo v0.0.0-20220613173612-397b4ae3bce7/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/gengo v0.0.0-20221011193443-fad74ee6edd9 h1:iu3o/SxaHVI7tKPtkGzD3M9IzrE21j+CUKH98NQJ8Ms= +k8s.io/gengo v0.0.0-20221011193443-fad74ee6edd9/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= @@ -1648,6 +1652,8 @@ k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/klog/v2 v2.80.2-0.20221028030830-9ae4992afb54 h1:hWRbsoRWt44OEBnYUd4ceLy4ofBoh+p9vauWp/I5Gdg= +k8s.io/klog/v2 v2.80.2-0.20221028030830-9ae4992afb54/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+OGxg8HsuBr/5f6tVAjDu6E= k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280/go.mod h1:+Axhij7bCpeqhklhUTe3xmOn6bWxolyZEeyaFpjGtl4= @@ -1655,8 +1661,12 @@ k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20221012122500-cfd413dd9e85 h1:cTdVh7LYu82xeClmfzGtgyspNh6UxpwLWGi8R4sspNo= k8s.io/utils v0.0.0-20221012122500-cfd413dd9e85/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 h1:GfD9OzL11kvZN5iArC6oTS7RTj7oJOIfnislxYlqTj8= +k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= knative.dev/pkg v0.0.0-20221011175852-714b7630a836 h1:0N7Zo/O+xeUUebJPm9keBaGclrUoEbljr3J1MsqtaIM= knative.dev/pkg v0.0.0-20221011175852-714b7630a836/go.mod h1:DMTRDJ5WRxf/DrlOPzohzfhSuJggscLZ8EavOq9O/x8= +knative.dev/pkg v0.0.0-20221209013515-911b435f02a1 h1:CqZicZHNls+v1vs/BvGIzgLbJGN4XxT0TjcIFje0uyM= +knative.dev/pkg v0.0.0-20221209013515-911b435f02a1/go.mod h1:IeUSNPPUpQnM35SjpnfCx0w5/V2RpEc+nmke6oPwpD0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/pkg/internal/computeresources/limitrange/limitrange_test.go b/pkg/internal/computeresources/limitrange/limitrange_test.go index 6c889d0cd2c..ed0b1d337b4 100644 --- a/pkg/internal/computeresources/limitrange/limitrange_test.go +++ b/pkg/internal/computeresources/limitrange/limitrange_test.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -31,6 +31,7 @@ import ( fakekubeclient "knative.dev/pkg/client/injection/kube/client/fake" fakelimitrangeinformer "knative.dev/pkg/client/injection/kube/informers/core/v1/limitrange/fake" fakeserviceaccountinformer "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/fake" + _ "knative.dev/pkg/system/testing" ) func setupTestData(t *testing.T, serviceaccounts []corev1.ServiceAccount, limitranges []corev1.LimitRange) (context.Context, func()) { diff --git a/pkg/reconciler/pipelinerun/controller.go b/pkg/reconciler/pipelinerun/controller.go index df3e5b65ac6..8150f673987 100644 --- a/pkg/reconciler/pipelinerun/controller.go +++ b/pkg/reconciler/pipelinerun/controller.go @@ -41,6 +41,7 @@ import ( kubeclient "knative.dev/pkg/client/injection/kube/client" "knative.dev/pkg/configmap" "knative.dev/pkg/controller" + secretinformer "knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret" "knative.dev/pkg/logging" ) @@ -56,6 +57,7 @@ func NewController(opts *pipeline.Options, clock clock.PassiveClock) func(contex resourceInformer := resourceinformer.Get(ctx) resolutionInformer := resolutioninformer.Get(ctx) runInformer := runinformer.Get(ctx) + secretinformer := secretinformer.Get(ctx) verificationpolicyInformer := verificationpolicyinformer.Get(ctx) configStore := config.NewStore(logger.Named("config-store"), pipelinerunmetrics.MetricsOnStore(logger)) configStore.WatchConfigs(cmw) @@ -70,6 +72,7 @@ func NewController(opts *pipeline.Options, clock clock.PassiveClock) func(contex customRunLister: customRunInformer.Lister(), runLister: runInformer.Lister(), resourceLister: resourceInformer.Lister(), + secretLister: secretinformer.Lister(), verificationPolicyLister: verificationpolicyInformer.Lister(), cloudEventClient: cloudeventclient.Get(ctx), metrics: pipelinerunmetrics.Get(ctx), diff --git a/pkg/reconciler/pipelinerun/pipelinerun.go b/pkg/reconciler/pipelinerun/pipelinerun.go index 343a6242366..62b1cea91af 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun.go +++ b/pkg/reconciler/pipelinerun/pipelinerun.go @@ -65,6 +65,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/client-go/kubernetes" + corev1Listers "k8s.io/client-go/listers/core/v1" "k8s.io/utils/clock" "knative.dev/pkg/apis" "knative.dev/pkg/controller" @@ -145,6 +146,7 @@ type Reconciler struct { customRunLister listers.CustomRunLister runLister alpha1listers.RunLister resourceLister resourcelisters.PipelineResourceLister + secretLister corev1Listers.SecretLister verificationPolicyLister alpha1listers.VerificationPolicyLister cloudEventClient cloudevent.CEClient metrics *pipelinerunmetrics.Recorder @@ -191,7 +193,19 @@ func (c *Reconciler) ReconcileKind(ctx context.Context, pr *v1beta1.PipelineRun) if err != nil { return fmt.Errorf("failed to list VerificationPolicies from namespace %s with error %v", pr.Namespace, err) } - getPipelineFunc := resources.GetVerifiedPipelineFunc(ctx, c.KubeClientSet, c.PipelineClientSet, c.resolutionRequester, pr, vp) + getSecretFunc := func(namespace, name string) (*corev1.Secret, error) { + secrets, err := c.secretLister.Secrets(namespace).List(labels.Everything()) + if err != nil { + return nil, fmt.Errorf("failed to list secrets:%v", err) + } + for _, s := range secrets { + if s.Name == name { + return s, nil + } + } + return nil, fmt.Errorf("failed to find secret:%v in namespace: %v", name, namespace) + } + getPipelineFunc := resources.GetVerifiedPipelineFunc(ctx, c.KubeClientSet, c.PipelineClientSet, c.resolutionRequester, pr, vp, getSecretFunc) if pr.IsDone() { pr.SetDefaults(ctx) @@ -322,8 +336,19 @@ func (c *Reconciler) resolvePipelineState( if err != nil { return nil, fmt.Errorf("failed to list VerificationPolicies from namespace %s with error %v", pr.Namespace, err) } - - fn := tresources.GetVerifiedTaskFunc(ctx, c.KubeClientSet, c.PipelineClientSet, c.resolutionRequester, pr, task.TaskRef, trName, pr.Namespace, pr.Spec.ServiceAccountName, vp) + getSecretFunc := func(namespace, name string) (*corev1.Secret, error) { + secrets, err := c.secretLister.Secrets(namespace).List(labels.Everything()) + if err != nil { + return nil, fmt.Errorf("failed to list secrets:%v", err) + } + for _, s := range secrets { + if s.Name == name { + return s, nil + } + } + return nil, fmt.Errorf("failed to find secret:%v in namespace: %v", name, namespace) + } + fn := tresources.GetVerifiedTaskFunc(ctx, c.KubeClientSet, c.PipelineClientSet, c.resolutionRequester, pr, task.TaskRef, trName, pr.Namespace, pr.Spec.ServiceAccountName, vp, getSecretFunc) getRunObjectFunc := func(name string) (v1beta1.RunObject, error) { r, err := c.customRunLister.CustomRuns(pr.Namespace).Get(name) diff --git a/pkg/reconciler/pipelinerun/resources/pipelineref.go b/pkg/reconciler/pipelinerun/resources/pipelineref.go index 755428bae99..15bd8ddac74 100644 --- a/pkg/reconciler/pipelinerun/resources/pipelineref.go +++ b/pkg/reconciler/pipelinerun/resources/pipelineref.go @@ -32,6 +32,7 @@ import ( "github.com/tektoncd/pipeline/pkg/remote/resolution" remoteresource "github.com/tektoncd/pipeline/pkg/resolution/resource" "github.com/tektoncd/pipeline/pkg/trustedresources" + "github.com/tektoncd/pipeline/pkg/trustedresources/verifier" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/kubernetes" @@ -101,7 +102,7 @@ func GetPipelineFunc(ctx context.Context, k8s kubernetes.Interface, tekton clien // GetVerifiedPipelineFunc is a wrapper of GetPipelineFunc and return the function to // verify the pipeline if resource-verification-mode is not "skip" -func GetVerifiedPipelineFunc(ctx context.Context, k8s kubernetes.Interface, tekton clientset.Interface, requester remoteresource.Requester, pipelineRun *v1beta1.PipelineRun, verificationpolicies []*v1alpha1.VerificationPolicy) rprp.GetPipeline { +func GetVerifiedPipelineFunc(ctx context.Context, k8s kubernetes.Interface, tekton clientset.Interface, requester remoteresource.Requester, pipelineRun *v1beta1.PipelineRun, verificationpolicies []*v1alpha1.VerificationPolicy, getSecretFunc verifier.GetSecret) rprp.GetPipeline { get := GetPipelineFunc(ctx, k8s, tekton, requester, pipelineRun) return func(context.Context, string) (v1beta1.PipelineObject, *v1beta1.ConfigSource, error) { p, s, err := get(ctx, pipelineRun.Spec.PipelineRef.Name) @@ -118,7 +119,7 @@ func GetVerifiedPipelineFunc(ctx context.Context, k8s kubernetes.Interface, tekt } logger := logging.FromContext(ctx) if config.CheckEnforceResourceVerificationMode(ctx) || config.CheckWarnResourceVerificationMode(ctx) { - if err := trustedresources.VerifyPipeline(ctx, p, k8s, source, verificationpolicies); err != nil { + if err := trustedresources.VerifyPipeline(ctx, p, getSecretFunc, source, verificationpolicies); err != nil { if config.CheckEnforceResourceVerificationMode(ctx) { logger.Errorf("GetVerifiedPipelineFunc failed: %v", err) return nil, nil, fmt.Errorf("GetVerifiedPipelineFunc failed: %w: %v", trustedresources.ErrorResourceVerificationFailed, err) diff --git a/pkg/reconciler/pipelinerun/resources/pipelineref_test.go b/pkg/reconciler/pipelinerun/resources/pipelineref_test.go index 1b3b900032d..35a99679d8d 100644 --- a/pkg/reconciler/pipelinerun/resources/pipelineref_test.go +++ b/pkg/reconciler/pipelinerun/resources/pipelineref_test.go @@ -445,8 +445,10 @@ func TestGetPipelineFunc_RemoteResolutionInvalidData(t *testing.T) { func TestGetVerifiedPipelineFunc_Success(t *testing.T) { ctx := context.Background() tektonclient := fake.NewSimpleClientset() - signer, k8sclient, vps := test.SetupMatchAllVerificationPolicies(t, "trusted-resources") - + signer, secret, vps := test.SetupMatchAllVerificationPolicies(t, "trusted-resources") + getSecretFunc := func(namespace, name string) (*corev1.Secret, error) { + return secret, nil + } unsignedPipeline := test.GetUnsignedPipeline("test-pipeline") unsignedPipelineBytes, err := json.Marshal(unsignedPipeline) if err != nil { @@ -577,7 +579,7 @@ func TestGetVerifiedPipelineFunc_Success(t *testing.T) { for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) { ctx = test.SetupTrustedResourceConfig(ctx, tc.resourceVerificationMode) - fn := resources.GetVerifiedPipelineFunc(ctx, k8sclient, tektonclient, tc.requester, &tc.pipelinerun, vps) + fn := resources.GetVerifiedPipelineFunc(ctx, fakek8s.NewSimpleClientset(), tektonclient, tc.requester, &tc.pipelinerun, vps, getSecretFunc) resolvedPipeline, source, err := fn(ctx, pipelineRef.Name) if err != nil { @@ -596,7 +598,10 @@ func TestGetVerifiedPipelineFunc_Success(t *testing.T) { func TestGetVerifiedPipelineFunc_VerifyError(t *testing.T) { ctx := context.Background() tektonclient := fake.NewSimpleClientset() - signer, k8sclient, vps := test.SetupMatchAllVerificationPolicies(t, "trusted-resources") + signer, secret, vps := test.SetupMatchAllVerificationPolicies(t, "trusted-resources") + getSecretFunc := func(namespace, name string) (*corev1.Secret, error) { + return secret, nil + } unsignedPipeline := test.GetUnsignedPipeline("test-pipeline") unsignedPipelineBytes, err := json.Marshal(unsignedPipeline) @@ -654,7 +659,7 @@ func TestGetVerifiedPipelineFunc_VerifyError(t *testing.T) { ServiceAccountName: "default", }, } - fn := resources.GetVerifiedPipelineFunc(ctx, k8sclient, tektonclient, tc.requester, pr, vps) + fn := resources.GetVerifiedPipelineFunc(ctx, fakek8s.NewSimpleClientset(), tektonclient, tc.requester, pr, vps, getSecretFunc) resolvedPipeline, source, err := fn(ctx, pipelineRef.Name) if !errors.Is(err, tc.expectedErr) { @@ -673,7 +678,10 @@ func TestGetVerifiedPipelineFunc_VerifyError(t *testing.T) { func TestGetVerifiedPipelineFunc_GetFuncError(t *testing.T) { ctx := context.Background() tektonclient := fake.NewSimpleClientset() - _, k8sclient, vps := test.SetupMatchAllVerificationPolicies(t, "trusted-resources") + _, secret, vps := test.SetupMatchAllVerificationPolicies(t, "trusted-resources") + getSecretFunc := func(namespace, name string) (*corev1.Secret, error) { + return secret, nil + } unsignedPipeline := test.GetUnsignedPipeline("test-pipeline") unsignedPipelineBytes, err := json.Marshal(unsignedPipeline) @@ -747,7 +755,7 @@ func TestGetVerifiedPipelineFunc_GetFuncError(t *testing.T) { store.OnConfigChanged(featureflags) ctx = store.ToContext(ctx) - fn := resources.GetVerifiedPipelineFunc(ctx, k8sclient, tektonclient, tc.requester, &tc.pipelinerun, vps) + fn := resources.GetVerifiedPipelineFunc(ctx, fakek8s.NewSimpleClientset(), tektonclient, tc.requester, &tc.pipelinerun, vps, getSecretFunc) _, _, err = fn(ctx, tc.pipelinerun.Spec.PipelineRef.Name) if d := cmp.Diff(err.Error(), tc.expectedErr.Error()); d != "" { diff --git a/pkg/reconciler/taskrun/controller.go b/pkg/reconciler/taskrun/controller.go index a9c7242662e..35e215cb2c3 100644 --- a/pkg/reconciler/taskrun/controller.go +++ b/pkg/reconciler/taskrun/controller.go @@ -41,6 +41,7 @@ import ( filteredpodinformer "knative.dev/pkg/client/injection/kube/informers/core/v1/pod/filtered" "knative.dev/pkg/configmap" "knative.dev/pkg/controller" + secretinformer "knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret" "knative.dev/pkg/logging" ) @@ -54,6 +55,7 @@ func NewController(opts *pipeline.Options, clock clock.PassiveClock) func(contex podInformer := filteredpodinformer.Get(ctx, v1beta1.ManagedByLabelKey) resourceInformer := resourceinformer.Get(ctx) limitrangeInformer := limitrangeinformer.Get(ctx) + secretinformer := secretinformer.Get(ctx) verificationpolicyInformer := verificationpolicyinformer.Get(ctx) resolutionInformer := resolutioninformer.Get(ctx) configStore := config.NewStore(logger.Named("config-store"), taskrunmetrics.MetricsOnStore(logger)) @@ -72,6 +74,7 @@ func NewController(opts *pipeline.Options, clock clock.PassiveClock) func(contex taskRunLister: taskRunInformer.Lister(), resourceLister: resourceInformer.Lister(), limitrangeLister: limitrangeInformer.Lister(), + secretLister: secretinformer.Lister(), verificationPolicyLister: verificationpolicyInformer.Lister(), cloudEventClient: cloudeventclient.Get(ctx), metrics: taskrunmetrics.Get(ctx), diff --git a/pkg/reconciler/taskrun/resources/taskref.go b/pkg/reconciler/taskrun/resources/taskref.go index 4e161a57920..cce1ee1575b 100644 --- a/pkg/reconciler/taskrun/resources/taskref.go +++ b/pkg/reconciler/taskrun/resources/taskref.go @@ -32,6 +32,7 @@ import ( "github.com/tektoncd/pipeline/pkg/remote/resolution" remoteresource "github.com/tektoncd/pipeline/pkg/resolution/resource" "github.com/tektoncd/pipeline/pkg/trustedresources" + "github.com/tektoncd/pipeline/pkg/trustedresources/verifier" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/kubernetes" @@ -58,7 +59,7 @@ func GetTaskKind(taskrun *v1beta1.TaskRun) v1beta1.TaskKind { // also requires a kubeclient, tektonclient, namespace, and service account in case it needs to find that task in // cluster or authorize against an external repositroy. It will figure out whether it needs to look in the cluster or in // a remote image to fetch the reference. It will also return the "kind" of the task being referenced. -func GetTaskFuncFromTaskRun(ctx context.Context, k8s kubernetes.Interface, tekton clientset.Interface, requester remoteresource.Requester, taskrun *v1beta1.TaskRun, verificationpolicies []*v1alpha1.VerificationPolicy) GetTask { +func GetTaskFuncFromTaskRun(ctx context.Context, k8s kubernetes.Interface, tekton clientset.Interface, requester remoteresource.Requester, taskrun *v1beta1.TaskRun, verificationpolicies []*v1alpha1.VerificationPolicy, getSecretFunc verifier.GetSecret) GetTask { // if the spec is already in the status, do not try to fetch it again, just use it as source of truth. // Same for the Source field in the Status.Provenance. if taskrun.Status.TaskSpec != nil { @@ -76,13 +77,13 @@ func GetTaskFuncFromTaskRun(ctx context.Context, k8s kubernetes.Interface, tekto }, configsource, nil } } - return GetVerifiedTaskFunc(ctx, k8s, tekton, requester, taskrun, taskrun.Spec.TaskRef, taskrun.Name, taskrun.Namespace, taskrun.Spec.ServiceAccountName, verificationpolicies) + return GetVerifiedTaskFunc(ctx, k8s, tekton, requester, taskrun, taskrun.Spec.TaskRef, taskrun.Name, taskrun.Namespace, taskrun.Spec.ServiceAccountName, verificationpolicies, getSecretFunc) } // GetVerifiedTaskFunc is a wrapper of GetTaskFunc and return the function to // verify the task if resource-verification-mode is not "skip" func GetVerifiedTaskFunc(ctx context.Context, k8s kubernetes.Interface, tekton clientset.Interface, requester remoteresource.Requester, - owner kmeta.OwnerRefable, taskref *v1beta1.TaskRef, trName string, namespace, saName string, verificationpolicies []*v1alpha1.VerificationPolicy) GetTask { + owner kmeta.OwnerRefable, taskref *v1beta1.TaskRef, trName string, namespace, saName string, verificationpolicies []*v1alpha1.VerificationPolicy, getSecretFunc verifier.GetSecret) GetTask { get := GetTaskFunc(ctx, k8s, tekton, requester, owner, taskref, trName, namespace, saName) return func(context.Context, string) (v1beta1.TaskObject, *v1beta1.ConfigSource, error) { @@ -96,7 +97,7 @@ func GetVerifiedTaskFunc(ctx context.Context, k8s kubernetes.Interface, tekton c } logger := logging.FromContext(ctx) if config.CheckEnforceResourceVerificationMode(ctx) || config.CheckWarnResourceVerificationMode(ctx) { - if err := trustedresources.VerifyTask(ctx, t, k8s, source, verificationpolicies); err != nil { + if err := trustedresources.VerifyTask(ctx, t, getSecretFunc, source, verificationpolicies); err != nil { if config.CheckEnforceResourceVerificationMode(ctx) { logger.Errorf("GetVerifiedTaskFunc failed: %v", err) return nil, nil, fmt.Errorf("GetVerifiedTaskFunc failed: %w: %v", trustedresources.ErrorResourceVerificationFailed, err) diff --git a/pkg/reconciler/taskrun/resources/taskref_test.go b/pkg/reconciler/taskrun/resources/taskref_test.go index 464985f8a89..1fb395f3de5 100644 --- a/pkg/reconciler/taskrun/resources/taskref_test.go +++ b/pkg/reconciler/taskrun/resources/taskref_test.go @@ -515,7 +515,7 @@ echo hello Spec: TaskSpec, } - fn := resources.GetTaskFuncFromTaskRun(ctx, kubeclient, tektonclient, nil, TaskRun, []*v1alpha1.VerificationPolicy{}) + fn := resources.GetTaskFuncFromTaskRun(ctx, kubeclient, tektonclient, nil, TaskRun, []*v1alpha1.VerificationPolicy{}, func(namespace, name string) (*corev1.Secret, error) { return nil, nil }) actualTask, actualConfigSource, err := fn(ctx, name) if err != nil { @@ -693,7 +693,10 @@ func TestGetPipelineFunc_RemoteResolutionInvalidData(t *testing.T) { func TestGetVerifiedTaskFunc_Success(t *testing.T) { ctx := context.Background() - signer, k8sclient, vps := test.SetupMatchAllVerificationPolicies(t, "trusted-resources") + signer, secret, vps := test.SetupMatchAllVerificationPolicies(t, "trusted-resources") + getSecretFunc := func(namespace, name string) (*corev1.Secret, error) { + return secret, nil + } tektonclient := fake.NewSimpleClientset() unsignedTask := test.GetUnsignedTask("test-task") @@ -780,7 +783,7 @@ func TestGetVerifiedTaskFunc_Success(t *testing.T) { ServiceAccountName: "default", }, } - fn := resources.GetVerifiedTaskFunc(ctx, k8sclient, tektonclient, tc.requester, tr, tr.Spec.TaskRef, "", "default", "default", vps) + fn := resources.GetVerifiedTaskFunc(ctx, fakek8s.NewSimpleClientset(), tektonclient, tc.requester, tr, tr.Spec.TaskRef, "", "default", "default", vps, getSecretFunc) resolvedTask, source, err := fn(ctx, taskRef.Name) @@ -801,7 +804,10 @@ func TestGetVerifiedTaskFunc_Success(t *testing.T) { func TestGetVerifiedTaskFunc_VerifyError(t *testing.T) { ctx := context.Background() - signer, k8sclient, vps := test.SetupMatchAllVerificationPolicies(t, "trusted-resources") + signer, secret, vps := test.SetupMatchAllVerificationPolicies(t, "trusted-resources") + getSecretFunc := func(namespace, name string) (*corev1.Secret, error) { + return secret, nil + } tektonclient := fake.NewSimpleClientset() unsignedTask := test.GetUnsignedTask("test-task") @@ -859,7 +865,7 @@ func TestGetVerifiedTaskFunc_VerifyError(t *testing.T) { ServiceAccountName: "default", }, } - fn := resources.GetVerifiedTaskFunc(ctx, k8sclient, tektonclient, tc.requester, tr, tr.Spec.TaskRef, "", "default", "default", vps) + fn := resources.GetVerifiedTaskFunc(ctx, fakek8s.NewSimpleClientset(), tektonclient, tc.requester, tr, tr.Spec.TaskRef, "", "default", "default", vps, getSecretFunc) resolvedTask, source, err := fn(ctx, taskRef.Name) @@ -880,7 +886,10 @@ func TestGetVerifiedTaskFunc_VerifyError(t *testing.T) { func TestGetVerifiedTaskFunc_GetFuncError(t *testing.T) { ctx := context.Background() - _, k8sclient, vps := test.SetupMatchAllVerificationPolicies(t, "trusted-resources") + _, secret, vps := test.SetupMatchAllVerificationPolicies(t, "trusted-resources") + getSecretFunc := func(namespace, name string) (*corev1.Secret, error) { + return secret, nil + } tektonclient := fake.NewSimpleClientset() unsignedTask := test.GetUnsignedTask("test-task") @@ -955,7 +964,7 @@ func TestGetVerifiedTaskFunc_GetFuncError(t *testing.T) { store.OnConfigChanged(featureflags) ctx = store.ToContext(ctx) - fn := resources.GetVerifiedTaskFunc(ctx, k8sclient, tektonclient, tc.requester, &tc.taskrun, tc.taskrun.Spec.TaskRef, "", "default", "default", vps) + fn := resources.GetVerifiedTaskFunc(ctx, fakek8s.NewSimpleClientset(), tektonclient, tc.requester, &tc.taskrun, tc.taskrun.Spec.TaskRef, "", "default", "default", vps, getSecretFunc) _, _, err = fn(ctx, tc.taskrun.Spec.TaskRef.Name) diff --git a/pkg/reconciler/taskrun/taskrun.go b/pkg/reconciler/taskrun/taskrun.go index 94f80eca6be..b5266c47160 100644 --- a/pkg/reconciler/taskrun/taskrun.go +++ b/pkg/reconciler/taskrun/taskrun.go @@ -82,6 +82,7 @@ type Reconciler struct { resourceLister resourcelisters.PipelineResourceLister limitrangeLister corev1Listers.LimitRangeLister podLister corev1Listers.PodLister + secretLister corev1Listers.SecretLister verificationPolicyLister alphalisters.VerificationPolicyLister cloudEventClient cloudevent.CEClient entrypointCache podconvert.EntrypointCache @@ -334,7 +335,19 @@ func (c *Reconciler) prepare(ctx context.Context, tr *v1beta1.TaskRun) (*v1beta1 return nil, nil, fmt.Errorf("failed to list VerificationPolicies from namespace %s with error %v", tr.Namespace, err) } } - getTaskfunc := resources.GetTaskFuncFromTaskRun(ctx, c.KubeClientSet, c.PipelineClientSet, c.resolutionRequester, tr, verificationpolicies) + getSecretFunc := func(namespace, name string) (*corev1.Secret, error) { + secrets, err := c.secretLister.Secrets(namespace).List(labels.Everything()) + if err != nil { + return nil, fmt.Errorf("failed to list secrets:%v", err) + } + for _, s := range secrets { + if s.Name == name { + return s, nil + } + } + return nil, fmt.Errorf("failed to find secret:%v in namespace: %v", name, namespace) + } + getTaskfunc := resources.GetTaskFuncFromTaskRun(ctx, c.KubeClientSet, c.PipelineClientSet, c.resolutionRequester, tr, verificationpolicies, getSecretFunc) taskMeta, taskSpec, err := resources.GetTaskData(ctx, tr, getTaskfunc) switch { diff --git a/pkg/status/status_test.go b/pkg/status/status_test.go index ac964ea579d..da5ced06dfb 100644 --- a/pkg/status/status_test.go +++ b/pkg/status/status_test.go @@ -31,6 +31,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "knative.dev/pkg/apis" duckv1 "knative.dev/pkg/apis/duck/v1" + _ "knative.dev/pkg/system/testing" "sigs.k8s.io/yaml" ) diff --git a/pkg/trustedresources/verifier/verifier.go b/pkg/trustedresources/verifier/verifier.go index 0608db5881c..a8a031f8e64 100644 --- a/pkg/trustedresources/verifier/verifier.go +++ b/pkg/trustedresources/verifier/verifier.go @@ -28,9 +28,8 @@ import ( "github.com/sigstore/sigstore/pkg/signature" "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + corev1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes" ) const ( @@ -38,15 +37,17 @@ const ( keyReference = "k8s://" ) -// FromConfigMap get all verifiers from configmap, k8s is provided to fetch secret from cluster -func FromConfigMap(ctx context.Context, k8s kubernetes.Interface) ([]signature.Verifier, error) { +type GetSecret func(namespace, name string) (*corev1.Secret, error) + +// FromConfigMap get all verifiers from configmap, getSecretFunc is provided to fetch secret from secret lister +func FromConfigMap(ctx context.Context, getSecretFunc GetSecret) ([]signature.Verifier, error) { cfg := config.FromContextOrDefaults(ctx) verifiers := []signature.Verifier{} for key := range cfg.TrustedResources.Keys { if key == "" { continue } - v, err := fromKeyRef(ctx, key, crypto.SHA256, k8s) + v, err := fromKeyRef(ctx, key, crypto.SHA256, getSecretFunc) if err != nil { return nil, fmt.Errorf("failed to get verifier from keyref: %w", err) } @@ -61,7 +62,7 @@ func FromConfigMap(ctx context.Context, k8s kubernetes.Interface) ([]signature.V // FromPolicy get all verifiers from VerificationPolicy. // For each policy, loop the Authorities of the VerificationPolicy to fetch public key // from either inline Data or from a SecretRef. -func FromPolicy(ctx context.Context, k8s kubernetes.Interface, policy *v1alpha1.VerificationPolicy) ([]signature.Verifier, error) { +func FromPolicy(ctx context.Context, getSecretFunc GetSecret, policy *v1alpha1.VerificationPolicy) ([]signature.Verifier, error) { verifiers := []signature.Verifier{} for _, a := range policy.Spec.Authorities { algorithm, err := matchHashAlgorithm(a.Key.HashAlgorithm) @@ -78,7 +79,7 @@ func FromPolicy(ctx context.Context, k8s kubernetes.Interface, policy *v1alpha1. } verifiers = append(verifiers, v) } else if a.Key.SecretRef != nil { - v, err := fromSecret(ctx, fmt.Sprintf("%s%s/%s", keyReference, a.Key.SecretRef.Namespace, a.Key.SecretRef.Name), algorithm, k8s) + v, err := fromSecret(ctx, fmt.Sprintf("%s%s/%s", keyReference, a.Key.SecretRef.Namespace, a.Key.SecretRef.Name), algorithm, getSecretFunc) if err != nil { return nil, fmt.Errorf("failed to get verifier from secret: %w", err) } @@ -94,10 +95,10 @@ func FromPolicy(ctx context.Context, k8s kubernetes.Interface, policy *v1alpha1. // fromKeyRef parses the given keyRef, loads the key and returns an appropriate // verifier using the provided hash algorithm -func fromKeyRef(ctx context.Context, keyRef string, hashAlgorithm crypto.Hash, k8s kubernetes.Interface) (signature.Verifier, error) { +func fromKeyRef(ctx context.Context, keyRef string, hashAlgorithm crypto.Hash, getSecretFunc GetSecret) (signature.Verifier, error) { var raw []byte if strings.HasPrefix(keyRef, keyReference) { - v, err := fromSecret(ctx, keyRef, hashAlgorithm, k8s) + v, err := fromSecret(ctx, keyRef, hashAlgorithm, getSecretFunc) if err != nil { return nil, fmt.Errorf("failed to get verifier from secret: %w", err) } @@ -116,9 +117,9 @@ func fromKeyRef(ctx context.Context, keyRef string, hashAlgorithm crypto.Hash, k // fromSecret fetches the public key from SecretRef and returns the verifier // hashAlgorithm is provided to determine the hash algorithm of the key -func fromSecret(ctx context.Context, secretRef string, hashAlgorithm crypto.Hash, k8s kubernetes.Interface) (signature.Verifier, error) { +func fromSecret(ctx context.Context, secretRef string, hashAlgorithm crypto.Hash, getSecretFunc GetSecret) (signature.Verifier, error) { if strings.HasPrefix(secretRef, keyReference) { - s, err := getKeyPairSecret(ctx, secretRef, k8s) + s, err := getKeyPairSecret(ctx, secretRef, getSecretFunc) if err != nil { return nil, fmt.Errorf("failed to get secret: %w", err) } @@ -154,14 +155,14 @@ func fromData(raw []byte, hashAlgorithm crypto.Hash) (signature.Verifier, error) } // getKeyPairSecret fetches the secret from a k8sRef -func getKeyPairSecret(ctx context.Context, k8sRef string, k8s kubernetes.Interface) (*v1.Secret, error) { +func getKeyPairSecret(ctx context.Context, k8sRef string, getSecretFunc GetSecret) (*v1.Secret, error) { split := strings.Split(strings.TrimPrefix(k8sRef, keyReference), "/") if len(split) != 2 { return nil, ErrorK8sSpecificationInvalid } namespace, name := split[0], split[1] - s, err := k8s.CoreV1().Secrets(namespace).Get(ctx, name, metav1.GetOptions{}) + s, err := getSecretFunc(namespace, name) if err != nil { return nil, fmt.Errorf("%w: %v", ErrorSecretNotFound, err) } diff --git a/pkg/trustedresources/verifier/verifier_test.go b/pkg/trustedresources/verifier/verifier_test.go index 204c6c6bb0e..8bd68544881 100644 --- a/pkg/trustedresources/verifier/verifier_test.go +++ b/pkg/trustedresources/verifier/verifier_test.go @@ -30,20 +30,24 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" "github.com/tektoncd/pipeline/test" "github.com/tektoncd/pipeline/test/diff" + corev1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - fakek8s "k8s.io/client-go/kubernetes/fake" ) const ( namespace = "trusted-resources" ) +var ( + emptyGetSecretFunc = func(namespace, name string) (*corev1.Secret, error) { return nil, nil } +) + func TestFromConfigMap_Success(t *testing.T) { ctx := context.Background() keys, keypath := test.GetKeysFromFile(ctx, t) ctx = test.SetupTrustedResourceKeyConfig(ctx, keypath, config.EnforceResourceVerificationMode) - v, err := FromConfigMap(ctx, fakek8s.NewSimpleClientset()) + v, err := FromConfigMap(ctx, emptyGetSecretFunc) checkVerifier(t, keys, v[0]) if err != nil { t.Errorf("couldn't construct expected verifier from config map: %v", err) @@ -67,7 +71,7 @@ func TestFromConfigMap_Error(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { ctx := test.SetupTrustedResourceKeyConfig(context.Background(), tc.keyPath, config.EnforceResourceVerificationMode) - _, err := FromConfigMap(ctx, fakek8s.NewSimpleClientset()) + _, err := FromConfigMap(ctx, emptyGetSecretFunc) if !errors.Is(err, tc.expectedError) { t.Errorf("FromConfigMap got: %v, want: %v", err, tc.expectedError) } @@ -78,7 +82,10 @@ func TestFromConfigMap_Error(t *testing.T) { func TestFromPolicy_Success(t *testing.T) { ctx := context.Background() - _, keys, k8sclient, vps := test.SetupVerificationPolicies(t) + _, keys, secret, vps := test.SetupVerificationPolicies(t) + getSecretFunc := func(namespace, name string) (*corev1.Secret, error) { + return secret, nil + } tcs := []struct { name string policy *v1alpha1.VerificationPolicy @@ -91,7 +98,7 @@ func TestFromPolicy_Success(t *testing.T) { }} for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { - verifiers, err := FromPolicy(ctx, k8sclient, tc.policy) + verifiers, err := FromPolicy(ctx, getSecretFunc, tc.policy) for _, v := range verifiers { checkVerifier(t, keys, v) } @@ -177,7 +184,10 @@ func TestFromPolicy_Error(t *testing.T) { }} for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { - _, err := FromPolicy(context.Background(), fakek8s.NewSimpleClientset(), tc.policy) + getErrorSecretFunc := func(namespace, name string) (*corev1.Secret, error) { + return nil, ErrorSecretNotFound + } + _, err := FromPolicy(context.Background(), getErrorSecretFunc, tc.policy) if !errors.Is(err, tc.expectedError) { t.Errorf("FromPolicy got: %v, want: %v", err, tc.expectedError) } @@ -193,7 +203,7 @@ func TestFromKeyRef_Success(t *testing.T) { if err != nil { t.Fatalf("failed to generate keys: %v", err) } - secretData := &v1.Secret{ + secret := &v1.Secret{ Data: map[string][]byte{ "data": pub, }, @@ -201,7 +211,9 @@ func TestFromKeyRef_Success(t *testing.T) { Name: "secret", Namespace: namespace}} - k8sclient := fakek8s.NewSimpleClientset(secretData) + getSecretFunc := func(namespace, name string) (*corev1.Secret, error) { + return secret, nil + } tcs := []struct { name string @@ -218,7 +230,7 @@ func TestFromKeyRef_Success(t *testing.T) { }} for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { - verifier, err := fromKeyRef(ctx, tc.keyref, crypto.SHA256, k8sclient) + verifier, err := fromKeyRef(ctx, tc.keyref, crypto.SHA256, getSecretFunc) checkVerifier(t, tc.key, verifier) if err != nil { t.Errorf("couldn't construct expected verifier from keyref: %v", err) @@ -253,7 +265,10 @@ func TestFromKeyRef_Error(t *testing.T) { }} for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { - _, err := fromKeyRef(ctx, tc.keyref, tc.algorithm, fakek8s.NewSimpleClientset()) + getSecretFunc := func(namespace, name string) (*corev1.Secret, error) { + return nil, ErrorSecretNotFound + } + _, err := fromKeyRef(ctx, tc.keyref, tc.algorithm, getSecretFunc) if !errors.Is(err, tc.expectedError) { t.Errorf("fromKeyRef got: %v, want: %v", err, tc.expectedError) } @@ -266,17 +281,18 @@ func TestFromSecret_Success(t *testing.T) { if err != nil { t.Fatalf("failed to generate keys: %v", err) } - secretData := &v1.Secret{ + secret := &v1.Secret{ Data: map[string][]byte{ "data": pub, }, ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: namespace}} + getSecretFunc := func(namespace, name string) (*corev1.Secret, error) { + return secret, nil + } - k8sclient := fakek8s.NewSimpleClientset(secretData) - - v, err := fromSecret(context.Background(), fmt.Sprintf("k8s://%s/secret", namespace), crypto.SHA256, k8sclient) + v, err := fromSecret(context.Background(), fmt.Sprintf("k8s://%s/secret", namespace), crypto.SHA256, getSecretFunc) checkVerifier(t, keys, v) if err != nil { t.Errorf("couldn't construct expected verifier from secret: %v", err) @@ -284,44 +300,42 @@ func TestFromSecret_Success(t *testing.T) { } func TestFromSecret_Error(t *testing.T) { - secretNoData := &v1.Secret{ - Data: map[string][]byte{}, - ObjectMeta: metav1.ObjectMeta{ - Name: "empty-secret", - Namespace: namespace}} - secretMultipleData := &v1.Secret{ - Data: map[string][]byte{ - "data1": []byte("key"), - "data2": []byte("key"), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: "multiple-data-secret", - Namespace: namespace}} - secretInvalidData := &v1.Secret{ - Data: map[string][]byte{ - "data1": []byte("key"), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: "invalid-data-secret", - Namespace: namespace}} - - k8sclient := fakek8s.NewSimpleClientset(secretNoData, secretMultipleData, secretInvalidData) - tcs := []struct { name string secretref string + secret *v1.Secret expectedError error }{{ - name: "no data in secret", - secretref: fmt.Sprintf("k8s://%s/empty-secret", namespace), + name: "no data in secret", + secretref: fmt.Sprintf("k8s://%s/empty-secret", namespace), + secret: &v1.Secret{ + Data: map[string][]byte{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "empty-secret", + Namespace: namespace}}, expectedError: ErrorEmptySecretData, }, { - name: "multiple data in secret", - secretref: fmt.Sprintf("k8s://%s/multiple-data-secret", namespace), + name: "multiple data in secret", + secretref: fmt.Sprintf("k8s://%s/multiple-data-secret", namespace), + secret: &v1.Secret{ + Data: map[string][]byte{ + "data1": []byte("key"), + "data2": []byte("key"), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "multiple-data-secret", + Namespace: namespace}}, expectedError: ErrorMultipleSecretData, }, { - name: "invalid data in secret", - secretref: fmt.Sprintf("k8s://%s/invalid-data-secret", namespace), + name: "invalid data in secret", + secretref: fmt.Sprintf("k8s://%s/invalid-data-secret", namespace), + secret: &v1.Secret{ + Data: map[string][]byte{ + "data1": []byte("key"), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "invalid-data-secret", + Namespace: namespace}}, expectedError: ErrorDecodeKey, }, { name: "invalid secretref", @@ -338,7 +352,13 @@ func TestFromSecret_Error(t *testing.T) { }} for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { - _, err := fromSecret(context.Background(), tc.secretref, crypto.SHA256, k8sclient) + getSecretFunc := func(namespace, name string) (*corev1.Secret, error) { + if tc.secret != nil { + return tc.secret, nil + } + return nil, ErrorSecretNotFound + } + _, err := fromSecret(context.Background(), tc.secretref, crypto.SHA256, getSecretFunc) if !errors.Is(err, tc.expectedError) { t.Errorf("FromSecret got: %v, want: %v", err, tc.expectedError) } diff --git a/pkg/trustedresources/verify.go b/pkg/trustedresources/verify.go index 8606f6877f3..ab1ed27ad40 100644 --- a/pkg/trustedresources/verify.go +++ b/pkg/trustedresources/verify.go @@ -31,7 +31,6 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/trustedresources/verifier" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes" ) const ( @@ -41,7 +40,7 @@ const ( // VerifyTask verifies the signature and public key against task. // source is from ConfigSource.URI, which will be used to match policy patterns. k8s is used to fetch secret from cluster -func VerifyTask(ctx context.Context, taskObj v1beta1.TaskObject, k8s kubernetes.Interface, source string, policies []*v1alpha1.VerificationPolicy) error { +func VerifyTask(ctx context.Context, taskObj v1beta1.TaskObject, getSecretFunc verifier.GetSecret, source string, policies []*v1alpha1.VerificationPolicy) error { tm, signature, err := prepareObjectMeta(taskObj.TaskMetadata()) if err != nil { return err @@ -54,12 +53,12 @@ func VerifyTask(ctx context.Context, taskObj v1beta1.TaskObject, k8s kubernetes. Spec: taskObj.TaskSpec(), } - return verifyResource(ctx, &task, k8s, signature, source, policies) + return verifyResource(ctx, &task, getSecretFunc, signature, source, policies) } // VerifyPipeline verifies the signature and public key against pipeline. // source is from ConfigSource.URI, which will be used to match policy patterns, k8s is used to fetch secret from cluster -func VerifyPipeline(ctx context.Context, pipelineObj v1beta1.PipelineObject, k8s kubernetes.Interface, source string, policies []*v1alpha1.VerificationPolicy) error { +func VerifyPipeline(ctx context.Context, pipelineObj v1beta1.PipelineObject, getSecretFunc verifier.GetSecret, source string, policies []*v1alpha1.VerificationPolicy) error { pm, signature, err := prepareObjectMeta(pipelineObj.PipelineMetadata()) if err != nil { return err @@ -72,7 +71,7 @@ func VerifyPipeline(ctx context.Context, pipelineObj v1beta1.PipelineObject, k8s Spec: pipelineObj.PipelineSpec(), } - return verifyResource(ctx, &pipeline, k8s, signature, source, policies) + return verifyResource(ctx, &pipeline, getSecretFunc, signature, source, policies) } // verifyResource verifies resource which implements metav1.Object by provided signature and public keys from configmap or policies. @@ -81,8 +80,8 @@ func VerifyPipeline(ctx context.Context, pipelineObj v1beta1.PipelineObject, k8s // 1. For each policy, check if the resource url is matching any of the `patterns` in the `resources` list. If matched then this policy will be used for verification. // 2. If multiple policies are matched, the resource needs to pass all of them to pass verification. // 3. To pass one policy, the resource can pass any public keys in the policy. -func verifyResource(ctx context.Context, resource metav1.Object, k8s kubernetes.Interface, signature []byte, source string, policies []*v1alpha1.VerificationPolicy) error { - verifiers, err := verifier.FromConfigMap(ctx, k8s) +func verifyResource(ctx context.Context, resource metav1.Object, getSecretFunc verifier.GetSecret, signature []byte, source string, policies []*v1alpha1.VerificationPolicy) error { + verifiers, err := verifier.FromConfigMap(ctx, getSecretFunc) if err != nil && !errors.Is(err, verifier.ErrorEmptyPublicKeys) { return fmt.Errorf("failed to get verifiers from configmap: %w", err) } @@ -119,7 +118,7 @@ func verifyResource(ctx context.Context, resource metav1.Object, k8s kubernetes. for _, p := range matchedPolicies { passVerification := false - verifiers, err := verifier.FromPolicy(ctx, k8s, p) + verifiers, err := verifier.FromPolicy(ctx, getSecretFunc, p) if err != nil { return fmt.Errorf("failed to get verifiers from policy: %w", err) } diff --git a/pkg/trustedresources/verify_test.go b/pkg/trustedresources/verify_test.go index 040abbb68fc..7bb36ae97e9 100644 --- a/pkg/trustedresources/verify_test.go +++ b/pkg/trustedresources/verify_test.go @@ -31,6 +31,7 @@ import ( test "github.com/tektoncd/pipeline/test" "github.com/tektoncd/pipeline/test/diff" "go.uber.org/zap/zaptest" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/logging" ) @@ -198,7 +199,10 @@ func TestVerifyTask_Configmap_Error(t *testing.T) { func TestVerifyTask_VerificationPolicy_Success(t *testing.T) { ctx := logging.WithLogger(context.Background(), zaptest.NewLogger(t).Sugar()) ctx = test.SetupTrustedResourceConfig(ctx, config.EnforceResourceVerificationMode) - sv, _, k8sclient, vps := test.SetupVerificationPolicies(t) + sv, _, secret, vps := test.SetupVerificationPolicies(t) + getSecretFunc := func(namespace, name string) (*v1.Secret, error) { + return secret, nil + } unsignedTask := test.GetUnsignedTask("test-task") @@ -223,7 +227,7 @@ func TestVerifyTask_VerificationPolicy_Success(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { - err := VerifyTask(ctx, tc.task, k8sclient, tc.source, vps) + err := VerifyTask(ctx, tc.task, getSecretFunc, tc.source, vps) if err != nil { t.Fatalf("VerifyTask() get err %v", err) } @@ -234,7 +238,10 @@ func TestVerifyTask_VerificationPolicy_Success(t *testing.T) { func TestVerifyTask_VerificationPolicy_Error(t *testing.T) { ctx := logging.WithLogger(context.Background(), zaptest.NewLogger(t).Sugar()) ctx = test.SetupTrustedResourceConfig(ctx, config.EnforceResourceVerificationMode) - sv, _, k8sclient, vps := test.SetupVerificationPolicies(t) + sv, _, secret, vps := test.SetupVerificationPolicies(t) + getSecretFunc := func(namespace, name string) (*v1.Secret, error) { + return secret, nil + } unsignedTask := test.GetUnsignedTask("test-task") @@ -315,7 +322,7 @@ func TestVerifyTask_VerificationPolicy_Error(t *testing.T) { }} for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { - err := VerifyTask(ctx, tc.task, k8sclient, tc.source, tc.verificationPolicy) + err := VerifyTask(ctx, tc.task, getSecretFunc, tc.source, tc.verificationPolicy) if !errors.Is(err, tc.expectedError) { t.Errorf("VerifyTask got: %v, want: %v", err, tc.expectedError) } @@ -326,7 +333,10 @@ func TestVerifyTask_VerificationPolicy_Error(t *testing.T) { func TestVerifyPipeline_Success(t *testing.T) { ctx := logging.WithLogger(context.Background(), zaptest.NewLogger(t).Sugar()) ctx = test.SetupTrustedResourceConfig(ctx, config.EnforceResourceVerificationMode) - sv, _, k8sclient, vps := test.SetupVerificationPolicies(t) + sv, _, secret, vps := test.SetupVerificationPolicies(t) + getSecretFunc := func(namespace, name string) (*v1.Secret, error) { + return secret, nil + } unsignedPipeline := test.GetUnsignedPipeline("test-pipeline") @@ -350,7 +360,7 @@ func TestVerifyPipeline_Success(t *testing.T) { }} for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { - err := VerifyPipeline(ctx, tc.pipeline, k8sclient, tc.source, vps) + err := VerifyPipeline(ctx, tc.pipeline, getSecretFunc, tc.source, vps) if err != nil { t.Fatalf("VerifyPipeline() get err: %v", err) } @@ -361,7 +371,10 @@ func TestVerifyPipeline_Success(t *testing.T) { func TestVerifyPipeline_Error(t *testing.T) { ctx := logging.WithLogger(context.Background(), zaptest.NewLogger(t).Sugar()) ctx = test.SetupTrustedResourceConfig(ctx, config.EnforceResourceVerificationMode) - sv, _, k8sclient, vps := test.SetupVerificationPolicies(t) + sv, _, secret, vps := test.SetupVerificationPolicies(t) + getSecretFunc := func(namespace, name string) (*v1.Secret, error) { + return secret, nil + } unsignedPipeline := test.GetUnsignedPipeline("test-pipeline") @@ -387,7 +400,7 @@ func TestVerifyPipeline_Error(t *testing.T) { }} for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { - err := VerifyPipeline(ctx, tc.pipeline, k8sclient, tc.source, vps) + err := VerifyPipeline(ctx, tc.pipeline, getSecretFunc, tc.source, vps) if err == nil { t.Fatalf("VerifyPipeline() expects to get err but got nil") } diff --git a/test/controller.go b/test/controller.go index a6fbb9066fe..3e336ed2af1 100644 --- a/test/controller.go +++ b/test/controller.go @@ -56,6 +56,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" coreinformers "k8s.io/client-go/informers/core/v1" + v1 "k8s.io/client-go/informers/core/v1" fakekubeclientset "k8s.io/client-go/kubernetes/fake" ktesting "k8s.io/client-go/testing" "k8s.io/client-go/tools/cache" @@ -66,6 +67,7 @@ import ( fakefilteredpodinformer "knative.dev/pkg/client/injection/kube/informers/core/v1/pod/filtered/fake" fakeserviceaccountinformer "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/fake" "knative.dev/pkg/controller" + fakesecretinformer "knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret/fake" "knative.dev/pkg/system" ) @@ -114,6 +116,7 @@ type Informers struct { ServiceAccount coreinformers.ServiceAccountInformer LimitRange coreinformers.LimitRangeInformer ResolutionRequest resolutioninformersv1alpha1.ResolutionRequestInformer + Secret v1.SecretInformer VerificationPolicy informersv1alpha1.VerificationPolicyInformer } @@ -199,6 +202,7 @@ func SeedTestData(t *testing.T, ctx context.Context, d Data) (Clients, Informers ServiceAccount: fakeserviceaccountinformer.Get(ctx), LimitRange: fakelimitrangeinformer.Get(ctx), ResolutionRequest: fakeresolutionrequestinformer.Get(ctx), + Secret: fakesecretinformer.Get(ctx), VerificationPolicy: fakevewrificationpolicynformer.Get(ctx), } diff --git a/test/trustedresources.go b/test/trustedresources.go index 6c0552a0f48..831cb25978c 100644 --- a/test/trustedresources.go +++ b/test/trustedresources.go @@ -39,7 +39,6 @@ import ( corev1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - fakek8s "k8s.io/client-go/kubernetes/fake" "knative.dev/pkg/logging" ) @@ -142,7 +141,7 @@ func SetupTrustedResourceConfig(ctx context.Context, resourceVerificationMode st // SignerVerifier is returned to sign resources // The k8s clientset is returned to fetch secret from it. // VerificationPolicies are returned to fetch public keys -func SetupVerificationPolicies(t *testing.T) (signature.SignerVerifier, *ecdsa.PrivateKey, *fakek8s.Clientset, []*v1alpha1.VerificationPolicy) { +func SetupVerificationPolicies(t *testing.T) (signature.SignerVerifier, *ecdsa.PrivateKey, *corev1.Secret, []*v1alpha1.VerificationPolicy) { t.Helper() sv, keys, pub, err := GenerateKeys(pass("1234")) if err != nil { @@ -209,16 +208,14 @@ func SetupVerificationPolicies(t *testing.T) (signature.SignerVerifier, *ecdsa.P }, }) - k8sclient := fakek8s.NewSimpleClientset(secret) - - return sv, keys, k8sclient, []*v1alpha1.VerificationPolicy{&keyInDataVp, &keyInSecretVp, &wrongKeyandPatternVp} + return sv, keys, secret, []*v1alpha1.VerificationPolicy{&keyInDataVp, &keyInSecretVp, &wrongKeyandPatternVp} } // SetupMatchAllVerificationPolicies set verification policies with a Pattern to match all resources // SignerVerifier is returned to sign resources // The k8s clientset is returned to fetch secret from it. // VerificationPolicies are returned to fetch public keys -func SetupMatchAllVerificationPolicies(t *testing.T, namespace string) (signature.SignerVerifier, *fakek8s.Clientset, []*v1alpha1.VerificationPolicy) { +func SetupMatchAllVerificationPolicies(t *testing.T, namespace string) (signature.SignerVerifier, *corev1.Secret, []*v1alpha1.VerificationPolicy) { t.Helper() sv, _, pub, err := GenerateKeys(pass("1234")) if err != nil { @@ -247,9 +244,7 @@ func SetupMatchAllVerificationPolicies(t *testing.T, namespace string) (signatur }, }) - k8sclient := fakek8s.NewSimpleClientset(secret) - - return sv, k8sclient, []*v1alpha1.VerificationPolicy{&matchAllVp} + return sv, secret, []*v1alpha1.VerificationPolicy{&matchAllVp} } // GetSignerFromFile generates key files to tmpdir, return signer and pubkey path diff --git a/vendor/k8s.io/gengo/examples/deepcopy-gen/generators/deepcopy.go b/vendor/k8s.io/gengo/examples/deepcopy-gen/generators/deepcopy.go index 03f9109c73a..170f6d7f162 100644 --- a/vendor/k8s.io/gengo/examples/deepcopy-gen/generators/deepcopy.go +++ b/vendor/k8s.io/gengo/examples/deepcopy-gen/generators/deepcopy.go @@ -173,19 +173,25 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat pkgNeedsGeneration := (ptagValue == tagValuePackage) if !pkgNeedsGeneration { // If the pkg-scoped tag did not exist, scan all types for one that - // explicitly wants generation. + // explicitly wants generation. Ensure all types that want generation + // can be copied. + var uncopyable []string for _, t := range pkg.Types { klog.V(5).Infof(" considering type %q", t.Name.String()) ttag := extractEnabledTypeTag(t) if ttag != nil && ttag.value == "true" { klog.V(5).Infof(" tag=true") if !copyableType(t) { - klog.Fatalf("Type %v requests deepcopy generation but is not copyable", t) + uncopyable = append(uncopyable, fmt.Sprintf("%v", t)) + } else { + pkgNeedsGeneration = true } - pkgNeedsGeneration = true - break } } + if len(uncopyable) > 0 { + klog.Fatalf("Types requested deepcopy generation but are not copyable: %s", + strings.Join(uncopyable, ", ")) + } } if pkgNeedsGeneration { diff --git a/vendor/k8s.io/gengo/examples/defaulter-gen/generators/defaulter.go b/vendor/k8s.io/gengo/examples/defaulter-gen/generators/defaulter.go index 220ec7e0d8a..48566aee542 100644 --- a/vendor/k8s.io/gengo/examples/defaulter-gen/generators/defaulter.go +++ b/vendor/k8s.io/gengo/examples/defaulter-gen/generators/defaulter.go @@ -23,6 +23,7 @@ import ( "io" "path/filepath" "reflect" + "regexp" "strconv" "strings" @@ -497,6 +498,23 @@ func mustEnforceDefault(t *types.Type, depth int, omitEmpty bool) (interface{}, } } +var refRE = regexp.MustCompile(`^ref\((?P[^"]+)\)$`) +var refREIdentIndex = refRE.SubexpIndex("reference") + +// parseAsRef looks for strings that match one of the following: +// - ref(Ident) +// - ref(pkgpath.Ident) +// If the input string matches either of these, it will return the (optional) +// pkgpath, the Ident, and true. Otherwise it will return empty strings and +// false. +func parseAsRef(s string) (string, bool) { + matches := refRE.FindStringSubmatch(s) + if len(matches) < refREIdentIndex || matches[refREIdentIndex] == "" { + return "", false + } + return matches[refREIdentIndex], true +} + func populateDefaultValue(node *callNode, t *types.Type, tags string, commentLines []string) *callNode { defaultMap := extractDefaultTag(commentLines) var defaultString string @@ -513,8 +531,12 @@ func populateDefaultValue(node *callNode, t *types.Type, tags string, commentLin } else if len(defaultMap) == 0 { return node } + var symbolReference string var defaultValue interface{} - if err := json.Unmarshal([]byte(defaultString), &defaultValue); err != nil { + if id, ok := parseAsRef(defaultString); ok { + symbolReference = id + defaultString = "" + } else if err := json.Unmarshal([]byte(defaultString), &defaultValue); err != nil { klog.Fatalf("Failed to unmarshal default: %v", err) } @@ -542,7 +564,8 @@ func populateDefaultValue(node *callNode, t *types.Type, tags string, commentLin node.defaultIsPrimitive = t.IsPrimitive() node.defaultType = t.String() - node.defaultValue = defaultString + node.defaultValue.InlineConstant = defaultString + node.defaultValue.SymbolReference = symbolReference node.defaultDepth = depth return node } @@ -668,6 +691,11 @@ const ( conversionPackagePath = "k8s.io/apimachinery/pkg/conversion" ) +type symbolTracker interface { + namer.ImportTracker + AddSymbol(types.Name) +} + // genDefaulter produces a file with a autogenerated conversions. type genDefaulter struct { generator.DefaultGen @@ -676,7 +704,7 @@ type genDefaulter struct { peerPackages []string newDefaulters defaulterFuncMap existingDefaulters defaulterFuncMap - imports namer.ImportTracker + imports symbolTracker typesForInit []*types.Type } @@ -766,6 +794,24 @@ func (g *genDefaulter) GenerateType(c *generator.Context, t *types.Type, w io.Wr } i := 0 callTree.VisitInOrder(func(ancestors []*callNode, current *callNode) { + if len(current.defaultValue.SymbolReference) > 0 { + // If the defaultValue was a reference to a symbol instead of a constant, + // make sure to add it to imports and resolve the name of the symbol + // before generating the defaults. + parsedName := types.ParseFullyQualifiedName(current.defaultValue.SymbolReference) + g.imports.AddSymbol(parsedName) + + // Rewrite the fully qualified name using the local package name + // from the imports + localPackage := g.imports.LocalNameOf(parsedName.Package) + if len(localPackage) > 0 { + current.defaultValue.SymbolReference = localPackage + "." + parsedName.Name + } else { + current.defaultValue.SymbolReference = parsedName.Name + } + + } + if len(current.call) == 0 { return } @@ -795,26 +841,26 @@ func (g *genDefaulter) generateDefaulter(inType *types.Type, callTree *callNode, // how in Go code an access would be performed. For example, if a defaulting function exists on a container // lifecycle hook, to invoke that defaulter correctly would require this Go code: // -// for i := range pod.Spec.Containers { -// o := &pod.Spec.Containers[i] -// if o.LifecycleHook != nil { -// SetDefaults_LifecycleHook(o.LifecycleHook) -// } -// } +// for i := range pod.Spec.Containers { +// o := &pod.Spec.Containers[i] +// if o.LifecycleHook != nil { +// SetDefaults_LifecycleHook(o.LifecycleHook) +// } +// } // // That would be represented by a call tree like: // -// callNode -// field: "Spec" -// children: -// - field: "Containers" -// children: -// - index: true -// children: -// - field: "LifecycleHook" -// elem: true -// call: -// - SetDefaults_LifecycleHook +// callNode +// field: "Spec" +// children: +// - field: "Containers" +// children: +// - index: true +// children: +// - field: "LifecycleHook" +// elem: true +// call: +// - SetDefaults_LifecycleHook // // which we can traverse to build that Go struct (you must call the field Spec, then Containers, then range over // that field, then check whether the LifecycleHook field is nil, before calling SetDefaults_LifecycleHook on @@ -836,7 +882,7 @@ type callNode struct { // defaultValue is the defaultValue of a callNode struct // Only primitive types and pointer types are eligible to have a default value - defaultValue string + defaultValue defaultValue // defaultIsPrimitive is used to determine how to assign the default value. // Primitive types will be directly assigned while complex types will use JSON unmarshalling @@ -862,6 +908,28 @@ type callNode struct { defaultType string } +type defaultValue struct { + // The value was written directly in the marker comment and + // has been parsed as JSON + InlineConstant string + // The name of the symbol relative to the parsed package path + // i.e. k8s.io/pkg.apis.v1.Foo if from another package or simply `Foo` + // if within the same package. + SymbolReference string +} + +func (d defaultValue) IsEmpty() bool { + resolved := d.Resolved() + return resolved == "" +} + +func (d defaultValue) Resolved() string { + if len(d.InlineConstant) > 0 { + return d.InlineConstant + } + return d.SymbolReference +} + // CallNodeVisitorFunc is a function for visiting a call tree. ancestors is the list of all parents // of this node to the root of the tree - will be empty at the root. type CallNodeVisitorFunc func(ancestors []*callNode, node *callNode) @@ -929,11 +997,11 @@ func getTypeZeroValue(t string) (interface{}, error) { } func (n *callNode) writeDefaulter(varName string, index string, isVarPointer bool, sw *generator.SnippetWriter) { - if n.defaultValue == "" { + if n.defaultValue.IsEmpty() { return } args := generator.Args{ - "defaultValue": n.defaultValue, + "defaultValue": n.defaultValue.Resolved(), "varName": varName, "index": index, "varDepth": n.defaultDepth, @@ -1046,7 +1114,7 @@ func (n *callNode) WriteMethod(varName string, depth int, ancestors []*callNode, } sw.Do("}\n", nil) case n.key: - if n.defaultValue != "" { + if !n.defaultValue.IsEmpty() { // Map keys are typed and cannot share the same index variable as arrays and other maps index = index + "_" + ancestors[len(ancestors)-1].field vars["index"] = index diff --git a/vendor/k8s.io/gengo/examples/set-gen/sets/byte.go b/vendor/k8s.io/gengo/examples/set-gen/sets/byte.go index 5d280dd3734..e9660c2f3a9 100644 --- a/vendor/k8s.io/gengo/examples/set-gen/sets/byte.go +++ b/vendor/k8s.io/gengo/examples/set-gen/sets/byte.go @@ -96,15 +96,15 @@ func (s Byte) Clone() Byte { return result } -// Difference returns a set of objects that are not in s2 +// Difference returns a set of objects that are not in s2. // For example: // s1 = {a1, a2, a3} // s2 = {a1, a2, a4, a5} // s1.Difference(s2) = {a3} // s2.Difference(s1) = {a4, a5} -func (s Byte) Difference(s2 Byte) Byte { +func (s1 Byte) Difference(s2 Byte) Byte { result := NewByte() - for key := range s { + for key := range s1 { if !s2.Has(key) { result.Insert(key) } @@ -112,6 +112,16 @@ func (s Byte) Difference(s2 Byte) Byte { return result } +// SymmetricDifference returns a set of elements which are in either of the sets, but not in their intersection. +// For example: +// s1 = {a1, a2, a3} +// s2 = {a1, a2, a4, a5} +// s1.SymmetricDifference(s2) = {a3, a4, a5} +// s2.SymmetricDifference(s1) = {a3, a4, a5} +func (s1 Byte) SymmetricDifference(s2 Byte) Byte { + return s1.Difference(s2).Union(s2.Difference(s1)) +} + // Union returns a new set which includes items in either s1 or s2. // For example: // s1 = {a1, a2} diff --git a/vendor/k8s.io/gengo/examples/set-gen/sets/int.go b/vendor/k8s.io/gengo/examples/set-gen/sets/int.go index f9a79d98164..f614f06e1f9 100644 --- a/vendor/k8s.io/gengo/examples/set-gen/sets/int.go +++ b/vendor/k8s.io/gengo/examples/set-gen/sets/int.go @@ -96,15 +96,15 @@ func (s Int) Clone() Int { return result } -// Difference returns a set of objects that are not in s2 +// Difference returns a set of objects that are not in s2. // For example: // s1 = {a1, a2, a3} // s2 = {a1, a2, a4, a5} // s1.Difference(s2) = {a3} // s2.Difference(s1) = {a4, a5} -func (s Int) Difference(s2 Int) Int { +func (s1 Int) Difference(s2 Int) Int { result := NewInt() - for key := range s { + for key := range s1 { if !s2.Has(key) { result.Insert(key) } @@ -112,6 +112,16 @@ func (s Int) Difference(s2 Int) Int { return result } +// SymmetricDifference returns a set of elements which are in either of the sets, but not in their intersection. +// For example: +// s1 = {a1, a2, a3} +// s2 = {a1, a2, a4, a5} +// s1.SymmetricDifference(s2) = {a3, a4, a5} +// s2.SymmetricDifference(s1) = {a3, a4, a5} +func (s1 Int) SymmetricDifference(s2 Int) Int { + return s1.Difference(s2).Union(s2.Difference(s1)) +} + // Union returns a new set which includes items in either s1 or s2. // For example: // s1 = {a1, a2} diff --git a/vendor/k8s.io/gengo/examples/set-gen/sets/int64.go b/vendor/k8s.io/gengo/examples/set-gen/sets/int64.go index 03ecb5f1faf..995d99bd90d 100644 --- a/vendor/k8s.io/gengo/examples/set-gen/sets/int64.go +++ b/vendor/k8s.io/gengo/examples/set-gen/sets/int64.go @@ -96,15 +96,15 @@ func (s Int64) Clone() Int64 { return result } -// Difference returns a set of objects that are not in s2 +// Difference returns a set of objects that are not in s2. // For example: // s1 = {a1, a2, a3} // s2 = {a1, a2, a4, a5} // s1.Difference(s2) = {a3} // s2.Difference(s1) = {a4, a5} -func (s Int64) Difference(s2 Int64) Int64 { +func (s1 Int64) Difference(s2 Int64) Int64 { result := NewInt64() - for key := range s { + for key := range s1 { if !s2.Has(key) { result.Insert(key) } @@ -112,6 +112,16 @@ func (s Int64) Difference(s2 Int64) Int64 { return result } +// SymmetricDifference returns a set of elements which are in either of the sets, but not in their intersection. +// For example: +// s1 = {a1, a2, a3} +// s2 = {a1, a2, a4, a5} +// s1.SymmetricDifference(s2) = {a3, a4, a5} +// s2.SymmetricDifference(s1) = {a3, a4, a5} +func (s1 Int64) SymmetricDifference(s2 Int64) Int64 { + return s1.Difference(s2).Union(s2.Difference(s1)) +} + // Union returns a new set which includes items in either s1 or s2. // For example: // s1 = {a1, a2} diff --git a/vendor/k8s.io/gengo/examples/set-gen/sets/string.go b/vendor/k8s.io/gengo/examples/set-gen/sets/string.go index 99b4cab3257..4a4a92fd21f 100644 --- a/vendor/k8s.io/gengo/examples/set-gen/sets/string.go +++ b/vendor/k8s.io/gengo/examples/set-gen/sets/string.go @@ -96,15 +96,15 @@ func (s String) Clone() String { return result } -// Difference returns a set of objects that are not in s2 +// Difference returns a set of objects that are not in s2. // For example: // s1 = {a1, a2, a3} // s2 = {a1, a2, a4, a5} // s1.Difference(s2) = {a3} // s2.Difference(s1) = {a4, a5} -func (s String) Difference(s2 String) String { +func (s1 String) Difference(s2 String) String { result := NewString() - for key := range s { + for key := range s1 { if !s2.Has(key) { result.Insert(key) } @@ -112,6 +112,16 @@ func (s String) Difference(s2 String) String { return result } +// SymmetricDifference returns a set of elements which are in either of the sets, but not in their intersection. +// For example: +// s1 = {a1, a2, a3} +// s2 = {a1, a2, a4, a5} +// s1.SymmetricDifference(s2) = {a3, a4, a5} +// s2.SymmetricDifference(s1) = {a3, a4, a5} +func (s1 String) SymmetricDifference(s2 String) String { + return s1.Difference(s2).Union(s2.Difference(s1)) +} + // Union returns a new set which includes items in either s1 or s2. // For example: // s1 = {a1, a2} diff --git a/vendor/k8s.io/gengo/generator/import_tracker.go b/vendor/k8s.io/gengo/generator/import_tracker.go index 60c899ac464..f7c25a01f27 100644 --- a/vendor/k8s.io/gengo/generator/import_tracker.go +++ b/vendor/k8s.io/gengo/generator/import_tracker.go @@ -26,7 +26,7 @@ import ( "k8s.io/gengo/types" ) -func NewImportTracker(typesToAdd ...*types.Type) namer.ImportTracker { +func NewImportTracker(typesToAdd ...*types.Type) *namer.DefaultImportTracker { tracker := namer.NewDefaultImportTracker(types.Name{}) tracker.IsInvalidType = func(*types.Type) bool { return false } tracker.LocalName = func(name types.Name) string { return golangTrackerLocalName(&tracker, name) } diff --git a/vendor/k8s.io/gengo/namer/import_tracker.go b/vendor/k8s.io/gengo/namer/import_tracker.go index 37094b2deb5..2bf1d503f94 100644 --- a/vendor/k8s.io/gengo/namer/import_tracker.go +++ b/vendor/k8s.io/gengo/namer/import_tracker.go @@ -55,6 +55,27 @@ func (tracker *DefaultImportTracker) AddTypes(types ...*types.Type) { tracker.AddType(t) } } +func (tracker *DefaultImportTracker) AddSymbol(symbol types.Name) { + if tracker.local.Package == symbol.Package { + return + } + + if len(symbol.Package) == 0 { + return + } + path := symbol.Path + if len(path) == 0 { + path = symbol.Package + } + if _, ok := tracker.pathToName[path]; ok { + return + } + + name := tracker.LocalName(symbol) + tracker.nameToPath[name] = path + tracker.pathToName[path] = name +} + func (tracker *DefaultImportTracker) AddType(t *types.Type) { if tracker.local.Package == t.Name.Package { return @@ -70,19 +91,7 @@ func (tracker *DefaultImportTracker) AddType(t *types.Type) { return } - if len(t.Name.Package) == 0 { - return - } - path := t.Name.Path - if len(path) == 0 { - path = t.Name.Package - } - if _, ok := tracker.pathToName[path]; ok { - return - } - name := tracker.LocalName(t.Name) - tracker.nameToPath[name] = path - tracker.pathToName[path] = name + tracker.AddSymbol(t.Name) } func (tracker *DefaultImportTracker) ImportLines() []string { diff --git a/vendor/k8s.io/utils/net/port.go b/vendor/k8s.io/utils/net/port.go index 7ac04f0dc98..c012f8903ca 100644 --- a/vendor/k8s.io/utils/net/port.go +++ b/vendor/k8s.io/utils/net/port.go @@ -29,7 +29,7 @@ type IPFamily string // Constants for valid IPFamilys: const ( IPv4 IPFamily = "4" - IPv6 = "6" + IPv6 IPFamily = "6" ) // Protocol is a network protocol support by LocalPort. diff --git a/vendor/k8s.io/utils/pointer/pointer.go b/vendor/k8s.io/utils/pointer/pointer.go index 638e27d419d..b8103223adc 100644 --- a/vendor/k8s.io/utils/pointer/pointer.go +++ b/vendor/k8s.io/utils/pointer/pointer.go @@ -53,6 +53,7 @@ func Int(i int) *int { } // IntPtr is a function variable referring to Int. +// // Deprecated: Use Int instead. var IntPtr = Int // for back-compat @@ -66,6 +67,7 @@ func IntDeref(ptr *int, def int) int { } // IntPtrDerefOr is a function variable referring to IntDeref. +// // Deprecated: Use IntDeref instead. var IntPtrDerefOr = IntDeref // for back-compat @@ -75,6 +77,7 @@ func Int32(i int32) *int32 { } // Int32Ptr is a function variable referring to Int32. +// // Deprecated: Use Int32 instead. var Int32Ptr = Int32 // for back-compat @@ -88,6 +91,7 @@ func Int32Deref(ptr *int32, def int32) int32 { } // Int32PtrDerefOr is a function variable referring to Int32Deref. +// // Deprecated: Use Int32Deref instead. var Int32PtrDerefOr = Int32Deref // for back-compat @@ -109,6 +113,7 @@ func Uint(i uint) *uint { } // UintPtr is a function variable referring to Uint. +// // Deprecated: Use Uint instead. var UintPtr = Uint // for back-compat @@ -122,6 +127,7 @@ func UintDeref(ptr *uint, def uint) uint { } // UintPtrDerefOr is a function variable referring to UintDeref. +// // Deprecated: Use UintDeref instead. var UintPtrDerefOr = UintDeref // for back-compat @@ -131,6 +137,7 @@ func Uint32(i uint32) *uint32 { } // Uint32Ptr is a function variable referring to Uint32. +// // Deprecated: Use Uint32 instead. var Uint32Ptr = Uint32 // for back-compat @@ -144,6 +151,7 @@ func Uint32Deref(ptr *uint32, def uint32) uint32 { } // Uint32PtrDerefOr is a function variable referring to Uint32Deref. +// // Deprecated: Use Uint32Deref instead. var Uint32PtrDerefOr = Uint32Deref // for back-compat @@ -165,6 +173,7 @@ func Int64(i int64) *int64 { } // Int64Ptr is a function variable referring to Int64. +// // Deprecated: Use Int64 instead. var Int64Ptr = Int64 // for back-compat @@ -178,6 +187,7 @@ func Int64Deref(ptr *int64, def int64) int64 { } // Int64PtrDerefOr is a function variable referring to Int64Deref. +// // Deprecated: Use Int64Deref instead. var Int64PtrDerefOr = Int64Deref // for back-compat @@ -199,6 +209,7 @@ func Uint64(i uint64) *uint64 { } // Uint64Ptr is a function variable referring to Uint64. +// // Deprecated: Use Uint64 instead. var Uint64Ptr = Uint64 // for back-compat @@ -212,6 +223,7 @@ func Uint64Deref(ptr *uint64, def uint64) uint64 { } // Uint64PtrDerefOr is a function variable referring to Uint64Deref. +// // Deprecated: Use Uint64Deref instead. var Uint64PtrDerefOr = Uint64Deref // for back-compat @@ -233,6 +245,7 @@ func Bool(b bool) *bool { } // BoolPtr is a function variable referring to Bool. +// // Deprecated: Use Bool instead. var BoolPtr = Bool // for back-compat @@ -246,6 +259,7 @@ func BoolDeref(ptr *bool, def bool) bool { } // BoolPtrDerefOr is a function variable referring to BoolDeref. +// // Deprecated: Use BoolDeref instead. var BoolPtrDerefOr = BoolDeref // for back-compat @@ -267,6 +281,7 @@ func String(s string) *string { } // StringPtr is a function variable referring to String. +// // Deprecated: Use String instead. var StringPtr = String // for back-compat @@ -280,6 +295,7 @@ func StringDeref(ptr *string, def string) string { } // StringPtrDerefOr is a function variable referring to StringDeref. +// // Deprecated: Use StringDeref instead. var StringPtrDerefOr = StringDeref // for back-compat @@ -301,6 +317,7 @@ func Float32(i float32) *float32 { } // Float32Ptr is a function variable referring to Float32. +// // Deprecated: Use Float32 instead. var Float32Ptr = Float32 @@ -314,6 +331,7 @@ func Float32Deref(ptr *float32, def float32) float32 { } // Float32PtrDerefOr is a function variable referring to Float32Deref. +// // Deprecated: Use Float32Deref instead. var Float32PtrDerefOr = Float32Deref // for back-compat @@ -335,6 +353,7 @@ func Float64(i float64) *float64 { } // Float64Ptr is a function variable referring to Float64. +// // Deprecated: Use Float64 instead. var Float64Ptr = Float64 @@ -348,6 +367,7 @@ func Float64Deref(ptr *float64, def float64) float64 { } // Float64PtrDerefOr is a function variable referring to Float64Deref. +// // Deprecated: Use Float64Deref instead. var Float64PtrDerefOr = Float64Deref // for back-compat diff --git a/vendor/k8s.io/utils/trace/trace.go b/vendor/k8s.io/utils/trace/trace.go index 3023d1066e3..a0b07a6d788 100644 --- a/vendor/k8s.io/utils/trace/trace.go +++ b/vendor/k8s.io/utils/trace/trace.go @@ -21,6 +21,7 @@ import ( "context" "fmt" "math/rand" + "sync" "time" "k8s.io/klog/v2" @@ -93,13 +94,16 @@ func (s traceStep) writeItem(b *bytes.Buffer, formatter string, startTime time.T // Trace keeps track of a set of "steps" and allows us to log a specific // step if it took longer than its share of the total allowed time type Trace struct { + // constant fields name string fields []Field - threshold *time.Duration startTime time.Time - endTime *time.Time - traceItems []traceItem parentTrace *Trace + // fields guarded by a lock + lock sync.RWMutex + threshold *time.Duration + endTime *time.Time + traceItems []traceItem } func (t *Trace) time() time.Time { @@ -138,6 +142,8 @@ func New(name string, fields ...Field) *Trace { // how long it took. The Fields add key value pairs to provide additional details about the trace // step. func (t *Trace) Step(msg string, fields ...Field) { + t.lock.Lock() + defer t.lock.Unlock() if t.traceItems == nil { // traces almost always have less than 6 steps, do this to avoid more than a single allocation t.traceItems = make([]traceItem, 0, 6) @@ -153,7 +159,9 @@ func (t *Trace) Nest(msg string, fields ...Field) *Trace { newTrace := New(msg, fields...) if t != nil { newTrace.parentTrace = t + t.lock.Lock() t.traceItems = append(t.traceItems, newTrace) + t.lock.Unlock() } return newTrace } @@ -163,7 +171,9 @@ func (t *Trace) Nest(msg string, fields ...Field) *Trace { // is logged. func (t *Trace) Log() { endTime := time.Now() + t.lock.Lock() t.endTime = &endTime + t.lock.Unlock() // an explicit logging request should dump all the steps out at the higher level if t.parentTrace == nil { // We don't start logging until Log or LogIfLong is called on the root trace t.logTrace() @@ -178,13 +188,17 @@ func (t *Trace) Log() { // If the Trace is nested it is not immediately logged. Instead, it is logged when the trace it // is nested within is logged. func (t *Trace) LogIfLong(threshold time.Duration) { + t.lock.Lock() t.threshold = &threshold + t.lock.Unlock() t.Log() } // logTopLevelTraces finds all traces in a hierarchy of nested traces that should be logged but do not have any // parents that will be logged, due to threshold limits, and logs them as top level traces. func (t *Trace) logTrace() { + t.lock.RLock() + defer t.lock.RUnlock() if t.durationIsWithinThreshold() { var buffer bytes.Buffer traceNum := rand.Int31() @@ -244,9 +258,13 @@ func (t *Trace) calculateStepThreshold() *time.Duration { traceThreshold := *t.threshold for _, s := range t.traceItems { nestedTrace, ok := s.(*Trace) - if ok && nestedTrace.threshold != nil { - traceThreshold = traceThreshold - *nestedTrace.threshold - lenTrace-- + if ok { + nestedTrace.lock.RLock() + if nestedTrace.threshold != nil { + traceThreshold = traceThreshold - *nestedTrace.threshold + lenTrace-- + } + nestedTrace.lock.RUnlock() } } diff --git a/vendor/knative.dev/pkg/apis/duck/verify.go b/vendor/knative.dev/pkg/apis/duck/verify.go index e3f5abab433..48675f93a47 100644 --- a/vendor/knative.dev/pkg/apis/duck/verify.go +++ b/vendor/knative.dev/pkg/apis/duck/verify.go @@ -31,10 +31,10 @@ type Populatable = ducktypes.Populatable // the provided Implementable duck type. It is expected that under the resource // definition implementing a particular "Fooable" that one would write: // -// type ConcreteResource struct { ... } +// type ConcreteResource struct { ... } // -// // Check that ConcreteResource properly implement Fooable. -// err := duck.VerifyType(&ConcreteResource{}, &something.Fooable{}) +// // Check that ConcreteResource properly implement Fooable. +// err := duck.VerifyType(&ConcreteResource{}, &something.Fooable{}) // // This will return an error if the duck typing is not satisfied. func VerifyType(instance interface{}, iface Implementable) error { diff --git a/vendor/knative.dev/pkg/apis/field_error.go b/vendor/knative.dev/pkg/apis/field_error.go index ddd4838af21..cacea2f3ce6 100644 --- a/vendor/knative.dev/pkg/apis/field_error.go +++ b/vendor/knative.dev/pkg/apis/field_error.go @@ -83,11 +83,12 @@ var _ error = (*FieldError)(nil) // ViaField is used to propagate a validation error along a field access. // For example, if a type recursively validates its "spec" via: -// if err := foo.Spec.Validate(); err != nil { -// // Augment any field paths with the context that they were accessed -// // via "spec". -// return err.ViaField("spec") -// } +// +// if err := foo.Spec.Validate(); err != nil { +// // Augment any field paths with the context that they were accessed +// // via "spec". +// return err.ViaField("spec") +// } func (fe *FieldError) ViaField(prefix ...string) *FieldError { if fe == nil { return nil @@ -114,11 +115,12 @@ func (fe *FieldError) ViaField(prefix ...string) *FieldError { // ViaIndex is used to attach an index to the next ViaField provided. // For example, if a type recursively validates a parameter that has a collection: -// for i, c := range spec.Collection { -// if err := doValidation(c); err != nil { -// return err.ViaIndex(i).ViaField("collection") -// } -// } +// +// for i, c := range spec.Collection { +// if err := doValidation(c); err != nil { +// return err.ViaIndex(i).ViaField("collection") +// } +// } func (fe *FieldError) ViaIndex(index int) *FieldError { return fe.ViaField(asIndex(index)) } @@ -130,11 +132,12 @@ func (fe *FieldError) ViaFieldIndex(field string, index int) *FieldError { // ViaKey is used to attach a key to the next ViaField provided. // For example, if a type recursively validates a parameter that has a collection: -// for k, v := range spec.Bag { -// if err := doValidation(v); err != nil { -// return err.ViaKey(k).ViaField("bag") -// } -// } +// +// for k, v := range spec.Bag { +// if err := doValidation(v); err != nil { +// return err.ViaKey(k).ViaField("bag") +// } +// } func (fe *FieldError) ViaKey(key string) *FieldError { return fe.ViaField(asKey(key)) } @@ -145,7 +148,8 @@ func (fe *FieldError) ViaFieldKey(field, key string) *FieldError { } // At is a way to alter the level of the diagnostics held in this FieldError. -// ErrMissingField("foo").At(WarningLevel) +// +// ErrMissingField("foo").At(WarningLevel) func (fe *FieldError) At(l DiagnosticLevel) *FieldError { if fe == nil { return nil @@ -166,9 +170,10 @@ func (fe *FieldError) At(l DiagnosticLevel) *FieldError { } // Filter is a way to access the set of diagnostics having a particular level. -// if err := x.Validate(ctx).Filter(ErrorLevel); err != nil { -// return err -// } +// +// if err := x.Validate(ctx).Filter(ErrorLevel); err != nil { +// return err +// } func (fe *FieldError) Filter(l DiagnosticLevel) *FieldError { if fe == nil { return nil @@ -251,10 +256,15 @@ func (fe *FieldError) normalized() []*FieldError { return errors } +// WrappedErrors returns the value of the errors after normalizing and deduping using merge(). +func (fe *FieldError) WrappedErrors() []*FieldError { + return merge(fe.normalized()) +} + // Error implements error func (fe *FieldError) Error() string { // Get the list of errors as a flat merged list. - normedErrors := merge(fe.normalized()) + normedErrors := fe.WrappedErrors() errs := make([]string, 0, len(normedErrors)) for _, e := range normedErrors { if e.Details == "" { @@ -282,10 +292,11 @@ func asKey(key string) string { // flatten takes in a array of path components and looks for chances to flatten // objects that have index prefixes, examples: -// err([0]).ViaField(bar).ViaField(foo) -> foo.bar.[0] converts to foo.bar[0] -// err(bar).ViaIndex(0).ViaField(foo) -> foo.[0].bar converts to foo[0].bar -// err(bar).ViaField(foo).ViaIndex(0) -> [0].foo.bar converts to [0].foo.bar -// err(bar).ViaIndex(0).ViaIndex(1).ViaField(foo) -> foo.[1].[0].bar converts to foo[1][0].bar +// +// err([0]).ViaField(bar).ViaField(foo) -> foo.bar.[0] converts to foo.bar[0] +// err(bar).ViaIndex(0).ViaField(foo) -> foo.[0].bar converts to foo[0].bar +// err(bar).ViaField(foo).ViaIndex(0) -> [0].foo.bar converts to [0].foo.bar +// err(bar).ViaIndex(0).ViaIndex(1).ViaField(foo) -> foo.[1].[0].bar converts to foo[1][0].bar func flatten(path []string) string { var newPath []string for _, part := range path { diff --git a/vendor/knative.dev/pkg/changeset/commit.go b/vendor/knative.dev/pkg/changeset/commit.go index da38bd330dd..90a031f5910 100644 --- a/vendor/knative.dev/pkg/changeset/commit.go +++ b/vendor/knative.dev/pkg/changeset/commit.go @@ -39,7 +39,10 @@ var ( // The result will have a '-dirty' suffix if the workspace was not clean func Get() string { once.Do(func() { - rev = get() + if rev == "" { + rev = get() + } + // It has been set through ldflags, do nothing }) return rev diff --git a/vendor/knative.dev/pkg/client/injection/kube/client/client.go b/vendor/knative.dev/pkg/client/injection/kube/client/client.go index 0111485ca0f..f490241e1d8 100644 --- a/vendor/knative.dev/pkg/client/injection/kube/client/client.go +++ b/vendor/knative.dev/pkg/client/injection/kube/client/client.go @@ -171,6 +171,7 @@ import ( injection "knative.dev/pkg/injection" dynamicclient "knative.dev/pkg/injection/clients/dynamicclient" logging "knative.dev/pkg/logging" + ptr "knative.dev/pkg/ptr" ) func init() { @@ -260,11 +261,43 @@ type wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl struct { var _ typedadmissionregistrationv1.MutatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl)(nil) func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Apply(ctx context.Context, in *v1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1.MutatingWebhookConfiguration, err error) { - panic("NYI") + in.Kind = ptr.String("MutatingWebhookConfiguration") + + in.APIVersion = ptr.String("admissionregistration.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) ApplyStatus(ctx context.Context, in *v1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1.MutatingWebhookConfiguration, err error) { - panic("NYI") + in.Kind = ptr.String("MutatingWebhookConfiguration") + + in.APIVersion = ptr.String("admissionregistration.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Create(ctx context.Context, in *admissionregistrationv1.MutatingWebhookConfiguration, opts metav1.CreateOptions) (*admissionregistrationv1.MutatingWebhookConfiguration, error) { @@ -395,11 +428,43 @@ type wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl struct { var _ typedadmissionregistrationv1.ValidatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl)(nil) func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Apply(ctx context.Context, in *v1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1.ValidatingWebhookConfiguration, err error) { - panic("NYI") + in.Kind = ptr.String("ValidatingWebhookConfiguration") + + in.APIVersion = ptr.String("admissionregistration.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) ApplyStatus(ctx context.Context, in *v1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1.ValidatingWebhookConfiguration, err error) { - panic("NYI") + in.Kind = ptr.String("ValidatingWebhookConfiguration") + + in.APIVersion = ptr.String("admissionregistration.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Create(ctx context.Context, in *admissionregistrationv1.ValidatingWebhookConfiguration, opts metav1.CreateOptions) (*admissionregistrationv1.ValidatingWebhookConfiguration, error) { @@ -545,11 +610,43 @@ type wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl struct { var _ typedadmissionregistrationv1beta1.MutatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl)(nil) func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Apply(ctx context.Context, in *v1beta1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1beta1.MutatingWebhookConfiguration, err error) { - panic("NYI") + in.Kind = ptr.String("MutatingWebhookConfiguration") + + in.APIVersion = ptr.String("admissionregistration.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) ApplyStatus(ctx context.Context, in *v1beta1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1beta1.MutatingWebhookConfiguration, err error) { - panic("NYI") + in.Kind = ptr.String("MutatingWebhookConfiguration") + + in.APIVersion = ptr.String("admissionregistration.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Create(ctx context.Context, in *admissionregistrationv1beta1.MutatingWebhookConfiguration, opts metav1.CreateOptions) (*admissionregistrationv1beta1.MutatingWebhookConfiguration, error) { @@ -680,11 +777,43 @@ type wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl struct { var _ typedadmissionregistrationv1beta1.ValidatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl)(nil) func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Apply(ctx context.Context, in *v1beta1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1beta1.ValidatingWebhookConfiguration, err error) { - panic("NYI") + in.Kind = ptr.String("ValidatingWebhookConfiguration") + + in.APIVersion = ptr.String("admissionregistration.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) ApplyStatus(ctx context.Context, in *v1beta1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1beta1.ValidatingWebhookConfiguration, err error) { - panic("NYI") + in.Kind = ptr.String("ValidatingWebhookConfiguration") + + in.APIVersion = ptr.String("admissionregistration.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Create(ctx context.Context, in *admissionregistrationv1beta1.ValidatingWebhookConfiguration, opts metav1.CreateOptions) (*admissionregistrationv1beta1.ValidatingWebhookConfiguration, error) { @@ -830,11 +959,43 @@ type wrapInternalV1alpha1StorageVersionImpl struct { var _ typedinternalv1alpha1.StorageVersionInterface = (*wrapInternalV1alpha1StorageVersionImpl)(nil) func (w *wrapInternalV1alpha1StorageVersionImpl) Apply(ctx context.Context, in *v1alpha1.StorageVersionApplyConfiguration, opts metav1.ApplyOptions) (result *apiserverinternalv1alpha1.StorageVersion, err error) { - panic("NYI") + in.Kind = ptr.String("StorageVersion") + + in.APIVersion = ptr.String("internal.apiserver.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiserverinternalv1alpha1.StorageVersion{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapInternalV1alpha1StorageVersionImpl) ApplyStatus(ctx context.Context, in *v1alpha1.StorageVersionApplyConfiguration, opts metav1.ApplyOptions) (result *apiserverinternalv1alpha1.StorageVersion, err error) { - panic("NYI") + in.Kind = ptr.String("StorageVersion") + + in.APIVersion = ptr.String("internal.apiserver.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiserverinternalv1alpha1.StorageVersion{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapInternalV1alpha1StorageVersionImpl) Create(ctx context.Context, in *apiserverinternalv1alpha1.StorageVersion, opts metav1.CreateOptions) (*apiserverinternalv1alpha1.StorageVersion, error) { @@ -984,11 +1145,43 @@ type wrapAppsV1ControllerRevisionImpl struct { var _ typedappsv1.ControllerRevisionInterface = (*wrapAppsV1ControllerRevisionImpl)(nil) func (w *wrapAppsV1ControllerRevisionImpl) Apply(ctx context.Context, in *appsv1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.ControllerRevision, err error) { - panic("NYI") + in.Kind = ptr.String("ControllerRevision") + + in.APIVersion = ptr.String("apps/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1ControllerRevisionImpl) ApplyStatus(ctx context.Context, in *appsv1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.ControllerRevision, err error) { - panic("NYI") + in.Kind = ptr.String("ControllerRevision") + + in.APIVersion = ptr.String("apps/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1ControllerRevisionImpl) Create(ctx context.Context, in *apiappsv1.ControllerRevision, opts metav1.CreateOptions) (*apiappsv1.ControllerRevision, error) { @@ -1123,11 +1316,43 @@ type wrapAppsV1DaemonSetImpl struct { var _ typedappsv1.DaemonSetInterface = (*wrapAppsV1DaemonSetImpl)(nil) func (w *wrapAppsV1DaemonSetImpl) Apply(ctx context.Context, in *appsv1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.DaemonSet, err error) { - panic("NYI") + in.Kind = ptr.String("DaemonSet") + + in.APIVersion = ptr.String("apps/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1DaemonSetImpl) ApplyStatus(ctx context.Context, in *appsv1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.DaemonSet, err error) { - panic("NYI") + in.Kind = ptr.String("DaemonSet") + + in.APIVersion = ptr.String("apps/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1DaemonSetImpl) Create(ctx context.Context, in *apiappsv1.DaemonSet, opts metav1.CreateOptions) (*apiappsv1.DaemonSet, error) { @@ -1262,11 +1487,43 @@ type wrapAppsV1DeploymentImpl struct { var _ typedappsv1.DeploymentInterface = (*wrapAppsV1DeploymentImpl)(nil) func (w *wrapAppsV1DeploymentImpl) Apply(ctx context.Context, in *appsv1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.Deployment, err error) { - panic("NYI") + in.Kind = ptr.String("Deployment") + + in.APIVersion = ptr.String("apps/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1DeploymentImpl) ApplyStatus(ctx context.Context, in *appsv1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.Deployment, err error) { - panic("NYI") + in.Kind = ptr.String("Deployment") + + in.APIVersion = ptr.String("apps/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1DeploymentImpl) Create(ctx context.Context, in *apiappsv1.Deployment, opts metav1.CreateOptions) (*apiappsv1.Deployment, error) { @@ -1413,24 +1670,15 @@ type wrapAppsV1ReplicaSetImpl struct { var _ typedappsv1.ReplicaSetInterface = (*wrapAppsV1ReplicaSetImpl)(nil) func (w *wrapAppsV1ReplicaSetImpl) Apply(ctx context.Context, in *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.ReplicaSet, err error) { - panic("NYI") -} + in.Kind = ptr.String("ReplicaSet") -func (w *wrapAppsV1ReplicaSetImpl) ApplyStatus(ctx context.Context, in *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.ReplicaSet, err error) { - panic("NYI") -} + in.APIVersion = ptr.String("apps/v1") -func (w *wrapAppsV1ReplicaSetImpl) Create(ctx context.Context, in *apiappsv1.ReplicaSet, opts metav1.CreateOptions) (*apiappsv1.ReplicaSet, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "apps", - Version: "v1", - Kind: "ReplicaSet", - }) uo := &unstructured.Unstructured{} if err := convert(in, uo); err != nil { return nil, err } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) if err != nil { return nil, err } @@ -1441,9 +1689,50 @@ func (w *wrapAppsV1ReplicaSetImpl) Create(ctx context.Context, in *apiappsv1.Rep return out, nil } -func (w *wrapAppsV1ReplicaSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) -} +func (w *wrapAppsV1ReplicaSetImpl) ApplyStatus(ctx context.Context, in *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.ReplicaSet, err error) { + in.Kind = ptr.String("ReplicaSet") + + in.APIVersion = ptr.String("apps/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ReplicaSetImpl) Create(ctx context.Context, in *apiappsv1.ReplicaSet, opts metav1.CreateOptions) (*apiappsv1.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ReplicaSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} func (w *wrapAppsV1ReplicaSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) @@ -1564,11 +1853,43 @@ type wrapAppsV1StatefulSetImpl struct { var _ typedappsv1.StatefulSetInterface = (*wrapAppsV1StatefulSetImpl)(nil) func (w *wrapAppsV1StatefulSetImpl) Apply(ctx context.Context, in *appsv1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.StatefulSet, err error) { - panic("NYI") + in.Kind = ptr.String("StatefulSet") + + in.APIVersion = ptr.String("apps/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1StatefulSetImpl) ApplyStatus(ctx context.Context, in *appsv1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.StatefulSet, err error) { - panic("NYI") + in.Kind = ptr.String("StatefulSet") + + in.APIVersion = ptr.String("apps/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1StatefulSetImpl) Create(ctx context.Context, in *apiappsv1.StatefulSet, opts metav1.CreateOptions) (*apiappsv1.StatefulSet, error) { @@ -1730,11 +2051,43 @@ type wrapAppsV1beta1ControllerRevisionImpl struct { var _ typedappsv1beta1.ControllerRevisionInterface = (*wrapAppsV1beta1ControllerRevisionImpl)(nil) func (w *wrapAppsV1beta1ControllerRevisionImpl) Apply(ctx context.Context, in *appsv1beta1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.ControllerRevision, err error) { - panic("NYI") + in.Kind = ptr.String("ControllerRevision") + + in.APIVersion = ptr.String("apps/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1beta1ControllerRevisionImpl) ApplyStatus(ctx context.Context, in *appsv1beta1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.ControllerRevision, err error) { - panic("NYI") + in.Kind = ptr.String("ControllerRevision") + + in.APIVersion = ptr.String("apps/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1beta1ControllerRevisionImpl) Create(ctx context.Context, in *apiappsv1beta1.ControllerRevision, opts metav1.CreateOptions) (*apiappsv1beta1.ControllerRevision, error) { @@ -1869,11 +2222,43 @@ type wrapAppsV1beta1DeploymentImpl struct { var _ typedappsv1beta1.DeploymentInterface = (*wrapAppsV1beta1DeploymentImpl)(nil) func (w *wrapAppsV1beta1DeploymentImpl) Apply(ctx context.Context, in *appsv1beta1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.Deployment, err error) { - panic("NYI") + in.Kind = ptr.String("Deployment") + + in.APIVersion = ptr.String("apps/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1beta1DeploymentImpl) ApplyStatus(ctx context.Context, in *appsv1beta1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.Deployment, err error) { - panic("NYI") + in.Kind = ptr.String("Deployment") + + in.APIVersion = ptr.String("apps/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1beta1DeploymentImpl) Create(ctx context.Context, in *apiappsv1beta1.Deployment, opts metav1.CreateOptions) (*apiappsv1beta1.Deployment, error) { @@ -2008,11 +2393,43 @@ type wrapAppsV1beta1StatefulSetImpl struct { var _ typedappsv1beta1.StatefulSetInterface = (*wrapAppsV1beta1StatefulSetImpl)(nil) func (w *wrapAppsV1beta1StatefulSetImpl) Apply(ctx context.Context, in *appsv1beta1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.StatefulSet, err error) { - panic("NYI") + in.Kind = ptr.String("StatefulSet") + + in.APIVersion = ptr.String("apps/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1beta1StatefulSetImpl) ApplyStatus(ctx context.Context, in *appsv1beta1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.StatefulSet, err error) { - panic("NYI") + in.Kind = ptr.String("StatefulSet") + + in.APIVersion = ptr.String("apps/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1beta1StatefulSetImpl) Create(ctx context.Context, in *apiappsv1beta1.StatefulSet, opts metav1.CreateOptions) (*apiappsv1beta1.StatefulSet, error) { @@ -2162,11 +2579,43 @@ type wrapAppsV1beta2ControllerRevisionImpl struct { var _ typedappsv1beta2.ControllerRevisionInterface = (*wrapAppsV1beta2ControllerRevisionImpl)(nil) func (w *wrapAppsV1beta2ControllerRevisionImpl) Apply(ctx context.Context, in *v1beta2.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.ControllerRevision, err error) { - panic("NYI") + in.Kind = ptr.String("ControllerRevision") + + in.APIVersion = ptr.String("apps/v1beta2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1beta2ControllerRevisionImpl) ApplyStatus(ctx context.Context, in *v1beta2.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.ControllerRevision, err error) { - panic("NYI") + in.Kind = ptr.String("ControllerRevision") + + in.APIVersion = ptr.String("apps/v1beta2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1beta2ControllerRevisionImpl) Create(ctx context.Context, in *appsv1beta2.ControllerRevision, opts metav1.CreateOptions) (*appsv1beta2.ControllerRevision, error) { @@ -2301,11 +2750,43 @@ type wrapAppsV1beta2DaemonSetImpl struct { var _ typedappsv1beta2.DaemonSetInterface = (*wrapAppsV1beta2DaemonSetImpl)(nil) func (w *wrapAppsV1beta2DaemonSetImpl) Apply(ctx context.Context, in *v1beta2.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.DaemonSet, err error) { - panic("NYI") + in.Kind = ptr.String("DaemonSet") + + in.APIVersion = ptr.String("apps/v1beta2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1beta2DaemonSetImpl) ApplyStatus(ctx context.Context, in *v1beta2.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.DaemonSet, err error) { - panic("NYI") + in.Kind = ptr.String("DaemonSet") + + in.APIVersion = ptr.String("apps/v1beta2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1beta2DaemonSetImpl) Create(ctx context.Context, in *appsv1beta2.DaemonSet, opts metav1.CreateOptions) (*appsv1beta2.DaemonSet, error) { @@ -2440,11 +2921,43 @@ type wrapAppsV1beta2DeploymentImpl struct { var _ typedappsv1beta2.DeploymentInterface = (*wrapAppsV1beta2DeploymentImpl)(nil) func (w *wrapAppsV1beta2DeploymentImpl) Apply(ctx context.Context, in *v1beta2.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.Deployment, err error) { - panic("NYI") + in.Kind = ptr.String("Deployment") + + in.APIVersion = ptr.String("apps/v1beta2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1beta2DeploymentImpl) ApplyStatus(ctx context.Context, in *v1beta2.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.Deployment, err error) { - panic("NYI") + in.Kind = ptr.String("Deployment") + + in.APIVersion = ptr.String("apps/v1beta2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1beta2DeploymentImpl) Create(ctx context.Context, in *appsv1beta2.Deployment, opts metav1.CreateOptions) (*appsv1beta2.Deployment, error) { @@ -2579,14 +3092,46 @@ type wrapAppsV1beta2ReplicaSetImpl struct { var _ typedappsv1beta2.ReplicaSetInterface = (*wrapAppsV1beta2ReplicaSetImpl)(nil) func (w *wrapAppsV1beta2ReplicaSetImpl) Apply(ctx context.Context, in *v1beta2.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.ReplicaSet, err error) { - panic("NYI") -} + in.Kind = ptr.String("ReplicaSet") -func (w *wrapAppsV1beta2ReplicaSetImpl) ApplyStatus(ctx context.Context, in *v1beta2.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.ReplicaSet, err error) { - panic("NYI") -} + in.APIVersion = ptr.String("apps/v1beta2") -func (w *wrapAppsV1beta2ReplicaSetImpl) Create(ctx context.Context, in *appsv1beta2.ReplicaSet, opts metav1.CreateOptions) (*appsv1beta2.ReplicaSet, error) { + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) ApplyStatus(ctx context.Context, in *v1beta2.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.ReplicaSet, err error) { + in.Kind = ptr.String("ReplicaSet") + + in.APIVersion = ptr.String("apps/v1beta2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) Create(ctx context.Context, in *appsv1beta2.ReplicaSet, opts metav1.CreateOptions) (*appsv1beta2.ReplicaSet, error) { in.SetGroupVersionKind(schema.GroupVersionKind{ Group: "apps", Version: "v1beta2", @@ -2718,11 +3263,43 @@ type wrapAppsV1beta2StatefulSetImpl struct { var _ typedappsv1beta2.StatefulSetInterface = (*wrapAppsV1beta2StatefulSetImpl)(nil) func (w *wrapAppsV1beta2StatefulSetImpl) Apply(ctx context.Context, in *v1beta2.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.StatefulSet, err error) { - panic("NYI") + in.Kind = ptr.String("StatefulSet") + + in.APIVersion = ptr.String("apps/v1beta2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1beta2StatefulSetImpl) ApplyStatus(ctx context.Context, in *v1beta2.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.StatefulSet, err error) { - panic("NYI") + in.Kind = ptr.String("StatefulSet") + + in.APIVersion = ptr.String("apps/v1beta2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAppsV1beta2StatefulSetImpl) Create(ctx context.Context, in *appsv1beta2.StatefulSet, opts metav1.CreateOptions) (*appsv1beta2.StatefulSet, error) { @@ -3322,11 +3899,43 @@ type wrapAutoscalingV1HorizontalPodAutoscalerImpl struct { var _ typedautoscalingv1.HorizontalPodAutoscalerInterface = (*wrapAutoscalingV1HorizontalPodAutoscalerImpl)(nil) func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Apply(ctx context.Context, in *applyconfigurationsautoscalingv1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.HorizontalPodAutoscaler, err error) { - panic("NYI") + in.Kind = ptr.String("HorizontalPodAutoscaler") + + in.APIVersion = ptr.String("autoscaling/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) ApplyStatus(ctx context.Context, in *applyconfigurationsautoscalingv1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.HorizontalPodAutoscaler, err error) { - panic("NYI") + in.Kind = ptr.String("HorizontalPodAutoscaler") + + in.APIVersion = ptr.String("autoscaling/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Create(ctx context.Context, in *autoscalingv1.HorizontalPodAutoscaler, opts metav1.CreateOptions) (*autoscalingv1.HorizontalPodAutoscaler, error) { @@ -3476,11 +4085,43 @@ type wrapAutoscalingV2HorizontalPodAutoscalerImpl struct { var _ typedautoscalingv2.HorizontalPodAutoscalerInterface = (*wrapAutoscalingV2HorizontalPodAutoscalerImpl)(nil) func (w *wrapAutoscalingV2HorizontalPodAutoscalerImpl) Apply(ctx context.Context, in *v2.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2.HorizontalPodAutoscaler, err error) { - panic("NYI") + in.Kind = ptr.String("HorizontalPodAutoscaler") + + in.APIVersion = ptr.String("autoscaling/v2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAutoscalingV2HorizontalPodAutoscalerImpl) ApplyStatus(ctx context.Context, in *v2.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2.HorizontalPodAutoscaler, err error) { - panic("NYI") + in.Kind = ptr.String("HorizontalPodAutoscaler") + + in.APIVersion = ptr.String("autoscaling/v2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAutoscalingV2HorizontalPodAutoscalerImpl) Create(ctx context.Context, in *autoscalingv2.HorizontalPodAutoscaler, opts metav1.CreateOptions) (*autoscalingv2.HorizontalPodAutoscaler, error) { @@ -3630,11 +4271,43 @@ type wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl struct { var _ typedautoscalingv2beta1.HorizontalPodAutoscalerInterface = (*wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl)(nil) func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Apply(ctx context.Context, in *v2beta1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2beta1.HorizontalPodAutoscaler, err error) { - panic("NYI") + in.Kind = ptr.String("HorizontalPodAutoscaler") + + in.APIVersion = ptr.String("autoscaling/v2beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) ApplyStatus(ctx context.Context, in *v2beta1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2beta1.HorizontalPodAutoscaler, err error) { - panic("NYI") + in.Kind = ptr.String("HorizontalPodAutoscaler") + + in.APIVersion = ptr.String("autoscaling/v2beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Create(ctx context.Context, in *autoscalingv2beta1.HorizontalPodAutoscaler, opts metav1.CreateOptions) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) { @@ -3784,11 +4457,43 @@ type wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl struct { var _ typedautoscalingv2beta2.HorizontalPodAutoscalerInterface = (*wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl)(nil) func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Apply(ctx context.Context, in *v2beta2.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2beta2.HorizontalPodAutoscaler, err error) { - panic("NYI") + in.Kind = ptr.String("HorizontalPodAutoscaler") + + in.APIVersion = ptr.String("autoscaling/v2beta2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta2.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) ApplyStatus(ctx context.Context, in *v2beta2.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2beta2.HorizontalPodAutoscaler, err error) { - panic("NYI") + in.Kind = ptr.String("HorizontalPodAutoscaler") + + in.APIVersion = ptr.String("autoscaling/v2beta2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta2.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Create(ctx context.Context, in *autoscalingv2beta2.HorizontalPodAutoscaler, opts metav1.CreateOptions) (*autoscalingv2beta2.HorizontalPodAutoscaler, error) { @@ -3938,11 +4643,43 @@ type wrapBatchV1CronJobImpl struct { var _ typedbatchv1.CronJobInterface = (*wrapBatchV1CronJobImpl)(nil) func (w *wrapBatchV1CronJobImpl) Apply(ctx context.Context, in *batchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1.CronJob, err error) { - panic("NYI") + in.Kind = ptr.String("CronJob") + + in.APIVersion = ptr.String("batch/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapBatchV1CronJobImpl) ApplyStatus(ctx context.Context, in *batchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1.CronJob, err error) { - panic("NYI") + in.Kind = ptr.String("CronJob") + + in.APIVersion = ptr.String("batch/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapBatchV1CronJobImpl) Create(ctx context.Context, in *apibatchv1.CronJob, opts metav1.CreateOptions) (*apibatchv1.CronJob, error) { @@ -4077,11 +4814,43 @@ type wrapBatchV1JobImpl struct { var _ typedbatchv1.JobInterface = (*wrapBatchV1JobImpl)(nil) func (w *wrapBatchV1JobImpl) Apply(ctx context.Context, in *batchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1.Job, err error) { - panic("NYI") + in.Kind = ptr.String("Job") + + in.APIVersion = ptr.String("batch/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.Job{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapBatchV1JobImpl) ApplyStatus(ctx context.Context, in *batchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1.Job, err error) { - panic("NYI") + in.Kind = ptr.String("Job") + + in.APIVersion = ptr.String("batch/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.Job{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapBatchV1JobImpl) Create(ctx context.Context, in *apibatchv1.Job, opts metav1.CreateOptions) (*apibatchv1.Job, error) { @@ -4231,24 +5000,15 @@ type wrapBatchV1beta1CronJobImpl struct { var _ typedbatchv1beta1.CronJobInterface = (*wrapBatchV1beta1CronJobImpl)(nil) func (w *wrapBatchV1beta1CronJobImpl) Apply(ctx context.Context, in *batchv1beta1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1beta1.CronJob, err error) { - panic("NYI") -} + in.Kind = ptr.String("CronJob") -func (w *wrapBatchV1beta1CronJobImpl) ApplyStatus(ctx context.Context, in *batchv1beta1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1beta1.CronJob, err error) { - panic("NYI") -} + in.APIVersion = ptr.String("batch/v1beta1") -func (w *wrapBatchV1beta1CronJobImpl) Create(ctx context.Context, in *apibatchv1beta1.CronJob, opts metav1.CreateOptions) (*apibatchv1beta1.CronJob, error) { - in.SetGroupVersionKind(schema.GroupVersionKind{ - Group: "batch", - Version: "v1beta1", - Kind: "CronJob", - }) uo := &unstructured.Unstructured{} if err := convert(in, uo); err != nil { return nil, err } - uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) if err != nil { return nil, err } @@ -4259,8 +5019,49 @@ func (w *wrapBatchV1beta1CronJobImpl) Create(ctx context.Context, in *apibatchv1 return out, nil } -func (w *wrapBatchV1beta1CronJobImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +func (w *wrapBatchV1beta1CronJobImpl) ApplyStatus(ctx context.Context, in *batchv1beta1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1beta1.CronJob, err error) { + in.Kind = ptr.String("CronJob") + + in.APIVersion = ptr.String("batch/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apibatchv1beta1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1beta1CronJobImpl) Create(ctx context.Context, in *apibatchv1beta1.CronJob, opts metav1.CreateOptions) (*apibatchv1beta1.CronJob, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1beta1", + Kind: "CronJob", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apibatchv1beta1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1beta1CronJobImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) } func (w *wrapBatchV1beta1CronJobImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { @@ -4381,11 +5182,43 @@ type wrapCertificatesV1CertificateSigningRequestImpl struct { var _ typedcertificatesv1.CertificateSigningRequestInterface = (*wrapCertificatesV1CertificateSigningRequestImpl)(nil) func (w *wrapCertificatesV1CertificateSigningRequestImpl) Apply(ctx context.Context, in *certificatesv1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *apicertificatesv1.CertificateSigningRequest, err error) { - panic("NYI") + in.Kind = ptr.String("CertificateSigningRequest") + + in.APIVersion = ptr.String("certificates.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCertificatesV1CertificateSigningRequestImpl) ApplyStatus(ctx context.Context, in *certificatesv1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *apicertificatesv1.CertificateSigningRequest, err error) { - panic("NYI") + in.Kind = ptr.String("CertificateSigningRequest") + + in.APIVersion = ptr.String("certificates.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCertificatesV1CertificateSigningRequestImpl) Create(ctx context.Context, in *apicertificatesv1.CertificateSigningRequest, opts metav1.CreateOptions) (*apicertificatesv1.CertificateSigningRequest, error) { @@ -4535,11 +5368,43 @@ type wrapCertificatesV1beta1CertificateSigningRequestImpl struct { var _ typedcertificatesv1beta1.CertificateSigningRequestInterface = (*wrapCertificatesV1beta1CertificateSigningRequestImpl)(nil) func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Apply(ctx context.Context, in *certificatesv1beta1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *apicertificatesv1beta1.CertificateSigningRequest, err error) { - panic("NYI") + in.Kind = ptr.String("CertificateSigningRequest") + + in.APIVersion = ptr.String("certificates.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1beta1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) ApplyStatus(ctx context.Context, in *certificatesv1beta1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *apicertificatesv1beta1.CertificateSigningRequest, err error) { - panic("NYI") + in.Kind = ptr.String("CertificateSigningRequest") + + in.APIVersion = ptr.String("certificates.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1beta1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Create(ctx context.Context, in *apicertificatesv1beta1.CertificateSigningRequest, opts metav1.CreateOptions) (*apicertificatesv1beta1.CertificateSigningRequest, error) { @@ -4689,11 +5554,43 @@ type wrapCoordinationV1LeaseImpl struct { var _ typedcoordinationv1.LeaseInterface = (*wrapCoordinationV1LeaseImpl)(nil) func (w *wrapCoordinationV1LeaseImpl) Apply(ctx context.Context, in *coordinationv1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *apicoordinationv1.Lease, err error) { - panic("NYI") + in.Kind = ptr.String("Lease") + + in.APIVersion = ptr.String("coordination.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoordinationV1LeaseImpl) ApplyStatus(ctx context.Context, in *coordinationv1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *apicoordinationv1.Lease, err error) { - panic("NYI") + in.Kind = ptr.String("Lease") + + in.APIVersion = ptr.String("coordination.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoordinationV1LeaseImpl) Create(ctx context.Context, in *apicoordinationv1.Lease, opts metav1.CreateOptions) (*apicoordinationv1.Lease, error) { @@ -4843,11 +5740,43 @@ type wrapCoordinationV1beta1LeaseImpl struct { var _ typedcoordinationv1beta1.LeaseInterface = (*wrapCoordinationV1beta1LeaseImpl)(nil) func (w *wrapCoordinationV1beta1LeaseImpl) Apply(ctx context.Context, in *coordinationv1beta1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *apicoordinationv1beta1.Lease, err error) { - panic("NYI") + in.Kind = ptr.String("Lease") + + in.APIVersion = ptr.String("coordination.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1beta1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoordinationV1beta1LeaseImpl) ApplyStatus(ctx context.Context, in *coordinationv1beta1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *apicoordinationv1beta1.Lease, err error) { - panic("NYI") + in.Kind = ptr.String("Lease") + + in.APIVersion = ptr.String("coordination.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1beta1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoordinationV1beta1LeaseImpl) Create(ctx context.Context, in *apicoordinationv1beta1.Lease, opts metav1.CreateOptions) (*apicoordinationv1beta1.Lease, error) { @@ -4993,11 +5922,43 @@ type wrapCoreV1ComponentStatusImpl struct { var _ typedcorev1.ComponentStatusInterface = (*wrapCoreV1ComponentStatusImpl)(nil) func (w *wrapCoreV1ComponentStatusImpl) Apply(ctx context.Context, in *corev1.ComponentStatusApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ComponentStatus, err error) { - panic("NYI") + in.Kind = ptr.String("ComponentStatus") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ComponentStatus{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1ComponentStatusImpl) ApplyStatus(ctx context.Context, in *corev1.ComponentStatusApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ComponentStatus, err error) { - panic("NYI") + in.Kind = ptr.String("ComponentStatus") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ComponentStatus{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1ComponentStatusImpl) Create(ctx context.Context, in *apicorev1.ComponentStatus, opts metav1.CreateOptions) (*apicorev1.ComponentStatus, error) { @@ -5132,11 +6093,43 @@ type wrapCoreV1ConfigMapImpl struct { var _ typedcorev1.ConfigMapInterface = (*wrapCoreV1ConfigMapImpl)(nil) func (w *wrapCoreV1ConfigMapImpl) Apply(ctx context.Context, in *corev1.ConfigMapApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ConfigMap, err error) { - panic("NYI") + in.Kind = ptr.String("ConfigMap") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ConfigMap{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1ConfigMapImpl) ApplyStatus(ctx context.Context, in *corev1.ConfigMapApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ConfigMap, err error) { - panic("NYI") + in.Kind = ptr.String("ConfigMap") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ConfigMap{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1ConfigMapImpl) Create(ctx context.Context, in *apicorev1.ConfigMap, opts metav1.CreateOptions) (*apicorev1.ConfigMap, error) { @@ -5271,11 +6264,43 @@ type wrapCoreV1EndpointsImpl struct { var _ typedcorev1.EndpointsInterface = (*wrapCoreV1EndpointsImpl)(nil) func (w *wrapCoreV1EndpointsImpl) Apply(ctx context.Context, in *corev1.EndpointsApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Endpoints, err error) { - panic("NYI") + in.Kind = ptr.String("Endpoints") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Endpoints{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1EndpointsImpl) ApplyStatus(ctx context.Context, in *corev1.EndpointsApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Endpoints, err error) { - panic("NYI") + in.Kind = ptr.String("Endpoints") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Endpoints{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1EndpointsImpl) Create(ctx context.Context, in *apicorev1.Endpoints, opts metav1.CreateOptions) (*apicorev1.Endpoints, error) { @@ -5410,14 +6435,46 @@ type wrapCoreV1EventImpl struct { var _ typedcorev1.EventInterface = (*wrapCoreV1EventImpl)(nil) func (w *wrapCoreV1EventImpl) Apply(ctx context.Context, in *corev1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Event, err error) { - panic("NYI") -} + in.Kind = ptr.String("Event") -func (w *wrapCoreV1EventImpl) ApplyStatus(ctx context.Context, in *corev1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Event, err error) { - panic("NYI") -} + in.APIVersion = ptr.String("v1") -func (w *wrapCoreV1EventImpl) Create(ctx context.Context, in *apicorev1.Event, opts metav1.CreateOptions) (*apicorev1.Event, error) { + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EventImpl) ApplyStatus(ctx context.Context, in *corev1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Event, err error) { + in.Kind = ptr.String("Event") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EventImpl) Create(ctx context.Context, in *apicorev1.Event, opts metav1.CreateOptions) (*apicorev1.Event, error) { in.SetGroupVersionKind(schema.GroupVersionKind{ Group: "", Version: "v1", @@ -5549,11 +6606,43 @@ type wrapCoreV1LimitRangeImpl struct { var _ typedcorev1.LimitRangeInterface = (*wrapCoreV1LimitRangeImpl)(nil) func (w *wrapCoreV1LimitRangeImpl) Apply(ctx context.Context, in *corev1.LimitRangeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.LimitRange, err error) { - panic("NYI") + in.Kind = ptr.String("LimitRange") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.LimitRange{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1LimitRangeImpl) ApplyStatus(ctx context.Context, in *corev1.LimitRangeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.LimitRange, err error) { - panic("NYI") + in.Kind = ptr.String("LimitRange") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.LimitRange{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1LimitRangeImpl) Create(ctx context.Context, in *apicorev1.LimitRange, opts metav1.CreateOptions) (*apicorev1.LimitRange, error) { @@ -5684,11 +6773,43 @@ type wrapCoreV1NamespaceImpl struct { var _ typedcorev1.NamespaceInterface = (*wrapCoreV1NamespaceImpl)(nil) func (w *wrapCoreV1NamespaceImpl) Apply(ctx context.Context, in *corev1.NamespaceApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Namespace, err error) { - panic("NYI") + in.Kind = ptr.String("Namespace") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Namespace{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1NamespaceImpl) ApplyStatus(ctx context.Context, in *corev1.NamespaceApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Namespace, err error) { - panic("NYI") + in.Kind = ptr.String("Namespace") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Namespace{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1NamespaceImpl) Create(ctx context.Context, in *apicorev1.Namespace, opts metav1.CreateOptions) (*apicorev1.Namespace, error) { @@ -5815,11 +6936,43 @@ type wrapCoreV1NodeImpl struct { var _ typedcorev1.NodeInterface = (*wrapCoreV1NodeImpl)(nil) func (w *wrapCoreV1NodeImpl) Apply(ctx context.Context, in *corev1.NodeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Node, err error) { - panic("NYI") + in.Kind = ptr.String("Node") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Node{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1NodeImpl) ApplyStatus(ctx context.Context, in *corev1.NodeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Node, err error) { - panic("NYI") + in.Kind = ptr.String("Node") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Node{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1NodeImpl) Create(ctx context.Context, in *apicorev1.Node, opts metav1.CreateOptions) (*apicorev1.Node, error) { @@ -5950,11 +7103,43 @@ type wrapCoreV1PersistentVolumeImpl struct { var _ typedcorev1.PersistentVolumeInterface = (*wrapCoreV1PersistentVolumeImpl)(nil) func (w *wrapCoreV1PersistentVolumeImpl) Apply(ctx context.Context, in *corev1.PersistentVolumeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PersistentVolume, err error) { - panic("NYI") + in.Kind = ptr.String("PersistentVolume") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolume{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1PersistentVolumeImpl) ApplyStatus(ctx context.Context, in *corev1.PersistentVolumeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PersistentVolume, err error) { - panic("NYI") + in.Kind = ptr.String("PersistentVolume") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolume{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1PersistentVolumeImpl) Create(ctx context.Context, in *apicorev1.PersistentVolume, opts metav1.CreateOptions) (*apicorev1.PersistentVolume, error) { @@ -6089,11 +7274,43 @@ type wrapCoreV1PersistentVolumeClaimImpl struct { var _ typedcorev1.PersistentVolumeClaimInterface = (*wrapCoreV1PersistentVolumeClaimImpl)(nil) func (w *wrapCoreV1PersistentVolumeClaimImpl) Apply(ctx context.Context, in *corev1.PersistentVolumeClaimApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PersistentVolumeClaim, err error) { - panic("NYI") + in.Kind = ptr.String("PersistentVolumeClaim") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolumeClaim{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1PersistentVolumeClaimImpl) ApplyStatus(ctx context.Context, in *corev1.PersistentVolumeClaimApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PersistentVolumeClaim, err error) { - panic("NYI") + in.Kind = ptr.String("PersistentVolumeClaim") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolumeClaim{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1PersistentVolumeClaimImpl) Create(ctx context.Context, in *apicorev1.PersistentVolumeClaim, opts metav1.CreateOptions) (*apicorev1.PersistentVolumeClaim, error) { @@ -6228,11 +7445,43 @@ type wrapCoreV1PodImpl struct { var _ typedcorev1.PodInterface = (*wrapCoreV1PodImpl)(nil) func (w *wrapCoreV1PodImpl) Apply(ctx context.Context, in *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Pod, err error) { - panic("NYI") + in.Kind = ptr.String("Pod") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Pod{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1PodImpl) ApplyStatus(ctx context.Context, in *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Pod, err error) { - panic("NYI") + in.Kind = ptr.String("Pod") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Pod{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1PodImpl) Create(ctx context.Context, in *apicorev1.Pod, opts metav1.CreateOptions) (*apicorev1.Pod, error) { @@ -6371,11 +7620,43 @@ type wrapCoreV1PodTemplateImpl struct { var _ typedcorev1.PodTemplateInterface = (*wrapCoreV1PodTemplateImpl)(nil) func (w *wrapCoreV1PodTemplateImpl) Apply(ctx context.Context, in *corev1.PodTemplateApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PodTemplate, err error) { - panic("NYI") + in.Kind = ptr.String("PodTemplate") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PodTemplate{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1PodTemplateImpl) ApplyStatus(ctx context.Context, in *corev1.PodTemplateApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PodTemplate, err error) { - panic("NYI") + in.Kind = ptr.String("PodTemplate") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PodTemplate{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1PodTemplateImpl) Create(ctx context.Context, in *apicorev1.PodTemplate, opts metav1.CreateOptions) (*apicorev1.PodTemplate, error) { @@ -6510,11 +7791,43 @@ type wrapCoreV1ReplicationControllerImpl struct { var _ typedcorev1.ReplicationControllerInterface = (*wrapCoreV1ReplicationControllerImpl)(nil) func (w *wrapCoreV1ReplicationControllerImpl) Apply(ctx context.Context, in *corev1.ReplicationControllerApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ReplicationController, err error) { - panic("NYI") + in.Kind = ptr.String("ReplicationController") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ReplicationController{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1ReplicationControllerImpl) ApplyStatus(ctx context.Context, in *corev1.ReplicationControllerApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ReplicationController, err error) { - panic("NYI") + in.Kind = ptr.String("ReplicationController") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ReplicationController{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1ReplicationControllerImpl) Create(ctx context.Context, in *apicorev1.ReplicationController, opts metav1.CreateOptions) (*apicorev1.ReplicationController, error) { @@ -6654,14 +7967,46 @@ type wrapCoreV1ResourceQuotaImpl struct { namespace string } -var _ typedcorev1.ResourceQuotaInterface = (*wrapCoreV1ResourceQuotaImpl)(nil) +var _ typedcorev1.ResourceQuotaInterface = (*wrapCoreV1ResourceQuotaImpl)(nil) + +func (w *wrapCoreV1ResourceQuotaImpl) Apply(ctx context.Context, in *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ResourceQuota, err error) { + in.Kind = ptr.String("ResourceQuota") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ResourceQuota{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ResourceQuotaImpl) ApplyStatus(ctx context.Context, in *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ResourceQuota, err error) { + in.Kind = ptr.String("ResourceQuota") -func (w *wrapCoreV1ResourceQuotaImpl) Apply(ctx context.Context, in *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ResourceQuota, err error) { - panic("NYI") -} + in.APIVersion = ptr.String("v1") -func (w *wrapCoreV1ResourceQuotaImpl) ApplyStatus(ctx context.Context, in *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ResourceQuota, err error) { - panic("NYI") + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ResourceQuota{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1ResourceQuotaImpl) Create(ctx context.Context, in *apicorev1.ResourceQuota, opts metav1.CreateOptions) (*apicorev1.ResourceQuota, error) { @@ -6796,11 +8141,43 @@ type wrapCoreV1SecretImpl struct { var _ typedcorev1.SecretInterface = (*wrapCoreV1SecretImpl)(nil) func (w *wrapCoreV1SecretImpl) Apply(ctx context.Context, in *corev1.SecretApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Secret, err error) { - panic("NYI") + in.Kind = ptr.String("Secret") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Secret{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1SecretImpl) ApplyStatus(ctx context.Context, in *corev1.SecretApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Secret, err error) { - panic("NYI") + in.Kind = ptr.String("Secret") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Secret{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1SecretImpl) Create(ctx context.Context, in *apicorev1.Secret, opts metav1.CreateOptions) (*apicorev1.Secret, error) { @@ -6935,11 +8312,43 @@ type wrapCoreV1ServiceImpl struct { var _ typedcorev1.ServiceInterface = (*wrapCoreV1ServiceImpl)(nil) func (w *wrapCoreV1ServiceImpl) Apply(ctx context.Context, in *corev1.ServiceApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Service, err error) { - panic("NYI") + in.Kind = ptr.String("Service") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Service{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1ServiceImpl) ApplyStatus(ctx context.Context, in *corev1.ServiceApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Service, err error) { - panic("NYI") + in.Kind = ptr.String("Service") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Service{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1ServiceImpl) Create(ctx context.Context, in *apicorev1.Service, opts metav1.CreateOptions) (*apicorev1.Service, error) { @@ -7070,11 +8479,43 @@ type wrapCoreV1ServiceAccountImpl struct { var _ typedcorev1.ServiceAccountInterface = (*wrapCoreV1ServiceAccountImpl)(nil) func (w *wrapCoreV1ServiceAccountImpl) Apply(ctx context.Context, in *corev1.ServiceAccountApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ServiceAccount, err error) { - panic("NYI") + in.Kind = ptr.String("ServiceAccount") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ServiceAccount{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1ServiceAccountImpl) ApplyStatus(ctx context.Context, in *corev1.ServiceAccountApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ServiceAccount, err error) { - panic("NYI") + in.Kind = ptr.String("ServiceAccount") + + in.APIVersion = ptr.String("v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ServiceAccount{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapCoreV1ServiceAccountImpl) Create(ctx context.Context, in *apicorev1.ServiceAccount, opts metav1.CreateOptions) (*apicorev1.ServiceAccount, error) { @@ -7228,11 +8669,43 @@ type wrapDiscoveryV1EndpointSliceImpl struct { var _ typeddiscoveryv1.EndpointSliceInterface = (*wrapDiscoveryV1EndpointSliceImpl)(nil) func (w *wrapDiscoveryV1EndpointSliceImpl) Apply(ctx context.Context, in *discoveryv1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *apidiscoveryv1.EndpointSlice, err error) { - panic("NYI") + in.Kind = ptr.String("EndpointSlice") + + in.APIVersion = ptr.String("discovery.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapDiscoveryV1EndpointSliceImpl) ApplyStatus(ctx context.Context, in *discoveryv1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *apidiscoveryv1.EndpointSlice, err error) { - panic("NYI") + in.Kind = ptr.String("EndpointSlice") + + in.APIVersion = ptr.String("discovery.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapDiscoveryV1EndpointSliceImpl) Create(ctx context.Context, in *apidiscoveryv1.EndpointSlice, opts metav1.CreateOptions) (*apidiscoveryv1.EndpointSlice, error) { @@ -7382,11 +8855,43 @@ type wrapDiscoveryV1beta1EndpointSliceImpl struct { var _ typeddiscoveryv1beta1.EndpointSliceInterface = (*wrapDiscoveryV1beta1EndpointSliceImpl)(nil) func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Apply(ctx context.Context, in *discoveryv1beta1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *apidiscoveryv1beta1.EndpointSlice, err error) { - panic("NYI") + in.Kind = ptr.String("EndpointSlice") + + in.APIVersion = ptr.String("discovery.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1beta1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapDiscoveryV1beta1EndpointSliceImpl) ApplyStatus(ctx context.Context, in *discoveryv1beta1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *apidiscoveryv1beta1.EndpointSlice, err error) { - panic("NYI") + in.Kind = ptr.String("EndpointSlice") + + in.APIVersion = ptr.String("discovery.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1beta1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Create(ctx context.Context, in *apidiscoveryv1beta1.EndpointSlice, opts metav1.CreateOptions) (*apidiscoveryv1beta1.EndpointSlice, error) { @@ -7536,11 +9041,43 @@ type wrapEventsV1EventImpl struct { var _ typedeventsv1.EventInterface = (*wrapEventsV1EventImpl)(nil) func (w *wrapEventsV1EventImpl) Apply(ctx context.Context, in *eventsv1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apieventsv1.Event, err error) { - panic("NYI") + in.Kind = ptr.String("Event") + + in.APIVersion = ptr.String("events.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apieventsv1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapEventsV1EventImpl) ApplyStatus(ctx context.Context, in *eventsv1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apieventsv1.Event, err error) { - panic("NYI") + in.Kind = ptr.String("Event") + + in.APIVersion = ptr.String("events.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apieventsv1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapEventsV1EventImpl) Create(ctx context.Context, in *apieventsv1.Event, opts metav1.CreateOptions) (*apieventsv1.Event, error) { @@ -7690,11 +9227,43 @@ type wrapEventsV1beta1EventImpl struct { var _ typedeventsv1beta1.EventInterface = (*wrapEventsV1beta1EventImpl)(nil) func (w *wrapEventsV1beta1EventImpl) Apply(ctx context.Context, in *eventsv1beta1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apieventsv1beta1.Event, err error) { - panic("NYI") + in.Kind = ptr.String("Event") + + in.APIVersion = ptr.String("events.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apieventsv1beta1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapEventsV1beta1EventImpl) ApplyStatus(ctx context.Context, in *eventsv1beta1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apieventsv1beta1.Event, err error) { - panic("NYI") + in.Kind = ptr.String("Event") + + in.APIVersion = ptr.String("events.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apieventsv1beta1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapEventsV1beta1EventImpl) Create(ctx context.Context, in *apieventsv1beta1.Event, opts metav1.CreateOptions) (*apieventsv1beta1.Event, error) { @@ -7835,20 +9404,52 @@ func (w *wrapExtensionsV1beta1) DaemonSets(namespace string) typedextensionsv1be } } -type wrapExtensionsV1beta1DaemonSetImpl struct { - dyn dynamic.NamespaceableResourceInterface - - namespace string -} - -var _ typedextensionsv1beta1.DaemonSetInterface = (*wrapExtensionsV1beta1DaemonSetImpl)(nil) +type wrapExtensionsV1beta1DaemonSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedextensionsv1beta1.DaemonSetInterface = (*wrapExtensionsV1beta1DaemonSetImpl)(nil) + +func (w *wrapExtensionsV1beta1DaemonSetImpl) Apply(ctx context.Context, in *extensionsv1beta1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.DaemonSet, err error) { + in.Kind = ptr.String("DaemonSet") + + in.APIVersion = ptr.String("extensions/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.DaemonSet, err error) { + in.Kind = ptr.String("DaemonSet") -func (w *wrapExtensionsV1beta1DaemonSetImpl) Apply(ctx context.Context, in *extensionsv1beta1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.DaemonSet, err error) { - panic("NYI") -} + in.APIVersion = ptr.String("extensions/v1beta1") -func (w *wrapExtensionsV1beta1DaemonSetImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.DaemonSet, err error) { - panic("NYI") + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapExtensionsV1beta1DaemonSetImpl) Create(ctx context.Context, in *apiextensionsv1beta1.DaemonSet, opts metav1.CreateOptions) (*apiextensionsv1beta1.DaemonSet, error) { @@ -7983,11 +9584,43 @@ type wrapExtensionsV1beta1DeploymentImpl struct { var _ typedextensionsv1beta1.DeploymentInterface = (*wrapExtensionsV1beta1DeploymentImpl)(nil) func (w *wrapExtensionsV1beta1DeploymentImpl) Apply(ctx context.Context, in *extensionsv1beta1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.Deployment, err error) { - panic("NYI") + in.Kind = ptr.String("Deployment") + + in.APIVersion = ptr.String("extensions/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapExtensionsV1beta1DeploymentImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.Deployment, err error) { - panic("NYI") + in.Kind = ptr.String("Deployment") + + in.APIVersion = ptr.String("extensions/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapExtensionsV1beta1DeploymentImpl) Create(ctx context.Context, in *apiextensionsv1beta1.Deployment, opts metav1.CreateOptions) (*apiextensionsv1beta1.Deployment, error) { @@ -8134,11 +9767,43 @@ type wrapExtensionsV1beta1IngressImpl struct { var _ typedextensionsv1beta1.IngressInterface = (*wrapExtensionsV1beta1IngressImpl)(nil) func (w *wrapExtensionsV1beta1IngressImpl) Apply(ctx context.Context, in *extensionsv1beta1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.Ingress, err error) { - panic("NYI") + in.Kind = ptr.String("Ingress") + + in.APIVersion = ptr.String("extensions/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapExtensionsV1beta1IngressImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.Ingress, err error) { - panic("NYI") + in.Kind = ptr.String("Ingress") + + in.APIVersion = ptr.String("extensions/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapExtensionsV1beta1IngressImpl) Create(ctx context.Context, in *apiextensionsv1beta1.Ingress, opts metav1.CreateOptions) (*apiextensionsv1beta1.Ingress, error) { @@ -8273,11 +9938,43 @@ type wrapExtensionsV1beta1NetworkPolicyImpl struct { var _ typedextensionsv1beta1.NetworkPolicyInterface = (*wrapExtensionsV1beta1NetworkPolicyImpl)(nil) func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Apply(ctx context.Context, in *extensionsv1beta1.NetworkPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.NetworkPolicy, err error) { - panic("NYI") + in.Kind = ptr.String("NetworkPolicy") + + in.APIVersion = ptr.String("extensions/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapExtensionsV1beta1NetworkPolicyImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.NetworkPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.NetworkPolicy, err error) { - panic("NYI") + in.Kind = ptr.String("NetworkPolicy") + + in.APIVersion = ptr.String("extensions/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Create(ctx context.Context, in *apiextensionsv1beta1.NetworkPolicy, opts metav1.CreateOptions) (*apiextensionsv1beta1.NetworkPolicy, error) { @@ -8408,11 +10105,43 @@ type wrapExtensionsV1beta1PodSecurityPolicyImpl struct { var _ typedextensionsv1beta1.PodSecurityPolicyInterface = (*wrapExtensionsV1beta1PodSecurityPolicyImpl)(nil) func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Apply(ctx context.Context, in *extensionsv1beta1.PodSecurityPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.PodSecurityPolicy, err error) { - panic("NYI") + in.Kind = ptr.String("PodSecurityPolicy") + + in.APIVersion = ptr.String("extensions/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.PodSecurityPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.PodSecurityPolicy, err error) { - panic("NYI") + in.Kind = ptr.String("PodSecurityPolicy") + + in.APIVersion = ptr.String("extensions/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Create(ctx context.Context, in *apiextensionsv1beta1.PodSecurityPolicy, opts metav1.CreateOptions) (*apiextensionsv1beta1.PodSecurityPolicy, error) { @@ -8547,11 +10276,43 @@ type wrapExtensionsV1beta1ReplicaSetImpl struct { var _ typedextensionsv1beta1.ReplicaSetInterface = (*wrapExtensionsV1beta1ReplicaSetImpl)(nil) func (w *wrapExtensionsV1beta1ReplicaSetImpl) Apply(ctx context.Context, in *extensionsv1beta1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.ReplicaSet, err error) { - panic("NYI") + in.Kind = ptr.String("ReplicaSet") + + in.APIVersion = ptr.String("extensions/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapExtensionsV1beta1ReplicaSetImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.ReplicaSet, err error) { - panic("NYI") + in.Kind = ptr.String("ReplicaSet") + + in.APIVersion = ptr.String("extensions/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapExtensionsV1beta1ReplicaSetImpl) Create(ctx context.Context, in *apiextensionsv1beta1.ReplicaSet, opts metav1.CreateOptions) (*apiextensionsv1beta1.ReplicaSet, error) { @@ -8709,11 +10470,43 @@ type wrapFlowcontrolV1alpha1FlowSchemaImpl struct { var _ typedflowcontrolv1alpha1.FlowSchemaInterface = (*wrapFlowcontrolV1alpha1FlowSchemaImpl)(nil) func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Apply(ctx context.Context, in *flowcontrolv1alpha1.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1alpha1.FlowSchema, err error) { - panic("NYI") + in.Kind = ptr.String("FlowSchema") + + in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1alpha1.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1alpha1.FlowSchema, err error) { - panic("NYI") + in.Kind = ptr.String("FlowSchema") + + in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Create(ctx context.Context, in *apiflowcontrolv1alpha1.FlowSchema, opts metav1.CreateOptions) (*apiflowcontrolv1alpha1.FlowSchema, error) { @@ -8844,11 +10637,43 @@ type wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl struct { var _ typedflowcontrolv1alpha1.PriorityLevelConfigurationInterface = (*wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl)(nil) func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Apply(ctx context.Context, in *flowcontrolv1alpha1.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1alpha1.PriorityLevelConfiguration, err error) { - panic("NYI") + in.Kind = ptr.String("PriorityLevelConfiguration") + + in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1alpha1.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1alpha1.PriorityLevelConfiguration, err error) { - panic("NYI") + in.Kind = ptr.String("PriorityLevelConfiguration") + + in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Create(ctx context.Context, in *apiflowcontrolv1alpha1.PriorityLevelConfiguration, opts metav1.CreateOptions) (*apiflowcontrolv1alpha1.PriorityLevelConfiguration, error) { @@ -8991,14 +10816,46 @@ type wrapFlowcontrolV1beta1FlowSchemaImpl struct { dyn dynamic.NamespaceableResourceInterface } -var _ typedflowcontrolv1beta1.FlowSchemaInterface = (*wrapFlowcontrolV1beta1FlowSchemaImpl)(nil) +var _ typedflowcontrolv1beta1.FlowSchemaInterface = (*wrapFlowcontrolV1beta1FlowSchemaImpl)(nil) + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Apply(ctx context.Context, in *flowcontrolv1beta1.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta1.FlowSchema, err error) { + in.Kind = ptr.String("FlowSchema") + + in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1beta1.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta1.FlowSchema, err error) { + in.Kind = ptr.String("FlowSchema") -func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Apply(ctx context.Context, in *flowcontrolv1beta1.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta1.FlowSchema, err error) { - panic("NYI") -} + in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta1") -func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1beta1.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta1.FlowSchema, err error) { - panic("NYI") + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Create(ctx context.Context, in *apiflowcontrolv1beta1.FlowSchema, opts metav1.CreateOptions) (*apiflowcontrolv1beta1.FlowSchema, error) { @@ -9129,11 +10986,43 @@ type wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl struct { var _ typedflowcontrolv1beta1.PriorityLevelConfigurationInterface = (*wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl)(nil) func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Apply(ctx context.Context, in *flowcontrolv1beta1.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta1.PriorityLevelConfiguration, err error) { - panic("NYI") + in.Kind = ptr.String("PriorityLevelConfiguration") + + in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1beta1.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta1.PriorityLevelConfiguration, err error) { - panic("NYI") + in.Kind = ptr.String("PriorityLevelConfiguration") + + in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Create(ctx context.Context, in *apiflowcontrolv1beta1.PriorityLevelConfiguration, opts metav1.CreateOptions) (*apiflowcontrolv1beta1.PriorityLevelConfiguration, error) { @@ -9279,11 +11168,43 @@ type wrapFlowcontrolV1beta2FlowSchemaImpl struct { var _ typedflowcontrolv1beta2.FlowSchemaInterface = (*wrapFlowcontrolV1beta2FlowSchemaImpl)(nil) func (w *wrapFlowcontrolV1beta2FlowSchemaImpl) Apply(ctx context.Context, in *flowcontrolv1beta2.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta2.FlowSchema, err error) { - panic("NYI") + in.Kind = ptr.String("FlowSchema") + + in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta2.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapFlowcontrolV1beta2FlowSchemaImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1beta2.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta2.FlowSchema, err error) { - panic("NYI") + in.Kind = ptr.String("FlowSchema") + + in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta2.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapFlowcontrolV1beta2FlowSchemaImpl) Create(ctx context.Context, in *apiflowcontrolv1beta2.FlowSchema, opts metav1.CreateOptions) (*apiflowcontrolv1beta2.FlowSchema, error) { @@ -9414,11 +11335,43 @@ type wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl struct { var _ typedflowcontrolv1beta2.PriorityLevelConfigurationInterface = (*wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl)(nil) func (w *wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl) Apply(ctx context.Context, in *flowcontrolv1beta2.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta2.PriorityLevelConfiguration, err error) { - panic("NYI") + in.Kind = ptr.String("PriorityLevelConfiguration") + + in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta2.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1beta2.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta2.PriorityLevelConfiguration, err error) { - panic("NYI") + in.Kind = ptr.String("PriorityLevelConfiguration") + + in.APIVersion = ptr.String("flowcontrol.apiserver.k8s.io/v1beta2") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta2.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapFlowcontrolV1beta2PriorityLevelConfigurationImpl) Create(ctx context.Context, in *apiflowcontrolv1beta2.PriorityLevelConfiguration, opts metav1.CreateOptions) (*apiflowcontrolv1beta2.PriorityLevelConfiguration, error) { @@ -9568,11 +11521,43 @@ type wrapNetworkingV1IngressImpl struct { var _ typednetworkingv1.IngressInterface = (*wrapNetworkingV1IngressImpl)(nil) func (w *wrapNetworkingV1IngressImpl) Apply(ctx context.Context, in *networkingv1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.Ingress, err error) { - panic("NYI") + in.Kind = ptr.String("Ingress") + + in.APIVersion = ptr.String("networking.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNetworkingV1IngressImpl) ApplyStatus(ctx context.Context, in *networkingv1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.Ingress, err error) { - panic("NYI") + in.Kind = ptr.String("Ingress") + + in.APIVersion = ptr.String("networking.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNetworkingV1IngressImpl) Create(ctx context.Context, in *apinetworkingv1.Ingress, opts metav1.CreateOptions) (*apinetworkingv1.Ingress, error) { @@ -9703,11 +11688,43 @@ type wrapNetworkingV1IngressClassImpl struct { var _ typednetworkingv1.IngressClassInterface = (*wrapNetworkingV1IngressClassImpl)(nil) func (w *wrapNetworkingV1IngressClassImpl) Apply(ctx context.Context, in *networkingv1.IngressClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.IngressClass, err error) { - panic("NYI") + in.Kind = ptr.String("IngressClass") + + in.APIVersion = ptr.String("networking.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNetworkingV1IngressClassImpl) ApplyStatus(ctx context.Context, in *networkingv1.IngressClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.IngressClass, err error) { - panic("NYI") + in.Kind = ptr.String("IngressClass") + + in.APIVersion = ptr.String("networking.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNetworkingV1IngressClassImpl) Create(ctx context.Context, in *apinetworkingv1.IngressClass, opts metav1.CreateOptions) (*apinetworkingv1.IngressClass, error) { @@ -9842,11 +11859,43 @@ type wrapNetworkingV1NetworkPolicyImpl struct { var _ typednetworkingv1.NetworkPolicyInterface = (*wrapNetworkingV1NetworkPolicyImpl)(nil) func (w *wrapNetworkingV1NetworkPolicyImpl) Apply(ctx context.Context, in *networkingv1.NetworkPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.NetworkPolicy, err error) { - panic("NYI") + in.Kind = ptr.String("NetworkPolicy") + + in.APIVersion = ptr.String("networking.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNetworkingV1NetworkPolicyImpl) ApplyStatus(ctx context.Context, in *networkingv1.NetworkPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.NetworkPolicy, err error) { - panic("NYI") + in.Kind = ptr.String("NetworkPolicy") + + in.APIVersion = ptr.String("networking.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNetworkingV1NetworkPolicyImpl) Create(ctx context.Context, in *apinetworkingv1.NetworkPolicy, opts metav1.CreateOptions) (*apinetworkingv1.NetworkPolicy, error) { @@ -9992,11 +12041,43 @@ type wrapNetworkingV1alpha1ClusterCIDRImpl struct { var _ typednetworkingv1alpha1.ClusterCIDRInterface = (*wrapNetworkingV1alpha1ClusterCIDRImpl)(nil) func (w *wrapNetworkingV1alpha1ClusterCIDRImpl) Apply(ctx context.Context, in *networkingv1alpha1.ClusterCIDRApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1alpha1.ClusterCIDR, err error) { - panic("NYI") + in.Kind = ptr.String("ClusterCIDR") + + in.APIVersion = ptr.String("networking.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1alpha1.ClusterCIDR{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNetworkingV1alpha1ClusterCIDRImpl) ApplyStatus(ctx context.Context, in *networkingv1alpha1.ClusterCIDRApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1alpha1.ClusterCIDR, err error) { - panic("NYI") + in.Kind = ptr.String("ClusterCIDR") + + in.APIVersion = ptr.String("networking.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1alpha1.ClusterCIDR{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNetworkingV1alpha1ClusterCIDRImpl) Create(ctx context.Context, in *apinetworkingv1alpha1.ClusterCIDR, opts metav1.CreateOptions) (*apinetworkingv1alpha1.ClusterCIDR, error) { @@ -10146,11 +12227,43 @@ type wrapNetworkingV1beta1IngressImpl struct { var _ typednetworkingv1beta1.IngressInterface = (*wrapNetworkingV1beta1IngressImpl)(nil) func (w *wrapNetworkingV1beta1IngressImpl) Apply(ctx context.Context, in *networkingv1beta1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1beta1.Ingress, err error) { - panic("NYI") + in.Kind = ptr.String("Ingress") + + in.APIVersion = ptr.String("networking.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNetworkingV1beta1IngressImpl) ApplyStatus(ctx context.Context, in *networkingv1beta1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1beta1.Ingress, err error) { - panic("NYI") + in.Kind = ptr.String("Ingress") + + in.APIVersion = ptr.String("networking.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNetworkingV1beta1IngressImpl) Create(ctx context.Context, in *apinetworkingv1beta1.Ingress, opts metav1.CreateOptions) (*apinetworkingv1beta1.Ingress, error) { @@ -10281,11 +12394,43 @@ type wrapNetworkingV1beta1IngressClassImpl struct { var _ typednetworkingv1beta1.IngressClassInterface = (*wrapNetworkingV1beta1IngressClassImpl)(nil) func (w *wrapNetworkingV1beta1IngressClassImpl) Apply(ctx context.Context, in *networkingv1beta1.IngressClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1beta1.IngressClass, err error) { - panic("NYI") + in.Kind = ptr.String("IngressClass") + + in.APIVersion = ptr.String("networking.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNetworkingV1beta1IngressClassImpl) ApplyStatus(ctx context.Context, in *networkingv1beta1.IngressClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1beta1.IngressClass, err error) { - panic("NYI") + in.Kind = ptr.String("IngressClass") + + in.APIVersion = ptr.String("networking.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNetworkingV1beta1IngressClassImpl) Create(ctx context.Context, in *apinetworkingv1beta1.IngressClass, opts metav1.CreateOptions) (*apinetworkingv1beta1.IngressClass, error) { @@ -10431,11 +12576,43 @@ type wrapNodeV1RuntimeClassImpl struct { var _ typednodev1.RuntimeClassInterface = (*wrapNodeV1RuntimeClassImpl)(nil) func (w *wrapNodeV1RuntimeClassImpl) Apply(ctx context.Context, in *nodev1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1.RuntimeClass, err error) { - panic("NYI") + in.Kind = ptr.String("RuntimeClass") + + in.APIVersion = ptr.String("node.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinodev1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNodeV1RuntimeClassImpl) ApplyStatus(ctx context.Context, in *nodev1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1.RuntimeClass, err error) { - panic("NYI") + in.Kind = ptr.String("RuntimeClass") + + in.APIVersion = ptr.String("node.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinodev1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNodeV1RuntimeClassImpl) Create(ctx context.Context, in *apinodev1.RuntimeClass, opts metav1.CreateOptions) (*apinodev1.RuntimeClass, error) { @@ -10581,11 +12758,43 @@ type wrapNodeV1alpha1RuntimeClassImpl struct { var _ typednodev1alpha1.RuntimeClassInterface = (*wrapNodeV1alpha1RuntimeClassImpl)(nil) func (w *wrapNodeV1alpha1RuntimeClassImpl) Apply(ctx context.Context, in *nodev1alpha1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1alpha1.RuntimeClass, err error) { - panic("NYI") + in.Kind = ptr.String("RuntimeClass") + + in.APIVersion = ptr.String("node.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinodev1alpha1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNodeV1alpha1RuntimeClassImpl) ApplyStatus(ctx context.Context, in *nodev1alpha1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1alpha1.RuntimeClass, err error) { - panic("NYI") + in.Kind = ptr.String("RuntimeClass") + + in.APIVersion = ptr.String("node.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinodev1alpha1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNodeV1alpha1RuntimeClassImpl) Create(ctx context.Context, in *apinodev1alpha1.RuntimeClass, opts metav1.CreateOptions) (*apinodev1alpha1.RuntimeClass, error) { @@ -10731,11 +12940,43 @@ type wrapNodeV1beta1RuntimeClassImpl struct { var _ typednodev1beta1.RuntimeClassInterface = (*wrapNodeV1beta1RuntimeClassImpl)(nil) func (w *wrapNodeV1beta1RuntimeClassImpl) Apply(ctx context.Context, in *nodev1beta1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1beta1.RuntimeClass, err error) { - panic("NYI") + in.Kind = ptr.String("RuntimeClass") + + in.APIVersion = ptr.String("node.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinodev1beta1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNodeV1beta1RuntimeClassImpl) ApplyStatus(ctx context.Context, in *nodev1beta1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1beta1.RuntimeClass, err error) { - panic("NYI") + in.Kind = ptr.String("RuntimeClass") + + in.APIVersion = ptr.String("node.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apinodev1beta1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapNodeV1beta1RuntimeClassImpl) Create(ctx context.Context, in *apinodev1beta1.RuntimeClass, opts metav1.CreateOptions) (*apinodev1beta1.RuntimeClass, error) { @@ -10905,11 +13146,43 @@ type wrapPolicyV1PodDisruptionBudgetImpl struct { var _ typedpolicyv1.PodDisruptionBudgetInterface = (*wrapPolicyV1PodDisruptionBudgetImpl)(nil) func (w *wrapPolicyV1PodDisruptionBudgetImpl) Apply(ctx context.Context, in *policyv1.PodDisruptionBudgetApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1.PodDisruptionBudget, err error) { - panic("NYI") + in.Kind = ptr.String("PodDisruptionBudget") + + in.APIVersion = ptr.String("policy/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapPolicyV1PodDisruptionBudgetImpl) ApplyStatus(ctx context.Context, in *policyv1.PodDisruptionBudgetApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1.PodDisruptionBudget, err error) { - panic("NYI") + in.Kind = ptr.String("PodDisruptionBudget") + + in.APIVersion = ptr.String("policy/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapPolicyV1PodDisruptionBudgetImpl) Create(ctx context.Context, in *apipolicyv1.PodDisruptionBudget, opts metav1.CreateOptions) (*apipolicyv1.PodDisruptionBudget, error) { @@ -11079,11 +13352,43 @@ type wrapPolicyV1beta1PodDisruptionBudgetImpl struct { var _ typedpolicyv1beta1.PodDisruptionBudgetInterface = (*wrapPolicyV1beta1PodDisruptionBudgetImpl)(nil) func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Apply(ctx context.Context, in *policyv1beta1.PodDisruptionBudgetApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1beta1.PodDisruptionBudget, err error) { - panic("NYI") + in.Kind = ptr.String("PodDisruptionBudget") + + in.APIVersion = ptr.String("policy/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) ApplyStatus(ctx context.Context, in *policyv1beta1.PodDisruptionBudgetApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1beta1.PodDisruptionBudget, err error) { - panic("NYI") + in.Kind = ptr.String("PodDisruptionBudget") + + in.APIVersion = ptr.String("policy/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Create(ctx context.Context, in *apipolicyv1beta1.PodDisruptionBudget, opts metav1.CreateOptions) (*apipolicyv1beta1.PodDisruptionBudget, error) { @@ -11214,11 +13519,43 @@ type wrapPolicyV1beta1PodSecurityPolicyImpl struct { var _ typedpolicyv1beta1.PodSecurityPolicyInterface = (*wrapPolicyV1beta1PodSecurityPolicyImpl)(nil) func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Apply(ctx context.Context, in *policyv1beta1.PodSecurityPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1beta1.PodSecurityPolicy, err error) { - panic("NYI") + in.Kind = ptr.String("PodSecurityPolicy") + + in.APIVersion = ptr.String("policy/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) ApplyStatus(ctx context.Context, in *policyv1beta1.PodSecurityPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1beta1.PodSecurityPolicy, err error) { - panic("NYI") + in.Kind = ptr.String("PodSecurityPolicy") + + in.APIVersion = ptr.String("policy/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Create(ctx context.Context, in *apipolicyv1beta1.PodSecurityPolicy, opts metav1.CreateOptions) (*apipolicyv1beta1.PodSecurityPolicy, error) { @@ -11364,11 +13701,43 @@ type wrapRbacV1ClusterRoleImpl struct { var _ typedrbacv1.ClusterRoleInterface = (*wrapRbacV1ClusterRoleImpl)(nil) func (w *wrapRbacV1ClusterRoleImpl) Apply(ctx context.Context, in *rbacv1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.ClusterRole, err error) { - panic("NYI") + in.Kind = ptr.String("ClusterRole") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1ClusterRoleImpl) ApplyStatus(ctx context.Context, in *rbacv1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.ClusterRole, err error) { - panic("NYI") + in.Kind = ptr.String("ClusterRole") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1ClusterRoleImpl) Create(ctx context.Context, in *apirbacv1.ClusterRole, opts metav1.CreateOptions) (*apirbacv1.ClusterRole, error) { @@ -11499,11 +13868,43 @@ type wrapRbacV1ClusterRoleBindingImpl struct { var _ typedrbacv1.ClusterRoleBindingInterface = (*wrapRbacV1ClusterRoleBindingImpl)(nil) func (w *wrapRbacV1ClusterRoleBindingImpl) Apply(ctx context.Context, in *rbacv1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.ClusterRoleBinding, err error) { - panic("NYI") + in.Kind = ptr.String("ClusterRoleBinding") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1ClusterRoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.ClusterRoleBinding, err error) { - panic("NYI") + in.Kind = ptr.String("ClusterRoleBinding") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1ClusterRoleBindingImpl) Create(ctx context.Context, in *apirbacv1.ClusterRoleBinding, opts metav1.CreateOptions) (*apirbacv1.ClusterRoleBinding, error) { @@ -11638,11 +14039,43 @@ type wrapRbacV1RoleImpl struct { var _ typedrbacv1.RoleInterface = (*wrapRbacV1RoleImpl)(nil) func (w *wrapRbacV1RoleImpl) Apply(ctx context.Context, in *rbacv1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.Role, err error) { - panic("NYI") + in.Kind = ptr.String("Role") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1RoleImpl) ApplyStatus(ctx context.Context, in *rbacv1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.Role, err error) { - panic("NYI") + in.Kind = ptr.String("Role") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1RoleImpl) Create(ctx context.Context, in *apirbacv1.Role, opts metav1.CreateOptions) (*apirbacv1.Role, error) { @@ -11777,11 +14210,43 @@ type wrapRbacV1RoleBindingImpl struct { var _ typedrbacv1.RoleBindingInterface = (*wrapRbacV1RoleBindingImpl)(nil) func (w *wrapRbacV1RoleBindingImpl) Apply(ctx context.Context, in *rbacv1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.RoleBinding, err error) { - panic("NYI") + in.Kind = ptr.String("RoleBinding") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1RoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.RoleBinding, err error) { - panic("NYI") + in.Kind = ptr.String("RoleBinding") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1RoleBindingImpl) Create(ctx context.Context, in *apirbacv1.RoleBinding, opts metav1.CreateOptions) (*apirbacv1.RoleBinding, error) { @@ -11927,11 +14392,43 @@ type wrapRbacV1alpha1ClusterRoleImpl struct { var _ typedrbacv1alpha1.ClusterRoleInterface = (*wrapRbacV1alpha1ClusterRoleImpl)(nil) func (w *wrapRbacV1alpha1ClusterRoleImpl) Apply(ctx context.Context, in *rbacv1alpha1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.ClusterRole, err error) { - panic("NYI") + in.Kind = ptr.String("ClusterRole") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1alpha1ClusterRoleImpl) ApplyStatus(ctx context.Context, in *rbacv1alpha1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.ClusterRole, err error) { - panic("NYI") + in.Kind = ptr.String("ClusterRole") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1alpha1ClusterRoleImpl) Create(ctx context.Context, in *apirbacv1alpha1.ClusterRole, opts metav1.CreateOptions) (*apirbacv1alpha1.ClusterRole, error) { @@ -12062,11 +14559,43 @@ type wrapRbacV1alpha1ClusterRoleBindingImpl struct { var _ typedrbacv1alpha1.ClusterRoleBindingInterface = (*wrapRbacV1alpha1ClusterRoleBindingImpl)(nil) func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Apply(ctx context.Context, in *rbacv1alpha1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.ClusterRoleBinding, err error) { - panic("NYI") + in.Kind = ptr.String("ClusterRoleBinding") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1alpha1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.ClusterRoleBinding, err error) { - panic("NYI") + in.Kind = ptr.String("ClusterRoleBinding") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Create(ctx context.Context, in *apirbacv1alpha1.ClusterRoleBinding, opts metav1.CreateOptions) (*apirbacv1alpha1.ClusterRoleBinding, error) { @@ -12201,11 +14730,43 @@ type wrapRbacV1alpha1RoleImpl struct { var _ typedrbacv1alpha1.RoleInterface = (*wrapRbacV1alpha1RoleImpl)(nil) func (w *wrapRbacV1alpha1RoleImpl) Apply(ctx context.Context, in *rbacv1alpha1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.Role, err error) { - panic("NYI") + in.Kind = ptr.String("Role") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1alpha1RoleImpl) ApplyStatus(ctx context.Context, in *rbacv1alpha1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.Role, err error) { - panic("NYI") + in.Kind = ptr.String("Role") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1alpha1RoleImpl) Create(ctx context.Context, in *apirbacv1alpha1.Role, opts metav1.CreateOptions) (*apirbacv1alpha1.Role, error) { @@ -12340,11 +14901,43 @@ type wrapRbacV1alpha1RoleBindingImpl struct { var _ typedrbacv1alpha1.RoleBindingInterface = (*wrapRbacV1alpha1RoleBindingImpl)(nil) func (w *wrapRbacV1alpha1RoleBindingImpl) Apply(ctx context.Context, in *rbacv1alpha1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.RoleBinding, err error) { - panic("NYI") + in.Kind = ptr.String("RoleBinding") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1alpha1RoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1alpha1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.RoleBinding, err error) { - panic("NYI") + in.Kind = ptr.String("RoleBinding") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1alpha1RoleBindingImpl) Create(ctx context.Context, in *apirbacv1alpha1.RoleBinding, opts metav1.CreateOptions) (*apirbacv1alpha1.RoleBinding, error) { @@ -12490,11 +15083,43 @@ type wrapRbacV1beta1ClusterRoleImpl struct { var _ typedrbacv1beta1.ClusterRoleInterface = (*wrapRbacV1beta1ClusterRoleImpl)(nil) func (w *wrapRbacV1beta1ClusterRoleImpl) Apply(ctx context.Context, in *rbacv1beta1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.ClusterRole, err error) { - panic("NYI") + in.Kind = ptr.String("ClusterRole") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1beta1ClusterRoleImpl) ApplyStatus(ctx context.Context, in *rbacv1beta1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.ClusterRole, err error) { - panic("NYI") + in.Kind = ptr.String("ClusterRole") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1beta1ClusterRoleImpl) Create(ctx context.Context, in *apirbacv1beta1.ClusterRole, opts metav1.CreateOptions) (*apirbacv1beta1.ClusterRole, error) { @@ -12625,11 +15250,43 @@ type wrapRbacV1beta1ClusterRoleBindingImpl struct { var _ typedrbacv1beta1.ClusterRoleBindingInterface = (*wrapRbacV1beta1ClusterRoleBindingImpl)(nil) func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Apply(ctx context.Context, in *rbacv1beta1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.ClusterRoleBinding, err error) { - panic("NYI") + in.Kind = ptr.String("ClusterRoleBinding") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1beta1ClusterRoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1beta1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.ClusterRoleBinding, err error) { - panic("NYI") + in.Kind = ptr.String("ClusterRoleBinding") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Create(ctx context.Context, in *apirbacv1beta1.ClusterRoleBinding, opts metav1.CreateOptions) (*apirbacv1beta1.ClusterRoleBinding, error) { @@ -12764,11 +15421,43 @@ type wrapRbacV1beta1RoleImpl struct { var _ typedrbacv1beta1.RoleInterface = (*wrapRbacV1beta1RoleImpl)(nil) func (w *wrapRbacV1beta1RoleImpl) Apply(ctx context.Context, in *rbacv1beta1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.Role, err error) { - panic("NYI") + in.Kind = ptr.String("Role") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1beta1RoleImpl) ApplyStatus(ctx context.Context, in *rbacv1beta1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.Role, err error) { - panic("NYI") + in.Kind = ptr.String("Role") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1beta1RoleImpl) Create(ctx context.Context, in *apirbacv1beta1.Role, opts metav1.CreateOptions) (*apirbacv1beta1.Role, error) { @@ -12903,11 +15592,43 @@ type wrapRbacV1beta1RoleBindingImpl struct { var _ typedrbacv1beta1.RoleBindingInterface = (*wrapRbacV1beta1RoleBindingImpl)(nil) func (w *wrapRbacV1beta1RoleBindingImpl) Apply(ctx context.Context, in *rbacv1beta1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.RoleBinding, err error) { - panic("NYI") + in.Kind = ptr.String("RoleBinding") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1beta1RoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1beta1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.RoleBinding, err error) { - panic("NYI") + in.Kind = ptr.String("RoleBinding") + + in.APIVersion = ptr.String("rbac.authorization.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapRbacV1beta1RoleBindingImpl) Create(ctx context.Context, in *apirbacv1beta1.RoleBinding, opts metav1.CreateOptions) (*apirbacv1beta1.RoleBinding, error) { @@ -13053,11 +15774,43 @@ type wrapSchedulingV1PriorityClassImpl struct { var _ typedschedulingv1.PriorityClassInterface = (*wrapSchedulingV1PriorityClassImpl)(nil) func (w *wrapSchedulingV1PriorityClassImpl) Apply(ctx context.Context, in *schedulingv1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1.PriorityClass, err error) { - panic("NYI") + in.Kind = ptr.String("PriorityClass") + + in.APIVersion = ptr.String("scheduling.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapSchedulingV1PriorityClassImpl) ApplyStatus(ctx context.Context, in *schedulingv1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1.PriorityClass, err error) { - panic("NYI") + in.Kind = ptr.String("PriorityClass") + + in.APIVersion = ptr.String("scheduling.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapSchedulingV1PriorityClassImpl) Create(ctx context.Context, in *apischedulingv1.PriorityClass, opts metav1.CreateOptions) (*apischedulingv1.PriorityClass, error) { @@ -13203,11 +15956,43 @@ type wrapSchedulingV1alpha1PriorityClassImpl struct { var _ typedschedulingv1alpha1.PriorityClassInterface = (*wrapSchedulingV1alpha1PriorityClassImpl)(nil) func (w *wrapSchedulingV1alpha1PriorityClassImpl) Apply(ctx context.Context, in *schedulingv1alpha1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1alpha1.PriorityClass, err error) { - panic("NYI") + in.Kind = ptr.String("PriorityClass") + + in.APIVersion = ptr.String("scheduling.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1alpha1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapSchedulingV1alpha1PriorityClassImpl) ApplyStatus(ctx context.Context, in *schedulingv1alpha1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1alpha1.PriorityClass, err error) { - panic("NYI") + in.Kind = ptr.String("PriorityClass") + + in.APIVersion = ptr.String("scheduling.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1alpha1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapSchedulingV1alpha1PriorityClassImpl) Create(ctx context.Context, in *apischedulingv1alpha1.PriorityClass, opts metav1.CreateOptions) (*apischedulingv1alpha1.PriorityClass, error) { @@ -13353,11 +16138,43 @@ type wrapSchedulingV1beta1PriorityClassImpl struct { var _ typedschedulingv1beta1.PriorityClassInterface = (*wrapSchedulingV1beta1PriorityClassImpl)(nil) func (w *wrapSchedulingV1beta1PriorityClassImpl) Apply(ctx context.Context, in *schedulingv1beta1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1beta1.PriorityClass, err error) { - panic("NYI") + in.Kind = ptr.String("PriorityClass") + + in.APIVersion = ptr.String("scheduling.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1beta1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapSchedulingV1beta1PriorityClassImpl) ApplyStatus(ctx context.Context, in *schedulingv1beta1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1beta1.PriorityClass, err error) { - panic("NYI") + in.Kind = ptr.String("PriorityClass") + + in.APIVersion = ptr.String("scheduling.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1beta1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapSchedulingV1beta1PriorityClassImpl) Create(ctx context.Context, in *apischedulingv1beta1.PriorityClass, opts metav1.CreateOptions) (*apischedulingv1beta1.PriorityClass, error) { @@ -13503,11 +16320,43 @@ type wrapStorageV1CSIDriverImpl struct { var _ typedstoragev1.CSIDriverInterface = (*wrapStorageV1CSIDriverImpl)(nil) func (w *wrapStorageV1CSIDriverImpl) Apply(ctx context.Context, in *storagev1.CSIDriverApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSIDriver, err error) { - panic("NYI") + in.Kind = ptr.String("CSIDriver") + + in.APIVersion = ptr.String("storage.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1CSIDriverImpl) ApplyStatus(ctx context.Context, in *storagev1.CSIDriverApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSIDriver, err error) { - panic("NYI") + in.Kind = ptr.String("CSIDriver") + + in.APIVersion = ptr.String("storage.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1CSIDriverImpl) Create(ctx context.Context, in *apistoragev1.CSIDriver, opts metav1.CreateOptions) (*apistoragev1.CSIDriver, error) { @@ -13638,11 +16487,43 @@ type wrapStorageV1CSINodeImpl struct { var _ typedstoragev1.CSINodeInterface = (*wrapStorageV1CSINodeImpl)(nil) func (w *wrapStorageV1CSINodeImpl) Apply(ctx context.Context, in *storagev1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSINode, err error) { - panic("NYI") + in.Kind = ptr.String("CSINode") + + in.APIVersion = ptr.String("storage.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1CSINodeImpl) ApplyStatus(ctx context.Context, in *storagev1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSINode, err error) { - panic("NYI") + in.Kind = ptr.String("CSINode") + + in.APIVersion = ptr.String("storage.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1CSINodeImpl) Create(ctx context.Context, in *apistoragev1.CSINode, opts metav1.CreateOptions) (*apistoragev1.CSINode, error) { @@ -13777,11 +16658,43 @@ type wrapStorageV1CSIStorageCapacityImpl struct { var _ typedstoragev1.CSIStorageCapacityInterface = (*wrapStorageV1CSIStorageCapacityImpl)(nil) func (w *wrapStorageV1CSIStorageCapacityImpl) Apply(ctx context.Context, in *storagev1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSIStorageCapacity, err error) { - panic("NYI") + in.Kind = ptr.String("CSIStorageCapacity") + + in.APIVersion = ptr.String("storage.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1CSIStorageCapacityImpl) ApplyStatus(ctx context.Context, in *storagev1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSIStorageCapacity, err error) { - panic("NYI") + in.Kind = ptr.String("CSIStorageCapacity") + + in.APIVersion = ptr.String("storage.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1CSIStorageCapacityImpl) Create(ctx context.Context, in *apistoragev1.CSIStorageCapacity, opts metav1.CreateOptions) (*apistoragev1.CSIStorageCapacity, error) { @@ -13912,11 +16825,43 @@ type wrapStorageV1StorageClassImpl struct { var _ typedstoragev1.StorageClassInterface = (*wrapStorageV1StorageClassImpl)(nil) func (w *wrapStorageV1StorageClassImpl) Apply(ctx context.Context, in *storagev1.StorageClassApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.StorageClass, err error) { - panic("NYI") + in.Kind = ptr.String("StorageClass") + + in.APIVersion = ptr.String("storage.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1StorageClassImpl) ApplyStatus(ctx context.Context, in *storagev1.StorageClassApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.StorageClass, err error) { - panic("NYI") + in.Kind = ptr.String("StorageClass") + + in.APIVersion = ptr.String("storage.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1StorageClassImpl) Create(ctx context.Context, in *apistoragev1.StorageClass, opts metav1.CreateOptions) (*apistoragev1.StorageClass, error) { @@ -14047,11 +16992,43 @@ type wrapStorageV1VolumeAttachmentImpl struct { var _ typedstoragev1.VolumeAttachmentInterface = (*wrapStorageV1VolumeAttachmentImpl)(nil) func (w *wrapStorageV1VolumeAttachmentImpl) Apply(ctx context.Context, in *storagev1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.VolumeAttachment, err error) { - panic("NYI") + in.Kind = ptr.String("VolumeAttachment") + + in.APIVersion = ptr.String("storage.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1VolumeAttachmentImpl) ApplyStatus(ctx context.Context, in *storagev1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.VolumeAttachment, err error) { - panic("NYI") + in.Kind = ptr.String("VolumeAttachment") + + in.APIVersion = ptr.String("storage.k8s.io/v1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1VolumeAttachmentImpl) Create(ctx context.Context, in *apistoragev1.VolumeAttachment, opts metav1.CreateOptions) (*apistoragev1.VolumeAttachment, error) { @@ -14201,11 +17178,43 @@ type wrapStorageV1alpha1CSIStorageCapacityImpl struct { var _ typedstoragev1alpha1.CSIStorageCapacityInterface = (*wrapStorageV1alpha1CSIStorageCapacityImpl)(nil) func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Apply(ctx context.Context, in *storagev1alpha1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1alpha1.CSIStorageCapacity, err error) { - panic("NYI") + in.Kind = ptr.String("CSIStorageCapacity") + + in.APIVersion = ptr.String("storage.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) ApplyStatus(ctx context.Context, in *storagev1alpha1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1alpha1.CSIStorageCapacity, err error) { - panic("NYI") + in.Kind = ptr.String("CSIStorageCapacity") + + in.APIVersion = ptr.String("storage.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Create(ctx context.Context, in *apistoragev1alpha1.CSIStorageCapacity, opts metav1.CreateOptions) (*apistoragev1alpha1.CSIStorageCapacity, error) { @@ -14336,11 +17345,43 @@ type wrapStorageV1alpha1VolumeAttachmentImpl struct { var _ typedstoragev1alpha1.VolumeAttachmentInterface = (*wrapStorageV1alpha1VolumeAttachmentImpl)(nil) func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Apply(ctx context.Context, in *storagev1alpha1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1alpha1.VolumeAttachment, err error) { - panic("NYI") + in.Kind = ptr.String("VolumeAttachment") + + in.APIVersion = ptr.String("storage.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1alpha1VolumeAttachmentImpl) ApplyStatus(ctx context.Context, in *storagev1alpha1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1alpha1.VolumeAttachment, err error) { - panic("NYI") + in.Kind = ptr.String("VolumeAttachment") + + in.APIVersion = ptr.String("storage.k8s.io/v1alpha1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Create(ctx context.Context, in *apistoragev1alpha1.VolumeAttachment, opts metav1.CreateOptions) (*apistoragev1alpha1.VolumeAttachment, error) { @@ -14486,11 +17527,43 @@ type wrapStorageV1beta1CSIDriverImpl struct { var _ typedstoragev1beta1.CSIDriverInterface = (*wrapStorageV1beta1CSIDriverImpl)(nil) func (w *wrapStorageV1beta1CSIDriverImpl) Apply(ctx context.Context, in *storagev1beta1.CSIDriverApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSIDriver, err error) { - panic("NYI") + in.Kind = ptr.String("CSIDriver") + + in.APIVersion = ptr.String("storage.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1beta1CSIDriverImpl) ApplyStatus(ctx context.Context, in *storagev1beta1.CSIDriverApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSIDriver, err error) { - panic("NYI") + in.Kind = ptr.String("CSIDriver") + + in.APIVersion = ptr.String("storage.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1beta1CSIDriverImpl) Create(ctx context.Context, in *apistoragev1beta1.CSIDriver, opts metav1.CreateOptions) (*apistoragev1beta1.CSIDriver, error) { @@ -14621,11 +17694,43 @@ type wrapStorageV1beta1CSINodeImpl struct { var _ typedstoragev1beta1.CSINodeInterface = (*wrapStorageV1beta1CSINodeImpl)(nil) func (w *wrapStorageV1beta1CSINodeImpl) Apply(ctx context.Context, in *storagev1beta1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSINode, err error) { - panic("NYI") + in.Kind = ptr.String("CSINode") + + in.APIVersion = ptr.String("storage.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1beta1CSINodeImpl) ApplyStatus(ctx context.Context, in *storagev1beta1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSINode, err error) { - panic("NYI") + in.Kind = ptr.String("CSINode") + + in.APIVersion = ptr.String("storage.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1beta1CSINodeImpl) Create(ctx context.Context, in *apistoragev1beta1.CSINode, opts metav1.CreateOptions) (*apistoragev1beta1.CSINode, error) { @@ -14760,11 +17865,43 @@ type wrapStorageV1beta1CSIStorageCapacityImpl struct { var _ typedstoragev1beta1.CSIStorageCapacityInterface = (*wrapStorageV1beta1CSIStorageCapacityImpl)(nil) func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Apply(ctx context.Context, in *storagev1beta1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSIStorageCapacity, err error) { - panic("NYI") + in.Kind = ptr.String("CSIStorageCapacity") + + in.APIVersion = ptr.String("storage.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1beta1CSIStorageCapacityImpl) ApplyStatus(ctx context.Context, in *storagev1beta1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSIStorageCapacity, err error) { - panic("NYI") + in.Kind = ptr.String("CSIStorageCapacity") + + in.APIVersion = ptr.String("storage.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Namespace(w.namespace).ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Create(ctx context.Context, in *apistoragev1beta1.CSIStorageCapacity, opts metav1.CreateOptions) (*apistoragev1beta1.CSIStorageCapacity, error) { @@ -14895,11 +18032,43 @@ type wrapStorageV1beta1StorageClassImpl struct { var _ typedstoragev1beta1.StorageClassInterface = (*wrapStorageV1beta1StorageClassImpl)(nil) func (w *wrapStorageV1beta1StorageClassImpl) Apply(ctx context.Context, in *storagev1beta1.StorageClassApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.StorageClass, err error) { - panic("NYI") + in.Kind = ptr.String("StorageClass") + + in.APIVersion = ptr.String("storage.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1beta1StorageClassImpl) ApplyStatus(ctx context.Context, in *storagev1beta1.StorageClassApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.StorageClass, err error) { - panic("NYI") + in.Kind = ptr.String("StorageClass") + + in.APIVersion = ptr.String("storage.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1beta1StorageClassImpl) Create(ctx context.Context, in *apistoragev1beta1.StorageClass, opts metav1.CreateOptions) (*apistoragev1beta1.StorageClass, error) { @@ -15030,11 +18199,43 @@ type wrapStorageV1beta1VolumeAttachmentImpl struct { var _ typedstoragev1beta1.VolumeAttachmentInterface = (*wrapStorageV1beta1VolumeAttachmentImpl)(nil) func (w *wrapStorageV1beta1VolumeAttachmentImpl) Apply(ctx context.Context, in *storagev1beta1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.VolumeAttachment, err error) { - panic("NYI") + in.Kind = ptr.String("VolumeAttachment") + + in.APIVersion = ptr.String("storage.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1beta1VolumeAttachmentImpl) ApplyStatus(ctx context.Context, in *storagev1beta1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.VolumeAttachment, err error) { - panic("NYI") + in.Kind = ptr.String("VolumeAttachment") + + in.APIVersion = ptr.String("storage.k8s.io/v1beta1") + + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } func (w *wrapStorageV1beta1VolumeAttachmentImpl) Create(ctx context.Context, in *apistoragev1beta1.VolumeAttachment, opts metav1.CreateOptions) (*apistoragev1beta1.VolumeAttachment, error) { diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go index 72047707769..b5059684666 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go @@ -29,6 +29,7 @@ type CustomArgs struct { ExternalVersionsInformersPackage string ListersPackage string ForceKinds string + ListerHasPointerElem bool } // NewDefaults returns default arguments for the generator. @@ -45,6 +46,7 @@ func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) { fs.StringVar(&ca.ExternalVersionsInformersPackage, "external-versions-informers-package", ca.ExternalVersionsInformersPackage, "the full package name for the external versions injection informer to use") fs.StringVar(&ca.ListersPackage, "listers-package", ca.ListersPackage, "the full package name for client listers to use") fs.StringVar(&ca.ForceKinds, "force-genreconciler-kinds", ca.ForceKinds, `force kinds will override the genreconciler tag setting for the given set of kinds, comma separated: "Foo,Bar,Baz"`) + fs.BoolVar(&ca.ListerHasPointerElem, "lister-has-pointer-elem", ca.ListerHasPointerElem, "set to true if the List types have an Item array of pointer element types") } // Validate checks the given arguments. diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/client.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/client.go index 6248db52fe7..8338ed647c1 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/client.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/client.go @@ -286,6 +286,11 @@ func (g *clientGenerator) GenerateType(c *generator.Context, t *types.Type, w io "Group": group, "VersionLower": version, "Kind": t.Name.Name, + + "ptrString": c.Universe.Function(types.Name{ + Package: "knative.dev/pkg/ptr", + Name: "String", + }), } for _, v := range verbs.List() { @@ -575,13 +580,51 @@ func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Patch(ctx {{ `, "apply": `{{if .generateApply}} func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) Apply(ctx {{ .contextContext|raw }}, in *{{ .ApplyType|raw }}, opts {{ .metav1ApplyOptions|raw }}) (result *{{ .ResultType|raw }}, err error) { - panic("NYI") + in.Kind = {{ .ptrString|raw }}("{{ .Kind }}") + {{ if .Group }} + in.APIVersion = {{ .ptrString|raw }}("{{ .Group }}/{{ .VersionLower }}") + {{ else }} + in.APIVersion = {{ .ptrString|raw }}("{{ .VersionLower }}") + {{ end }} + + uo := &{{ .unstructuredUnstructured|raw }}{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.Apply(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &{{ .ResultType|raw }}{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } {{end}} `, "applyStatus": `{{if .generateApply}} func (w *wrap{{.GroupGoName}}{{.Version}}{{ .Type.Name.Name }}Impl) ApplyStatus(ctx {{ .contextContext|raw }}, in *{{ .ApplyType|raw }}, opts {{ .metav1ApplyOptions|raw }}) (result *{{ .ResultType|raw }}, err error) { - panic("NYI") + in.Kind = {{ .ptrString|raw }}("{{ .Kind }}") + {{ if .Group }} + in.APIVersion = {{ .ptrString|raw }}("{{ .Group }}/{{ .VersionLower }}") + {{ else }} + in.APIVersion = {{ .ptrString|raw }}("{{ .VersionLower }}") + {{ end }} + + uo := &{{ .unstructuredUnstructured|raw }}{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err = w.dyn{{if .Namespaced}}.Namespace(w.namespace){{end}}.ApplyStatus(ctx, uo.GetName(), uo, opts) + if err != nil { + return nil, err + } + out := &{{ .ResultType|raw }}{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil } {{end}} `, diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/comment_parser.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/comment_parser.go index 68ac8b4cba1..4051e6a8623 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/comment_parser.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/comment_parser.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -27,10 +27,10 @@ type CommentTag map[string][]string // ExtractCommentTags parses comments for lines of the form: // -// "marker" + "prefix" + ':' + "key=value,key2=value2". +// "marker" + "prefix" + ':' + "key=value,key2=value2". // -// In the following example the marker is '+' and the prefix is 'foo': -// +foo:key=value1,key2=value2,key=value3 +// In the following example the marker is '+' and the prefix is 'foo': +// +foo:key=value1,key2=value2,key=value3 // // Values are optional; empty map is the default. A tag can be specified more than // one time and all values are returned. If the resulting map has an entry for @@ -38,17 +38,19 @@ type CommentTag map[string][]string // // Example: if you pass "+" for 'marker', and the following lines are in // the comments: -// +foo:key=value1,key2=value2,key=value3 -// +bar +// +// +foo:key=value1,key2=value2,key=value3 +// +bar // // Then this function will return: -// map[string]map[string]string{ -// "foo":{ -// "key": []string{"value1", "value3"}, -// "key2": []string{"value2"} -// }, -// "bar": {}, -// } +// +// map[string]map[string]string{ +// "foo":{ +// "key": []string{"value1", "value3"}, +// "key2": []string{"value2"} +// }, +// "bar": {}, +// } // // Users are not expected to repeat values. func ExtractCommentTags(marker string, lines []string) CommentTags { diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/filtered_informer.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/filtered_informer.go index 53debfb38e5..b9c5c4ae2f8 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/filtered_informer.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/filtered_informer.go @@ -41,6 +41,7 @@ type filteredInjectionGenerator struct { injectionClientSetPackage string clientSetPackage string listerPkg string + listerHasPointerElem bool } var _ generator.Generator = (*filteredInjectionGenerator)(nil) @@ -92,6 +93,7 @@ func (g *filteredInjectionGenerator) GenerateType(c *generator.Context, t *types "clientSetInterface": c.Universe.Type(types.Name{Package: g.clientSetPackage, Name: "Interface"}), "resourceLister": c.Universe.Type(types.Name{Name: g.typeToGenerate.Name.Name + "Lister", Package: g.listerPkg}), "resourceNamespaceLister": c.Universe.Type(types.Name{Name: g.typeToGenerate.Name.Name + "NamespaceLister", Package: g.listerPkg}), + "listerHasPointerElem": g.listerHasPointerElem, "groupGoName": namer.IC(g.groupGoName), "versionGoName": namer.IC(g.groupVersion.Version.String()), "group": namer.IC(g.groupGoName), @@ -246,7 +248,7 @@ func (w *wrapper) List(selector {{ .labelsSelector|raw }}) (ret []*{{ .type|raw return nil, err } for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) + ret = append(ret, {{if not .listerHasPointerElem}}&{{end}}lo.Items[idx]) } return ret, nil } diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/informer.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/informer.go index d00158b28e5..305ec2476e4 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/informer.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/informer.go @@ -41,6 +41,7 @@ type injectionGenerator struct { injectionClientSetPackage string clientSetPackage string listerPkg string + listerHasPointerElem bool } var _ generator.Generator = (*injectionGenerator)(nil) @@ -92,6 +93,7 @@ func (g *injectionGenerator) GenerateType(c *generator.Context, t *types.Type, w "clientSetInterface": c.Universe.Type(types.Name{Package: g.clientSetPackage, Name: "Interface"}), "resourceLister": c.Universe.Type(types.Name{Name: g.typeToGenerate.Name.Name + "Lister", Package: g.listerPkg}), "resourceNamespaceLister": c.Universe.Type(types.Name{Name: g.typeToGenerate.Name.Name + "NamespaceLister", Package: g.listerPkg}), + "listerHasPointerElem": g.listerHasPointerElem, "groupGoName": namer.IC(g.groupGoName), "versionGoName": namer.IC(g.groupVersion.Version.String()), "group": g.groupVersion.Group.String(), @@ -226,7 +228,7 @@ func (w *wrapper) List(selector {{ .labelsSelector|raw }}) (ret []*{{ .type|raw return nil, err } for idx := range lo.Items { - ret = append(ret, &lo.Items[idx]) + ret = append(ret, {{if not .listerHasPointerElem}}&{{end}}lo.Items[idx]) } return ret, nil } diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go index 62a143d43ed..8c3fe5240e3 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go @@ -446,6 +446,7 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg clientSetPackage: customArgs.VersionedClientSetPackage, injectionClientSetPackage: filepath.Join(basePackage, "client"), listerPkg: listerPackagePath, + listerHasPointerElem: customArgs.ListerHasPointerElem, }) return generators }, @@ -502,6 +503,7 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg clientSetPackage: customArgs.VersionedClientSetPackage, injectionClientSetPackage: filepath.Join(basePackage, "client"), listerPkg: listerPackagePath, + listerHasPointerElem: customArgs.ListerHasPointerElem, }) return generators }, diff --git a/vendor/knative.dev/pkg/configmap/doc.go b/vendor/knative.dev/pkg/configmap/doc.go index d861a3801f5..5e9ab8990c0 100644 --- a/vendor/knative.dev/pkg/configmap/doc.go +++ b/vendor/knative.dev/pkg/configmap/doc.go @@ -16,6 +16,6 @@ limitations under the License. // Package configmap exists to facilitate consuming Kubernetes ConfigMap // resources in various ways, including: -// - Watching them for changes over time, and -// - Loading them from a VolumeMount. +// - Watching them for changes over time, and +// - Loading them from a VolumeMount. package configmap diff --git a/vendor/knative.dev/pkg/configmap/store.go b/vendor/knative.dev/pkg/configmap/store.go index ffe9ad8c68f..375a474c26f 100644 --- a/vendor/knative.dev/pkg/configmap/store.go +++ b/vendor/knative.dev/pkg/configmap/store.go @@ -35,7 +35,7 @@ type Logger interface { // Constructors is a map for specifying configmap names to // their function constructors // -// The values of this map must be functions with the definition +// # The values of this map must be functions with the definition // // func(*k8s.io/api/core/v1.ConfigMap) (... , error) // @@ -60,7 +60,7 @@ type UntypedStore struct { // NewUntypedStore creates an UntypedStore with given name, // Logger and Constructors // -// The Logger must not be nil +// # The Logger must not be nil // // The values in the Constructors map must be functions with // the definition diff --git a/vendor/knative.dev/pkg/hash/doc.go b/vendor/knative.dev/pkg/hash/doc.go index 8b849cd3e1e..5595336ad60 100644 --- a/vendor/knative.dev/pkg/hash/doc.go +++ b/vendor/knative.dev/pkg/hash/doc.go @@ -16,12 +16,12 @@ limitations under the License. // Package hash contains various Knative specific hashing utilities. // -// - ChooseSubset is a consistent hashing/mapping function providing -// a consistent selection of N keys from M (N<=M) keys for a given -// target. -// - BucketSet is a bucketer library which uses ChooseSubset under the -// the hood in order to implement consistent mapping between keys and -// set of buckets, identified by unique names. Compared to basic bucket -// implementation which just does hash%num_buckets, when the number of -// buckets change only a small subset of keys are supposed to migrate. +// - ChooseSubset is a consistent hashing/mapping function providing +// a consistent selection of N keys from M (N<=M) keys for a given +// target. +// - BucketSet is a bucketer library which uses ChooseSubset under the +// the hood in order to implement consistent mapping between keys and +// set of buckets, identified by unique names. Compared to basic bucket +// implementation which just does hash%num_buckets, when the number of +// buckets change only a small subset of keys are supposed to migrate. package hash diff --git a/vendor/knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret/fake/fake.go b/vendor/knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret/fake/fake.go new file mode 100644 index 00000000000..89384a18087 --- /dev/null +++ b/vendor/knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret/fake/fake.go @@ -0,0 +1,38 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + context "context" + + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + secret "knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret" + fake "knative.dev/pkg/injection/clients/namespacedkube/informers/factory/fake" +) + +var Get = secret.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Core().V1().Secrets() + return context.WithValue(ctx, secret.Key{}, inf), inf.Informer() +} diff --git a/vendor/knative.dev/pkg/injection/clients/namespacedkube/informers/factory/fake/fake.go b/vendor/knative.dev/pkg/injection/clients/namespacedkube/informers/factory/fake/fake.go new file mode 100644 index 00000000000..d92469c85ed --- /dev/null +++ b/vendor/knative.dev/pkg/injection/clients/namespacedkube/informers/factory/fake/fake.go @@ -0,0 +1,42 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + context "context" + + informers "k8s.io/client-go/informers" + fake "knative.dev/pkg/client/injection/kube/client/fake" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + factory "knative.dev/pkg/injection/clients/namespacedkube/informers/factory" + "knative.dev/pkg/system" +) + +var Get = factory.Get + +func init() { + injection.Fake.RegisterInformerFactory(withInformerFactory) +} + +func withInformerFactory(ctx context.Context) context.Context { + c := fake.Get(ctx) + return context.WithValue(ctx, factory.Key{}, + informers.NewSharedInformerFactoryWithOptions(c, controller.GetResyncPeriod(ctx), + // This factory scopes things to the system namespace. + informers.WithNamespace(system.Namespace()))) +} diff --git a/vendor/knative.dev/pkg/injection/doc.go b/vendor/knative.dev/pkg/injection/doc.go index db5495d815e..960674deada 100644 --- a/vendor/knative.dev/pkg/injection/doc.go +++ b/vendor/knative.dev/pkg/injection/doc.go @@ -22,84 +22,84 @@ limitations under the License. // interesting. The first is in the context of implementations of // `controller.Reconciler` being wrapped in a `*controller.Impl`: // -// import ( -// // Simply linking this triggers the injection of the informer, which links -// // the factory triggering its injection, and which links the client, -// // triggering its injection. All you need to know is that it works :) -// deployinformer "knative.dev/pkg/injection/informers/kubeinformers/appsv1/deployment" -// "knative.dev/pkg/injection" -// ) +// import ( +// // Simply linking this triggers the injection of the informer, which links +// // the factory triggering its injection, and which links the client, +// // triggering its injection. All you need to know is that it works :) +// deployinformer "knative.dev/pkg/injection/informers/kubeinformers/appsv1/deployment" +// "knative.dev/pkg/injection" +// ) // -// func NewController(ctx context.Context) *controller.Impl { -// deploymentInformer := deployinformer.Get(ctx) -// // Pass deploymentInformer.Lister() to Reconciler -// ... -// // Set up events on deploymentInformer.Informer() -// ... -// } +// func NewController(ctx context.Context) *controller.Impl { +// deploymentInformer := deployinformer.Get(ctx) +// // Pass deploymentInformer.Lister() to Reconciler +// ... +// // Set up events on deploymentInformer.Informer() +// ... +// } // // Then in `package main` the entire controller process can be set up via: // -// package main +// package main // -// import ( -// // The set of controllers this controller process runs. -// // Linking these will register their transitive dependencies, after -// // which the shared main can set up the rest. -// "github.com/knative/foo/pkg/reconciler/matt" -// "github.com/knative/foo/pkg/reconciler/scott" -// "github.com/knative/foo/pkg/reconciler/ville" -// "github.com/knative/foo/pkg/reconciler/dave" +// import ( +// // The set of controllers this controller process runs. +// // Linking these will register their transitive dependencies, after +// // which the shared main can set up the rest. +// "github.com/knative/foo/pkg/reconciler/matt" +// "github.com/knative/foo/pkg/reconciler/scott" +// "github.com/knative/foo/pkg/reconciler/ville" +// "github.com/knative/foo/pkg/reconciler/dave" // -// // This defines the shared main for injected controllers. -// "knative.dev/pkg/injection/sharedmain" -// ) +// // This defines the shared main for injected controllers. +// "knative.dev/pkg/injection/sharedmain" +// ) // -// func main() { -// sharedmain.Main("mycomponent", -// // We pass in the list of controllers to construct, and that's it! -// // If we forget to add this, go will complain about the unused import. -// matt.NewController, -// scott.NewController, -// ville.NewController, -// dave.NewController, -// ) -// } +// func main() { +// sharedmain.Main("mycomponent", +// // We pass in the list of controllers to construct, and that's it! +// // If we forget to add this, go will complain about the unused import. +// matt.NewController, +// scott.NewController, +// ville.NewController, +// dave.NewController, +// ) +// } // // If you want to adapt the above to run the controller within a single // namespace, you can instead do something like: // -// package main +// package main // -// import ( -// // The set of controllers this controller process runs. -// // Linking these will register their transitive dependencies, after -// // which the shared main can set up the rest. -// "github.com/knative/foo/pkg/reconciler/matt" -// "github.com/knative/foo/pkg/reconciler/scott" -// "github.com/knative/foo/pkg/reconciler/ville" -// "github.com/knative/foo/pkg/reconciler/dave" +// import ( +// // The set of controllers this controller process runs. +// // Linking these will register their transitive dependencies, after +// // which the shared main can set up the rest. +// "github.com/knative/foo/pkg/reconciler/matt" +// "github.com/knative/foo/pkg/reconciler/scott" +// "github.com/knative/foo/pkg/reconciler/ville" +// "github.com/knative/foo/pkg/reconciler/dave" // -// // This defines the shared main for injected controllers. -// "knative.dev/pkg/injection/sharedmain" +// // This defines the shared main for injected controllers. +// "knative.dev/pkg/injection/sharedmain" // -// // These are used to set up the context. -// "knative.dev/pkg/injection" -// "knative.dev/pkg/signals" -// ) +// // These are used to set up the context. +// "knative.dev/pkg/injection" +// "knative.dev/pkg/signals" +// ) // -// func main() { -// // Scope the shared informer factories to the provided namespace. -// ctx := injection.WithNamespace(signals.NewContext(), "the-namespace") +// func main() { +// // Scope the shared informer factories to the provided namespace. +// ctx := injection.WithNamespace(signals.NewContext(), "the-namespace") // -// // Use our initial context when setting up the controllers. -// sharedmain.MainWithContext(ctx, "mycomponent", -// // We pass in the list of controllers to construct, and that's it! -// // If we forget to add this, go will complain about the unused import. -// matt.NewController, -// scott.NewController, -// ville.NewController, -// dave.NewController, -// ) -// } +// // Use our initial context when setting up the controllers. +// sharedmain.MainWithContext(ctx, "mycomponent", +// // We pass in the list of controllers to construct, and that's it! +// // If we forget to add this, go will complain about the unused import. +// matt.NewController, +// scott.NewController, +// ville.NewController, +// dave.NewController, +// ) +// } package injection diff --git a/vendor/knative.dev/pkg/injection/injection.go b/vendor/knative.dev/pkg/injection/injection.go index d8cefc9fbe6..f06e06f1798 100644 --- a/vendor/knative.dev/pkg/injection/injection.go +++ b/vendor/knative.dev/pkg/injection/injection.go @@ -34,9 +34,11 @@ import ( // // Typical integration: // ```go -// ctx, startInformers := injection.EnableInjectionOrDie(signals.NewContext(), nil) -// ... start watches with informers, if required ... -// startInformers() +// +// ctx, startInformers := injection.EnableInjectionOrDie(signals.NewContext(), nil) +// ... start watches with informers, if required ... +// startInformers() +// // ``` func EnableInjectionOrDie(ctx context.Context, cfg *rest.Config) (context.Context, func()) { if ctx == nil { diff --git a/vendor/knative.dev/pkg/injection/sharedmain/main.go b/vendor/knative.dev/pkg/injection/sharedmain/main.go index 3b8ab3f40bd..8af9eb5d1f7 100644 --- a/vendor/knative.dev/pkg/injection/sharedmain/main.go +++ b/vendor/knative.dev/pkg/injection/sharedmain/main.go @@ -104,6 +104,25 @@ func GetLeaderElectionConfig(ctx context.Context) (*leaderelection.Config, error return leaderelection.NewConfigFromConfigMap(leaderElectionConfigMap) } +// GetObservabilityConfig gets the observability config from the (in order): +// 1. provided context, +// 2. reading from the API server, +// 3. defaults (if not found). +func GetObservabilityConfig(ctx context.Context) (*metrics.ObservabilityConfig, error) { + if cfg := metrics.GetObservabilityConfig(ctx); cfg != nil { + return cfg, nil + } + + observabilityConfigMap, err := kubeclient.Get(ctx).CoreV1().ConfigMaps(system.Namespace()).Get(ctx, metrics.ConfigMapName(), metav1.GetOptions{}) + if apierrors.IsNotFound(err) { + return metrics.NewObservabilityConfigFromConfigMap(nil) + } + if err != nil { + return nil, err + } + return metrics.NewObservabilityConfigFromConfigMap(observabilityConfigMap) +} + // EnableInjectionOrDie enables Knative Injection and starts the informers. // Both Context and Config are optional. // Deprecated: use injection.EnableInjectionOrDie @@ -249,6 +268,8 @@ func MainWithConfig(ctx context.Context, component string, cfg *rest.Config, cto leaderElectionConfig.GetComponentConfig(component)) } + SetupObservabilityOrDie(ctx, component, logger, profilingHandler) + controllers, webhooks := ControllersAndWebhooksFromCtors(ctx, cmw, ctors...) WatchLoggingConfigOrDie(ctx, cmw, logger, atomicLevel, component) WatchObservabilityConfigOrDie(ctx, cmw, profilingHandler, logger, component) @@ -327,6 +348,18 @@ func SetupLoggerOrDie(ctx context.Context, component string) (*zap.SugaredLogger return l, level } +// SetupObservabilityOrDie sets up the observability using the config from the given context +// or dies by calling log.Fatalf. +func SetupObservabilityOrDie(ctx context.Context, component string, logger *zap.SugaredLogger, profilingHandler *profiling.Handler) { + observabilityConfig, err := GetObservabilityConfig(ctx) + if err != nil { + logger.Fatal("Error loading observability configuration: ", err) + } + observabilityConfigMap := observabilityConfig.GetConfigMap() + metrics.ConfigMapWatcher(ctx, component, SecretFetcher(ctx), logger)(&observabilityConfigMap) + profilingHandler.UpdateFromConfigMap(&observabilityConfigMap) +} + // CheckK8sClientMinimumVersionOrDie checks that the hosting Kubernetes cluster // is at least the minimum allowable version or dies by calling log.Fatalw. func CheckK8sClientMinimumVersionOrDie(ctx context.Context, logger *zap.SugaredLogger) { diff --git a/vendor/knative.dev/pkg/logging/object_encoders.go b/vendor/knative.dev/pkg/logging/object_encoders.go index ee14737cee9..9a30f8aab1b 100644 --- a/vendor/knative.dev/pkg/logging/object_encoders.go +++ b/vendor/knative.dev/pkg/logging/object_encoders.go @@ -29,9 +29,12 @@ import ( // StringSet returns a marshaler for the set of strings. // To use this in sugared logger do: +// // logger.Infow("Revision State", zap.Object("healthy", logging.StringSet(healthySet)), // zap.Object("unhealthy", logging.StringSet(unhealthySet))) +// // To use with non-sugared logger do: +// // logger.Info("Revision State", zap.Object("healthy", logging.StringSet(healthySet)), // zap.Object("unhealthy", logging.StringSet(unhealthySet))) func StringSet(s sets.String) zapcore.ObjectMarshalerFunc { diff --git a/vendor/knative.dev/pkg/metrics/config.go b/vendor/knative.dev/pkg/metrics/config.go index 27bbf9206fa..3fe3c1737d1 100644 --- a/vendor/knative.dev/pkg/metrics/config.go +++ b/vendor/knative.dev/pkg/metrics/config.go @@ -124,12 +124,7 @@ func (mc *metricsConfig) record(ctx context.Context, mss []stats.Measurement, ro func createMetricsConfig(_ context.Context, ops ExporterOptions) (*metricsConfig, error) { var mc metricsConfig - - if ops.Domain == "" { - return nil, errors.New("metrics domain cannot be empty") - } mc.domain = ops.Domain - if ops.Component == "" { return nil, errors.New("metrics component name cannot be empty") } @@ -159,6 +154,9 @@ func createMetricsConfig(_ context.Context, ops ExporterOptions) (*metricsConfig switch mc.backendDestination { case openCensus: + if ops.Domain == "" { + return nil, errors.New("metrics domain cannot be empty") + } mc.collectorAddress = ops.ConfigMap[collectorAddressKey] if isSecure := ops.ConfigMap[collectorSecureKey]; isSecure != "" { var err error @@ -221,22 +219,7 @@ func Domain() string { if domain := os.Getenv(DomainEnv); domain != "" { return domain } - - panic(fmt.Sprintf(`The environment variable %q is not set - -If this is a process running on Kubernetes, then it should be specifying -this via: - - env: - - name: %s - value: knative.dev/some-repository - -If this is a Go unit test consuming metric.Domain() then it should add the -following import: - -import ( - _ "knative.dev/pkg/metrics/testing" -)`, DomainEnv, DomainEnv)) + return "" } // prometheusPort returns the TCP port number configured via the environment diff --git a/vendor/knative.dev/pkg/metrics/config_observability.go b/vendor/knative.dev/pkg/metrics/config_observability.go index 0a17e0f03be..b6affd2936d 100644 --- a/vendor/knative.dev/pkg/metrics/config_observability.go +++ b/vendor/knative.dev/pkg/metrics/config_observability.go @@ -17,8 +17,10 @@ limitations under the License. package metrics import ( + "context" "fmt" "os" + "strconv" texttemplate "text/template" corev1 "k8s.io/api/core/v1" @@ -81,6 +83,22 @@ type ObservabilityConfig struct { MetricsCollectorAddress string } +type ocfg struct{} + +// WithConfig associates a observability configuration with the context. +func WithConfig(ctx context.Context, cfg *ObservabilityConfig) context.Context { + return context.WithValue(ctx, ocfg{}, cfg) +} + +// GetObservability gets the observability config from the provided context. +func GetObservabilityConfig(ctx context.Context) *ObservabilityConfig { + untyped := ctx.Value(ocfg{}) + if untyped == nil { + return nil + } + return untyped.(*ObservabilityConfig) +} + func defaultConfig() *ObservabilityConfig { return &ObservabilityConfig{ LoggingURLTemplate: DefaultLogURLTemplate, @@ -92,6 +110,9 @@ func defaultConfig() *ObservabilityConfig { // NewObservabilityConfigFromConfigMap creates a ObservabilityConfig from the supplied ConfigMap func NewObservabilityConfigFromConfigMap(configMap *corev1.ConfigMap) (*ObservabilityConfig, error) { oc := defaultConfig() + if configMap == nil { + return oc, nil + } if err := cm.Parse(configMap.Data, cm.AsBool("logging.enable-var-log-collection", &oc.EnableVarLogCollection), @@ -120,6 +141,21 @@ func NewObservabilityConfigFromConfigMap(configMap *corev1.ConfigMap) (*Observab return oc, nil } +func (oc *ObservabilityConfig) GetConfigMap() corev1.ConfigMap { + return corev1.ConfigMap{ + Data: map[string]string{ + "logging.enable-var-log-collection": strconv.FormatBool(oc.EnableVarLogCollection), + "logging.revision-url-template": oc.LoggingURLTemplate, + ReqLogTemplateKey: oc.RequestLogTemplate, + EnableReqLogKey: strconv.FormatBool(oc.EnableRequestLog), + EnableProbeReqLogKey: strconv.FormatBool(oc.EnableProbeRequestLog), + "metrics.request-metrics-backend-destination": oc.RequestMetricsBackend, + "profiling.enable": strconv.FormatBool(oc.EnableProfiling), + "metrics.opencensus-address": oc.MetricsCollectorAddress, + }, + } +} + // ConfigMapName gets the name of the metrics ConfigMap func ConfigMapName() string { if cm := os.Getenv(configMapNameEnv); cm != "" { diff --git a/vendor/knative.dev/pkg/metrics/prometheus_exporter.go b/vendor/knative.dev/pkg/metrics/prometheus_exporter.go index b5b39d9fcea..aec6c09a095 100644 --- a/vendor/knative.dev/pkg/metrics/prometheus_exporter.go +++ b/vendor/knative.dev/pkg/metrics/prometheus_exporter.go @@ -41,7 +41,7 @@ func (emptyPromExporter) ExportView(viewData *view.Data) { // a signal to enrich the internal Meters with Resource information. } -//nolint: unparam // False positive of flagging the second result of this function unused. +// nolint: unparam // False positive of flagging the second result of this function unused. func newPrometheusExporter(config *metricsConfig, logger *zap.SugaredLogger) (view.Exporter, ResourceExporterFactory, error) { e, err := prom.NewExporter(prom.Options{Namespace: config.component}) if err != nil { @@ -82,6 +82,7 @@ func startNewPromSrv(e *prom.Exporter, host string, port int) *http.Server { if curPromSrv != nil { curPromSrv.Close() } + //nolint:gosec curPromSrv = &http.Server{ Addr: host + ":" + strconv.Itoa(port), Handler: sm, diff --git a/vendor/knative.dev/pkg/network/h2c.go b/vendor/knative.dev/pkg/network/h2c.go index 6cc0fa733d9..4620b084d20 100644 --- a/vendor/knative.dev/pkg/network/h2c.go +++ b/vendor/knative.dev/pkg/network/h2c.go @@ -28,6 +28,7 @@ import ( // NewServer returns a new HTTP Server with HTTP2 handler. func NewServer(addr string, h http.Handler) *http.Server { + //nolint:gosec h1s := &http.Server{ Addr: addr, Handler: h2c.NewHandler(h, &http2.Server{}), diff --git a/vendor/knative.dev/pkg/network/handlers/drain.go b/vendor/knative.dev/pkg/network/handlers/drain.go index 5eee2ea42e3..3b2f28a077f 100644 --- a/vendor/knative.dev/pkg/network/handlers/drain.go +++ b/vendor/knative.dev/pkg/network/handlers/drain.go @@ -196,7 +196,7 @@ func (d *Drainer) resetTimer() { d.Lock() defer d.Unlock() - if d.timer.Stop() { + if d.timer != nil && d.timer.Stop() { d.timer.Reset(d.QuietPeriod) } } diff --git a/vendor/knative.dev/pkg/network/handlers/error.go b/vendor/knative.dev/pkg/network/handlers/error.go index e45d2fa0301..fd3b1c1b27d 100644 --- a/vendor/knative.dev/pkg/network/handlers/error.go +++ b/vendor/knative.dev/pkg/network/handlers/error.go @@ -20,5 +20,6 @@ import "knative.dev/pkg/network" // Error sets up a handler suitable for use with the ErrorHandler field on // httputil's reverse proxy, which logs /proc/net/sockstat data. +// //nolint:staticcheck // We actually want to mirror this. var Error = network.ErrorHandler diff --git a/vendor/knative.dev/pkg/profiling/server.go b/vendor/knative.dev/pkg/profiling/server.go index 9d61c0981fa..8af5bd98ddc 100644 --- a/vendor/knative.dev/pkg/profiling/server.go +++ b/vendor/knative.dev/pkg/profiling/server.go @@ -110,6 +110,7 @@ func NewServer(handler http.Handler) *http.Server { port = strconv.Itoa(ProfilingPort) } + //nolint:gosec return &http.Server{ Addr: ":" + port, Handler: handler, diff --git a/vendor/knative.dev/pkg/reconciler/retry.go b/vendor/knative.dev/pkg/reconciler/retry.go index 1a50406b1e0..2c6cfd612e8 100644 --- a/vendor/knative.dev/pkg/reconciler/retry.go +++ b/vendor/knative.dev/pkg/reconciler/retry.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Veroute.on 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/vendor/knative.dev/pkg/reconciler/testing/hooks.go b/vendor/knative.dev/pkg/reconciler/testing/hooks.go index f60d6ebeda6..c89be34a0f5 100644 --- a/vendor/knative.dev/pkg/reconciler/testing/hooks.go +++ b/vendor/knative.dev/pkg/reconciler/testing/hooks.go @@ -44,7 +44,7 @@ CreateHookFunc is a function for handling a Create hook. Its runtime.Object parameter will be the Kubernetes resource created. The resource can be cast to its actual type like this: - pod := obj.(*v1.Pod) + pod := obj.(*v1.Pod) A return value of true marks the hook as completed. Returning false allows the hook to run again when the next resource of the requested type is @@ -57,7 +57,7 @@ UpdateHookFunc is a function for handling an update hook. its runtime.Object parameter will be the Kubernetes resource updated. The resource can be cast to its actual type like this: - pod := obj.(*v1.Pod) + pod := obj.(*v1.Pod) A return value of true marks the hook as completed. Returning false allows the hook to run again when the next resource of the requested type is diff --git a/vendor/knative.dev/pkg/reconciler/testing/reactions.go b/vendor/knative.dev/pkg/reconciler/testing/reactions.go index d66b41a71e3..bd77d409005 100644 --- a/vendor/knative.dev/pkg/reconciler/testing/reactions.go +++ b/vendor/knative.dev/pkg/reconciler/testing/reactions.go @@ -28,15 +28,18 @@ import ( // InduceFailure is used in conjunction with TableTest's WithReactors field. // Tests that want to induce a failure in a row of a TableTest would add: -// WithReactors: []clientgotesting.ReactionFunc{ -// // Makes calls to create revisions return an error. -// InduceFailure("create", "revisions"), -// }, +// +// WithReactors: []clientgotesting.ReactionFunc{ +// // Makes calls to create revisions return an error. +// InduceFailure("create", "revisions"), +// }, +// // Or to target a subresource, say a patch to InMemoryChannel.Status, you would add: -// WithReactors: []clientgotesting.ReactionFunc{ -// // Makes calls to patch inmemorychannels status subresource return an error. -// InduceFailure("patch", "inmemorychannels/status"), -// }, +// +// WithReactors: []clientgotesting.ReactionFunc{ +// // Makes calls to patch inmemorychannels status subresource return an error. +// InduceFailure("patch", "inmemorychannels/status"), +// }, func InduceFailure(verb, resource string) clientgotesting.ReactionFunc { return func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { if !action.Matches(verb, resource) { @@ -52,7 +55,8 @@ func ValidateCreates(ctx context.Context, action clientgotesting.Action) (handle if !ok { return false, nil, nil } - if err := obj.Validate(ctx); err != nil { + // Only return error-level errors; warnings should not block API calls. + if err := obj.Validate(ctx).Filter(apis.ErrorLevel); err != nil { return true, nil, err } return false, nil, nil @@ -64,7 +68,8 @@ func ValidateUpdates(ctx context.Context, action clientgotesting.Action) (handle if !ok { return false, nil, nil } - if err := obj.Validate(ctx); err != nil { + // Only return error-level errors; warnings should not block API calls. + if err := obj.Validate(ctx).Filter(apis.ErrorLevel); err != nil { return true, nil, err } return false, nil, nil diff --git a/vendor/knative.dev/pkg/reconciler/testing/sorter.go b/vendor/knative.dev/pkg/reconciler/testing/sorter.go index 2c1e91923d9..a55286f7b58 100644 --- a/vendor/knative.dev/pkg/reconciler/testing/sorter.go +++ b/vendor/knative.dev/pkg/reconciler/testing/sorter.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/vendor/knative.dev/pkg/reconciler/testing/table.go b/vendor/knative.dev/pkg/reconciler/testing/table.go index 962ce94baeb..bfeb6825e36 100644 --- a/vendor/knative.dev/pkg/reconciler/testing/table.go +++ b/vendor/knative.dev/pkg/reconciler/testing/table.go @@ -387,10 +387,13 @@ func (tt TableTest) Test(t *testing.T, factory Factory) { t.Run(test.Name, func(t *testing.T) { t.Helper() test.Test(t, factory) + opts := make([]cmp.Option, 0, len(defaultCmpOpts)+len(test.CmpOpts)) + opts = append(opts, defaultCmpOpts...) + opts = append(opts, test.CmpOpts...) // Validate cached objects do not get soiled after controller loops. - if !cmp.Equal(originObjects, test.Objects, defaultCmpOpts...) { + if !cmp.Equal(originObjects, test.Objects, opts...) { t.Errorf("Unexpected objects (-want, +got):\n%s", - cmp.Diff(originObjects, test.Objects, defaultCmpOpts...)) + cmp.Diff(originObjects, test.Objects, opts...)) } }) } diff --git a/vendor/knative.dev/pkg/test/ingress/ingress.go b/vendor/knative.dev/pkg/test/ingress/ingress.go index fc9f9a19c8c..8de4052c75f 100644 --- a/vendor/knative.dev/pkg/test/ingress/ingress.go +++ b/vendor/knative.dev/pkg/test/ingress/ingress.go @@ -35,8 +35,10 @@ const ( // GetIngressEndpoint gets the ingress public IP or hostname. // address - is the endpoint to which we should actually connect. // portMap - translates the request's port to the port on address to which the caller -// should connect. This is used when the resolution to address goes through some -// sort of port-mapping, e.g. Kubernetes node ports. +// +// should connect. This is used when the resolution to address goes through some +// sort of port-mapping, e.g. Kubernetes node ports. +// // err - an error when address/portMap cannot be established. func GetIngressEndpoint(ctx context.Context, kubeClientset kubernetes.Interface, endpointOverride string) (address string, portMap func(string) string, err error) { ingressName := istioIngressName diff --git a/vendor/knative.dev/pkg/test/zipkin/doc.go b/vendor/knative.dev/pkg/test/zipkin/doc.go index c4464f45961..81c15343f68 100644 --- a/vendor/knative.dev/pkg/test/zipkin/doc.go +++ b/vendor/knative.dev/pkg/test/zipkin/doc.go @@ -33,9 +33,8 @@ This package exposes following methods: A general flow for a Test Suite to use Zipkin Tracing support is as follows: - 1. Call SetupZipkinTracing(kubernetes.Interface) in TestMain. - 2. Use SpoofingClient to make HTTP requests. - 3. Call CleanupZipkinTracingSetup on cleanup after tests are executed. - + 1. Call SetupZipkinTracing(kubernetes.Interface) in TestMain. + 2. Use SpoofingClient to make HTTP requests. + 3. Call CleanupZipkinTracingSetup on cleanup after tests are executed. */ package zipkin diff --git a/vendor/knative.dev/pkg/test/zipkin/util.go b/vendor/knative.dev/pkg/test/zipkin/util.go index 481dddb426b..f22efa44182 100644 --- a/vendor/knative.dev/pkg/test/zipkin/util.go +++ b/vendor/knative.dev/pkg/test/zipkin/util.go @@ -110,9 +110,10 @@ func SetupZipkinTracingFromConfigTracingOrFail(ctx context.Context, t testing.TB } // SetupZipkinTracing sets up zipkin tracing which involves: -// 1. Setting up port-forwarding from localhost to zipkin pod on the cluster -// (pid of the process doing Port-Forward is stored in a global variable). -// 2. Enable AlwaysSample config for tracing for the SpoofingClient. +// 1. Setting up port-forwarding from localhost to zipkin pod on the cluster +// (pid of the process doing Port-Forward is stored in a global variable). +// 2. Enable AlwaysSample config for tracing for the SpoofingClient. +// // The zipkin deployment must have the label app=zipkin func SetupZipkinTracing(ctx context.Context, kubeClientset kubernetes.Interface, logf logging.FormatLogger, zipkinRemotePort int, zipkinNamespace string) (err error) { setupOnce.Do(func() { @@ -152,13 +153,13 @@ func SetupZipkinTracingOrFail(ctx context.Context, t testing.TB, kubeClientset k // CleanupZipkinTracingSetup cleans up the Zipkin tracing setup on the machine. This involves killing the process performing port-forward. // This should be called exactly once in TestMain. Likely in the form: // -// func TestMain(m *testing.M) { -// os.Exit(func() int { -// // Any setup required for the tests. -// defer zipkin.CleanupZipkinTracingSetup(logger) -// return m.Run() -// }()) -// } +// func TestMain(m *testing.M) { +// os.Exit(func() int { +// // Any setup required for the tests. +// defer zipkin.CleanupZipkinTracingSetup(logger) +// return m.Run() +// }()) +// } func CleanupZipkinTracingSetup(logf logging.FormatLogger) { teardownOnce.Do(func() { // Because CleanupZipkinTracingSetup only runs once, make sure that now that it has been diff --git a/vendor/knative.dev/pkg/version/version.go b/vendor/knative.dev/pkg/version/version.go index 32b818ecf42..dbf7daa69aa 100644 --- a/vendor/knative.dev/pkg/version/version.go +++ b/vendor/knative.dev/pkg/version/version.go @@ -33,7 +33,7 @@ const ( // NOTE: If you are changing this line, please also update the minimum kubernetes // version listed here: // https://github.com/knative/docs/blob/mkdocs/docs/snippets/prerequisites.md - defaultMinimumVersion = "v1.23.0" + defaultMinimumVersion = "v1.24.0" ) func getMinimumVersion() string { diff --git a/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/validation_admit.go b/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/validation_admit.go index 2b05a7cd039..002d607915e 100644 --- a/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/validation_admit.go +++ b/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/validation_admit.go @@ -84,7 +84,10 @@ func (ac *reconciler) Admit(ctx context.Context, request *admissionv1.AdmissionR // below all overwrite `resp`, but the `defer` affords us one final // crack at things. defer func() { - resp.Warnings = []string{warnings.Error()} + resp.Warnings = make([]string, 0, len(warnings)) + for _, w := range warnings { + resp.Warnings = append(resp.Warnings, w.Error()) + } }() } if errors != nil { @@ -157,7 +160,7 @@ func (ac *reconciler) decodeRequestAndPrepareContext( return ctx, newObj, nil } -func validate(ctx context.Context, resource resourcesemantics.GenericCRD, req *admissionv1.AdmissionRequest) (err error, warn error) { +func validate(ctx context.Context, resource resourcesemantics.GenericCRD, req *admissionv1.AdmissionRequest) (err error, warn []error) { //nolint logger := logging.FromContext(ctx) // Only run validation for supported create and update validation. @@ -187,7 +190,11 @@ func validate(ctx context.Context, resource resourcesemantics.GenericCRD, req *a err = errorResult } if warningResult := result.Filter(apis.WarningLevel); warningResult != nil { - warn = warningResult + ws := warningResult.WrappedErrors() + warn = make([]error, 0, len(ws)) + for _, w := range ws { + warn = append(warn, w) + } } } return err, warn diff --git a/vendor/knative.dev/pkg/webhook/webhook.go b/vendor/knative.dev/pkg/webhook/webhook.go index ffb806ee0b2..435dfe38aa7 100644 --- a/vendor/knative.dev/pkg/webhook/webhook.go +++ b/vendor/knative.dev/pkg/webhook/webhook.go @@ -208,6 +208,7 @@ func (wh *Webhook) Run(stop <-chan struct{}) error { QuietPeriod: wh.Options.GracePeriod, } + //nolint:gosec server := &http.Server{ Handler: drainer, Addr: fmt.Sprint(":", wh.Options.Port), diff --git a/vendor/modules.txt b/vendor/modules.txt index a913f5f088f..f51c7ff047c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -969,7 +969,7 @@ k8s.io/api/scheduling/v1beta1 k8s.io/api/storage/v1 k8s.io/api/storage/v1alpha1 k8s.io/api/storage/v1beta1 -# k8s.io/apiextensions-apiserver v0.25.2 +# k8s.io/apiextensions-apiserver v0.25.4 ## explicit; go 1.19 k8s.io/apiextensions-apiserver/pkg/apis/apiextensions k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1 @@ -1345,7 +1345,7 @@ k8s.io/code-generator/cmd/lister-gen/args k8s.io/code-generator/cmd/lister-gen/generators k8s.io/code-generator/pkg/namer k8s.io/code-generator/pkg/util -# k8s.io/gengo v0.0.0-20220613173612-397b4ae3bce7 +# k8s.io/gengo v0.0.0-20221011193443-fad74ee6edd9 ## explicit; go 1.13 k8s.io/gengo/args k8s.io/gengo/examples/deepcopy-gen/generators @@ -1358,7 +1358,7 @@ k8s.io/gengo/types # k8s.io/klog v1.0.0 ## explicit; go 1.12 k8s.io/klog -# k8s.io/klog/v2 v2.80.1 +# k8s.io/klog/v2 v2.80.2-0.20221028030830-9ae4992afb54 ## explicit; go 1.13 k8s.io/klog/v2 k8s.io/klog/v2/internal/buffer @@ -1385,7 +1385,7 @@ k8s.io/kube-openapi/pkg/spec3 k8s.io/kube-openapi/pkg/util/proto k8s.io/kube-openapi/pkg/util/sets k8s.io/kube-openapi/pkg/validation/spec -# k8s.io/utils v0.0.0-20221012122500-cfd413dd9e85 +# k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 ## explicit; go 1.18 k8s.io/utils/buffer k8s.io/utils/clock @@ -1396,7 +1396,7 @@ k8s.io/utils/net k8s.io/utils/pointer k8s.io/utils/strings/slices k8s.io/utils/trace -# knative.dev/pkg v0.0.0-20221011175852-714b7630a836 +# knative.dev/pkg v0.0.0-20221209013515-911b435f02a1 ## explicit; go 1.18 knative.dev/pkg/apis knative.dev/pkg/apis/duck @@ -1433,7 +1433,9 @@ knative.dev/pkg/hash knative.dev/pkg/injection knative.dev/pkg/injection/clients/dynamicclient knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret +knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret/fake knative.dev/pkg/injection/clients/namespacedkube/informers/factory +knative.dev/pkg/injection/clients/namespacedkube/informers/factory/fake knative.dev/pkg/injection/sharedmain knative.dev/pkg/kmap knative.dev/pkg/kmeta