From 4d3dce296851df9714df3897eb3c438b8b4279e9 Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Tue, 29 Oct 2019 16:21:45 +0100 Subject: [PATCH] remove validation for kind, apiVersion and metadata --- .../templates/customrresourcedefinition.yaml | 57 ------------ manifests/operatorconfiguration.crd.yaml | 28 ------ manifests/postgresql.crd.yaml | 29 ------ pkg/apis/acid.zalan.do/v1/crds.go | 93 +------------------ 4 files changed, 2 insertions(+), 205 deletions(-) diff --git a/charts/postgres-operator/templates/customrresourcedefinition.yaml b/charts/postgres-operator/templates/customrresourcedefinition.yaml index abbc1b13f..18ce8af3b 100644 --- a/charts/postgres-operator/templates/customrresourcedefinition.yaml +++ b/charts/postgres-operator/templates/customrresourcedefinition.yaml @@ -57,37 +57,8 @@ spec: validation: openAPIV3Schema: required: - - kind - - apiVersion - - metadata - spec properties: - kind: - type: string - enum: - - postgresql - apiVersion: - type: string - enum: - - acid.zalan.do/v1 - metadata: - type: object - required: - - name - properties: - annotations: - type: object - additionalProperties: - type: string - labels: - type: object - additionalProperties: - type: string - name: - type: string - # Note: the cluster name specified here must begin with the team name. - namespace: - type: string spec: type: object required: @@ -405,36 +376,8 @@ spec: validation: openAPIV3Schema: required: - - kind - - apiVersion - - metadata - configuration properties: - kind: - type: string - enum: - - OperatorConfiguration - apiVersion: - type: string - enum: - - acid.zalan.do/v1 - metadata: - type: object - required: - - name - properties: - annotations: - type: object - additionalProperties: - type: string - labels: - type: object - additionalProperties: - type: string - name: - type: string - namespace: - type: string configuration: type: object properties: diff --git a/manifests/operatorconfiguration.crd.yaml b/manifests/operatorconfiguration.crd.yaml index 735787a6d..9f622d1a3 100644 --- a/manifests/operatorconfiguration.crd.yaml +++ b/manifests/operatorconfiguration.crd.yaml @@ -17,36 +17,8 @@ spec: validation: openAPIV3Schema: required: - - kind - - apiVersion - - metadata - configuration properties: - kind: - type: string - enum: - - OperatorConfiguration - apiVersion: - type: string - enum: - - acid.zalan.do/v1 - metadata: - type: object - required: - - name - properties: - annotations: - type: object - additionalProperties: - type: string - labels: - type: object - additionalProperties: - type: string - name: - type: string - namespace: - type: string configuration: type: object properties: diff --git a/manifests/postgresql.crd.yaml b/manifests/postgresql.crd.yaml index 32ce4157a..57657f50e 100644 --- a/manifests/postgresql.crd.yaml +++ b/manifests/postgresql.crd.yaml @@ -17,37 +17,8 @@ spec: validation: openAPIV3Schema: required: - - kind - - apiVersion - - metadata - spec properties: - kind: - type: string - enum: - - postgresql - apiVersion: - type: string - enum: - - acid.zalan.do/v1 - metadata: - type: object - required: - - name - properties: - annotations: - type: object - additionalProperties: - type: string - labels: - type: object - additionalProperties: - type: string - name: - type: string - # Note: the cluster name specified here must begin with the team name. - namespace: - type: string spec: type: object required: diff --git a/pkg/apis/acid.zalan.do/v1/crds.go b/pkg/apis/acid.zalan.do/v1/crds.go index 064ce0750..8fd820fe8 100644 --- a/pkg/apis/acid.zalan.do/v1/crds.go +++ b/pkg/apis/acid.zalan.do/v1/crds.go @@ -109,53 +109,8 @@ var minDisable = -1.0 var postgresCRDResourceValidation = apiextv1beta1.JSONSchemaProps{ Type: "object", - Required: []string{"kind", "apiVersion", "metadata", "spec"}, + Required: []string{"spec"}, Properties: map[string]apiextv1beta1.JSONSchemaProps{ - "kind": { - Type: "string", - Enum: []apiextv1beta1.JSON{ - { - Raw: []byte(`"postgresql"`), - }, - }, - }, - "apiVersion": { - Type: "string", - Enum: []apiextv1beta1.JSON{ - { - Raw: []byte(`"acid.zalan.do/v1"`), - }, - }, - }, - "metadata": { - Type: "object", - Required: []string{"name"}, - Properties: map[string]apiextv1beta1.JSONSchemaProps{ - "annotations": { - Type: "object", - AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ - Schema: &apiextv1beta1.JSONSchemaProps{ - Type: "string", - }, - }, - }, - "labels": { - Type: "object", - AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ - Schema: &apiextv1beta1.JSONSchemaProps{ - Type: "string", - }, - }, - }, - "name": { - Type: "string", - Description: "The cluster name specified here must begin with the team name", - }, - "namespace": { - Type: "string", - }, - }, - }, "spec": { Type: "object", Required: []string{"numberOfInstances", "teamId", "postgresql"}, @@ -567,52 +522,8 @@ var postgresCRDResourceValidation = apiextv1beta1.JSONSchemaProps{ var operatorConfigCRDResourceValidation = apiextv1beta1.JSONSchemaProps{ Type: "object", - Required: []string{"kind", "apiVersion", "metadata", "configuration"}, + Required: []string{"configuration"}, Properties: map[string]apiextv1beta1.JSONSchemaProps{ - "kind": { - Type: "string", - Enum: []apiextv1beta1.JSON{ - { - Raw: []byte(`"OperatorConfiguration"`), - }, - }, - }, - "apiVersion": { - Type: "string", - Enum: []apiextv1beta1.JSON{ - { - Raw: []byte(`"acid.zalan.do/v1"`), - }, - }, - }, - "metadata": { - Type: "object", - Required: []string{"name"}, - Properties: map[string]apiextv1beta1.JSONSchemaProps{ - "annotations": { - Type: "object", - AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ - Schema: &apiextv1beta1.JSONSchemaProps{ - Type: "string", - }, - }, - }, - "labels": { - Type: "object", - AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ - Schema: &apiextv1beta1.JSONSchemaProps{ - Type: "string", - }, - }, - }, - "name": { - Type: "string", - }, - "namespace": { - Type: "string", - }, - }, - }, "configuration": { Type: "object", Properties: map[string]apiextv1beta1.JSONSchemaProps{