From 7619fe1441cca8d4db6d3b02944af582aa93ef83 Mon Sep 17 00:00:00 2001 From: "naman.gupta" Date: Thu, 21 Mar 2024 15:53:05 +0530 Subject: [PATCH] Adding the custom resource definition for the ric. Adding the custom resource definition for the ric platform. Change-Id: Ia5e22501e730b650ba4e353830d19e2a8bbd7009 Signed-off-by: naman.gupta --- .../bases/ricdeploy.ricplt.com_ricplatforms.yaml | 49 ++++++++++++++++++++++ .../config/crd/kustomization.yaml | 21 ++++++++++ .../config/crd/kustomizeconfig.yaml | 19 +++++++++ .../crd/patches/cainjection_in_ricplatforms.yaml | 7 ++++ .../crd/patches/webhook_in_ricplatforms.yaml | 16 +++++++ 5 files changed, 112 insertions(+) create mode 100644 depRicKubernetesOperator/config/crd/bases/ricdeploy.ricplt.com_ricplatforms.yaml create mode 100644 depRicKubernetesOperator/config/crd/kustomization.yaml create mode 100644 depRicKubernetesOperator/config/crd/kustomizeconfig.yaml create mode 100644 depRicKubernetesOperator/config/crd/patches/cainjection_in_ricplatforms.yaml create mode 100644 depRicKubernetesOperator/config/crd/patches/webhook_in_ricplatforms.yaml diff --git a/depRicKubernetesOperator/config/crd/bases/ricdeploy.ricplt.com_ricplatforms.yaml b/depRicKubernetesOperator/config/crd/bases/ricdeploy.ricplt.com_ricplatforms.yaml new file mode 100644 index 0000000..dc242eb --- /dev/null +++ b/depRicKubernetesOperator/config/crd/bases/ricdeploy.ricplt.com_ricplatforms.yaml @@ -0,0 +1,49 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.12.0 + name: ricplatforms.ricdeploy.ricplt.com +spec: + group: ricdeploy.ricplt.com + names: + kind: RicPlatform + listKind: RicPlatformList + plural: ricplatforms + singular: ricplatform + scope: Namespaced + versions: + - name: v1 + schema: + openAPIV3Schema: + description: RicPlatform is the Schema for the ricplatforms 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: RicPlatformSpec defines the desired state of RicPlatform + properties: + foo: + description: Foo is an example field of RicPlatform. Edit ricplatform_types.go + to remove/update + type: string + type: object + status: + description: RicPlatformStatus defines the observed state of RicPlatform + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/depRicKubernetesOperator/config/crd/kustomization.yaml b/depRicKubernetesOperator/config/crd/kustomization.yaml new file mode 100644 index 0000000..6545b3c --- /dev/null +++ b/depRicKubernetesOperator/config/crd/kustomization.yaml @@ -0,0 +1,21 @@ +# This kustomization.yaml is not intended to be run by itself, +# since it depends on service name and namespace that are out of this kustomize package. +# It should be run by config/default +resources: +- bases/ricdeploy.ricplt.com_ricplatforms.yaml +#+kubebuilder:scaffold:crdkustomizeresource + +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_ricplatforms.yaml +#+kubebuilder:scaffold:crdkustomizewebhookpatch + +# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. +# patches here are for enabling the CA injection for each CRD +#- path: patches/cainjection_in_ricplatforms.yaml +#+kubebuilder:scaffold:crdkustomizecainjectionpatch + +# the following config is for teaching kustomize how to do kustomization for CRDs. +configurations: +- kustomizeconfig.yaml diff --git a/depRicKubernetesOperator/config/crd/kustomizeconfig.yaml b/depRicKubernetesOperator/config/crd/kustomizeconfig.yaml new file mode 100644 index 0000000..ec5c150 --- /dev/null +++ b/depRicKubernetesOperator/config/crd/kustomizeconfig.yaml @@ -0,0 +1,19 @@ +# This file is for teaching kustomize how to substitute name and namespace reference in CRD +nameReference: +- kind: Service + version: v1 + fieldSpecs: + - kind: CustomResourceDefinition + version: v1 + group: apiextensions.k8s.io + path: spec/conversion/webhook/clientConfig/service/name + +namespace: +- kind: CustomResourceDefinition + version: v1 + group: apiextensions.k8s.io + path: spec/conversion/webhook/clientConfig/service/namespace + create: false + +varReference: +- path: metadata/annotations diff --git a/depRicKubernetesOperator/config/crd/patches/cainjection_in_ricplatforms.yaml b/depRicKubernetesOperator/config/crd/patches/cainjection_in_ricplatforms.yaml new file mode 100644 index 0000000..799c6fa --- /dev/null +++ b/depRicKubernetesOperator/config/crd/patches/cainjection_in_ricplatforms.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME + name: ricplatforms.ricdeploy.ricplt.com diff --git a/depRicKubernetesOperator/config/crd/patches/webhook_in_ricplatforms.yaml b/depRicKubernetesOperator/config/crd/patches/webhook_in_ricplatforms.yaml new file mode 100644 index 0000000..5c53c02 --- /dev/null +++ b/depRicKubernetesOperator/config/crd/patches/webhook_in_ricplatforms.yaml @@ -0,0 +1,16 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: ricplatforms.ricdeploy.ricplt.com +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: system + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 -- 2.16.6