From ce3af26178f206075ba7bde57985beb4181f59cb Mon Sep 17 00:00:00 2001 From: amecea Date: Tue, 30 Jun 2020 19:19:13 +0300 Subject: [PATCH] Remove port from CRD validation, fix CRDs for k8s>=1.18 --- config/kustomization.yaml | 9 +- .../patches/x-kubernetes-list-map-keys.yaml | 5 ++ .../charts/wordpress-operator/crds/crds.yaml | 90 ------------------- 3 files changed, 13 insertions(+), 91 deletions(-) create mode 100644 config/patches/x-kubernetes-list-map-keys.yaml diff --git a/config/kustomization.yaml b/config/kustomization.yaml index 4b55d1e5..62fdb4e4 100644 --- a/config/kustomization.yaml +++ b/config/kustomization.yaml @@ -3,7 +3,7 @@ resources: patchesJson6902: -#https://github.com/kubernetes/kubernetes/issues/84880 +# https://github.com/kubernetes/kubernetes/issues/84880 - target: group: apiextensions.k8s.io version: v1beta1 @@ -11,3 +11,10 @@ patchesJson6902: name: wordpresses.wordpress.presslabs.org path: patches/volume.yaml +# https://github.com/kubernetes-sigs/controller-tools/issues/444 +- target: + group: apiextensions.k8s.io + version: v1beta1 + kind: CustomResourceDefinition + name: wordpresses.wordpress.presslabs.org + path: patches/x-kubernetes-list-map-keys.yaml diff --git a/config/patches/x-kubernetes-list-map-keys.yaml b/config/patches/x-kubernetes-list-map-keys.yaml new file mode 100644 index 00000000..3e7dec8c --- /dev/null +++ b/config/patches/x-kubernetes-list-map-keys.yaml @@ -0,0 +1,5 @@ +- op: remove + path: /spec/validation/openAPIV3Schema/properties/spec/properties/sidecars/items/properties/ports + +- op: remove + path: /spec/validation/openAPIV3Schema/properties/spec/properties/initContainers/items/properties/ports diff --git a/deploy/charts/wordpress-operator/crds/crds.yaml b/deploy/charts/wordpress-operator/crds/crds.yaml index e1929cd1..7631e65b 100644 --- a/deploy/charts/wordpress-operator/crds/crds.yaml +++ b/deploy/charts/wordpress-operator/crds/crds.yaml @@ -1870,51 +1870,6 @@ spec: container in a pod must have a unique name (DNS_LABEL). Cannot be updated. type: string - ports: - description: List of ports to expose from the container. Exposing - a port here gives the system additional information about the - network connections a container uses, but is primarily informational. - Not specifying a port here DOES NOT prevent that port from being - exposed. Any port which is listening on the default "0.0.0.0" - address inside a container will be accessible from the network. - Cannot be updated. - items: - description: ContainerPort represents a network port in a single - container. - properties: - containerPort: - description: Number of port to expose on the pod's IP address. - This must be a valid port number, 0 < x < 65536. - format: int32 - type: integer - hostIP: - description: What host IP to bind the external port to. - type: string - hostPort: - description: Number of port to expose on the host. If specified, - this must be a valid port number, 0 < x < 65536. If HostNetwork - is specified, this must match ContainerPort. Most containers - do not need this. - format: int32 - type: integer - name: - description: If specified, this must be an IANA_SVC_NAME - and unique within the pod. Each named port in a pod must - have a unique name. Name for the port that can be referred - to by services. - type: string - protocol: - description: Protocol for port. Must be UDP, TCP, or SCTP. - Defaults to "TCP". - type: string - required: - - containerPort - type: object - type: array - x-kubernetes-list-map-keys: - - containerPort - - protocol - x-kubernetes-list-type: map readinessProbe: description: 'Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot @@ -3422,51 +3377,6 @@ spec: container in a pod must have a unique name (DNS_LABEL). Cannot be updated. type: string - ports: - description: List of ports to expose from the container. Exposing - a port here gives the system additional information about the - network connections a container uses, but is primarily informational. - Not specifying a port here DOES NOT prevent that port from being - exposed. Any port which is listening on the default "0.0.0.0" - address inside a container will be accessible from the network. - Cannot be updated. - items: - description: ContainerPort represents a network port in a single - container. - properties: - containerPort: - description: Number of port to expose on the pod's IP address. - This must be a valid port number, 0 < x < 65536. - format: int32 - type: integer - hostIP: - description: What host IP to bind the external port to. - type: string - hostPort: - description: Number of port to expose on the host. If specified, - this must be a valid port number, 0 < x < 65536. If HostNetwork - is specified, this must match ContainerPort. Most containers - do not need this. - format: int32 - type: integer - name: - description: If specified, this must be an IANA_SVC_NAME - and unique within the pod. Each named port in a pod must - have a unique name. Name for the port that can be referred - to by services. - type: string - protocol: - description: Protocol for port. Must be UDP, TCP, or SCTP. - Defaults to "TCP". - type: string - required: - - containerPort - type: object - type: array - x-kubernetes-list-map-keys: - - containerPort - - protocol - x-kubernetes-list-type: map readinessProbe: description: 'Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot