diff --git a/api/v2beta1/atom_types.go b/api/v2beta1/atom_types.go index f8e9950..7997842 100644 --- a/api/v2beta1/atom_types.go +++ b/api/v2beta1/atom_types.go @@ -59,7 +59,7 @@ type AtomStatus struct { } // +kubebuilder:object:root=true -// +kubebuilder:subresource:status +// +kubebuilder:skipversion // versionName=v2beta1 // Atom is the Schema for the atoms API. diff --git a/cmd/main.go b/cmd/main.go index cc110fe..f1919f5 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -43,10 +43,8 @@ import ( metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" "sigs.k8s.io/controller-runtime/pkg/webhook" - pdoknlv2beta1 "github.com/pdok/atom-operator/api/v2beta1" pdoknlv3 "github.com/pdok/atom-operator/api/v3" "github.com/pdok/atom-operator/internal/controller" - webhookpdoknlv2beta1 "github.com/pdok/atom-operator/internal/webhook/v2beta1" webhookpdoknlv3 "github.com/pdok/atom-operator/internal/webhook/v3" // +kubebuilder:scaffold:imports ) @@ -65,7 +63,6 @@ func init() { utilruntime.Must(clientgoscheme.AddToScheme(scheme)) utilruntime.Must(pdoknlv3.AddToScheme(scheme)) - utilruntime.Must(pdoknlv2beta1.AddToScheme(scheme)) utilruntime.Must(traefikiov1alpha1.AddToScheme(scheme)) utilruntime.Must(smoothoperatorv1.AddToScheme(scheme)) @@ -198,10 +195,6 @@ func main() { } if os.Getenv("ENABLE_WEBHOOKS") != "false" { - if err = webhookpdoknlv2beta1.SetupAtomWebhookWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "Atom") - os.Exit(1) - } if err = webhookpdoknlv3.SetupAtomWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "Atom") diff --git a/config/crd/bases/pdok.nl_atoms.yaml b/config/crd/bases/pdok.nl_atoms.yaml index bb139cc..35f9a3e 100644 --- a/config/crd/bases/pdok.nl_atoms.yaml +++ b/config/crd/bases/pdok.nl_atoms.yaml @@ -16,313 +16,6 @@ spec: singular: atom scope: Namespaced versions: - - name: v2beta1 - schema: - openAPIV3Schema: - description: Atom is the Schema for the atoms API. - properties: - apiVersion: - 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 - kind: - 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 - metadata: - type: object - spec: - description: AtomSpec defines the desired state of Atom. - properties: - general: - description: General is the struct with all generic fields for the - crds - properties: - dataVersion: - type: string - dataset: - type: string - datasetOwner: - type: string - serviceVersion: - type: string - theme: - type: string - required: - - dataset - - datasetOwner - type: object - kubernetes: - description: Kubernetes is the struct with all fields that can be - defined in kubernetes fields in the crds - properties: - autoscaling: - description: Autoscaling is the struct with all fields to configure - autoscalers for the crs - properties: - averageCpuUtilization: - type: integer - maxReplicas: - type: integer - minReplicas: - type: integer - type: object - healthCheck: - description: HealthCheck is the struct with all fields to configure - healthchecks for the crs - properties: - boundingbox: - type: string - mimetype: - type: string - querystring: - type: string - type: object - lifecycle: - description: Lifecycle is the struct with the fields to configure - lifecycle settings for the resources - properties: - ttlInDays: - type: integer - type: object - resources: - description: ResourceRequirements describes the compute resource - requirements. - properties: - claims: - description: |- - Claims lists the names of resources, defined in spec.resourceClaims, - that are used by this container. - - This is an alpha field and requires enabling the - DynamicResourceAllocation feature gate. - - This field is immutable. It can only be set for containers. - items: - description: ResourceClaim references one entry in PodSpec.ResourceClaims. - properties: - name: - description: |- - Name must match the name of one entry in pod.spec.resourceClaims of - the Pod where this field is used. It makes that resource available - inside a container. - type: string - request: - description: |- - Request is the name chosen for a request in the referenced claim. - If empty, everything from the claim is made available, otherwise - only the result of this request. - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Limits describes the maximum amount of compute resources allowed. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Requests describes the minimum amount of compute resources required. - If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. Requests cannot exceed Limits. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - type: object - type: object - service: - description: AtomService is the struct for all service level fields - properties: - author: - description: Author is the struct with the input for the author - field of an atom - properties: - email: - type: string - name: - type: string - required: - - email - - name - type: object - datasets: - items: - description: Dataset is the struct for all dataset level fields - properties: - bbox: - description: Bbox is the struct for the bounding box extent - of an atom - properties: - maxx: - type: number - maxy: - type: number - minx: - type: number - miny: - type: number - required: - - maxx - - maxy - - minx - - miny - type: object - downloads: - items: - description: Download is the struct for the download level - fields - properties: - content: - type: string - links: - items: - description: Link represents a link in a download - entry - properties: - bbox: - description: Bbox is the struct for the bounding - box extent of an atom - properties: - maxx: - type: number - maxy: - type: number - minx: - type: number - miny: - type: number - required: - - maxx - - maxy - - minx - - miny - type: object - blobKey: - type: string - rel: - type: string - updated: - type: string - version: - type: string - required: - - blobKey - type: object - type: array - name: - type: string - srs: - description: Srs is the struct with the information - for the srs field of an atom - properties: - code: - type: string - uri: - type: string - required: - - code - - uri - type: object - title: - type: string - updated: - type: string - required: - - name - - srs - type: object - type: array - links: - items: - description: OtherLink represents any type of link that - is not a download link related to the data (see Link) - properties: - contentType: - type: string - language: - type: string - type: - type: string - uri: - type: string - required: - - type - - uri - type: object - type: array - metadataIdentifier: - type: string - name: - type: string - sourceIdentifier: - type: string - subtitle: - type: string - title: - type: string - required: - - bbox - - downloads - - metadataIdentifier - - name - - sourceIdentifier - - subtitle - - title - type: object - type: array - metadataIdentifier: - type: string - rights: - type: string - subtitle: - type: string - title: - type: string - updated: - type: string - required: - - author - - datasets - - metadataIdentifier - - rights - - subtitle - - title - type: object - required: - - general - - service - type: object - status: - description: AtomStatus defines the observed state of Atom. - type: object - type: object - served: true - storage: false - subresources: - status: {} - name: v3 schema: openAPIV3Schema: diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 1bb8bd7..2b0415a 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -10,10 +10,10 @@ configMapGenerator: files: - CSP=content-security-policy.txt -patches: +# patches: # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. # patches here are for enabling the conversion webhook for each CRD -- path: patches/webhook_in_atoms.yaml +# - path: patches/webhook_in_atoms.yaml # +kubebuilder:scaffold:crdkustomizewebhookpatch # [WEBHOOK] To enable webhook, uncomment the following section diff --git a/internal/webhook/v2beta1/atom_webhook.go b/internal/webhook/v2beta1/atom_webhook.go deleted file mode 100644 index bdae607..0000000 --- a/internal/webhook/v2beta1/atom_webhook.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -MIT License - -Copyright (c) 2024 Publieke Dienstverlening op de Kaart - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - -package v3 - -import ( - pdoknlv2beta1 "github.com/pdok/atom-operator/api/v2beta1" - ctrl "sigs.k8s.io/controller-runtime" -) - -// SetupAtomWebhookWithManager registers the webhook for Atom in the manager. -func SetupAtomWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr).For(&pdoknlv2beta1.Atom{}). - // Todo add WithValidator / AtomCustomValidator ? - // Todo add WithDefaulter / AtomCustomDefaulter ? - Complete() -} - -// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!