From 93fd4e89d5016df800b1a5986ccfdc3b15683363 Mon Sep 17 00:00:00 2001 From: Timo Behrendt Date: Thu, 14 May 2026 18:55:57 +0200 Subject: [PATCH] minimum runnable --- .gitignore | 2 +- .gitmodules | 3 + Makefile | 6 +- .../examples/crd-status-subresource.yaml | 41 -- artifacts/examples/crd.yaml | 38 +- controller.go | 298 ++---------- controller_test.go | 316 ------------- go.mod | 10 +- go.sum | 7 + .../codegen_violation_exceptions.list | 18 + hack/boilerplate.go.txt | 16 - hack/tools.go | 22 - hack/update-codegen.sh | 59 --- hack/verify-codegen.sh | 57 --- main.go | 10 +- .../v1alpha1 => proxyprovider/v1}/doc.go | 6 +- .../v1alpha1 => proxyprovider/v1}/types.go | 28 +- .../v1}/zz_generated.deepcopy.go | 47 +- .../v1}/zz_generated.register.go | 16 +- .../applyconfiguration/internal/internal.go | 10 - .../v1/proxyprovider.go} | 122 ++--- .../proxyprovider/v1/proxyproviderspec.go | 66 +++ .../proxyprovider/v1/proxyproviderstatus.go | 39 ++ .../samplecontroller/v1alpha1/foospec.go | 50 -- .../samplecontroller/v1alpha1/foostatus.go | 41 -- pkg/generated/applyconfiguration/utils.go | 18 +- .../clientset/versioned/clientset.go | 16 +- .../versioned/fake/clientset_generated.go | 10 +- .../clientset/versioned/fake/register.go | 4 +- .../clientset/versioned/scheme/register.go | 4 +- .../v1alpha1 => proxyprovider/v1}/doc.go | 2 +- .../v1alpha1 => proxyprovider/v1}/fake/doc.go | 0 .../v1/fake/fake_proxyprovider.go | 51 +++ .../v1/fake/fake_proxyprovider_client.go} | 10 +- .../v1}/generated_expansion.go | 4 +- .../typed/proxyprovider/v1/proxyprovider.go | 74 +++ .../v1/proxyprovider_client.go} | 40 +- .../v1alpha1/fake/fake_foo.go | 49 -- .../typed/samplecontroller/v1alpha1/foo.go | 74 --- .../informers/externalversions/factory.go | 8 +- .../informers/externalversions/generic.go | 8 +- .../interface.go | 14 +- .../v1}/interface.go | 12 +- .../proxyprovider/v1/proxyprovider.go | 116 +++++ .../samplecontroller/v1alpha1/foo.go | 116 ----- .../v1}/expansion_generated.go | 14 +- .../listers/proxyprovider/v1/proxyprovider.go | 70 +++ .../listers/samplecontroller/v1alpha1/foo.go | 70 --- .../openapi/cmd/models-schema/main.go | 76 --- pkg/generated/openapi/zz_generated.openapi.go | 431 +++++++++--------- pkg/signals/signal_windows.go | 23 - scripts/codegen.sh | 50 ++ 52 files changed, 948 insertions(+), 1744 deletions(-) create mode 100644 .gitmodules delete mode 100644 artifacts/examples/crd-status-subresource.yaml delete mode 100644 controller_test.go create mode 100644 hack/api-violations/codegen_violation_exceptions.list delete mode 100644 hack/boilerplate.go.txt delete mode 100644 hack/tools.go delete mode 100755 hack/update-codegen.sh delete mode 100755 hack/verify-codegen.sh rename pkg/apis/{samplecontroller/v1alpha1 => proxyprovider/v1}/doc.go (84%) rename pkg/apis/{samplecontroller/v1alpha1 => proxyprovider/v1}/types.go (65%) rename pkg/apis/{samplecontroller/v1alpha1 => proxyprovider/v1}/zz_generated.deepcopy.go (71%) rename pkg/apis/{samplecontroller/v1alpha1 => proxyprovider/v1}/zz_generated.register.go (88%) rename pkg/generated/applyconfiguration/{samplecontroller/v1alpha1/foo.go => proxyprovider/v1/proxyprovider.go} (61%) create mode 100644 pkg/generated/applyconfiguration/proxyprovider/v1/proxyproviderspec.go create mode 100644 pkg/generated/applyconfiguration/proxyprovider/v1/proxyproviderstatus.go delete mode 100644 pkg/generated/applyconfiguration/samplecontroller/v1alpha1/foospec.go delete mode 100644 pkg/generated/applyconfiguration/samplecontroller/v1alpha1/foostatus.go rename pkg/generated/clientset/versioned/typed/{samplecontroller/v1alpha1 => proxyprovider/v1}/doc.go (97%) rename pkg/generated/clientset/versioned/typed/{samplecontroller/v1alpha1 => proxyprovider/v1}/fake/doc.go (100%) create mode 100644 pkg/generated/clientset/versioned/typed/proxyprovider/v1/fake/fake_proxyprovider.go rename pkg/generated/clientset/versioned/typed/{samplecontroller/v1alpha1/fake/fake_samplecontroller_client.go => proxyprovider/v1/fake/fake_proxyprovider_client.go} (70%) rename pkg/generated/clientset/versioned/typed/{samplecontroller/v1alpha1 => proxyprovider/v1}/generated_expansion.go (92%) create mode 100644 pkg/generated/clientset/versioned/typed/proxyprovider/v1/proxyprovider.go rename pkg/generated/clientset/versioned/typed/{samplecontroller/v1alpha1/samplecontroller_client.go => proxyprovider/v1/proxyprovider_client.go} (59%) delete mode 100644 pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_foo.go delete mode 100644 pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/foo.go rename pkg/generated/informers/externalversions/{samplecontroller => proxyprovider}/interface.go (75%) rename pkg/generated/informers/externalversions/{samplecontroller/v1alpha1 => proxyprovider/v1}/interface.go (79%) create mode 100644 pkg/generated/informers/externalversions/proxyprovider/v1/proxyprovider.go delete mode 100644 pkg/generated/informers/externalversions/samplecontroller/v1alpha1/foo.go rename pkg/generated/listers/{samplecontroller/v1alpha1 => proxyprovider/v1}/expansion_generated.go (66%) create mode 100644 pkg/generated/listers/proxyprovider/v1/proxyprovider.go delete mode 100644 pkg/generated/listers/samplecontroller/v1alpha1/foo.go delete mode 100644 pkg/generated/openapi/cmd/models-schema/main.go delete mode 100644 pkg/signals/signal_windows.go create mode 100755 scripts/codegen.sh diff --git a/.gitignore b/.gitignore index 5b90e79..eb38878 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,4 @@ go.work.sum # env file .env - +vendor/* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a7b679c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "code-generator"] + path = code-generator + url = https://github.com/kubernetes/code-generator.git diff --git a/Makefile b/Makefile index 728f6bc..f9cac0a 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,7 @@ +REPO_ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) + +.PHONY: build run codegen + build: go build @@ -6,4 +10,4 @@ run: ./main codegen: - ./hack/update-codegen.sh + $(REPO_ROOT)/scripts/codegen.sh diff --git a/artifacts/examples/crd-status-subresource.yaml b/artifacts/examples/crd-status-subresource.yaml deleted file mode 100644 index 90b70d1..0000000 --- a/artifacts/examples/crd-status-subresource.yaml +++ /dev/null @@ -1,41 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: foos.samplecontroller.k8s.io - # for more information on the below annotation, please see - # https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/2337-k8s.io-group-protection/README.md - annotations: - "api-approved.kubernetes.io": "unapproved, experimental-only; please get an approval from Kubernetes API reviewers if you're trying to develop a CRD in the *.k8s.io or *.kubernetes.io groups" -spec: - group: samplecontroller.k8s.io - versions: - - name: v1alpha1 - served: true - storage: true - schema: - # schema used for validation - openAPIV3Schema: - type: object - properties: - spec: - type: object - properties: - deploymentName: - type: string - replicas: - type: integer - minimum: 1 - maximum: 10 - status: - type: object - properties: - availableReplicas: - type: integer - # subresources for the custom resource - subresources: - # enables the status subresource - status: {} - names: - kind: Foo - plural: foos - scope: Namespaced diff --git a/artifacts/examples/crd.yaml b/artifacts/examples/crd.yaml index 8ac6e60..e492835 100644 --- a/artifacts/examples/crd.yaml +++ b/artifacts/examples/crd.yaml @@ -1,37 +1,41 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: foos.samplecontroller.k8s.io - # for more information on the below annotation, please see - # https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/2337-k8s.io-group-protection/README.md - annotations: - "api-approved.kubernetes.io": "unapproved, experimental-only; please get an approval from Kubernetes API reviewers if you're trying to develop a CRD in the *.k8s.io or *.kubernetes.io groups" + name: proxyproviders.proxyprovider.t000-n.de spec: - group: samplecontroller.k8s.io + group: proxyprovider.t000-n.de versions: - - name: v1alpha1 + - name: v1 served: true storage: true schema: - # schema used for validation openAPIV3Schema: type: object properties: spec: type: object properties: - deploymentName: + name: type: string - replicas: - type: integer - minimum: 1 - maximum: 10 + authorization_flow: + type: string + invalidation_flow: + type: string + external_host: + type: string + required: + - name + - authorization_flow + - invalidation_flow + - external_host status: type: object properties: - availableReplicas: - type: integer + pk: + type: string + required: + - pk names: - kind: Foo - plural: foos + kind: ProxyProvider + plural: proxyproviders scope: Namespaced diff --git a/controller.go b/controller.go index 5553509..908fd98 100644 --- a/controller.go +++ b/controller.go @@ -39,68 +39,45 @@ import ( "k8s.io/client-go/util/workqueue" "k8s.io/klog/v2" - samplev1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1" clientset "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned" - samplescheme "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/scheme" - informers "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/samplecontroller/v1alpha1" - listers "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/listers/samplecontroller/v1alpha1" + operatorscheme "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/scheme" + informers "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/proxyprovider/v1" + listers "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/listers/proxyprovider/v1" ) -const controllerAgentName = "sample-controller" +const controllerAgentName = "proxy-provider-controller" const ( - // SuccessSynced is used as part of the Event 'reason' when a Foo is synced - SuccessSynced = "Synced" - // ErrResourceExists is used as part of the Event 'reason' when a Foo fails - // to sync due to a Deployment of the same name already existing. - ErrResourceExists = "ErrResourceExists" - - // MessageResourceExists is the message used for Events when a resource - // fails to sync due to a Deployment already existing - MessageResourceExists = "Resource %q already exists and is not managed by Foo" - // MessageResourceSynced is the message used for an Event fired when a Foo - // is synced successfully - MessageResourceSynced = "Foo synced successfully" - // FieldManager distinguishes this controller from other things writing to API objects - FieldManager = controllerAgentName + SuccessSynced = "Synced" + ErrResourceExists = "ErrResourceExists" + MessageResourceExists = "Resource %q already exists and is not managed by ProxyProvider" + MessageResourceSynced = "ProxyProvider synced successfully" + FieldManager = controllerAgentName ) -// Controller is the controller implementation for Foo resources type Controller struct { - // kubeclientset is a standard kubernetes clientset - kubeclientset kubernetes.Interface - // sampleclientset is a clientset for our own API group - sampleclientset clientset.Interface + kubeclientset kubernetes.Interface + operatorclientset clientset.Interface deploymentsLister appslisters.DeploymentLister deploymentsSynced cache.InformerSynced - foosLister listers.FooLister - foosSynced cache.InformerSynced + proxyLister listers.ProxyProviderLister + proxySynced cache.InformerSynced - // workqueue is a rate limited work queue. This is used to queue work to be - // processed instead of performing it as soon as a change happens. This - // means we can ensure we only process a fixed amount of resources at a - // time, and makes it easy to ensure we are never processing the same item - // simultaneously in two different workers. workqueue workqueue.TypedRateLimitingInterface[cache.ObjectName] - // recorder is an event recorder for recording Event resources to the - // Kubernetes API. - recorder record.EventRecorder + recorder record.EventRecorder } -// NewController returns a new sample controller func NewController( ctx context.Context, kubeclientset kubernetes.Interface, - sampleclientset clientset.Interface, + operatorclientset clientset.Interface, deploymentInformer appsinformers.DeploymentInformer, - fooInformer informers.FooInformer) *Controller { + proxyInformer informers.ProxyProviderInformer, +) *Controller { logger := klog.FromContext(ctx) - // Create event broadcaster - // Add sample-controller types to the default Kubernetes Scheme so Events can be - // logged for sample-controller types. - utilruntime.Must(samplescheme.AddToScheme(scheme.Scheme)) + utilruntime.Must(operatorscheme.AddToScheme(scheme.Scheme)) logger.V(4).Info("Creating event broadcaster") eventBroadcaster := record.NewBroadcaster(record.WithContext(ctx)) @@ -112,70 +89,53 @@ func NewController( &workqueue.TypedBucketRateLimiter[cache.ObjectName]{Limiter: rate.NewLimiter(rate.Limit(50), 300)}, ) - controller := &Controller{ + c := &Controller{ kubeclientset: kubeclientset, - sampleclientset: sampleclientset, + operatorclientset: operatorclientset, deploymentsLister: deploymentInformer.Lister(), deploymentsSynced: deploymentInformer.Informer().HasSynced, - foosLister: fooInformer.Lister(), - foosSynced: fooInformer.Informer().HasSynced, + proxyLister: proxyInformer.Lister(), + proxySynced: proxyInformer.Informer().HasSynced, workqueue: workqueue.NewTypedRateLimitingQueue(ratelimiter), recorder: recorder, } logger.Info("Setting up event handlers") - // Set up an event handler for when Foo resources change - fooInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: controller.enqueueFoo, - UpdateFunc: func(old, new interface{}) { - controller.enqueueFoo(new) + proxyInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: c.enqueueProxyProvider, + UpdateFunc: func(_, newObj interface{}) { + c.enqueueProxyProvider(newObj) }, }) - // Set up an event handler for when Deployment resources change. This - // handler will lookup the owner of the given Deployment, and if it is - // owned by a Foo resource then the handler will enqueue that Foo resource for - // processing. This way, we don't need to implement custom logic for - // handling Deployment resources. More info on this pattern: - // https://github.com/kubernetes/community/blob/8cafef897a22026d42f5e5bb3f104febe7e29830/contributors/devel/controllers.md deploymentInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: controller.handleObject, + AddFunc: c.handleObject, UpdateFunc: func(old, new interface{}) { newDepl := new.(*appsv1.Deployment) oldDepl := old.(*appsv1.Deployment) if newDepl.ResourceVersion == oldDepl.ResourceVersion { - // Periodic resync will send update events for all known Deployments. - // Two different versions of the same Deployment will always have different RVs. return } - controller.handleObject(new) + c.handleObject(new) }, - DeleteFunc: controller.handleObject, + DeleteFunc: c.handleObject, }) - return controller + return c } -// Run will set up the event handlers for types we are interested in, as well -// as syncing informer caches and starting workers. It will block until stopCh -// is closed, at which point it will shutdown the workqueue and wait for -// workers to finish processing their current work items. func (c *Controller) Run(ctx context.Context, workers int) error { defer utilruntime.HandleCrash() defer c.workqueue.ShutDown() logger := klog.FromContext(ctx) - // Start the informer factories to begin populating the informer caches - logger.Info("Starting Foo controller") + logger.Info("Starting ProxyProvider controller") - // Wait for the caches to be synced before starting workers logger.Info("Waiting for informer caches to sync") - - if ok := cache.WaitForCacheSync(ctx.Done(), c.deploymentsSynced, c.foosSynced); !ok { + if ok := cache.WaitForCacheSync(ctx.Done(), c.deploymentsSynced, c.proxySynced); !ok { return fmt.Errorf("failed to wait for caches to sync") } logger.Info("Starting workers", "count", workers) - // Launch two workers to process Foo resources for i := 0; i < workers; i++ { go wait.UntilWithContext(ctx, c.runWorker, time.Second) } @@ -183,239 +143,71 @@ func (c *Controller) Run(ctx context.Context, workers int) error { logger.Info("Started workers") <-ctx.Done() logger.Info("Shutting down workers") - return nil } -// runWorker is a long-running function that will continually call the -// processNextWorkItem function in order to read and process a message on the -// workqueue. func (c *Controller) runWorker(ctx context.Context) { for c.processNextWorkItem(ctx) { } } -// processNextWorkItem will read a single work item off the workqueue and -// attempt to process it, by calling the syncHandler. func (c *Controller) processNextWorkItem(ctx context.Context) bool { objRef, shutdown := c.workqueue.Get() logger := klog.FromContext(ctx) - if shutdown { return false } - - // We call Done at the end of this func so the workqueue knows we have - // finished processing this item. We also must remember to call Forget - // if we do not want this work item being re-queued. For example, we do - // not call Forget if a transient error occurs, instead the item is - // put back on the workqueue and attempted again after a back-off - // period. defer c.workqueue.Done(objRef) - // Run the syncHandler, passing it the structured reference to the object to be synced. err := c.syncHandler(ctx, objRef) if err == nil { - // If no error occurs then we Forget this item so it does not - // get queued again until another change happens. c.workqueue.Forget(objRef) logger.Info("Successfully synced", "objectName", objRef) return true } - // there was a failure so be sure to report it. This method allows for - // pluggable error handling which can be used for things like - // cluster-monitoring. utilruntime.HandleErrorWithContext(ctx, err, "Error syncing; requeuing for later retry", "objectReference", objRef) - // since we failed, we should requeue the item to work on later. This - // method will add a backoff to avoid hotlooping on particular items - // (they're probably still not going to work right away) and overall - // controller protection (everything I've done is broken, this controller - // needs to calm down or it can starve other useful work) cases. c.workqueue.AddRateLimited(objRef) return true } -// syncHandler compares the actual state with the desired, and attempts to -// converge the two. It then updates the Status block of the Foo resource -// with the current status of the resource. func (c *Controller) syncHandler(ctx context.Context, objectRef cache.ObjectName) error { logger := klog.LoggerWithValues(klog.FromContext(ctx), "objectRef", objectRef) - // Get the Foo resource with this namespace/name - foo, err := c.foosLister.Foos(objectRef.Namespace).Get(objectRef.Name) + pp, err := c.proxyLister.ProxyProviders(objectRef.Namespace).Get(objectRef.Name) if err != nil { - // The Foo resource may no longer exist, in which case we stop - // processing. if errors.IsNotFound(err) { - utilruntime.HandleErrorWithContext(ctx, err, "Foo referenced by item in work queue no longer exists", "objectReference", objectRef) + logger.V(4).Info("ProxyProvider no longer exists") return nil } - return err } - deploymentName := foo.Spec.DeploymentName - if deploymentName == "" { - // We choose to absorb the error here as the worker would requeue the - // resource otherwise. Instead, the next time the resource is updated - // the resource will be queued again. - utilruntime.HandleErrorWithContext(ctx, nil, "Deployment name missing from object reference", "objectReference", objectRef) - return nil - } - - // Get the deployment with the name specified in Foo.spec - deployment, err := c.deploymentsLister.Deployments(foo.Namespace).Get(deploymentName) - // If the resource doesn't exist, we'll create it - if errors.IsNotFound(err) { - deployment, err = c.kubeclientset.AppsV1().Deployments(foo.Namespace).Create(ctx, newDeployment(foo), metav1.CreateOptions{FieldManager: FieldManager}) - } - - // If an error occurs during Get/Create, we'll requeue the item so we can - // attempt processing again later. This could have been caused by a - // temporary network failure, or any other transient reason. - if err != nil { - return err - } - - // If the Deployment is not controlled by this Foo resource, we should log - // a warning to the event recorder and return error msg. - if !metav1.IsControlledBy(deployment, foo) { - msg := fmt.Sprintf(MessageResourceExists, deployment.Name) - c.recorder.Event(foo, corev1.EventTypeWarning, ErrResourceExists, msg) - return fmt.Errorf("%s", msg) - } - - // If this number of the replicas on the Foo resource is specified, and the - // number does not equal the current desired replicas on the Deployment, we - // should update the Deployment resource. - if foo.Spec.Replicas != nil && *foo.Spec.Replicas != *deployment.Spec.Replicas { - logger.V(4).Info("Update deployment resource", "currentReplicas", *deployment.Spec.Replicas, "desiredReplicas", *foo.Spec.Replicas) - deployment, err = c.kubeclientset.AppsV1().Deployments(foo.Namespace).Update(ctx, newDeployment(foo), metav1.UpdateOptions{FieldManager: FieldManager}) - } - - // If an error occurs during Update, we'll requeue the item so we can - // attempt processing again later. This could have been caused by a - // temporary network failure, or any other transient reason. - if err != nil { - return err - } - - // Finally, we update the status block of the Foo resource to reflect the - // current state of the world - err = c.updateFooStatus(ctx, foo, deployment) - if err != nil { - return err - } - - c.recorder.Event(foo, corev1.EventTypeNormal, SuccessSynced, MessageResourceSynced) + logger.V(4).Info("sync ProxyProvider", "name", pp.Name) return nil } -func (c *Controller) updateFooStatus(ctx context.Context, foo *samplev1alpha1.Foo, deployment *appsv1.Deployment) error { - // NEVER modify objects from the store. It's a read-only, local cache. - // You can use DeepCopy() to make a deep copy of original object and modify this copy - // Or create a copy manually for better performance - fooCopy := foo.DeepCopy() - fooCopy.Status.AvailableReplicas = deployment.Status.AvailableReplicas - // If the CustomResourceSubresources feature gate is not enabled, - // we must use Update instead of UpdateStatus to update the Status block of the Foo resource. - // UpdateStatus will not allow changes to the Spec of the resource, - // which is ideal for ensuring nothing other than resource status has been updated. - _, err := c.sampleclientset.SamplecontrollerV1alpha1().Foos(foo.Namespace).UpdateStatus(ctx, fooCopy, metav1.UpdateOptions{FieldManager: FieldManager}) - return err -} - -// enqueueFoo takes a Foo resource and converts it into a namespace/name -// string which is then put onto the work queue. This method should *not* be -// passed resources of any type other than Foo. -func (c *Controller) enqueueFoo(obj interface{}) { - if objectRef, err := cache.ObjectToName(obj); err != nil { +func (c *Controller) enqueueProxyProvider(obj interface{}) { + objectRef, err := cache.ObjectToName(obj) + if err != nil { utilruntime.HandleError(err) return - } else { - c.workqueue.Add(objectRef) } + c.workqueue.Add(objectRef) } -// handleObject will take any resource implementing metav1.Object and attempt -// to find the Foo resource that 'owns' it. It does this by looking at the -// objects metadata.ownerReferences field for an appropriate OwnerReference. -// It then enqueues that Foo resource to be processed. If the object does not -// have an appropriate OwnerReference, it will simply be skipped. func (c *Controller) handleObject(obj interface{}) { - var object metav1.Object - var ok bool - logger := klog.FromContext(context.Background()) - if object, ok = obj.(metav1.Object); !ok { + // Optional: resolve Deployment owners back to ProxyProvider and enqueue. + _, ok := obj.(metav1.Object) + if !ok { tombstone, ok := obj.(cache.DeletedFinalStateUnknown) if !ok { - // If the object value is not too big and does not contain sensitive information then - // it may be useful to include it. - utilruntime.HandleErrorWithContext(context.Background(), nil, "Error decoding object, invalid type", "type", fmt.Sprintf("%T", obj)) + utilruntime.HandleError(fmt.Errorf("couldn't get object from tombstone %#v", obj)) return } - object, ok = tombstone.Obj.(metav1.Object) + _, ok = tombstone.Obj.(metav1.Object) if !ok { - // If the object value is not too big and does not contain sensitive information then - // it may be useful to include it. - utilruntime.HandleErrorWithContext(context.Background(), nil, "Error decoding object tombstone, invalid type", "type", fmt.Sprintf("%T", tombstone.Obj)) + utilruntime.HandleError(fmt.Errorf("tombstone contained object that is not a metav1.Object %#v", obj)) return } - logger.V(4).Info("Recovered deleted object", "resourceName", object.GetName()) - } - logger.V(4).Info("Processing object", "object", klog.KObj(object)) - if ownerRef := metav1.GetControllerOf(object); ownerRef != nil { - // If this object is not owned by a Foo, we should not do anything more - // with it. - if ownerRef.Kind != "Foo" { - return - } - - foo, err := c.foosLister.Foos(object.GetNamespace()).Get(ownerRef.Name) - if err != nil { - logger.V(4).Info("Ignore orphaned object", "object", klog.KObj(object), "foo", ownerRef.Name) - return - } - - c.enqueueFoo(foo) - return - } -} - -// newDeployment creates a new Deployment for a Foo resource. It also sets -// the appropriate OwnerReferences on the resource so handleObject can discover -// the Foo resource that 'owns' it. -func newDeployment(foo *samplev1alpha1.Foo) *appsv1.Deployment { - labels := map[string]string{ - "app": "nginx", - "controller": foo.Name, - } - return &appsv1.Deployment{ - ObjectMeta: metav1.ObjectMeta{ - Name: foo.Spec.DeploymentName, - Namespace: foo.Namespace, - OwnerReferences: []metav1.OwnerReference{ - *metav1.NewControllerRef(foo, samplev1alpha1.SchemeGroupVersion.WithKind("Foo")), - }, - }, - Spec: appsv1.DeploymentSpec{ - Replicas: foo.Spec.Replicas, - Selector: &metav1.LabelSelector{ - MatchLabels: labels, - }, - Template: corev1.PodTemplateSpec{ - ObjectMeta: metav1.ObjectMeta{ - Labels: labels, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: "nginx", - Image: "nginx:latest", - }, - }, - }, - }, - }, } } diff --git a/controller_test.go b/controller_test.go deleted file mode 100644 index 5ae6321..0000000 --- a/controller_test.go +++ /dev/null @@ -1,316 +0,0 @@ -/* -Copyright 2017 The Kubernetes 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 main - -import ( - "context" - "fmt" - "reflect" - "testing" - "time" - - apps "k8s.io/api/apps/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/diff" - kubeinformers "k8s.io/client-go/informers" - k8sfake "k8s.io/client-go/kubernetes/fake" - core "k8s.io/client-go/testing" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/tools/record" - "k8s.io/klog/v2/ktesting" - "k8s.io/utils/ptr" - - samplecontroller "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1" - "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/fake" - informers "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions" -) - -var ( - alwaysReady = func() bool { return true } - noResyncPeriodFunc = func() time.Duration { return 0 } -) - -type fixture struct { - t *testing.T - - client *fake.Clientset - kubeclient *k8sfake.Clientset - // Objects to put in the store. - fooLister []*samplecontroller.Foo - deploymentLister []*apps.Deployment - // Actions expected to happen on the client. - kubeactions []core.Action - actions []core.Action - // Objects from here preloaded into NewSimpleFake. - kubeobjects []runtime.Object - objects []runtime.Object -} - -func newFixture(t *testing.T) *fixture { - f := &fixture{} - f.t = t - f.objects = []runtime.Object{} - f.kubeobjects = []runtime.Object{} - return f -} - -func newFoo(name string, replicas *int32) *samplecontroller.Foo { - return &samplecontroller.Foo{ - TypeMeta: metav1.TypeMeta{APIVersion: samplecontroller.SchemeGroupVersion.String()}, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: metav1.NamespaceDefault, - }, - Spec: samplecontroller.FooSpec{ - DeploymentName: fmt.Sprintf("%s-deployment", name), - Replicas: replicas, - }, - } -} - -func (f *fixture) newController(ctx context.Context) (*Controller, informers.SharedInformerFactory, kubeinformers.SharedInformerFactory) { - f.client = fake.NewClientset(f.objects...) - f.kubeclient = k8sfake.NewClientset(f.kubeobjects...) - - i := informers.NewSharedInformerFactory(f.client, noResyncPeriodFunc()) - k8sI := kubeinformers.NewSharedInformerFactory(f.kubeclient, noResyncPeriodFunc()) - - c := NewController(ctx, f.kubeclient, f.client, - k8sI.Apps().V1().Deployments(), i.Samplecontroller().V1alpha1().Foos()) - - c.foosSynced = alwaysReady - c.deploymentsSynced = alwaysReady - c.recorder = &record.FakeRecorder{} - - for _, f := range f.fooLister { - i.Samplecontroller().V1alpha1().Foos().Informer().GetIndexer().Add(f) - } - - for _, d := range f.deploymentLister { - k8sI.Apps().V1().Deployments().Informer().GetIndexer().Add(d) - } - - return c, i, k8sI -} - -func (f *fixture) run(ctx context.Context, fooRef cache.ObjectName) { - f.runController(ctx, fooRef, true, false) -} - -func (f *fixture) runExpectError(ctx context.Context, fooRef cache.ObjectName) { - f.runController(ctx, fooRef, true, true) -} - -func (f *fixture) runController(ctx context.Context, fooRef cache.ObjectName, startInformers bool, expectError bool) { - c, i, k8sI := f.newController(ctx) - if startInformers { - i.Start(ctx.Done()) - k8sI.Start(ctx.Done()) - } - - err := c.syncHandler(ctx, fooRef) - if !expectError && err != nil { - f.t.Errorf("error syncing foo: %v", err) - } else if expectError && err == nil { - f.t.Error("expected error syncing foo, got nil") - } - - actions := filterInformerActions(f.client.Actions()) - for i, action := range actions { - if len(f.actions) < i+1 { - f.t.Errorf("%d unexpected actions: %+v", len(actions)-len(f.actions), actions[i:]) - break - } - - expectedAction := f.actions[i] - checkAction(expectedAction, action, f.t) - } - - if len(f.actions) > len(actions) { - f.t.Errorf("%d additional expected actions:%+v", len(f.actions)-len(actions), f.actions[len(actions):]) - } - - k8sActions := filterInformerActions(f.kubeclient.Actions()) - for i, action := range k8sActions { - if len(f.kubeactions) < i+1 { - f.t.Errorf("%d unexpected actions: %+v", len(k8sActions)-len(f.kubeactions), k8sActions[i:]) - break - } - - expectedAction := f.kubeactions[i] - checkAction(expectedAction, action, f.t) - } - - if len(f.kubeactions) > len(k8sActions) { - f.t.Errorf("%d additional expected actions:%+v", len(f.kubeactions)-len(k8sActions), f.kubeactions[len(k8sActions):]) - } -} - -// checkAction verifies that expected and actual actions are equal and both have -// same attached resources -func checkAction(expected, actual core.Action, t *testing.T) { - if !(expected.Matches(actual.GetVerb(), actual.GetResource().Resource) && actual.GetSubresource() == expected.GetSubresource()) { - t.Errorf("Expected\n\t%#v\ngot\n\t%#v", expected, actual) - return - } - - if reflect.TypeOf(actual) != reflect.TypeOf(expected) { - t.Errorf("Action has wrong type. Expected: %t. Got: %t", expected, actual) - return - } - - switch a := actual.(type) { - case core.CreateActionImpl: - e, _ := expected.(core.CreateActionImpl) - expObject := e.GetObject() - object := a.GetObject() - - if !reflect.DeepEqual(expObject, object) { - t.Errorf("Action %s %s has wrong object\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object)) - } - case core.UpdateActionImpl: - e, _ := expected.(core.UpdateActionImpl) - expObject := e.GetObject() - object := a.GetObject() - - if !reflect.DeepEqual(expObject, object) { - t.Errorf("Action %s %s has wrong object\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object)) - } - case core.PatchActionImpl: - e, _ := expected.(core.PatchActionImpl) - expPatch := e.GetPatch() - patch := a.GetPatch() - - if !reflect.DeepEqual(expPatch, patch) { - t.Errorf("Action %s %s has wrong patch\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expPatch, patch)) - } - default: - t.Errorf("Uncaptured Action %s %s, you should explicitly add a case to capture it", - actual.GetVerb(), actual.GetResource().Resource) - } -} - -// filterInformerActions filters list and watch actions for testing resources. -// Since list and watch don't change resource state we can filter it to lower -// nose level in our tests. -func filterInformerActions(actions []core.Action) []core.Action { - ret := []core.Action{} - for _, action := range actions { - if len(action.GetNamespace()) == 0 && - (action.Matches("list", "foos") || - action.Matches("watch", "foos") || - action.Matches("list", "deployments") || - action.Matches("watch", "deployments")) { - continue - } - ret = append(ret, action) - } - - return ret -} - -func (f *fixture) expectCreateDeploymentAction(d *apps.Deployment) { - f.kubeactions = append(f.kubeactions, core.NewCreateAction(schema.GroupVersionResource{Resource: "deployments"}, d.Namespace, d)) -} - -func (f *fixture) expectUpdateDeploymentAction(d *apps.Deployment) { - f.kubeactions = append(f.kubeactions, core.NewUpdateAction(schema.GroupVersionResource{Resource: "deployments"}, d.Namespace, d)) -} - -func (f *fixture) expectUpdateFooStatusAction(foo *samplecontroller.Foo) { - action := core.NewUpdateSubresourceAction(schema.GroupVersionResource{Resource: "foos"}, "status", foo.Namespace, foo) - f.actions = append(f.actions, action) -} - -func getRef(foo *samplecontroller.Foo, t *testing.T) cache.ObjectName { - ref := cache.MetaObjectToName(foo) - return ref -} - -func TestCreatesDeployment(t *testing.T) { - f := newFixture(t) - foo := newFoo("test", ptr.To[int32](1)) - _, ctx := ktesting.NewTestContext(t) - - f.fooLister = append(f.fooLister, foo) - f.objects = append(f.objects, foo) - - expDeployment := newDeployment(foo) - f.expectCreateDeploymentAction(expDeployment) - f.expectUpdateFooStatusAction(foo) - - f.run(ctx, getRef(foo, t)) -} - -func TestDoNothing(t *testing.T) { - f := newFixture(t) - foo := newFoo("test", ptr.To[int32](1)) - _, ctx := ktesting.NewTestContext(t) - - d := newDeployment(foo) - - f.fooLister = append(f.fooLister, foo) - f.objects = append(f.objects, foo) - f.deploymentLister = append(f.deploymentLister, d) - f.kubeobjects = append(f.kubeobjects, d) - - f.expectUpdateFooStatusAction(foo) - f.run(ctx, getRef(foo, t)) -} - -func TestUpdateDeployment(t *testing.T) { - f := newFixture(t) - foo := newFoo("test", ptr.To[int32](1)) - _, ctx := ktesting.NewTestContext(t) - - d := newDeployment(foo) - - // Update replicas - foo.Spec.Replicas = ptr.To[int32](2) - expDeployment := newDeployment(foo) - - f.fooLister = append(f.fooLister, foo) - f.objects = append(f.objects, foo) - f.deploymentLister = append(f.deploymentLister, d) - f.kubeobjects = append(f.kubeobjects, d) - - f.expectUpdateFooStatusAction(foo) - f.expectUpdateDeploymentAction(expDeployment) - f.run(ctx, getRef(foo, t)) -} - -func TestNotControlledByUs(t *testing.T) { - f := newFixture(t) - foo := newFoo("test", ptr.To[int32](1)) - _, ctx := ktesting.NewTestContext(t) - - d := newDeployment(foo) - - d.ObjectMeta.OwnerReferences = []metav1.OwnerReference{} - - f.fooLister = append(f.fooLister, foo) - f.objects = append(f.objects, foo) - f.deploymentLister = append(f.deploymentLister, d) - f.kubeobjects = append(f.kubeobjects, d) - - f.runExpectError(ctx, getRef(foo, t)) -} diff --git a/go.mod b/go.mod index 0e5e94b..43b39a9 100644 --- a/go.mod +++ b/go.mod @@ -7,13 +7,13 @@ godebug default=go1.26 require ( golang.org/x/time v0.15.0 k8s.io/api v0.0.0-20260509204538-0dfb117cc6ec - k8s.io/apimachinery v0.0.0-20260509204146-64dfe1db2af5 + k8s.io/apimachinery v0.0.0-20260513183604-f9371b815e42 k8s.io/client-go v0.0.0-20260509205101-ca52b81a2940 k8s.io/code-generator v0.0.0-20260509210052-5595d1310975 k8s.io/klog/v2 v2.140.0 - k8s.io/kube-openapi v0.0.0-20260509150519-312035bf509b + k8s.io/kube-openapi v0.0.0-20260511211612-da4e56fe5676 k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 - sigs.k8s.io/structured-merge-diff/v6 v6.3.2 + sigs.k8s.io/structured-merge-diff/v6 v6.4.0 ) require ( @@ -57,8 +57,10 @@ require ( google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect - k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b // indirect + k8s.io/gengo/v2 v2.0.0-20260408192533-25e2208e0dc3 // indirect sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/randfill v1.0.0 // indirect sigs.k8s.io/yaml v1.6.0 // indirect ) + +replace k8s.io/code-generator => ./code-generator diff --git a/go.sum b/go.sum index fd8673a..24b1ea4 100644 --- a/go.sum +++ b/go.sum @@ -121,16 +121,21 @@ k8s.io/api v0.0.0-20260509204538-0dfb117cc6ec h1:xf12Yh3ltN4fnNyP0CyyM0TwNVnZDfL k8s.io/api v0.0.0-20260509204538-0dfb117cc6ec/go.mod h1:C+fcNlNQ9TcKHspN+DD7UybdfnjDAGyBjfCd6W7ogbY= k8s.io/apimachinery v0.0.0-20260509204146-64dfe1db2af5 h1:k2HBxRBq6w2QCj14oAhBosjMqqgNlj4dmLXFj8f1A+8= k8s.io/apimachinery v0.0.0-20260509204146-64dfe1db2af5/go.mod h1:37ALVDWo0LgW74Y9rAdewmZo20SVCGGH34806wUMrko= +k8s.io/apimachinery v0.0.0-20260513183604-f9371b815e42 h1:rWdGOTor3z0WSyZcRl9ms4dn9Cw9CqmNBqXuf2z0k1k= +k8s.io/apimachinery v0.0.0-20260513183604-f9371b815e42/go.mod h1:hiubQ6UTHIdr0bS8ExXOJEywFVOoudnldm/l/NiNVlA= k8s.io/client-go v0.0.0-20260509205101-ca52b81a2940 h1:n5t5Jx3VpLdiAGxIvIHsZDmsExtZVwghUPLM3wFi6Go= k8s.io/client-go v0.0.0-20260509205101-ca52b81a2940/go.mod h1:0e7OLwg7kdXISVFwn7ishFdvxfVgi7wsqHqsQPHl61w= k8s.io/code-generator v0.0.0-20260509210052-5595d1310975 h1:hDrusFgTzvqcDJ7p13A9Eid4i8Y9uNSs/67lniaYHwM= k8s.io/code-generator v0.0.0-20260509210052-5595d1310975/go.mod h1:mQXg0n0EeF4oU8aTwm9mzwoyAKqVRmUb9wLhjHnRq3I= k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b h1:gMplByicHV/TJBizHd9aVEsTYoJBnnUAT5MHlTkbjhQ= k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b/go.mod h1:CgujABENc3KuTrcsdpGmrrASjtQsWCT7R99mEV4U/fM= +k8s.io/gengo/v2 v2.0.0-20260408192533-25e2208e0dc3/go.mod h1:yvyl3l9E+UxlqOMUULdKTAYB0rEhsmjr7+2Vb/1pCSo= k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc= k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0= k8s.io/kube-openapi v0.0.0-20260509150519-312035bf509b h1:WrpNVPKkCaOO9h77E1P2HLnhWDQxrxzpf2jfsM8WevY= k8s.io/kube-openapi v0.0.0-20260509150519-312035bf509b/go.mod h1:V/QaCUYDa+0QpcHhVVc5l99Uz56wEMEXBSj9oCDkNDY= +k8s.io/kube-openapi v0.0.0-20260511211612-da4e56fe5676 h1:ahjrVu/DBcaAhw/GcblfaOvvQ2wi8kqXWvn62nud3UU= +k8s.io/kube-openapi v0.0.0-20260511211612-da4e56fe5676/go.mod h1:V/QaCUYDa+0QpcHhVVc5l99Uz56wEMEXBSj9oCDkNDY= k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU= k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= @@ -139,5 +144,7 @@ sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= sigs.k8s.io/structured-merge-diff/v6 v6.3.2 h1:kwVWMx5yS1CrnFWA/2QHyRVJ8jM6dBA80uLmm0wJkk8= sigs.k8s.io/structured-merge-diff/v6 v6.3.2/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/structured-merge-diff/v6 v6.4.0 h1:qmp2e3ZfFi1/jJbDGpD4mt3wyp6PE1NfKHCYLqgNQJo= +sigs.k8s.io/structured-merge-diff/v6 v6.4.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/hack/api-violations/codegen_violation_exceptions.list b/hack/api-violations/codegen_violation_exceptions.list new file mode 100644 index 0000000..249ee25 --- /dev/null +++ b/hack/api-violations/codegen_violation_exceptions.list @@ -0,0 +1,18 @@ +API rule violation: names_match,gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1,ProxyProviderSpec,AuthorizationFlow +API rule violation: names_match,gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1,ProxyProviderSpec,ExternalHost +API rule violation: names_match,gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1,ProxyProviderSpec,InvalidationFlow +API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,Quantity,Format +API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,Quantity,d +API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,Quantity,i +API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,Quantity,s +API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,int64Amount,scale +API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,int64Amount,value +API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,APIResourceList,APIResources +API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Duration,Duration +API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,InternalEvent,Object +API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,InternalEvent,Type +API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,MicroTime,Time +API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,StatusCause,Type +API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Time,Time +API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentEncoding +API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentType diff --git a/hack/boilerplate.go.txt b/hack/boilerplate.go.txt deleted file mode 100644 index b7c650d..0000000 --- a/hack/boilerplate.go.txt +++ /dev/null @@ -1,16 +0,0 @@ -/* -Copyright The Kubernetes 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. -*/ - diff --git a/hack/tools.go b/hack/tools.go deleted file mode 100644 index 3e2ab98..0000000 --- a/hack/tools.go +++ /dev/null @@ -1,22 +0,0 @@ -//go:build tools - -/* -Copyright 2019 The Kubernetes 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. -*/ - -// This package imports things required by build scripts, to force `go mod` to see them as dependencies -package tools - -import _ "k8s.io/code-generator" diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh deleted file mode 100755 index 31d9dae..0000000 --- a/hack/update-codegen.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2017 The Kubernetes 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. - -set -o errexit -set -o nounset -set -o pipefail - -SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. -CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)} - -source "${CODEGEN_PKG}/kube_codegen.sh" - -THIS_PKG="gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator" - -kube::codegen::gen_helpers \ - --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \ - "${SCRIPT_ROOT}/pkg/apis" - -if [[ -n "${API_KNOWN_VIOLATIONS_DIR:-}" ]]; then - report_filename="${API_KNOWN_VIOLATIONS_DIR}/sample_controller_violation_exceptions.list" - if [[ "${UPDATE_API_KNOWN_VIOLATIONS:-}" == "true" ]]; then - update_report="--update-report" - fi -fi - -kube::codegen::gen_openapi \ - --output-dir "${SCRIPT_ROOT}/pkg/generated/openapi" \ - --output-pkg "k8s.io/${THIS_PKG}/pkg/generated/openapi" \ - --report-filename "${report_filename:-"/dev/null"}" \ - --output-model-name-file "zz_generated.model_name.go" \ - ${update_report:+"${update_report}"} \ - --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \ - "${SCRIPT_ROOT}/pkg/apis" - -kube::codegen::gen_client \ - --with-watch \ - --with-applyconfig \ - --applyconfig-openapi-schema <(go run gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/openapi/cmd/models-schema) \ - --output-dir "${SCRIPT_ROOT}/pkg/generated" \ - --output-pkg "${THIS_PKG}/pkg/generated" \ - --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \ - "${SCRIPT_ROOT}/pkg/apis" - -kube::codegen::gen_register \ - --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \ - "${SCRIPT_ROOT}/pkg/apis" diff --git a/hack/verify-codegen.sh b/hack/verify-codegen.sh deleted file mode 100755 index 0af433f..0000000 --- a/hack/verify-codegen.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2017 The Kubernetes 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. - -set -o errexit -set -o nounset -set -o pipefail - -SCRIPT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" -DIFFROOT="${SCRIPT_ROOT}/pkg" -TMP_DIFFROOT="$(mktemp -d -t "$(basename "$0").XXXXXX")/pkg" - -cleanup() { - rm -rf "${TMP_DIFFROOT}" -} -trap "cleanup" EXIT SIGINT - -cleanup - -# Ensure model-schema generator matches the version from -# k8s.io/kubernetes/pkg/generated/openapi/cmd/models-schema/main.go -echo "Ensuring models-schema is up-to-date" -K8S_MODELS_SCHEMA="${SCRIPT_ROOT}/../../../../pkg/generated/openapi/cmd/models-schema/main.go" -SAMPLE_CONTROLLER_MODELS_SCHEMA="${SCRIPT_ROOT}/pkg/generated/openapi/cmd/models-schema/main.go" -# these two files will only differ in the imported lines for generated openapi -if ! diff -I "k8s.io/kubernetes/pkg/generated/openapi" \ - -I "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/openapi" \ - "${K8S_MODELS_SCHEMA}" "${SAMPLE_CONTROLLER_MODELS_SCHEMA}"; then - echo "${SAMPLE_CONTROLLER_MODELS_SCHEMA} is out of date. Compare changes with ${K8S_MODELS_SCHEMA}" - exit 1 -fi - -mkdir -p "${TMP_DIFFROOT}" -cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}" - -"${SCRIPT_ROOT}/hack/update-codegen.sh" -echo "diffing ${DIFFROOT} against freshly generated codegen" -ret=0 -diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$? -if [[ $ret -eq 0 ]]; then - echo "${DIFFROOT} up to date." -else - echo "${DIFFROOT} is out of date. Please run hack/update-codegen.sh" -fi -exit $ret diff --git a/main.go b/main.go index fac31a3..58e139e 100644 --- a/main.go +++ b/main.go @@ -58,23 +58,23 @@ func main() { klog.FlushAndExit(klog.ExitFlushTimeout, 1) } - exampleClient, err := clientset.NewForConfig(cfg) + operatorClient, err := clientset.NewForConfig(cfg) if err != nil { logger.Error(err, "Error building kubernetes clientset") klog.FlushAndExit(klog.ExitFlushTimeout, 1) } kubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeClient, time.Second*30) - exampleInformerFactory := informers.NewSharedInformerFactory(exampleClient, time.Second*30) + operatorInformerFactory := informers.NewSharedInformerFactory(operatorClient, time.Second*30) - controller := NewController(ctx, kubeClient, exampleClient, + controller := NewController(ctx, kubeClient, operatorClient, kubeInformerFactory.Apps().V1().Deployments(), - exampleInformerFactory.Samplecontroller().V1alpha1().Foos()) + operatorInformerFactory.Proxyprovider().V1().ProxyProviders()) // notice that there is no need to run Start methods in a separate goroutine. (i.e. go kubeInformerFactory.Start(ctx.done()) // Start method is non-blocking and runs all registered informers in a dedicated goroutine. kubeInformerFactory.Start(ctx.Done()) - exampleInformerFactory.Start(ctx.Done()) + operatorInformerFactory.Start(ctx.Done()) if err = controller.Run(ctx, 2); err != nil { logger.Error(err, "Error running controller") diff --git a/pkg/apis/samplecontroller/v1alpha1/doc.go b/pkg/apis/proxyprovider/v1/doc.go similarity index 84% rename from pkg/apis/samplecontroller/v1alpha1/doc.go rename to pkg/apis/proxyprovider/v1/doc.go index 72ef5ae..408cb35 100644 --- a/pkg/apis/samplecontroller/v1alpha1/doc.go +++ b/pkg/apis/proxyprovider/v1/doc.go @@ -16,7 +16,7 @@ limitations under the License. // +k8s:deepcopy-gen=package // +k8s:openapi-gen=true -// +groupName=samplecontroller.k8s.io +// +groupName=proxyprovider.t000-n.de -// Package v1alpha1 is the v1alpha1 version of the API. -package v1alpha1 +// Package v1 is the v1 version of the API. +package v1 diff --git a/pkg/apis/samplecontroller/v1alpha1/types.go b/pkg/apis/proxyprovider/v1/types.go similarity index 65% rename from pkg/apis/samplecontroller/v1alpha1/types.go rename to pkg/apis/proxyprovider/v1/types.go index e387d34..b0a4afa 100644 --- a/pkg/apis/samplecontroller/v1alpha1/types.go +++ b/pkg/apis/proxyprovider/v1/types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -23,32 +23,30 @@ import ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// Foo is a specification for a Foo resource -type Foo struct { +type ProxyProvider struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec FooSpec `json:"spec"` - Status FooStatus `json:"status"` + Spec ProxyProviderSpec `json:"spec"` + Status ProxyProviderStatus `json:"status"` } -// FooSpec is the spec for a Foo resource -type FooSpec struct { - DeploymentName string `json:"deploymentName"` - Replicas *int32 `json:"replicas"` +type ProxyProviderSpec struct { + Name string `json:"name"` + AuthorizationFlow string `json:"authorization_flow"` + InvalidationFlow string `json:"invalidation_flow"` + ExternalHost string `json:"external_host"` } -// FooStatus is the status for a Foo resource -type FooStatus struct { - AvailableReplicas int32 `json:"availableReplicas"` +type ProxyProviderStatus struct { + PK string `json:"pk"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// FooList is a list of Foo resources -type FooList struct { +type ProxyProviderList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []Foo `json:"items"` + Items []ProxyProvider `json:"items"` } diff --git a/pkg/apis/samplecontroller/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/proxyprovider/v1/zz_generated.deepcopy.go similarity index 71% rename from pkg/apis/samplecontroller/v1alpha1/zz_generated.deepcopy.go rename to pkg/apis/proxyprovider/v1/zz_generated.deepcopy.go index 2619460..27be419 100644 --- a/pkg/apis/samplecontroller/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/proxyprovider/v1/zz_generated.deepcopy.go @@ -19,34 +19,34 @@ limitations under the License. // Code generated by deepcopy-gen. DO NOT EDIT. -package v1alpha1 +package v1 import ( runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Foo) DeepCopyInto(out *Foo) { +func (in *ProxyProvider) DeepCopyInto(out *ProxyProvider) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) + out.Spec = in.Spec out.Status = in.Status return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Foo. -func (in *Foo) DeepCopy() *Foo { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProxyProvider. +func (in *ProxyProvider) DeepCopy() *ProxyProvider { if in == nil { return nil } - out := new(Foo) + out := new(ProxyProvider) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Foo) DeepCopyObject() runtime.Object { +func (in *ProxyProvider) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -54,13 +54,13 @@ func (in *Foo) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FooList) DeepCopyInto(out *FooList) { +func (in *ProxyProviderList) DeepCopyInto(out *ProxyProviderList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]Foo, len(*in)) + *out = make([]ProxyProvider, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -68,18 +68,18 @@ func (in *FooList) DeepCopyInto(out *FooList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FooList. -func (in *FooList) DeepCopy() *FooList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProxyProviderList. +func (in *ProxyProviderList) DeepCopy() *ProxyProviderList { if in == nil { return nil } - out := new(FooList) + out := new(ProxyProviderList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FooList) DeepCopyObject() runtime.Object { +func (in *ProxyProviderList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -87,38 +87,33 @@ func (in *FooList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FooSpec) DeepCopyInto(out *FooSpec) { +func (in *ProxyProviderSpec) DeepCopyInto(out *ProxyProviderSpec) { *out = *in - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas - *out = new(int32) - **out = **in - } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FooSpec. -func (in *FooSpec) DeepCopy() *FooSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProxyProviderSpec. +func (in *ProxyProviderSpec) DeepCopy() *ProxyProviderSpec { if in == nil { return nil } - out := new(FooSpec) + out := new(ProxyProviderSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FooStatus) DeepCopyInto(out *FooStatus) { +func (in *ProxyProviderStatus) DeepCopyInto(out *ProxyProviderStatus) { *out = *in return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FooStatus. -func (in *FooStatus) DeepCopy() *FooStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProxyProviderStatus. +func (in *ProxyProviderStatus) DeepCopy() *ProxyProviderStatus { if in == nil { return nil } - out := new(FooStatus) + out := new(ProxyProviderStatus) in.DeepCopyInto(out) return out } diff --git a/pkg/apis/samplecontroller/v1alpha1/zz_generated.register.go b/pkg/apis/proxyprovider/v1/zz_generated.register.go similarity index 88% rename from pkg/apis/samplecontroller/v1alpha1/zz_generated.register.go rename to pkg/apis/proxyprovider/v1/zz_generated.register.go index 146e82e..236a8cb 100644 --- a/pkg/apis/samplecontroller/v1alpha1/zz_generated.register.go +++ b/pkg/apis/proxyprovider/v1/zz_generated.register.go @@ -19,24 +19,24 @@ limitations under the License. // Code generated by register-gen. DO NOT EDIT. -package v1alpha1 +package v1 import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" ) // GroupName specifies the group name used to register the objects. -const GroupName = "samplecontroller.k8s.io" +const GroupName = "proxyprovider.t000-n.de" // GroupVersion specifies the group and the version used to register the objects. -var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha1"} +var GroupVersion = metav1.GroupVersion{Group: GroupName, Version: "v1"} // SchemeGroupVersion is group version used to register these objects // // Deprecated: use GroupVersion instead. -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { @@ -62,10 +62,10 @@ func init() { // Adds the list of known types to Scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &Foo{}, - &FooList{}, + &ProxyProvider{}, + &ProxyProviderList{}, ) // AddToGroupVersion allows the serialization of client types like ListOptions. - v1.AddToGroupVersion(scheme, SchemeGroupVersion) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil } diff --git a/pkg/generated/applyconfiguration/internal/internal.go b/pkg/generated/applyconfiguration/internal/internal.go index 66a908c..c482faa 100644 --- a/pkg/generated/applyconfiguration/internal/internal.go +++ b/pkg/generated/applyconfiguration/internal/internal.go @@ -39,16 +39,6 @@ func Parser() *typed.Parser { var parserOnce sync.Once var parser *typed.Parser var schemaYAML = typed.YAMLObject(`types: -- name: io.k8s.sample-controller.pkg.apis.samplecontroller.v1alpha1.Foo - scalar: untyped - list: - elementType: - namedType: __untyped_atomic_ - elementRelationship: atomic - map: - elementType: - namedType: __untyped_deduced_ - elementRelationship: separable - name: __untyped_atomic_ scalar: untyped list: diff --git a/pkg/generated/applyconfiguration/samplecontroller/v1alpha1/foo.go b/pkg/generated/applyconfiguration/proxyprovider/v1/proxyprovider.go similarity index 61% rename from pkg/generated/applyconfiguration/samplecontroller/v1alpha1/foo.go rename to pkg/generated/applyconfiguration/proxyprovider/v1/proxyprovider.go index b55eeff..97b5dd5 100644 --- a/pkg/generated/applyconfiguration/samplecontroller/v1alpha1/foo.go +++ b/pkg/generated/applyconfiguration/proxyprovider/v1/proxyprovider.go @@ -16,86 +16,40 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha1 +package v1 import ( - samplecontrollerv1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1" - internal "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/applyconfiguration/internal" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" - managedfields "k8s.io/apimachinery/pkg/util/managedfields" - v1 "k8s.io/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// FooApplyConfiguration represents a declarative configuration of the Foo type for use +// ProxyProviderApplyConfiguration represents a declarative configuration of the ProxyProvider type for use // with apply. -// -// Foo is a specification for a Foo resource -type FooApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - Spec *FooSpecApplyConfiguration `json:"spec,omitempty"` - Status *FooStatusApplyConfiguration `json:"status,omitempty"` +type ProxyProviderApplyConfiguration struct { + metav1.TypeMetaApplyConfiguration `json:""` + *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ProxyProviderSpecApplyConfiguration `json:"spec,omitempty"` + Status *ProxyProviderStatusApplyConfiguration `json:"status,omitempty"` } -// Foo constructs a declarative configuration of the Foo type for use with +// ProxyProvider constructs a declarative configuration of the ProxyProvider type for use with // apply. -func Foo(name, namespace string) *FooApplyConfiguration { - b := &FooApplyConfiguration{} +func ProxyProvider(name, namespace string) *ProxyProviderApplyConfiguration { + b := &ProxyProviderApplyConfiguration{} b.WithName(name) b.WithNamespace(namespace) - b.WithKind("Foo") - b.WithAPIVersion("samplecontroller.k8s.io/v1alpha1") + b.WithKind("ProxyProvider") + b.WithAPIVersion("proxyprovider.t000-n.de/v1") return b } -// ExtractFooFrom extracts the applied configuration owned by fieldManager from -// foo for the specified subresource. Pass an empty string for subresource to extract -// the main resource. Common subresources include "status", "scale", etc. -// foo must be a unmodified Foo API object that was retrieved from the Kubernetes API. -// ExtractFooFrom provides a way to perform a extract/modify-in-place/apply workflow. -// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously -// applied if another fieldManager has updated or force applied any of the previously applied fields. -func ExtractFooFrom(foo *samplecontrollerv1alpha1.Foo, fieldManager string, subresource string) (*FooApplyConfiguration, error) { - b := &FooApplyConfiguration{} - err := managedfields.ExtractInto(foo, internal.Parser().Type("io.k8s.sample-controller.pkg.apis.samplecontroller.v1alpha1.Foo"), fieldManager, b, subresource) - if err != nil { - return nil, err - } - b.WithName(foo.Name) - b.WithNamespace(foo.Namespace) - - b.WithKind("Foo") - b.WithAPIVersion("samplecontroller.k8s.io/v1alpha1") - return b, nil -} - -// ExtractFoo extracts the applied configuration owned by fieldManager from -// foo. If no managedFields are found in foo for fieldManager, a -// FooApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. It is possible that no managed fields were found for because other -// field managers have taken ownership of all the fields previously owned by fieldManager, or because -// the fieldManager never owned fields any fields. -// foo must be a unmodified Foo API object that was retrieved from the Kubernetes API. -// ExtractFoo provides a way to perform a extract/modify-in-place/apply workflow. -// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously -// applied if another fieldManager has updated or force applied any of the previously applied fields. -func ExtractFoo(foo *samplecontrollerv1alpha1.Foo, fieldManager string) (*FooApplyConfiguration, error) { - return ExtractFooFrom(foo, fieldManager, "") -} - -// ExtractFooStatus extracts the applied configuration owned by fieldManager from -// foo for the status subresource. -func ExtractFooStatus(foo *samplecontrollerv1alpha1.Foo, fieldManager string) (*FooApplyConfiguration, error) { - return ExtractFooFrom(foo, fieldManager, "status") -} - -func (b FooApplyConfiguration) IsApplyConfiguration() {} +func (b ProxyProviderApplyConfiguration) IsApplyConfiguration() {} // WithKind sets the Kind field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Kind field is set to the value of the last call. -func (b *FooApplyConfiguration) WithKind(value string) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithKind(value string) *ProxyProviderApplyConfiguration { b.TypeMetaApplyConfiguration.Kind = &value return b } @@ -103,7 +57,7 @@ func (b *FooApplyConfiguration) WithKind(value string) *FooApplyConfiguration { // WithAPIVersion sets the APIVersion field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the APIVersion field is set to the value of the last call. -func (b *FooApplyConfiguration) WithAPIVersion(value string) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithAPIVersion(value string) *ProxyProviderApplyConfiguration { b.TypeMetaApplyConfiguration.APIVersion = &value return b } @@ -111,7 +65,7 @@ func (b *FooApplyConfiguration) WithAPIVersion(value string) *FooApplyConfigurat // WithName sets the Name field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Name field is set to the value of the last call. -func (b *FooApplyConfiguration) WithName(value string) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithName(value string) *ProxyProviderApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.Name = &value return b @@ -120,7 +74,7 @@ func (b *FooApplyConfiguration) WithName(value string) *FooApplyConfiguration { // WithGenerateName sets the GenerateName field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the GenerateName field is set to the value of the last call. -func (b *FooApplyConfiguration) WithGenerateName(value string) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithGenerateName(value string) *ProxyProviderApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.GenerateName = &value return b @@ -129,7 +83,7 @@ func (b *FooApplyConfiguration) WithGenerateName(value string) *FooApplyConfigur // WithNamespace sets the Namespace field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Namespace field is set to the value of the last call. -func (b *FooApplyConfiguration) WithNamespace(value string) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithNamespace(value string) *ProxyProviderApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.Namespace = &value return b @@ -138,7 +92,7 @@ func (b *FooApplyConfiguration) WithNamespace(value string) *FooApplyConfigurati // WithUID sets the UID field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the UID field is set to the value of the last call. -func (b *FooApplyConfiguration) WithUID(value types.UID) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithUID(value types.UID) *ProxyProviderApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.UID = &value return b @@ -147,7 +101,7 @@ func (b *FooApplyConfiguration) WithUID(value types.UID) *FooApplyConfiguration // WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the ResourceVersion field is set to the value of the last call. -func (b *FooApplyConfiguration) WithResourceVersion(value string) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithResourceVersion(value string) *ProxyProviderApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.ResourceVersion = &value return b @@ -156,7 +110,7 @@ func (b *FooApplyConfiguration) WithResourceVersion(value string) *FooApplyConfi // WithGeneration sets the Generation field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Generation field is set to the value of the last call. -func (b *FooApplyConfiguration) WithGeneration(value int64) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithGeneration(value int64) *ProxyProviderApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.Generation = &value return b @@ -165,7 +119,7 @@ func (b *FooApplyConfiguration) WithGeneration(value int64) *FooApplyConfigurati // WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the CreationTimestamp field is set to the value of the last call. -func (b *FooApplyConfiguration) WithCreationTimestamp(value metav1.Time) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *ProxyProviderApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.CreationTimestamp = &value return b @@ -174,7 +128,7 @@ func (b *FooApplyConfiguration) WithCreationTimestamp(value metav1.Time) *FooApp // WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the DeletionTimestamp field is set to the value of the last call. -func (b *FooApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *ProxyProviderApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value return b @@ -183,7 +137,7 @@ func (b *FooApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *FooApp // WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. -func (b *FooApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ProxyProviderApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value return b @@ -193,7 +147,7 @@ func (b *FooApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *Foo // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, the entries provided by each call will be put on the Labels field, // overwriting an existing map entries in Labels field with the same key. -func (b *FooApplyConfiguration) WithLabels(entries map[string]string) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithLabels(entries map[string]string) *ProxyProviderApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) @@ -208,7 +162,7 @@ func (b *FooApplyConfiguration) WithLabels(entries map[string]string) *FooApplyC // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, the entries provided by each call will be put on the Annotations field, // overwriting an existing map entries in Annotations field with the same key. -func (b *FooApplyConfiguration) WithAnnotations(entries map[string]string) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithAnnotations(entries map[string]string) *ProxyProviderApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) @@ -222,7 +176,7 @@ func (b *FooApplyConfiguration) WithAnnotations(entries map[string]string) *FooA // WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the OwnerReferences field. -func (b *FooApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *ProxyProviderApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() for i := range values { if values[i] == nil { @@ -236,7 +190,7 @@ func (b *FooApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReference // WithFinalizers adds the given value to the Finalizers field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Finalizers field. -func (b *FooApplyConfiguration) WithFinalizers(values ...string) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithFinalizers(values ...string) *ProxyProviderApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() for i := range values { b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) @@ -244,16 +198,16 @@ func (b *FooApplyConfiguration) WithFinalizers(values ...string) *FooApplyConfig return b } -func (b *FooApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { +func (b *ProxyProviderApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { if b.ObjectMetaApplyConfiguration == nil { - b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{} } } // WithSpec sets the Spec field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Spec field is set to the value of the last call. -func (b *FooApplyConfiguration) WithSpec(value *FooSpecApplyConfiguration) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithSpec(value *ProxyProviderSpecApplyConfiguration) *ProxyProviderApplyConfiguration { b.Spec = value return b } @@ -261,29 +215,29 @@ func (b *FooApplyConfiguration) WithSpec(value *FooSpecApplyConfiguration) *FooA // WithStatus sets the Status field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Status field is set to the value of the last call. -func (b *FooApplyConfiguration) WithStatus(value *FooStatusApplyConfiguration) *FooApplyConfiguration { +func (b *ProxyProviderApplyConfiguration) WithStatus(value *ProxyProviderStatusApplyConfiguration) *ProxyProviderApplyConfiguration { b.Status = value return b } // GetKind retrieves the value of the Kind field in the declarative configuration. -func (b *FooApplyConfiguration) GetKind() *string { +func (b *ProxyProviderApplyConfiguration) GetKind() *string { return b.TypeMetaApplyConfiguration.Kind } // GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. -func (b *FooApplyConfiguration) GetAPIVersion() *string { +func (b *ProxyProviderApplyConfiguration) GetAPIVersion() *string { return b.TypeMetaApplyConfiguration.APIVersion } // GetName retrieves the value of the Name field in the declarative configuration. -func (b *FooApplyConfiguration) GetName() *string { +func (b *ProxyProviderApplyConfiguration) GetName() *string { b.ensureObjectMetaApplyConfigurationExists() return b.ObjectMetaApplyConfiguration.Name } // GetNamespace retrieves the value of the Namespace field in the declarative configuration. -func (b *FooApplyConfiguration) GetNamespace() *string { +func (b *ProxyProviderApplyConfiguration) GetNamespace() *string { b.ensureObjectMetaApplyConfigurationExists() return b.ObjectMetaApplyConfiguration.Namespace } diff --git a/pkg/generated/applyconfiguration/proxyprovider/v1/proxyproviderspec.go b/pkg/generated/applyconfiguration/proxyprovider/v1/proxyproviderspec.go new file mode 100644 index 0000000..9b9838d --- /dev/null +++ b/pkg/generated/applyconfiguration/proxyprovider/v1/proxyproviderspec.go @@ -0,0 +1,66 @@ +/* +Copyright The Kubernetes 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// ProxyProviderSpecApplyConfiguration represents a declarative configuration of the ProxyProviderSpec type for use +// with apply. +type ProxyProviderSpecApplyConfiguration struct { + Name *string `json:"name,omitempty"` + AuthorizationFlow *string `json:"authorization_flow,omitempty"` + InvalidationFlow *string `json:"invalidation_flow,omitempty"` + ExternalHost *string `json:"external_host,omitempty"` +} + +// ProxyProviderSpecApplyConfiguration constructs a declarative configuration of the ProxyProviderSpec type for use with +// apply. +func ProxyProviderSpec() *ProxyProviderSpecApplyConfiguration { + return &ProxyProviderSpecApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ProxyProviderSpecApplyConfiguration) WithName(value string) *ProxyProviderSpecApplyConfiguration { + b.Name = &value + return b +} + +// WithAuthorizationFlow sets the AuthorizationFlow field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AuthorizationFlow field is set to the value of the last call. +func (b *ProxyProviderSpecApplyConfiguration) WithAuthorizationFlow(value string) *ProxyProviderSpecApplyConfiguration { + b.AuthorizationFlow = &value + return b +} + +// WithInvalidationFlow sets the InvalidationFlow field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InvalidationFlow field is set to the value of the last call. +func (b *ProxyProviderSpecApplyConfiguration) WithInvalidationFlow(value string) *ProxyProviderSpecApplyConfiguration { + b.InvalidationFlow = &value + return b +} + +// WithExternalHost sets the ExternalHost field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExternalHost field is set to the value of the last call. +func (b *ProxyProviderSpecApplyConfiguration) WithExternalHost(value string) *ProxyProviderSpecApplyConfiguration { + b.ExternalHost = &value + return b +} diff --git a/pkg/generated/applyconfiguration/proxyprovider/v1/proxyproviderstatus.go b/pkg/generated/applyconfiguration/proxyprovider/v1/proxyproviderstatus.go new file mode 100644 index 0000000..1527289 --- /dev/null +++ b/pkg/generated/applyconfiguration/proxyprovider/v1/proxyproviderstatus.go @@ -0,0 +1,39 @@ +/* +Copyright The Kubernetes 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// ProxyProviderStatusApplyConfiguration represents a declarative configuration of the ProxyProviderStatus type for use +// with apply. +type ProxyProviderStatusApplyConfiguration struct { + PK *string `json:"pk,omitempty"` +} + +// ProxyProviderStatusApplyConfiguration constructs a declarative configuration of the ProxyProviderStatus type for use with +// apply. +func ProxyProviderStatus() *ProxyProviderStatusApplyConfiguration { + return &ProxyProviderStatusApplyConfiguration{} +} + +// WithPK sets the PK field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PK field is set to the value of the last call. +func (b *ProxyProviderStatusApplyConfiguration) WithPK(value string) *ProxyProviderStatusApplyConfiguration { + b.PK = &value + return b +} diff --git a/pkg/generated/applyconfiguration/samplecontroller/v1alpha1/foospec.go b/pkg/generated/applyconfiguration/samplecontroller/v1alpha1/foospec.go deleted file mode 100644 index 91a1410..0000000 --- a/pkg/generated/applyconfiguration/samplecontroller/v1alpha1/foospec.go +++ /dev/null @@ -1,50 +0,0 @@ -/* -Copyright The Kubernetes 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// FooSpecApplyConfiguration represents a declarative configuration of the FooSpec type for use -// with apply. -// -// FooSpec is the spec for a Foo resource -type FooSpecApplyConfiguration struct { - DeploymentName *string `json:"deploymentName,omitempty"` - Replicas *int32 `json:"replicas,omitempty"` -} - -// FooSpecApplyConfiguration constructs a declarative configuration of the FooSpec type for use with -// apply. -func FooSpec() *FooSpecApplyConfiguration { - return &FooSpecApplyConfiguration{} -} - -// WithDeploymentName sets the DeploymentName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeploymentName field is set to the value of the last call. -func (b *FooSpecApplyConfiguration) WithDeploymentName(value string) *FooSpecApplyConfiguration { - b.DeploymentName = &value - return b -} - -// WithReplicas sets the Replicas field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Replicas field is set to the value of the last call. -func (b *FooSpecApplyConfiguration) WithReplicas(value int32) *FooSpecApplyConfiguration { - b.Replicas = &value - return b -} diff --git a/pkg/generated/applyconfiguration/samplecontroller/v1alpha1/foostatus.go b/pkg/generated/applyconfiguration/samplecontroller/v1alpha1/foostatus.go deleted file mode 100644 index f170c81..0000000 --- a/pkg/generated/applyconfiguration/samplecontroller/v1alpha1/foostatus.go +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright The Kubernetes 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// FooStatusApplyConfiguration represents a declarative configuration of the FooStatus type for use -// with apply. -// -// FooStatus is the status for a Foo resource -type FooStatusApplyConfiguration struct { - AvailableReplicas *int32 `json:"availableReplicas,omitempty"` -} - -// FooStatusApplyConfiguration constructs a declarative configuration of the FooStatus type for use with -// apply. -func FooStatus() *FooStatusApplyConfiguration { - return &FooStatusApplyConfiguration{} -} - -// WithAvailableReplicas sets the AvailableReplicas field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the AvailableReplicas field is set to the value of the last call. -func (b *FooStatusApplyConfiguration) WithAvailableReplicas(value int32) *FooStatusApplyConfiguration { - b.AvailableReplicas = &value - return b -} diff --git a/pkg/generated/applyconfiguration/utils.go b/pkg/generated/applyconfiguration/utils.go index 2e03b62..da6a1aa 100644 --- a/pkg/generated/applyconfiguration/utils.go +++ b/pkg/generated/applyconfiguration/utils.go @@ -19,9 +19,9 @@ limitations under the License. package applyconfiguration import ( - v1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1" + v1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1" internal "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/applyconfiguration/internal" - samplecontrollerv1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/applyconfiguration/samplecontroller/v1alpha1" + proxyproviderv1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/applyconfiguration/proxyprovider/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" managedfields "k8s.io/apimachinery/pkg/util/managedfields" @@ -31,13 +31,13 @@ import ( // apply configuration type exists for the given GroupVersionKind. func ForKind(kind schema.GroupVersionKind) interface{} { switch kind { - // Group=samplecontroller.k8s.io, Version=v1alpha1 - case v1alpha1.SchemeGroupVersion.WithKind("Foo"): - return &samplecontrollerv1alpha1.FooApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("FooSpec"): - return &samplecontrollerv1alpha1.FooSpecApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("FooStatus"): - return &samplecontrollerv1alpha1.FooStatusApplyConfiguration{} + // Group=proxyprovider.t000-n.de, Version=v1 + case v1.SchemeGroupVersion.WithKind("ProxyProvider"): + return &proxyproviderv1.ProxyProviderApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ProxyProviderSpec"): + return &proxyproviderv1.ProxyProviderSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ProxyProviderStatus"): + return &proxyproviderv1.ProxyProviderStatusApplyConfiguration{} } return nil diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go index 2339bde..02a0897 100644 --- a/pkg/generated/clientset/versioned/clientset.go +++ b/pkg/generated/clientset/versioned/clientset.go @@ -22,7 +22,7 @@ import ( fmt "fmt" http "net/http" - samplecontrollerv1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1" + proxyproviderv1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/typed/proxyprovider/v1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -30,18 +30,18 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - SamplecontrollerV1alpha1() samplecontrollerv1alpha1.SamplecontrollerV1alpha1Interface + ProxyproviderV1() proxyproviderv1.ProxyproviderV1Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient - samplecontrollerV1alpha1 *samplecontrollerv1alpha1.SamplecontrollerV1alpha1Client + proxyproviderV1 *proxyproviderv1.ProxyproviderV1Client } -// SamplecontrollerV1alpha1 retrieves the SamplecontrollerV1alpha1Client -func (c *Clientset) SamplecontrollerV1alpha1() samplecontrollerv1alpha1.SamplecontrollerV1alpha1Interface { - return c.samplecontrollerV1alpha1 +// ProxyproviderV1 retrieves the ProxyproviderV1Client +func (c *Clientset) ProxyproviderV1() proxyproviderv1.ProxyproviderV1Interface { + return c.proxyproviderV1 } // Discovery retrieves the DiscoveryClient @@ -88,7 +88,7 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, var cs Clientset var err error - cs.samplecontrollerV1alpha1, err = samplecontrollerv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.proxyproviderV1, err = proxyproviderv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } @@ -113,7 +113,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.samplecontrollerV1alpha1 = samplecontrollerv1alpha1.New(c) + cs.proxyproviderV1 = proxyproviderv1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go index 1a59e3d..8651721 100644 --- a/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -21,8 +21,8 @@ package fake import ( applyconfiguration "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/applyconfiguration" clientset "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned" - samplecontrollerv1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1" - fakesamplecontrollerv1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake" + proxyproviderv1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/typed/proxyprovider/v1" + fakeproxyproviderv1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/typed/proxyprovider/v1/fake" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" @@ -136,7 +136,7 @@ var ( _ testing.FakeClient = &Clientset{} ) -// SamplecontrollerV1alpha1 retrieves the SamplecontrollerV1alpha1Client -func (c *Clientset) SamplecontrollerV1alpha1() samplecontrollerv1alpha1.SamplecontrollerV1alpha1Interface { - return &fakesamplecontrollerv1alpha1.FakeSamplecontrollerV1alpha1{Fake: &c.Fake} +// ProxyproviderV1 retrieves the ProxyproviderV1Client +func (c *Clientset) ProxyproviderV1() proxyproviderv1.ProxyproviderV1Interface { + return &fakeproxyproviderv1.FakeProxyproviderV1{Fake: &c.Fake} } diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go index 4726554..8a725b8 100644 --- a/pkg/generated/clientset/versioned/fake/register.go +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -19,7 +19,7 @@ limitations under the License. package fake import ( - samplecontrollerv1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1" + proxyproviderv1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,7 +31,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - samplecontrollerv1alpha1.AddToScheme, + proxyproviderv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go index bcefc82..098bade 100644 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -19,7 +19,7 @@ limitations under the License. package scheme import ( - samplecontrollerv1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1" + proxyproviderv1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,7 +31,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - samplecontrollerv1alpha1.AddToScheme, + proxyproviderv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/doc.go b/pkg/generated/clientset/versioned/typed/proxyprovider/v1/doc.go similarity index 97% rename from pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/doc.go rename to pkg/generated/clientset/versioned/typed/proxyprovider/v1/doc.go index df51baa..3af5d05 100644 --- a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/doc.go +++ b/pkg/generated/clientset/versioned/typed/proxyprovider/v1/doc.go @@ -17,4 +17,4 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. -package v1alpha1 +package v1 diff --git a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/doc.go b/pkg/generated/clientset/versioned/typed/proxyprovider/v1/fake/doc.go similarity index 100% rename from pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/doc.go rename to pkg/generated/clientset/versioned/typed/proxyprovider/v1/fake/doc.go diff --git a/pkg/generated/clientset/versioned/typed/proxyprovider/v1/fake/fake_proxyprovider.go b/pkg/generated/clientset/versioned/typed/proxyprovider/v1/fake/fake_proxyprovider.go new file mode 100644 index 0000000..575e1c9 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/proxyprovider/v1/fake/fake_proxyprovider.go @@ -0,0 +1,51 @@ +/* +Copyright The Kubernetes 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1" + proxyproviderv1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/applyconfiguration/proxyprovider/v1" + typedproxyproviderv1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/typed/proxyprovider/v1" + gentype "k8s.io/client-go/gentype" +) + +// fakeProxyProviders implements ProxyProviderInterface +type fakeProxyProviders struct { + *gentype.FakeClientWithListAndApply[*v1.ProxyProvider, *v1.ProxyProviderList, *proxyproviderv1.ProxyProviderApplyConfiguration] + Fake *FakeProxyproviderV1 +} + +func newFakeProxyProviders(fake *FakeProxyproviderV1, namespace string) typedproxyproviderv1.ProxyProviderInterface { + return &fakeProxyProviders{ + gentype.NewFakeClientWithListAndApply[*v1.ProxyProvider, *v1.ProxyProviderList, *proxyproviderv1.ProxyProviderApplyConfiguration]( + fake.Fake, + namespace, + v1.SchemeGroupVersion.WithResource("proxyproviders"), + v1.SchemeGroupVersion.WithKind("ProxyProvider"), + func() *v1.ProxyProvider { return &v1.ProxyProvider{} }, + func() *v1.ProxyProviderList { return &v1.ProxyProviderList{} }, + func(dst, src *v1.ProxyProviderList) { dst.ListMeta = src.ListMeta }, + func(list *v1.ProxyProviderList) []*v1.ProxyProvider { return gentype.ToPointerSlice(list.Items) }, + func(list *v1.ProxyProviderList, items []*v1.ProxyProvider) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_samplecontroller_client.go b/pkg/generated/clientset/versioned/typed/proxyprovider/v1/fake/fake_proxyprovider_client.go similarity index 70% rename from pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_samplecontroller_client.go rename to pkg/generated/clientset/versioned/typed/proxyprovider/v1/fake/fake_proxyprovider_client.go index a806837..6e7210b 100644 --- a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_samplecontroller_client.go +++ b/pkg/generated/clientset/versioned/typed/proxyprovider/v1/fake/fake_proxyprovider_client.go @@ -19,22 +19,22 @@ limitations under the License. package fake import ( - v1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1" + v1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/typed/proxyprovider/v1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) -type FakeSamplecontrollerV1alpha1 struct { +type FakeProxyproviderV1 struct { *testing.Fake } -func (c *FakeSamplecontrollerV1alpha1) Foos(namespace string) v1alpha1.FooInterface { - return newFakeFoos(c, namespace) +func (c *FakeProxyproviderV1) ProxyProviders(namespace string) v1.ProxyProviderInterface { + return newFakeProxyProviders(c, namespace) } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *FakeSamplecontrollerV1alpha1) RESTClient() rest.Interface { +func (c *FakeProxyproviderV1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } diff --git a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/proxyprovider/v1/generated_expansion.go similarity index 92% rename from pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/generated_expansion.go rename to pkg/generated/clientset/versioned/typed/proxyprovider/v1/generated_expansion.go index b64ea02..828bd72 100644 --- a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/generated_expansion.go +++ b/pkg/generated/clientset/versioned/typed/proxyprovider/v1/generated_expansion.go @@ -16,6 +16,6 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha1 +package v1 -type FooExpansion interface{} +type ProxyProviderExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/proxyprovider/v1/proxyprovider.go b/pkg/generated/clientset/versioned/typed/proxyprovider/v1/proxyprovider.go new file mode 100644 index 0000000..9a2107b --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/proxyprovider/v1/proxyprovider.go @@ -0,0 +1,74 @@ +/* +Copyright The Kubernetes 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + + proxyproviderv1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1" + applyconfigurationproxyproviderv1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/applyconfiguration/proxyprovider/v1" + scheme "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// ProxyProvidersGetter has a method to return a ProxyProviderInterface. +// A group's client should implement this interface. +type ProxyProvidersGetter interface { + ProxyProviders(namespace string) ProxyProviderInterface +} + +// ProxyProviderInterface has methods to work with ProxyProvider resources. +type ProxyProviderInterface interface { + Create(ctx context.Context, proxyProvider *proxyproviderv1.ProxyProvider, opts metav1.CreateOptions) (*proxyproviderv1.ProxyProvider, error) + Update(ctx context.Context, proxyProvider *proxyproviderv1.ProxyProvider, opts metav1.UpdateOptions) (*proxyproviderv1.ProxyProvider, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, proxyProvider *proxyproviderv1.ProxyProvider, opts metav1.UpdateOptions) (*proxyproviderv1.ProxyProvider, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*proxyproviderv1.ProxyProvider, error) + List(ctx context.Context, opts metav1.ListOptions) (*proxyproviderv1.ProxyProviderList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *proxyproviderv1.ProxyProvider, err error) + Apply(ctx context.Context, proxyProvider *applyconfigurationproxyproviderv1.ProxyProviderApplyConfiguration, opts metav1.ApplyOptions) (result *proxyproviderv1.ProxyProvider, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, proxyProvider *applyconfigurationproxyproviderv1.ProxyProviderApplyConfiguration, opts metav1.ApplyOptions) (result *proxyproviderv1.ProxyProvider, err error) + ProxyProviderExpansion +} + +// proxyProviders implements ProxyProviderInterface +type proxyProviders struct { + *gentype.ClientWithListAndApply[*proxyproviderv1.ProxyProvider, *proxyproviderv1.ProxyProviderList, *applyconfigurationproxyproviderv1.ProxyProviderApplyConfiguration] +} + +// newProxyProviders returns a ProxyProviders +func newProxyProviders(c *ProxyproviderV1Client, namespace string) *proxyProviders { + return &proxyProviders{ + gentype.NewClientWithListAndApply[*proxyproviderv1.ProxyProvider, *proxyproviderv1.ProxyProviderList, *applyconfigurationproxyproviderv1.ProxyProviderApplyConfiguration]( + "proxyproviders", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *proxyproviderv1.ProxyProvider { return &proxyproviderv1.ProxyProvider{} }, + func() *proxyproviderv1.ProxyProviderList { return &proxyproviderv1.ProxyProviderList{} }, + ), + } +} diff --git a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/samplecontroller_client.go b/pkg/generated/clientset/versioned/typed/proxyprovider/v1/proxyprovider_client.go similarity index 59% rename from pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/samplecontroller_client.go rename to pkg/generated/clientset/versioned/typed/proxyprovider/v1/proxyprovider_client.go index a3e621d..0cf67b5 100644 --- a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/samplecontroller_client.go +++ b/pkg/generated/clientset/versioned/typed/proxyprovider/v1/proxyprovider_client.go @@ -16,34 +16,34 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha1 +package v1 import ( http "net/http" - samplecontrollerv1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1" + proxyproviderv1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1" scheme "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/scheme" rest "k8s.io/client-go/rest" ) -type SamplecontrollerV1alpha1Interface interface { +type ProxyproviderV1Interface interface { RESTClient() rest.Interface - FoosGetter + ProxyProvidersGetter } -// SamplecontrollerV1alpha1Client is used to interact with features provided by the samplecontroller.k8s.io group. -type SamplecontrollerV1alpha1Client struct { +// ProxyproviderV1Client is used to interact with features provided by the proxyprovider.t000-n.de group. +type ProxyproviderV1Client struct { restClient rest.Interface } -func (c *SamplecontrollerV1alpha1Client) Foos(namespace string) FooInterface { - return newFoos(c, namespace) +func (c *ProxyproviderV1Client) ProxyProviders(namespace string) ProxyProviderInterface { + return newProxyProviders(c, namespace) } -// NewForConfig creates a new SamplecontrollerV1alpha1Client for the given config. +// NewForConfig creates a new ProxyproviderV1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*SamplecontrollerV1alpha1Client, error) { +func NewForConfig(c *rest.Config) (*ProxyproviderV1Client, error) { config := *c setConfigDefaults(&config) httpClient, err := rest.HTTPClientFor(&config) @@ -53,21 +53,21 @@ func NewForConfig(c *rest.Config) (*SamplecontrollerV1alpha1Client, error) { return NewForConfigAndClient(&config, httpClient) } -// NewForConfigAndClient creates a new SamplecontrollerV1alpha1Client for the given config and http client. +// NewForConfigAndClient creates a new ProxyproviderV1Client for the given config and http client. // Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SamplecontrollerV1alpha1Client, error) { +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ProxyproviderV1Client, error) { config := *c setConfigDefaults(&config) client, err := rest.RESTClientForConfigAndClient(&config, h) if err != nil { return nil, err } - return &SamplecontrollerV1alpha1Client{client}, nil + return &ProxyproviderV1Client{client}, nil } -// NewForConfigOrDie creates a new SamplecontrollerV1alpha1Client for the given config and +// NewForConfigOrDie creates a new ProxyproviderV1Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *SamplecontrollerV1alpha1Client { +func NewForConfigOrDie(c *rest.Config) *ProxyproviderV1Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -75,13 +75,13 @@ func NewForConfigOrDie(c *rest.Config) *SamplecontrollerV1alpha1Client { return client } -// New creates a new SamplecontrollerV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *SamplecontrollerV1alpha1Client { - return &SamplecontrollerV1alpha1Client{c} +// New creates a new ProxyproviderV1Client for the given RESTClient. +func New(c rest.Interface) *ProxyproviderV1Client { + return &ProxyproviderV1Client{c} } func setConfigDefaults(config *rest.Config) { - gv := samplecontrollerv1alpha1.SchemeGroupVersion + gv := proxyproviderv1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() @@ -93,7 +93,7 @@ func setConfigDefaults(config *rest.Config) { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *SamplecontrollerV1alpha1Client) RESTClient() rest.Interface { +func (c *ProxyproviderV1Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_foo.go b/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_foo.go deleted file mode 100644 index ef2a943..0000000 --- a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_foo.go +++ /dev/null @@ -1,49 +0,0 @@ -/* -Copyright The Kubernetes 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1" - samplecontrollerv1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/applyconfiguration/samplecontroller/v1alpha1" - typedsamplecontrollerv1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1" - gentype "k8s.io/client-go/gentype" -) - -// fakeFoos implements FooInterface -type fakeFoos struct { - *gentype.FakeClientWithListAndApply[*v1alpha1.Foo, *v1alpha1.FooList, *samplecontrollerv1alpha1.FooApplyConfiguration] - Fake *FakeSamplecontrollerV1alpha1 -} - -func newFakeFoos(fake *FakeSamplecontrollerV1alpha1, namespace string) typedsamplecontrollerv1alpha1.FooInterface { - return &fakeFoos{ - gentype.NewFakeClientWithListAndApply[*v1alpha1.Foo, *v1alpha1.FooList, *samplecontrollerv1alpha1.FooApplyConfiguration]( - fake.Fake, - namespace, - v1alpha1.SchemeGroupVersion.WithResource("foos"), - v1alpha1.SchemeGroupVersion.WithKind("Foo"), - func() *v1alpha1.Foo { return &v1alpha1.Foo{} }, - func() *v1alpha1.FooList { return &v1alpha1.FooList{} }, - func(dst, src *v1alpha1.FooList) { dst.ListMeta = src.ListMeta }, - func(list *v1alpha1.FooList) []*v1alpha1.Foo { return gentype.ToPointerSlice(list.Items) }, - func(list *v1alpha1.FooList, items []*v1alpha1.Foo) { list.Items = gentype.FromPointerSlice(items) }, - ), - fake, - } -} diff --git a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/foo.go b/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/foo.go deleted file mode 100644 index 4abd819..0000000 --- a/pkg/generated/clientset/versioned/typed/samplecontroller/v1alpha1/foo.go +++ /dev/null @@ -1,74 +0,0 @@ -/* -Copyright The Kubernetes 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - context "context" - - samplecontrollerv1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1" - applyconfigurationsamplecontrollerv1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/applyconfiguration/samplecontroller/v1alpha1" - scheme "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - gentype "k8s.io/client-go/gentype" -) - -// FoosGetter has a method to return a FooInterface. -// A group's client should implement this interface. -type FoosGetter interface { - Foos(namespace string) FooInterface -} - -// FooInterface has methods to work with Foo resources. -type FooInterface interface { - Create(ctx context.Context, foo *samplecontrollerv1alpha1.Foo, opts v1.CreateOptions) (*samplecontrollerv1alpha1.Foo, error) - Update(ctx context.Context, foo *samplecontrollerv1alpha1.Foo, opts v1.UpdateOptions) (*samplecontrollerv1alpha1.Foo, error) - // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, foo *samplecontrollerv1alpha1.Foo, opts v1.UpdateOptions) (*samplecontrollerv1alpha1.Foo, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*samplecontrollerv1alpha1.Foo, error) - List(ctx context.Context, opts v1.ListOptions) (*samplecontrollerv1alpha1.FooList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *samplecontrollerv1alpha1.Foo, err error) - Apply(ctx context.Context, foo *applyconfigurationsamplecontrollerv1alpha1.FooApplyConfiguration, opts v1.ApplyOptions) (result *samplecontrollerv1alpha1.Foo, err error) - // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). - ApplyStatus(ctx context.Context, foo *applyconfigurationsamplecontrollerv1alpha1.FooApplyConfiguration, opts v1.ApplyOptions) (result *samplecontrollerv1alpha1.Foo, err error) - FooExpansion -} - -// foos implements FooInterface -type foos struct { - *gentype.ClientWithListAndApply[*samplecontrollerv1alpha1.Foo, *samplecontrollerv1alpha1.FooList, *applyconfigurationsamplecontrollerv1alpha1.FooApplyConfiguration] -} - -// newFoos returns a Foos -func newFoos(c *SamplecontrollerV1alpha1Client, namespace string) *foos { - return &foos{ - gentype.NewClientWithListAndApply[*samplecontrollerv1alpha1.Foo, *samplecontrollerv1alpha1.FooList, *applyconfigurationsamplecontrollerv1alpha1.FooApplyConfiguration]( - "foos", - c.RESTClient(), - scheme.ParameterCodec, - namespace, - func() *samplecontrollerv1alpha1.Foo { return &samplecontrollerv1alpha1.Foo{} }, - func() *samplecontrollerv1alpha1.FooList { return &samplecontrollerv1alpha1.FooList{} }, - ), - } -} diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go index 6b1a26a..2268ae3 100644 --- a/pkg/generated/informers/externalversions/factory.go +++ b/pkg/generated/informers/externalversions/factory.go @@ -26,7 +26,7 @@ import ( versioned "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned" internalinterfaces "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/internalinterfaces" - samplecontroller "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/samplecontroller" + proxyprovider "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/proxyprovider" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -325,9 +325,9 @@ type SharedInformerFactory interface { // client. InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer - Samplecontroller() samplecontroller.Interface + Proxyprovider() proxyprovider.Interface } -func (f *sharedInformerFactory) Samplecontroller() samplecontroller.Interface { - return samplecontroller.New(f, f.namespace, f.tweakListOptions) +func (f *sharedInformerFactory) Proxyprovider() proxyprovider.Interface { + return proxyprovider.New(f, f.namespace, f.tweakListOptions) } diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index a8563be..d855ee4 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -21,7 +21,7 @@ package externalversions import ( fmt "fmt" - v1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1" + v1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -52,9 +52,9 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=samplecontroller.k8s.io, Version=v1alpha1 - case v1alpha1.SchemeGroupVersion.WithResource("foos"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Samplecontroller().V1alpha1().Foos().Informer()}, nil + // Group=proxyprovider.t000-n.de, Version=v1 + case v1.SchemeGroupVersion.WithResource("proxyproviders"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Proxyprovider().V1().ProxyProviders().Informer()}, nil } diff --git a/pkg/generated/informers/externalversions/samplecontroller/interface.go b/pkg/generated/informers/externalversions/proxyprovider/interface.go similarity index 75% rename from pkg/generated/informers/externalversions/samplecontroller/interface.go rename to pkg/generated/informers/externalversions/proxyprovider/interface.go index acd7c61..e91d464 100644 --- a/pkg/generated/informers/externalversions/samplecontroller/interface.go +++ b/pkg/generated/informers/externalversions/proxyprovider/interface.go @@ -16,17 +16,17 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package samplecontroller +package proxyprovider import ( internalinterfaces "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/internalinterfaces" - v1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/samplecontroller/v1alpha1" + v1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/proxyprovider/v1" ) // Interface provides access to each of this group's versions. type Interface interface { - // V1alpha1 provides access to shared informers for resources in V1alpha1. - V1alpha1() v1alpha1.Interface + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface } type group struct { @@ -40,7 +40,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// V1alpha1 returns a new v1alpha1.Interface. -func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) } diff --git a/pkg/generated/informers/externalversions/samplecontroller/v1alpha1/interface.go b/pkg/generated/informers/externalversions/proxyprovider/v1/interface.go similarity index 79% rename from pkg/generated/informers/externalversions/samplecontroller/v1alpha1/interface.go rename to pkg/generated/informers/externalversions/proxyprovider/v1/interface.go index 7fe2077..556060f 100644 --- a/pkg/generated/informers/externalversions/samplecontroller/v1alpha1/interface.go +++ b/pkg/generated/informers/externalversions/proxyprovider/v1/interface.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1alpha1 +package v1 import ( internalinterfaces "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/internalinterfaces" @@ -24,8 +24,8 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { - // Foos returns a FooInformer. - Foos() FooInformer + // ProxyProviders returns a ProxyProviderInformer. + ProxyProviders() ProxyProviderInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// Foos returns a FooInformer. -func (v *version) Foos() FooInformer { - return &fooInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +// ProxyProviders returns a ProxyProviderInformer. +func (v *version) ProxyProviders() ProxyProviderInformer { + return &proxyProviderInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/pkg/generated/informers/externalversions/proxyprovider/v1/proxyprovider.go b/pkg/generated/informers/externalversions/proxyprovider/v1/proxyprovider.go new file mode 100644 index 0000000..dd8ab33 --- /dev/null +++ b/pkg/generated/informers/externalversions/proxyprovider/v1/proxyprovider.go @@ -0,0 +1,116 @@ +/* +Copyright The Kubernetes 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + time "time" + + apisproxyproviderv1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1" + versioned "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned" + internalinterfaces "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/internalinterfaces" + proxyproviderv1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/listers/proxyprovider/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ProxyProviderInformer provides access to a shared informer and lister for +// ProxyProviders. +type ProxyProviderInformer interface { + Informer() cache.SharedIndexInformer + Lister() proxyproviderv1.ProxyProviderLister +} + +type proxyProviderInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewProxyProviderInformer constructs a new informer for ProxyProvider type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewProxyProviderInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewProxyProviderInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewFilteredProxyProviderInformer constructs a new informer for ProxyProvider type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredProxyProviderInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewProxyProviderInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewProxyProviderInformerWithOptions constructs a new informer for ProxyProvider type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewProxyProviderInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "proxyprovider.t000-n.de", Version: "v1", Resource: "proxyproviders"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ProxyproviderV1().ProxyProviders(namespace).List(context.Background(), opts) + }, + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ProxyproviderV1().ProxyProviders(namespace).Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ProxyproviderV1().ProxyProviders(namespace).List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ProxyproviderV1().ProxyProviders(namespace).Watch(ctx, opts) + }, + }, client), + &apisproxyproviderv1.ProxyProvider{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + ) +} + +func (f *proxyProviderInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewProxyProviderInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *proxyProviderInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apisproxyproviderv1.ProxyProvider{}, f.defaultInformer) +} + +func (f *proxyProviderInformer) Lister() proxyproviderv1.ProxyProviderLister { + return proxyproviderv1.NewProxyProviderLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/samplecontroller/v1alpha1/foo.go b/pkg/generated/informers/externalversions/samplecontroller/v1alpha1/foo.go deleted file mode 100644 index cb7fa39..0000000 --- a/pkg/generated/informers/externalversions/samplecontroller/v1alpha1/foo.go +++ /dev/null @@ -1,116 +0,0 @@ -/* -Copyright The Kubernetes 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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - context "context" - time "time" - - apissamplecontrollerv1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1" - versioned "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned" - internalinterfaces "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/internalinterfaces" - samplecontrollerv1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/listers/samplecontroller/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// FooInformer provides access to a shared informer and lister for -// Foos. -type FooInformer interface { - Informer() cache.SharedIndexInformer - Lister() samplecontrollerv1alpha1.FooLister -} - -type fooInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewFooInformer constructs a new informer for Foo type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFooInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFooInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) -} - -// NewFilteredFooInformer constructs a new informer for Foo type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredFooInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewFooInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) -} - -// NewFooInformerWithOptions constructs a new informer for Foo type with additional options. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFooInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { - gvr := schema.GroupVersionResource{Group: "samplecontroller.k8s.io", Version: "v1alpha1", Resource: "foos"} - identifier := options.InformerName.WithResource(gvr) - tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( - cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&opts) - } - return client.SamplecontrollerV1alpha1().Foos(namespace).List(context.Background(), opts) - }, - WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&opts) - } - return client.SamplecontrollerV1alpha1().Foos(namespace).Watch(context.Background(), opts) - }, - ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&opts) - } - return client.SamplecontrollerV1alpha1().Foos(namespace).List(ctx, opts) - }, - WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&opts) - } - return client.SamplecontrollerV1alpha1().Foos(namespace).Watch(ctx, opts) - }, - }, client), - &apissamplecontrollerv1alpha1.Foo{}, - cache.SharedIndexInformerOptions{ - ResyncPeriod: options.ResyncPeriod, - Indexers: options.Indexers, - Identifier: identifier, - }, - ) -} - -func (f *fooInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFooInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) -} - -func (f *fooInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apissamplecontrollerv1alpha1.Foo{}, f.defaultInformer) -} - -func (f *fooInformer) Lister() samplecontrollerv1alpha1.FooLister { - return samplecontrollerv1alpha1.NewFooLister(f.Informer().GetIndexer()) -} diff --git a/pkg/generated/listers/samplecontroller/v1alpha1/expansion_generated.go b/pkg/generated/listers/proxyprovider/v1/expansion_generated.go similarity index 66% rename from pkg/generated/listers/samplecontroller/v1alpha1/expansion_generated.go rename to pkg/generated/listers/proxyprovider/v1/expansion_generated.go index 9a34636..06a3fac 100644 --- a/pkg/generated/listers/samplecontroller/v1alpha1/expansion_generated.go +++ b/pkg/generated/listers/proxyprovider/v1/expansion_generated.go @@ -16,12 +16,12 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1alpha1 +package v1 -// FooListerExpansion allows custom methods to be added to -// FooLister. -type FooListerExpansion interface{} +// ProxyProviderListerExpansion allows custom methods to be added to +// ProxyProviderLister. +type ProxyProviderListerExpansion interface{} -// FooNamespaceListerExpansion allows custom methods to be added to -// FooNamespaceLister. -type FooNamespaceListerExpansion interface{} +// ProxyProviderNamespaceListerExpansion allows custom methods to be added to +// ProxyProviderNamespaceLister. +type ProxyProviderNamespaceListerExpansion interface{} diff --git a/pkg/generated/listers/proxyprovider/v1/proxyprovider.go b/pkg/generated/listers/proxyprovider/v1/proxyprovider.go new file mode 100644 index 0000000..64d319b --- /dev/null +++ b/pkg/generated/listers/proxyprovider/v1/proxyprovider.go @@ -0,0 +1,70 @@ +/* +Copyright The Kubernetes 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + proxyproviderv1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// ProxyProviderLister helps list ProxyProviders. +// All objects returned here must be treated as read-only. +type ProxyProviderLister interface { + // List lists all ProxyProviders in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*proxyproviderv1.ProxyProvider, err error) + // ProxyProviders returns an object that can list and get ProxyProviders. + ProxyProviders(namespace string) ProxyProviderNamespaceLister + ProxyProviderListerExpansion +} + +// proxyProviderLister implements the ProxyProviderLister interface. +type proxyProviderLister struct { + listers.ResourceIndexer[*proxyproviderv1.ProxyProvider] +} + +// NewProxyProviderLister returns a new ProxyProviderLister. +func NewProxyProviderLister(indexer cache.Indexer) ProxyProviderLister { + return &proxyProviderLister{listers.New[*proxyproviderv1.ProxyProvider](indexer, proxyproviderv1.Resource("proxyprovider"))} +} + +// ProxyProviders returns an object that can list and get ProxyProviders. +func (s *proxyProviderLister) ProxyProviders(namespace string) ProxyProviderNamespaceLister { + return proxyProviderNamespaceLister{listers.NewNamespaced[*proxyproviderv1.ProxyProvider](s.ResourceIndexer, namespace)} +} + +// ProxyProviderNamespaceLister helps list and get ProxyProviders. +// All objects returned here must be treated as read-only. +type ProxyProviderNamespaceLister interface { + // List lists all ProxyProviders in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*proxyproviderv1.ProxyProvider, err error) + // Get retrieves the ProxyProvider from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*proxyproviderv1.ProxyProvider, error) + ProxyProviderNamespaceListerExpansion +} + +// proxyProviderNamespaceLister implements the ProxyProviderNamespaceLister +// interface. +type proxyProviderNamespaceLister struct { + listers.ResourceIndexer[*proxyproviderv1.ProxyProvider] +} diff --git a/pkg/generated/listers/samplecontroller/v1alpha1/foo.go b/pkg/generated/listers/samplecontroller/v1alpha1/foo.go deleted file mode 100644 index b854564..0000000 --- a/pkg/generated/listers/samplecontroller/v1alpha1/foo.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright The Kubernetes 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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - samplecontrollerv1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1" - labels "k8s.io/apimachinery/pkg/labels" - listers "k8s.io/client-go/listers" - cache "k8s.io/client-go/tools/cache" -) - -// FooLister helps list Foos. -// All objects returned here must be treated as read-only. -type FooLister interface { - // List lists all Foos in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*samplecontrollerv1alpha1.Foo, err error) - // Foos returns an object that can list and get Foos. - Foos(namespace string) FooNamespaceLister - FooListerExpansion -} - -// fooLister implements the FooLister interface. -type fooLister struct { - listers.ResourceIndexer[*samplecontrollerv1alpha1.Foo] -} - -// NewFooLister returns a new FooLister. -func NewFooLister(indexer cache.Indexer) FooLister { - return &fooLister{listers.New[*samplecontrollerv1alpha1.Foo](indexer, samplecontrollerv1alpha1.Resource("foo"))} -} - -// Foos returns an object that can list and get Foos. -func (s *fooLister) Foos(namespace string) FooNamespaceLister { - return fooNamespaceLister{listers.NewNamespaced[*samplecontrollerv1alpha1.Foo](s.ResourceIndexer, namespace)} -} - -// FooNamespaceLister helps list and get Foos. -// All objects returned here must be treated as read-only. -type FooNamespaceLister interface { - // List lists all Foos in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*samplecontrollerv1alpha1.Foo, err error) - // Get retrieves the Foo from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*samplecontrollerv1alpha1.Foo, error) - FooNamespaceListerExpansion -} - -// fooNamespaceLister implements the FooNamespaceLister -// interface. -type fooNamespaceLister struct { - listers.ResourceIndexer[*samplecontrollerv1alpha1.Foo] -} diff --git a/pkg/generated/openapi/cmd/models-schema/main.go b/pkg/generated/openapi/cmd/models-schema/main.go deleted file mode 100644 index f3e6b6e..0000000 --- a/pkg/generated/openapi/cmd/models-schema/main.go +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright 2021 The Kubernetes 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 main - -import ( - "encoding/json" - "fmt" - "os" - - "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/openapi" - "k8s.io/kube-openapi/pkg/common" - "k8s.io/kube-openapi/pkg/validation/spec" -) - -// Outputs openAPI schema JSON containing the schema definitions in zz_generated.openapi.go. -func main() { - err := output() - if err != nil { - fmt.Fprintf(os.Stderr, "Failed: %v", err) // nolint:errcheck - os.Exit(1) - } -} - -func output() error { - refFunc := func(name string) spec.Ref { - return spec.MustCreateRef(fmt.Sprintf("#/definitions/%s", name)) - } - defs := openapi.GetOpenAPIDefinitions(refFunc) - schemaDefs := make(map[string]spec.Schema, len(defs)) - for k, v := range defs { - // Replace top-level schema with v2 if a v2 schema is embedded - // so that the output of this program is always in OpenAPI v2. - // This is done by looking up an extension that marks the embedded v2 - // schema, and, if the v2 schema is found, make it the resulting schema for - // the type. - if schema, ok := v.Schema.Extensions[common.ExtensionV2Schema]; ok { - if v2Schema, isOpenAPISchema := schema.(spec.Schema); isOpenAPISchema { - schemaDefs[k] = v2Schema - continue - } - } - - schemaDefs[k] = v.Schema - } - data, err := json.Marshal(&spec.Swagger{ - SwaggerProps: spec.SwaggerProps{ - Definitions: schemaDefs, - Info: &spec.Info{ - InfoProps: spec.InfoProps{ - Title: "Kubernetes", - Version: "unversioned", - }, - }, - Swagger: "2.0", - }, - }) - if err != nil { - return fmt.Errorf("error serializing api definitions: %w", err) - } - os.Stdout.Write(data) // nolint:errcheck - return nil -} diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index d825901..b245522 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -32,6 +32,10 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ + "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1.ProxyProvider": schema_pkg_apis_proxyprovider_v1_ProxyProvider(ref), + "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1.ProxyProviderList": schema_pkg_apis_proxyprovider_v1_ProxyProviderList(ref), + "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1.ProxyProviderSpec": schema_pkg_apis_proxyprovider_v1_ProxyProviderSpec(ref), + "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1.ProxyProviderStatus": schema_pkg_apis_proxyprovider_v1_ProxyProviderStatus(ref), resource.Quantity{}.OpenAPIModelName(): schema_apimachinery_pkg_api_resource_Quantity(ref), v1.APIGroup{}.OpenAPIModelName(): schema_pkg_apis_meta_v1_APIGroup(ref), v1.APIGroupList{}.OpenAPIModelName(): schema_pkg_apis_meta_v1_APIGroupList(ref), @@ -87,10 +91,161 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA runtime.TypeMeta{}.OpenAPIModelName(): schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref), runtime.Unknown{}.OpenAPIModelName(): schema_k8sio_apimachinery_pkg_runtime_Unknown(ref), version.Info{}.OpenAPIModelName(): schema_k8sio_apimachinery_pkg_version_Info(ref), - "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1.Foo": schema_pkg_apis_samplecontroller_v1alpha1_Foo(ref), - "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1.FooList": schema_pkg_apis_samplecontroller_v1alpha1_FooList(ref), - "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1.FooSpec": schema_pkg_apis_samplecontroller_v1alpha1_FooSpec(ref), - "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1.FooStatus": schema_pkg_apis_samplecontroller_v1alpha1_FooStatus(ref), + } +} + +func schema_pkg_apis_proxyprovider_v1_ProxyProvider(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref(v1.ObjectMeta{}.OpenAPIModelName()), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1.ProxyProviderSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1.ProxyProviderStatus"), + }, + }, + }, + Required: []string{"spec", "status"}, + }, + }, + Dependencies: []string{ + "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1.ProxyProviderSpec", "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1.ProxyProviderStatus", v1.ObjectMeta{}.OpenAPIModelName()}, + } +} + +func schema_pkg_apis_proxyprovider_v1_ProxyProviderList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref(v1.ListMeta{}.OpenAPIModelName()), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1.ProxyProvider"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1.ProxyProvider", v1.ListMeta{}.OpenAPIModelName()}, + } +} + +func schema_pkg_apis_proxyprovider_v1_ProxyProviderSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "authorization_flow": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "invalidation_flow": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "external_host": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "authorization_flow", "invalidation_flow", "external_host"}, + }, + }, + } +} + +func schema_pkg_apis_proxyprovider_v1_ProxyProviderStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "pk": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"pk"}, + }, + }, } } @@ -183,8 +338,7 @@ func schema_pkg_apis_meta_v1_APIGroup(ref common.ReferenceCallback) common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(v1.GroupVersionForDiscovery{}.OpenAPIModelName()), + Ref: ref(v1.GroupVersionForDiscovery{}.OpenAPIModelName()), }, }, }, @@ -209,8 +363,7 @@ func schema_pkg_apis_meta_v1_APIGroup(ref common.ReferenceCallback) common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(v1.ServerAddressByClientCIDR{}.OpenAPIModelName()), + Ref: ref(v1.ServerAddressByClientCIDR{}.OpenAPIModelName()), }, }, }, @@ -258,8 +411,7 @@ func schema_pkg_apis_meta_v1_APIGroupList(ref common.ReferenceCallback) common.O Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(v1.APIGroup{}.OpenAPIModelName()), + Ref: ref(v1.APIGroup{}.OpenAPIModelName()), }, }, }, @@ -334,9 +486,8 @@ func schema_pkg_apis_meta_v1_APIResource(ref common.ReferenceCallback) common.Op Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -354,9 +505,8 @@ func schema_pkg_apis_meta_v1_APIResource(ref common.ReferenceCallback) common.Op Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -374,9 +524,8 @@ func schema_pkg_apis_meta_v1_APIResource(ref common.ReferenceCallback) common.Op Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -437,8 +586,7 @@ func schema_pkg_apis_meta_v1_APIResourceList(ref common.ReferenceCallback) commo Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(v1.APIResource{}.OpenAPIModelName()), + Ref: ref(v1.APIResource{}.OpenAPIModelName()), }, }, }, @@ -486,9 +634,8 @@ func schema_pkg_apis_meta_v1_APIVersions(ref common.ReferenceCallback) common.Op Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -506,8 +653,7 @@ func schema_pkg_apis_meta_v1_APIVersions(ref common.ReferenceCallback) common.Op Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(v1.ServerAddressByClientCIDR{}.OpenAPIModelName()), + Ref: ref(v1.ServerAddressByClientCIDR{}.OpenAPIModelName()), }, }, }, @@ -555,9 +701,8 @@ func schema_pkg_apis_meta_v1_ApplyOptions(ref common.ReferenceCallback) common.O Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -680,9 +825,8 @@ func schema_pkg_apis_meta_v1_CreateOptions(ref common.ReferenceCallback) common. Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -768,9 +912,8 @@ func schema_pkg_apis_meta_v1_DeleteOptions(ref common.ReferenceCallback) common. Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -838,9 +981,8 @@ func schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref common.ReferenceCallba Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -1123,9 +1265,8 @@ func schema_pkg_apis_meta_v1_LabelSelector(ref common.ReferenceCallback) common. Allows: true, Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -1143,8 +1284,7 @@ func schema_pkg_apis_meta_v1_LabelSelector(ref common.ReferenceCallback) common. Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(v1.LabelSelectorRequirement{}.OpenAPIModelName()), + Ref: ref(v1.LabelSelectorRequirement{}.OpenAPIModelName()), }, }, }, @@ -1198,9 +1338,8 @@ func schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref common.ReferenceCallba Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -1573,9 +1712,8 @@ func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.Ope Allows: true, Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -1589,9 +1727,8 @@ func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.Ope Allows: true, Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -1614,8 +1751,7 @@ func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.Ope Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(v1.OwnerReference{}.OpenAPIModelName()), + Ref: ref(v1.OwnerReference{}.OpenAPIModelName()), }, }, }, @@ -1634,9 +1770,8 @@ func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.Ope Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -1654,8 +1789,7 @@ func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.Ope Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(v1.ManagedFieldsEntry{}.OpenAPIModelName()), + Ref: ref(v1.ManagedFieldsEntry{}.OpenAPIModelName()), }, }, }, @@ -1805,8 +1939,7 @@ func schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref common.ReferenceCallb Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(v1.PartialObjectMetadata{}.OpenAPIModelName()), + Ref: ref(v1.PartialObjectMetadata{}.OpenAPIModelName()), }, }, }, @@ -1865,9 +1998,8 @@ func schema_pkg_apis_meta_v1_PatchOptions(ref common.ReferenceCallback) common.O Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -1946,9 +2078,8 @@ func schema_pkg_apis_meta_v1_RootPaths(ref common.ReferenceCallback) common.Open Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -2164,8 +2295,7 @@ func schema_pkg_apis_meta_v1_StatusDetails(ref common.ReferenceCallback) common. Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(v1.StatusCause{}.OpenAPIModelName()), + Ref: ref(v1.StatusCause{}.OpenAPIModelName()), }, }, }, @@ -2226,8 +2356,7 @@ func schema_pkg_apis_meta_v1_Table(ref common.ReferenceCallback) common.OpenAPID Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(v1.TableColumnDefinition{}.OpenAPIModelName()), + Ref: ref(v1.TableColumnDefinition{}.OpenAPIModelName()), }, }, }, @@ -2245,8 +2374,7 @@ func schema_pkg_apis_meta_v1_Table(ref common.ReferenceCallback) common.OpenAPID Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(v1.TableRow{}.OpenAPIModelName()), + Ref: ref(v1.TableRow{}.OpenAPIModelName()), }, }, }, @@ -2387,8 +2515,7 @@ func schema_pkg_apis_meta_v1_TableRow(ref common.ReferenceCallback) common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(v1.TableRowCondition{}.OpenAPIModelName()), + Ref: ref(v1.TableRowCondition{}.OpenAPIModelName()), }, }, }, @@ -2555,9 +2682,8 @@ func schema_pkg_apis_meta_v1_UpdateOptions(ref common.ReferenceCallback) common. Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -2616,7 +2742,7 @@ func schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref common.ReferenceCall return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "RawExtension is used to hold extensions in external versions.\n\nTo use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.\n\n// Internal package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\",inline\"`\n\t\tMyPlugin runtime.Object `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// External package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\",inline\"`\n\t\tMyPlugin runtime.RawExtension `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// On the wire, the JSON will look something like this:\n\n\t{\n\t\t\"kind\":\"MyAPIObject\",\n\t\t\"apiVersion\":\"v1\",\n\t\t\"myPlugin\": {\n\t\t\t\"kind\":\"PluginA\",\n\t\t\t\"aOption\":\"foo\",\n\t\t},\n\t}\n\nSo what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)", + Description: "RawExtension is used to hold extensions in external versions.\n\nTo use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.\n\n// Internal package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\"\"`\n\t\tMyPlugin runtime.Object `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// External package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\"\"`\n\t\tMyPlugin runtime.RawExtension `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// On the wire, the JSON will look something like this:\n\n\t{\n\t\t\"kind\":\"MyAPIObject\",\n\t\t\"apiVersion\":\"v1\",\n\t\t\"myPlugin\": {\n\t\t\t\"kind\":\"PluginA\",\n\t\t\t\"aOption\":\"foo\",\n\t\t},\n\t}\n\nSo what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)", Type: []string{"object"}, }, }, @@ -2627,7 +2753,7 @@ func schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref common.ReferenceCallback return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "TypeMeta is shared by all top level objects. The proper way to use it is to inline it in your type, like this:\n\n\ttype MyAwesomeAPIObject struct {\n\t runtime.TypeMeta `json:\",inline\"`\n\t ... // other fields\n\t}\n\nfunc (obj *MyAwesomeAPIObject) SetGroupVersionKind(gvk *metav1.GroupVersionKind) { metav1.UpdateTypeMeta(obj,gvk) }; GroupVersionKind() *GroupVersionKind\n\nTypeMeta is provided here for convenience. You may use it directly from this package or define your own with the same fields.", + Description: "TypeMeta is shared by all top level objects. The proper way to use it is to inline it in your type, like this:\n\n\ttype MyAwesomeAPIObject struct {\n\t runtime.TypeMeta `json:\"\"`\n\t ... // other fields\n\t}\n\nfunc (obj *MyAwesomeAPIObject) SetGroupVersionKind(gvk *metav1.GroupVersionKind) { metav1.UpdateTypeMeta(obj,gvk) }; GroupVersionKind() *GroupVersionKind\n\nTypeMeta is provided here for convenience. You may use it directly from this package or define your own with the same fields.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "apiVersion": { @@ -2796,148 +2922,3 @@ func schema_k8sio_apimachinery_pkg_version_Info(ref common.ReferenceCallback) co }, } } - -func schema_pkg_apis_samplecontroller_v1alpha1_Foo(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Foo is a specification for a Foo resource", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(v1.ObjectMeta{}.OpenAPIModelName()), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1.FooSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1.FooStatus"), - }, - }, - }, - Required: []string{"spec", "status"}, - }, - }, - Dependencies: []string{ - v1.ObjectMeta{}.OpenAPIModelName(), "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1.FooSpec", "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1.FooStatus"}, - } -} - -func schema_pkg_apis_samplecontroller_v1alpha1_FooList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "FooList is a list of Foo resources", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(v1.ListMeta{}.OpenAPIModelName()), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1.Foo"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - v1.ListMeta{}.OpenAPIModelName(), "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/samplecontroller/v1alpha1.Foo"}, - } -} - -func schema_pkg_apis_samplecontroller_v1alpha1_FooSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "FooSpec is the spec for a Foo resource", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "deploymentName": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "replicas": { - SchemaProps: spec.SchemaProps{ - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - Required: []string{"deploymentName", "replicas"}, - }, - }, - } -} - -func schema_pkg_apis_samplecontroller_v1alpha1_FooStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "FooStatus is the status for a Foo resource", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "availableReplicas": { - SchemaProps: spec.SchemaProps{ - Default: 0, - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - Required: []string{"availableReplicas"}, - }, - }, - } -} diff --git a/pkg/signals/signal_windows.go b/pkg/signals/signal_windows.go deleted file mode 100644 index 4907d57..0000000 --- a/pkg/signals/signal_windows.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2017 The Kubernetes 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 signals - -import ( - "os" -) - -var shutdownSignals = []os.Signal{os.Interrupt} diff --git a/scripts/codegen.sh b/scripts/codegen.sh new file mode 100755 index 0000000..cca51c7 --- /dev/null +++ b/scripts/codegen.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# Run Kubernetes code generators for pkg/apis using vendored kube_codegen.sh. + +set -euo pipefail + +# kube_codegen runs nested `go install` from the code-generator submodule. For this +# repo we force: +# -buildvcs=false — avoid git stamping failures (submodules, safe.directory) +# -mod=mod — do not use the repo root vendor/ (often stale vs go.mod +# or unrelated to generator tools); fetch modules instead. +export GOFLAGS="-buildvcs=false -mod=mod" + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)" +REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd -P)" + +MODULE="gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator" +KUBE_CODEGEN="${REPO_ROOT}/code-generator/kube_codegen.sh" +BOILERPLATE="${REPO_ROOT}/code-generator/examples/hack/boilerplate.go.txt" +API_ROOT="${REPO_ROOT}/pkg/apis" +GEN_ROOT="${REPO_ROOT}/pkg/generated" + +source "${KUBE_CODEGEN}" + +kube::codegen::gen_helpers --boilerplate "${BOILERPLATE}" "${API_ROOT}" +kube::codegen::gen_register --boilerplate "${BOILERPLATE}" "${API_ROOT}" + +# OpenAPI rule diff: keep a checked-in baseline (see k8s.io/code-generator examples/hack/update-codegen.sh). +API_VIOLATIONS_DIR="${REPO_ROOT}/hack/api-violations" +VIOLATIONS_LIST="${API_VIOLATIONS_DIR}/codegen_violation_exceptions.list" +mkdir -p "${API_VIOLATIONS_DIR}" +openapi_report_args=(--report-filename "${VIOLATIONS_LIST}") +if [[ ! -s "${VIOLATIONS_LIST}" ]] || [[ "${UPDATE_API_KNOWN_VIOLATIONS:-}" == "true" ]]; then + openapi_report_args+=(--update-report) +fi + +kube::codegen::gen_openapi \ + --output-dir "${GEN_ROOT}/openapi" \ + --output-pkg "${MODULE}/pkg/generated/openapi" \ + --output-model-name-file zz_generated.model_name.go \ + --boilerplate "${BOILERPLATE}" \ + "${openapi_report_args[@]}" \ + "${API_ROOT}" + +kube::codegen::gen_client \ + --with-watch \ + --with-applyconfig \ + --output-dir "${GEN_ROOT}" \ + --output-pkg "${MODULE}/pkg/generated" \ + --boilerplate "${BOILERPLATE}" \ + "${API_ROOT}"