From 4a3176ea107a9c94306e2bf7993a4103d848a016 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Wed, 25 Aug 2021 09:43:49 -0700 Subject: [PATCH 01/10] feat(crd) add shortNames Add shortNames to CRDs matching the shortNames available in 1.x. --- .../crd/bases/configuration.konghq.com_kongclusterplugins.yaml | 2 ++ config/crd/bases/configuration.konghq.com_kongconsumers.yaml | 2 ++ config/crd/bases/configuration.konghq.com_kongingresses.yaml | 2 ++ config/crd/bases/configuration.konghq.com_kongplugins.yaml | 2 ++ pkg/apis/configuration/v1/kongclusterplugin_types.go | 2 +- pkg/apis/configuration/v1/kongconsumer_types.go | 1 + pkg/apis/configuration/v1/kongingress_types.go | 1 + pkg/apis/configuration/v1/kongplugin_types.go | 1 + 8 files changed, 12 insertions(+), 1 deletion(-) diff --git a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml index e1860735b2..c14fd8f13b 100644 --- a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml @@ -13,6 +13,8 @@ spec: kind: KongClusterPlugin listKind: KongClusterPluginList plural: kongclusterplugins + shortNames: + - kcp singular: kongclusterplugin preserveUnknownFields: false scope: Cluster diff --git a/config/crd/bases/configuration.konghq.com_kongconsumers.yaml b/config/crd/bases/configuration.konghq.com_kongconsumers.yaml index cd384bca10..ceb265a811 100644 --- a/config/crd/bases/configuration.konghq.com_kongconsumers.yaml +++ b/config/crd/bases/configuration.konghq.com_kongconsumers.yaml @@ -13,6 +13,8 @@ spec: kind: KongConsumer listKind: KongConsumerList plural: kongconsumers + shortNames: + - kc singular: kongconsumer preserveUnknownFields: false scope: Namespaced diff --git a/config/crd/bases/configuration.konghq.com_kongingresses.yaml b/config/crd/bases/configuration.konghq.com_kongingresses.yaml index 674ccef434..4ef9865b13 100644 --- a/config/crd/bases/configuration.konghq.com_kongingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_kongingresses.yaml @@ -13,6 +13,8 @@ spec: kind: KongIngress listKind: KongIngressList plural: kongingresses + shortNames: + - ki singular: kongingress preserveUnknownFields: false scope: Namespaced diff --git a/config/crd/bases/configuration.konghq.com_kongplugins.yaml b/config/crd/bases/configuration.konghq.com_kongplugins.yaml index 95e1b66c33..d6df9f6593 100644 --- a/config/crd/bases/configuration.konghq.com_kongplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongplugins.yaml @@ -13,6 +13,8 @@ spec: kind: KongPlugin listKind: KongPluginList plural: kongplugins + shortNames: + - kp singular: kongplugin preserveUnknownFields: false scope: Namespaced diff --git a/pkg/apis/configuration/v1/kongclusterplugin_types.go b/pkg/apis/configuration/v1/kongclusterplugin_types.go index c5c51d2234..bbb3bc30ee 100644 --- a/pkg/apis/configuration/v1/kongclusterplugin_types.go +++ b/pkg/apis/configuration/v1/kongclusterplugin_types.go @@ -25,7 +25,7 @@ import ( //+genclient:nonNamespaced //+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object //+kubebuilder:object:root=true -//+kubebuilder:resource:scope=Cluster +//+kubebuilder:resource:scope=Cluster,shortName=kcp //+kubebuilder:subresource:status //+kubebuilder:storageversion diff --git a/pkg/apis/configuration/v1/kongconsumer_types.go b/pkg/apis/configuration/v1/kongconsumer_types.go index 689fb6b841..3333e3c374 100644 --- a/pkg/apis/configuration/v1/kongconsumer_types.go +++ b/pkg/apis/configuration/v1/kongconsumer_types.go @@ -25,6 +25,7 @@ import ( //+kubebuilder:object:root=true //+kubebuilder:subresource:status //+kubebuilder:storageversion +//+kubebuilder:resource:shortName=kc // KongConsumer is the Schema for the kongconsumers API type KongConsumer struct { diff --git a/pkg/apis/configuration/v1/kongingress_types.go b/pkg/apis/configuration/v1/kongingress_types.go index f2268336af..52212cba97 100644 --- a/pkg/apis/configuration/v1/kongingress_types.go +++ b/pkg/apis/configuration/v1/kongingress_types.go @@ -26,6 +26,7 @@ import ( //+kubebuilder:object:root=true //+kubebuilder:subresource:status //+kubebuilder:storageversion +//+kubebuilder:resource:shortName=ki // KongIngress is the Schema for the kongingresses API type KongIngress struct { diff --git a/pkg/apis/configuration/v1/kongplugin_types.go b/pkg/apis/configuration/v1/kongplugin_types.go index 4730a613dd..9a5d6b73bd 100644 --- a/pkg/apis/configuration/v1/kongplugin_types.go +++ b/pkg/apis/configuration/v1/kongplugin_types.go @@ -26,6 +26,7 @@ import ( //+kubebuilder:object:root=true //+kubebuilder:subresource:status //+kubebuilder:storageversion +//+kubebuilder:resource:shortName=kp // KongPlugin is the Schema for the kongplugins API type KongPlugin struct { From fdf855276c440124bd87c4e5118d83589504562f Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Wed, 25 Aug 2021 11:01:46 -0700 Subject: [PATCH 02/10] feat(crd) add validation rules Add validation to CRD schemas, mostly aligned with the 1.x CRDs. Omits type validations where 1.x specified the type explicitly even though it did not differ from the underlying Go type. These validations are implicit. Omits KongIngress validations. KongIngress does not specify fields of its own and inherits everything from go-kong. --- ...guration.konghq.com_kongclusterplugins.yaml | 18 ++++++++++++++++++ .../configuration.konghq.com_kongplugins.yaml | 17 +++++++++++++++++ .../configuration.konghq.com_tcpingresses.yaml | 2 ++ .../configuration.konghq.com_udpingresses.yaml | 1 + pkg/apis/configuration/v1/configsource.go | 7 +++++++ .../v1/kongclusterplugin_types.go | 5 +++++ .../configuration/v1/kongconsumer_types.go | 1 + pkg/apis/configuration/v1/kongingress_types.go | 1 + pkg/apis/configuration/v1/kongplugin_types.go | 5 +++++ .../configuration/v1beta1/ingress_rules.go | 13 +++++++++++++ .../configuration/v1beta1/tcpingress_types.go | 1 + .../configuration/v1beta1/udpingress_types.go | 1 + 12 files changed, 72 insertions(+) diff --git a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml index c14fd8f13b..049bf51118 100644 --- a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml @@ -31,6 +31,7 @@ spec: type: string config: description: Config contains the plugin configuration. + type: object x-kubernetes-preserve-unknown-fields: true configFrom: description: ConfigFrom references a secret containing the plugin configuration. @@ -71,6 +72,10 @@ spec: namespace: description: The namespace containing the secret type: string + required: + - key + - name + - namespace type: object type: object consumerRef: @@ -93,13 +98,26 @@ spec: protocols: description: Protocols configures plugin to run on requests received on specific protocols. + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls items: type: string type: array run_on: description: RunOn configures the plugin to run on the first or the second or both nodes in case of a service mesh deployment. + enum: + - first + - second + - all type: string + required: + - plugin type: object served: true storage: true diff --git a/config/crd/bases/configuration.konghq.com_kongplugins.yaml b/config/crd/bases/configuration.konghq.com_kongplugins.yaml index d6df9f6593..656c536998 100644 --- a/config/crd/bases/configuration.konghq.com_kongplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongplugins.yaml @@ -31,6 +31,7 @@ spec: type: string config: description: Config contains the plugin configuration. + type: object x-kubernetes-preserve-unknown-fields: true configFrom: description: ConfigFrom references a secret containing the plugin configuration. @@ -68,6 +69,9 @@ spec: name: description: the secret containing the key type: string + required: + - key + - name type: object type: object consumerRef: @@ -90,13 +94,26 @@ spec: protocols: description: Protocols configures plugin to run on requests received on specific protocols. + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls items: type: string type: array run_on: description: RunOn configures the plugin to run on the first or the second or both nodes in case of a service mesh deployment. + enum: + - first + - second + - all type: string + required: + - plugin type: object served: true storage: true diff --git a/config/crd/bases/configuration.konghq.com_tcpingresses.yaml b/config/crd/bases/configuration.konghq.com_tcpingresses.yaml index 6490e3e039..0648fd9723 100644 --- a/config/crd/bases/configuration.konghq.com_tcpingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_tcpingresses.yaml @@ -53,6 +53,7 @@ spec: type: string servicePort: description: Specifies the port of the referenced service. + format: int32 type: integer required: - serviceName @@ -69,6 +70,7 @@ spec: over TCP sessions and route. It is a required field. If a Host is not specified, the requested are routed based only on Port. + format: int32 maximum: 65535 minimum: 1 type: integer diff --git a/config/crd/bases/configuration.konghq.com_udpingresses.yaml b/config/crd/bases/configuration.konghq.com_udpingresses.yaml index 3169787d90..f21f21853b 100644 --- a/config/crd/bases/configuration.konghq.com_udpingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_udpingresses.yaml @@ -53,6 +53,7 @@ spec: type: string servicePort: description: Specifies the port of the referenced service. + format: int32 type: integer required: - serviceName diff --git a/pkg/apis/configuration/v1/configsource.go b/pkg/apis/configuration/v1/configsource.go index af47bc3fea..aafc5c9f1f 100644 --- a/pkg/apis/configuration/v1/configsource.go +++ b/pkg/apis/configuration/v1/configsource.go @@ -19,25 +19,32 @@ type NamespacedConfigSource struct { } //+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +//+kubebuilder:validation:Optional // SecretValueFromSource represents the source of a secret value type SecretValueFromSource struct { metav1.TypeMeta `json:",inline"` // the secret containing the key + //+kubebuilder:validation:Required Secret string `json:"name,omitempty"` // the key containing the value + //+kubebuilder:validation:Required Key string `json:"key,omitempty"` } //+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +//+kubebuilder:validation:Optional // NamespacedSecretValueFromSource represents the source of a secret value specifying the secret namespace type NamespacedSecretValueFromSource struct { metav1.TypeMeta `json:",inline"` // The namespace containing the secret + //+kubebuilder:validation:Required Namespace string `json:"namespace,omitempty"` // the secret containing the key + //+kubebuilder:validation:Required Secret string `json:"name,omitempty"` // the key containing the value + //+kubebuilder:validation:Required Key string `json:"key,omitempty"` } diff --git a/pkg/apis/configuration/v1/kongclusterplugin_types.go b/pkg/apis/configuration/v1/kongclusterplugin_types.go index bbb3bc30ee..c7a280b508 100644 --- a/pkg/apis/configuration/v1/kongclusterplugin_types.go +++ b/pkg/apis/configuration/v1/kongclusterplugin_types.go @@ -28,6 +28,7 @@ import ( //+kubebuilder:resource:scope=Cluster,shortName=kcp //+kubebuilder:subresource:status //+kubebuilder:storageversion +//+kubebuilder:validation:Optional // KongClusterPlugin is the Schema for the kongclusterplugins API type KongClusterPlugin struct { @@ -41,20 +42,24 @@ type KongClusterPlugin struct { Disabled bool `json:"disabled,omitempty"` // Config contains the plugin configuration. + //+kubebuilder:validation:Type=object Config apiextensionsv1.JSON `json:"config,omitempty"` // ConfigFrom references a secret containing the plugin configuration. ConfigFrom NamespacedConfigSource `json:"configFrom,omitempty"` // PluginName is the name of the plugin to which to apply the config + //+kubebuilder:validation:Required PluginName string `json:"plugin,omitempty"` // RunOn configures the plugin to run on the first or the second or both // nodes in case of a service mesh deployment. + //+kubebuilder:validation:Enum:=first;second;all RunOn string `json:"run_on,omitempty"` // Protocols configures plugin to run on requests received on specific // protocols. + //+kubebuilder:validation:Enum=http;https;grpc;grpcs;tcp;tls Protocols []string `json:"protocols,omitempty"` } diff --git a/pkg/apis/configuration/v1/kongconsumer_types.go b/pkg/apis/configuration/v1/kongconsumer_types.go index 3333e3c374..38423c3abc 100644 --- a/pkg/apis/configuration/v1/kongconsumer_types.go +++ b/pkg/apis/configuration/v1/kongconsumer_types.go @@ -26,6 +26,7 @@ import ( //+kubebuilder:subresource:status //+kubebuilder:storageversion //+kubebuilder:resource:shortName=kc +//+kubebuilder:validation:Optional // KongConsumer is the Schema for the kongconsumers API type KongConsumer struct { diff --git a/pkg/apis/configuration/v1/kongingress_types.go b/pkg/apis/configuration/v1/kongingress_types.go index 52212cba97..f61030b186 100644 --- a/pkg/apis/configuration/v1/kongingress_types.go +++ b/pkg/apis/configuration/v1/kongingress_types.go @@ -27,6 +27,7 @@ import ( //+kubebuilder:subresource:status //+kubebuilder:storageversion //+kubebuilder:resource:shortName=ki +//+kubebuilder:validation:Optional // KongIngress is the Schema for the kongingresses API type KongIngress struct { diff --git a/pkg/apis/configuration/v1/kongplugin_types.go b/pkg/apis/configuration/v1/kongplugin_types.go index 9a5d6b73bd..e559779ecc 100644 --- a/pkg/apis/configuration/v1/kongplugin_types.go +++ b/pkg/apis/configuration/v1/kongplugin_types.go @@ -27,6 +27,7 @@ import ( //+kubebuilder:subresource:status //+kubebuilder:storageversion //+kubebuilder:resource:shortName=kp +//+kubebuilder:validation:Optional // KongPlugin is the Schema for the kongplugins API type KongPlugin struct { @@ -40,20 +41,24 @@ type KongPlugin struct { Disabled bool `json:"disabled,omitempty"` // Config contains the plugin configuration. + //+kubebuilder:validation:Type=object Config apiextensionsv1.JSON `json:"config,omitempty"` // ConfigFrom references a secret containing the plugin configuration. ConfigFrom ConfigSource `json:"configFrom,omitempty"` // PluginName is the name of the plugin to which to apply the config + //+kubebuilder:validation:Required PluginName string `json:"plugin,omitempty"` // RunOn configures the plugin to run on the first or the second or both // nodes in case of a service mesh deployment. + //+kubebuilder:validation:Enum:=first;second;all RunOn string `json:"run_on,omitempty"` // Protocols configures plugin to run on requests received on specific // protocols. + //+kubebuilder:validation:Enum=http;https;grpc;grpcs;tcp;tls Protocols []string `json:"protocols,omitempty"` } diff --git a/pkg/apis/configuration/v1beta1/ingress_rules.go b/pkg/apis/configuration/v1beta1/ingress_rules.go index ddeaf1742d..e4237aa7df 100644 --- a/pkg/apis/configuration/v1beta1/ingress_rules.go +++ b/pkg/apis/configuration/v1beta1/ingress_rules.go @@ -1,18 +1,24 @@ package v1beta1 +//+kubebuilder:validation:Optional + // UDPIngressRule represents a rule to apply against incoming requests // wherein no Host matching is available for request routing, only the port // is used to match requests. type UDPIngressRule struct { // Port indicates the port for the Kong proxy to accept incoming traffic // on, which will then be routed to the service Backend. + // +kubebuilder:validation:Required Port int `json:"port"` // Backend defines the Kubernetes service which accepts traffic from the // listening Port defined above. + // +kubebuilder:validation:Required Backend IngressBackend `json:"backend"` } +//+kubebuilder:validation:Optional + // IngressRule represents a rule to apply against incoming requests. // Matching is performed based on an (optional) SNI and port. type IngressRule struct { @@ -29,18 +35,25 @@ type IngressRule struct { // are routed based only on Port. // +kubebuilder:validation:Minimum=1 // +kubebuilder:validation:Maximum=65535 + // +kubebuilder:validation:Format=int32 Port int `json:"port,omitempty"` // Backend defines the referenced service endpoint to which the traffic // will be forwarded to. + // +kubebuilder:validation:Required Backend IngressBackend `json:"backend"` } +//+kubebuilder:validation:Optional + // IngressBackend describes all endpoints for a given service and port. type IngressBackend struct { // Specifies the name of the referenced service. + // +kubebuilder:validation:Required ServiceName string `json:"serviceName"` // Specifies the port of the referenced service. + // +kubebuilder:validation:Format=int32 + // +kubebuilder:validation:Required ServicePort int `json:"servicePort"` } diff --git a/pkg/apis/configuration/v1beta1/tcpingress_types.go b/pkg/apis/configuration/v1beta1/tcpingress_types.go index 87bef8b1a6..40caf9f522 100644 --- a/pkg/apis/configuration/v1beta1/tcpingress_types.go +++ b/pkg/apis/configuration/v1beta1/tcpingress_types.go @@ -26,6 +26,7 @@ import ( //+kubebuilder:object:root=true //+kubebuilder:subresource:status //+kubebuilder:storageversion +//+kubebuilder:validation:Optional // TCPIngress is the Schema for the tcpingresses API type TCPIngress struct { diff --git a/pkg/apis/configuration/v1beta1/udpingress_types.go b/pkg/apis/configuration/v1beta1/udpingress_types.go index e2f0a221d1..9a472f939b 100644 --- a/pkg/apis/configuration/v1beta1/udpingress_types.go +++ b/pkg/apis/configuration/v1beta1/udpingress_types.go @@ -39,6 +39,7 @@ type UDPIngressList struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status //+kubebuilder:storageversion +//+kubebuilder:validation:Optional // UDPIngress is the Schema for the udpingresses API type UDPIngress struct { From 2813eb15f55842780e416e995eb41360a48f45d6 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Wed, 25 Aug 2021 11:55:46 -0700 Subject: [PATCH 03/10] feat(crd) use 1.x KongIngress OAS Copy the 1.x KongIngress openAPIV3Schema verbatim into the 2.x CRD via Kustomize patch. This works around generation pulling in undesired fields from the underlying go-kong structures we include inside KongIngress, as well as adding validation to fields even though the go-kong types have no Kubebuilder tags. --- config/base/kong-ingress-crd-spec.yaml | 161 +++++++++++++++++++++++++ config/base/kustomization.yaml | 2 + 2 files changed, 163 insertions(+) create mode 100644 config/base/kong-ingress-crd-spec.yaml diff --git a/config/base/kong-ingress-crd-spec.yaml b/config/base/kong-ingress-crd-spec.yaml new file mode 100644 index 0000000000..145170d230 --- /dev/null +++ b/config/base/kong-ingress-crd-spec.yaml @@ -0,0 +1,161 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: kongingresses.configuration.konghq.com +spec: + versions: + - name: v1 + schema: + openAPIV3Schema: + properties: + route: + properties: + methods: + type: array + items: + type: string + headers: + type: object + additionalProperties: + type: array + items: + type: string + regex_priority: + type: integer + strip_path: + type: boolean + preserve_host: + type: boolean + path_handling: + type: string + enum: + - "v0" + - "v1" + protocols: + type: array + items: + type: string + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + https_redirect_status_code: + type: integer + snis: + type: array + items: + type: string + request_buffering: + type: boolean + response_buffering: + type: boolean + proxy: + type: object + properties: + protocol: + type: string + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + path: + type: string + pattern: ^/.*$ + retries: + type: integer + minimum: 0 + connect_timeout: + type: integer + minimum: 0 + read_timeout: + type: integer + minimum: 0 + write_timeout: + type: integer + minimum: 0 + upstream: + type: object + properties: + algorithm: + type: string + enum: + - "round-robin" + - "consistent-hashing" + - "least-connections" + host_header: + type: string + hash_on: + type: string + hash_on_cookie: + type: string + hash_on_cookie_path: + type: string + hash_on_header: + type: string + hash_fallback_header: + type: string + hash_fallback: + type: string + slots: + type: integer + minimum: 10 + healthchecks: + type: object + properties: + threshold: + type: integer + active: + type: object + properties: + concurrency: + type: integer + minimum: 1 + timeout: + type: integer + minimum: 0 + http_path: + type: string + pattern: ^/.*$ + healthy: &healthy + type: object + properties: + http_statuses: + type: array + items: + type: integer + interval: + type: integer + minimum: 0 + successes: + type: integer + minimum: 0 + unhealthy: &unhealthy + type: object + properties: + http_failures: + type: integer + minimum: 0 + http_statuses: + type: array + items: + type: integer + interval: + type: integer + minimum: 0 + tcp_failures: + type: integer + minimum: 0 + timeout: + type: integer + minimum: 0 + passive: + type: object + properties: + healthy: *healthy + unhealthy: *unhealthy diff --git a/config/base/kustomization.yaml b/config/base/kustomization.yaml index c63b187538..0c19ed5b31 100644 --- a/config/base/kustomization.yaml +++ b/config/base/kustomization.yaml @@ -7,3 +7,5 @@ resources: - validation-service.yaml - kong-ingress-dbless.yaml namespace: kong +patchesStrategicMerge: +- kong-ingress-crd-spec.yaml From 68cc8163587649659b5c1c8e3bef32b828149aa3 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Wed, 25 Aug 2021 14:01:40 -0700 Subject: [PATCH 04/10] feat(crd) add additional printer columns Add additional printer columns included in the 1.x CRDs to the 2.x CRDs. --- ...uration.konghq.com_kongclusterplugins.yaml | 19 ++++++++++++++++++- ...onfiguration.konghq.com_kongconsumers.yaml | 11 ++++++++++- .../configuration.konghq.com_kongplugins.yaml | 19 ++++++++++++++++++- ...configuration.konghq.com_tcpingresses.yaml | 11 ++++++++++- ...configuration.konghq.com_udpingresses.yaml | 11 ++++++++++- .../v1/kongclusterplugin_types.go | 4 ++++ .../configuration/v1/kongconsumer_types.go | 2 ++ pkg/apis/configuration/v1/kongplugin_types.go | 4 ++++ .../configuration/v1beta1/tcpingress_types.go | 2 ++ .../configuration/v1beta1/udpingress_types.go | 2 ++ 10 files changed, 80 insertions(+), 5 deletions(-) diff --git a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml index 049bf51118..4335e2401e 100644 --- a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml @@ -19,7 +19,24 @@ spec: preserveUnknownFields: false scope: Cluster versions: - - name: v1 + - additionalPrinterColumns: + - description: Name of the plugin + jsonPath: .plugin + name: Plugin-Type + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: Indicates if the plugin is disabled + jsonPath: .disabled + name: Disabled + type: boolean + - description: Configuration of the plugin + jsonPath: .config + name: Config + type: string + name: v1 schema: openAPIV3Schema: description: KongClusterPlugin is the Schema for the kongclusterplugins API diff --git a/config/crd/bases/configuration.konghq.com_kongconsumers.yaml b/config/crd/bases/configuration.konghq.com_kongconsumers.yaml index ceb265a811..07778a4176 100644 --- a/config/crd/bases/configuration.konghq.com_kongconsumers.yaml +++ b/config/crd/bases/configuration.konghq.com_kongconsumers.yaml @@ -19,7 +19,16 @@ spec: preserveUnknownFields: false scope: Namespaced versions: - - name: v1 + - additionalPrinterColumns: + - description: Username of a Kong Consumer + jsonPath: .username + name: Username + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 schema: openAPIV3Schema: description: KongConsumer is the Schema for the kongconsumers API diff --git a/config/crd/bases/configuration.konghq.com_kongplugins.yaml b/config/crd/bases/configuration.konghq.com_kongplugins.yaml index 656c536998..79501aed53 100644 --- a/config/crd/bases/configuration.konghq.com_kongplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongplugins.yaml @@ -19,7 +19,24 @@ spec: preserveUnknownFields: false scope: Namespaced versions: - - name: v1 + - additionalPrinterColumns: + - description: Name of the plugin + jsonPath: .plugin + name: Plugin-Type + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: Indicates if the plugin is disabled + jsonPath: .disabled + name: Disabled + type: boolean + - description: Configuration of the plugin + jsonPath: .config + name: Config + type: string + name: v1 schema: openAPIV3Schema: description: KongPlugin is the Schema for the kongplugins API diff --git a/config/crd/bases/configuration.konghq.com_tcpingresses.yaml b/config/crd/bases/configuration.konghq.com_tcpingresses.yaml index 0648fd9723..bc8cfcb5b9 100644 --- a/config/crd/bases/configuration.konghq.com_tcpingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_tcpingresses.yaml @@ -17,7 +17,16 @@ spec: preserveUnknownFields: false scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - description: Address of the load balancer + jsonPath: .status.loadBalancer.ingress[*].ip + name: Address + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 schema: openAPIV3Schema: description: TCPIngress is the Schema for the tcpingresses API diff --git a/config/crd/bases/configuration.konghq.com_udpingresses.yaml b/config/crd/bases/configuration.konghq.com_udpingresses.yaml index f21f21853b..51bb0b680c 100644 --- a/config/crd/bases/configuration.konghq.com_udpingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_udpingresses.yaml @@ -17,7 +17,16 @@ spec: preserveUnknownFields: false scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - description: Address of the load balancer + jsonPath: .status.loadBalancer.ingress[*].ip + name: Address + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 schema: openAPIV3Schema: description: UDPIngress is the Schema for the udpingresses API diff --git a/pkg/apis/configuration/v1/kongclusterplugin_types.go b/pkg/apis/configuration/v1/kongclusterplugin_types.go index c7a280b508..3bc8d77374 100644 --- a/pkg/apis/configuration/v1/kongclusterplugin_types.go +++ b/pkg/apis/configuration/v1/kongclusterplugin_types.go @@ -29,6 +29,10 @@ import ( //+kubebuilder:subresource:status //+kubebuilder:storageversion //+kubebuilder:validation:Optional +//+kubebuilder:printcolumn:name="Plugin-Type",type=string,JSONPath=`.plugin`,description="Name of the plugin" +//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" +//+kubebuilder:printcolumn:name="Disabled",type=boolean,JSONPath=`.disabled`,description="Indicates if the plugin is disabled" +//+kubebuilder:printcolumn:name="Config",type=string,JSONPath=`.config`,description="Configuration of the plugin" // KongClusterPlugin is the Schema for the kongclusterplugins API type KongClusterPlugin struct { diff --git a/pkg/apis/configuration/v1/kongconsumer_types.go b/pkg/apis/configuration/v1/kongconsumer_types.go index 38423c3abc..73149a5557 100644 --- a/pkg/apis/configuration/v1/kongconsumer_types.go +++ b/pkg/apis/configuration/v1/kongconsumer_types.go @@ -27,6 +27,8 @@ import ( //+kubebuilder:storageversion //+kubebuilder:resource:shortName=kc //+kubebuilder:validation:Optional +//+kubebuilder:printcolumn:name="Username",type=string,JSONPath=`.username`,description="Username of a Kong Consumer" +//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" // KongConsumer is the Schema for the kongconsumers API type KongConsumer struct { diff --git a/pkg/apis/configuration/v1/kongplugin_types.go b/pkg/apis/configuration/v1/kongplugin_types.go index e559779ecc..6519e59093 100644 --- a/pkg/apis/configuration/v1/kongplugin_types.go +++ b/pkg/apis/configuration/v1/kongplugin_types.go @@ -28,6 +28,10 @@ import ( //+kubebuilder:storageversion //+kubebuilder:resource:shortName=kp //+kubebuilder:validation:Optional +//+kubebuilder:printcolumn:name="Plugin-Type",type=string,JSONPath=`.plugin`,description="Name of the plugin" +//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" +//+kubebuilder:printcolumn:name="Disabled",type=boolean,JSONPath=`.disabled`,description="Indicates if the plugin is disabled" +//+kubebuilder:printcolumn:name="Config",type=string,JSONPath=`.config`,description="Configuration of the plugin" // KongPlugin is the Schema for the kongplugins API type KongPlugin struct { diff --git a/pkg/apis/configuration/v1beta1/tcpingress_types.go b/pkg/apis/configuration/v1beta1/tcpingress_types.go index 40caf9f522..2f2ab577f7 100644 --- a/pkg/apis/configuration/v1beta1/tcpingress_types.go +++ b/pkg/apis/configuration/v1beta1/tcpingress_types.go @@ -27,6 +27,8 @@ import ( //+kubebuilder:subresource:status //+kubebuilder:storageversion //+kubebuilder:validation:Optional +//+kubebuilder:printcolumn:name="Address",type=string,JSONPath=`.status.loadBalancer.ingress[*].ip`,description="Address of the load balancer" +//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" // TCPIngress is the Schema for the tcpingresses API type TCPIngress struct { diff --git a/pkg/apis/configuration/v1beta1/udpingress_types.go b/pkg/apis/configuration/v1beta1/udpingress_types.go index 9a472f939b..6bd31d2b60 100644 --- a/pkg/apis/configuration/v1beta1/udpingress_types.go +++ b/pkg/apis/configuration/v1beta1/udpingress_types.go @@ -40,6 +40,8 @@ type UDPIngressList struct { //+kubebuilder:subresource:status //+kubebuilder:storageversion //+kubebuilder:validation:Optional +//+kubebuilder:printcolumn:name="Address",type=string,JSONPath=`.status.loadBalancer.ingress[*].ip`,description="Address of the load balancer" +//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" // UDPIngress is the Schema for the udpingresses API type UDPIngress struct { From 12b2dde98d889e02e6fa22491f79d53e030d2871 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Thu, 26 Aug 2021 10:17:33 -0700 Subject: [PATCH 05/10] chore(deploy) rebuild manifests --- deploy/single-v2/all-in-one-dbless.yaml | 399 +++++++----------- .../all-in-one-enterprise-dbless.yaml | 399 +++++++----------- .../all-in-one-enterprise-postgres.yaml | 399 +++++++----------- deploy/single-v2/all-in-one-postgres.yaml | 399 +++++++----------- 4 files changed, 628 insertions(+), 968 deletions(-) diff --git a/deploy/single-v2/all-in-one-dbless.yaml b/deploy/single-v2/all-in-one-dbless.yaml index f8d124a19c..4557a791ae 100644 --- a/deploy/single-v2/all-in-one-dbless.yaml +++ b/deploy/single-v2/all-in-one-dbless.yaml @@ -16,11 +16,30 @@ spec: kind: KongClusterPlugin listKind: KongClusterPluginList plural: kongclusterplugins + shortNames: + - kcp singular: kongclusterplugin preserveUnknownFields: false scope: Cluster versions: - - name: v1 + - additionalPrinterColumns: + - description: Name of the plugin + jsonPath: .plugin + name: Plugin-Type + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: Indicates if the plugin is disabled + jsonPath: .disabled + name: Disabled + type: boolean + - description: Configuration of the plugin + jsonPath: .config + name: Config + type: string + name: v1 schema: openAPIV3Schema: description: KongClusterPlugin is the Schema for the kongclusterplugins API @@ -32,6 +51,7 @@ spec: type: string config: description: Config contains the plugin configuration. + type: object x-kubernetes-preserve-unknown-fields: true configFrom: description: ConfigFrom references a secret containing the plugin configuration. @@ -72,6 +92,10 @@ spec: namespace: description: The namespace containing the secret type: string + required: + - key + - name + - namespace type: object type: object consumerRef: @@ -94,13 +118,26 @@ spec: protocols: description: Protocols configures plugin to run on requests received on specific protocols. + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls items: type: string type: array run_on: description: RunOn configures the plugin to run on the first or the second or both nodes in case of a service mesh deployment. + enum: + - first + - second + - all type: string + required: + - plugin type: object served: true storage: true @@ -126,11 +163,22 @@ spec: kind: KongConsumer listKind: KongConsumerList plural: kongconsumers + shortNames: + - kc singular: kongconsumer preserveUnknownFields: false scope: Namespaced versions: - - name: v1 + - additionalPrinterColumns: + - description: Username of a Kong Consumer + jsonPath: .username + name: Username + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 schema: openAPIV3Schema: description: KongConsumer is the Schema for the kongconsumers API @@ -177,7 +225,6 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.6.2 - creationTimestamp: null name: kongingresses.configuration.konghq.com spec: group: configuration.konghq.com @@ -185,6 +232,8 @@ spec: kind: KongIngress listKind: KongIngressList plural: kongingresses + shortNames: + - ki singular: kongingress preserveUnknownFields: false scope: Namespaced @@ -192,258 +241,86 @@ spec: - name: v1 schema: openAPIV3Schema: - description: KongIngress is the Schema for the kongingresses 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 proxy: - description: Service represents a Service in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Service-object properties: - ca_certificates: - items: - type: string - type: array - client_certificate: - description: Certificate represents a Certificate in Kong. Read https://getkong.org/docs/0.14.x/admin-api/#certificate-object - properties: - cert: - type: string - created_at: - format: int64 - type: integer - id: - type: string - key: - type: string - snis: - items: - type: string - type: array - tags: - items: - type: string - type: array - type: object connect_timeout: + minimum: 0 type: integer - created_at: - type: integer - host: - type: string - id: - type: string - name: - type: string path: + pattern: ^/.*$ type: string - port: - type: integer protocol: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls type: string read_timeout: + minimum: 0 type: integer retries: + minimum: 0 type: integer - tags: - items: - type: string - type: array - tls_verify: - type: boolean - tls_verify_depth: - type: integer - updated_at: - type: integer - url: - type: string write_timeout: + minimum: 0 type: integer type: object route: - description: Route represents a Route in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Route-object properties: - created_at: - type: integer - destinations: - items: - description: CIDRPort represents a set of CIDR and a port. - properties: - ip: - type: string - port: - type: integer - type: object - type: array headers: additionalProperties: items: type: string type: array type: object - hosts: - items: - type: string - type: array https_redirect_status_code: type: integer - id: - type: string methods: items: type: string type: array - name: - type: string path_handling: + enum: + - v0 + - v1 type: string - paths: - items: - type: string - type: array preserve_host: type: boolean protocols: items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls type: string type: array regex_priority: type: integer request_buffering: - description: "Kong buffers requests and responses by default. Buffering - is not always desired, for instance if large payloads are being - proxied using HTTP 1.1 chunked encoding. \n The request and response - route buffering options are enabled by default and allow the user - to disable buffering if desired for their use case. \n SEE ALSO: - - https://github.com/Kong/kong/pull/6057 - https://docs.konghq.com/2.2.x/admin-api/#route-object" type: boolean response_buffering: type: boolean - service: - description: Service represents a Service in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Service-object - properties: - ca_certificates: - items: - type: string - type: array - client_certificate: - description: Certificate represents a Certificate in Kong. Read - https://getkong.org/docs/0.14.x/admin-api/#certificate-object - properties: - cert: - type: string - created_at: - format: int64 - type: integer - id: - type: string - key: - type: string - snis: - items: - type: string - type: array - tags: - items: - type: string - type: array - type: object - connect_timeout: - type: integer - created_at: - type: integer - host: - type: string - id: - type: string - name: - type: string - path: - type: string - port: - type: integer - protocol: - type: string - read_timeout: - type: integer - retries: - type: integer - tags: - items: - type: string - type: array - tls_verify: - type: boolean - tls_verify_depth: - type: integer - updated_at: - type: integer - url: - type: string - write_timeout: - type: integer - type: object snis: items: type: string type: array - sources: - items: - description: CIDRPort represents a set of CIDR and a port. - properties: - ip: - type: string - port: - type: integer - type: object - type: array strip_path: type: boolean - tags: - items: - type: string - type: array - updated_at: - type: integer - type: object upstream: - description: Upstream represents an Upstream in Kong. properties: algorithm: + enum: + - round-robin + - consistent-hashing + - least-connections type: string - client_certificate: - description: Certificate represents a Certificate in Kong. Read https://getkong.org/docs/0.14.x/admin-api/#certificate-object - properties: - cert: - type: string - created_at: - format: int64 - type: integer - id: - type: string - key: - type: string - snis: - items: - type: string - type: array - tags: - items: - type: string - type: array - type: object - created_at: - format: int64 - type: integer hash_fallback: type: string hash_fallback_header: @@ -457,114 +334,95 @@ spec: hash_on_header: type: string healthchecks: - description: Healthcheck represents a health-check config of an upstream - in Kong. properties: active: - description: ActiveHealthcheck configures active health check - probing. properties: concurrency: + minimum: 1 type: integer healthy: - description: Healthy configures thresholds and HTTP status - codes to mark targets healthy for an upstream. properties: http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object http_path: + pattern: ^/.*$ type: string - https_sni: - type: string - https_verify_certificate: - type: boolean timeout: + minimum: 0 type: integer - type: - type: string unhealthy: - description: Unhealthy configures thresholds and HTTP status - codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer - timeouts: + timeout: + minimum: 0 type: integer type: object type: object passive: - description: PassiveHealthcheck configures passive checks around - passive health checks. properties: healthy: - description: Healthy configures thresholds and HTTP status - codes to mark targets healthy for an upstream. properties: http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object - type: - type: string unhealthy: - description: Unhealthy configures thresholds and HTTP status - codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer - timeouts: + timeout: + minimum: 0 type: integer type: object type: object threshold: - type: number + type: integer type: object host_header: type: string - id: - type: string - name: - type: string slots: + minimum: 10 type: integer - tags: - items: - type: string - type: array type: object - type: object - served: true - storage: true - subresources: - status: {} status: acceptedNames: kind: "" @@ -585,11 +443,30 @@ spec: kind: KongPlugin listKind: KongPluginList plural: kongplugins + shortNames: + - kp singular: kongplugin preserveUnknownFields: false scope: Namespaced versions: - - name: v1 + - additionalPrinterColumns: + - description: Name of the plugin + jsonPath: .plugin + name: Plugin-Type + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: Indicates if the plugin is disabled + jsonPath: .disabled + name: Disabled + type: boolean + - description: Configuration of the plugin + jsonPath: .config + name: Config + type: string + name: v1 schema: openAPIV3Schema: description: KongPlugin is the Schema for the kongplugins API @@ -601,6 +478,7 @@ spec: type: string config: description: Config contains the plugin configuration. + type: object x-kubernetes-preserve-unknown-fields: true configFrom: description: ConfigFrom references a secret containing the plugin configuration. @@ -638,6 +516,9 @@ spec: name: description: the secret containing the key type: string + required: + - key + - name type: object type: object consumerRef: @@ -660,13 +541,26 @@ spec: protocols: description: Protocols configures plugin to run on requests received on specific protocols. + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls items: type: string type: array run_on: description: RunOn configures the plugin to run on the first or the second or both nodes in case of a service mesh deployment. + enum: + - first + - second + - all type: string + required: + - plugin type: object served: true storage: true @@ -696,7 +590,16 @@ spec: preserveUnknownFields: false scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - description: Address of the load balancer + jsonPath: .status.loadBalancer.ingress[*].ip + name: Address + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 schema: openAPIV3Schema: description: TCPIngress is the Schema for the tcpingresses API @@ -732,6 +635,7 @@ spec: type: string servicePort: description: Specifies the port of the referenced service. + format: int32 type: integer required: - serviceName @@ -748,6 +652,7 @@ spec: over TCP sessions and route. It is a required field. If a Host is not specified, the requested are routed based only on Port. + format: int32 maximum: 65535 minimum: 1 type: integer @@ -870,7 +775,16 @@ spec: preserveUnknownFields: false scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - description: Address of the load balancer + jsonPath: .status.loadBalancer.ingress[*].ip + name: Address + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 schema: openAPIV3Schema: description: UDPIngress is the Schema for the udpingresses API @@ -906,6 +820,7 @@ spec: type: string servicePort: description: Specifies the port of the referenced service. + format: int32 type: integer required: - serviceName diff --git a/deploy/single-v2/all-in-one-enterprise-dbless.yaml b/deploy/single-v2/all-in-one-enterprise-dbless.yaml index 71bd03d9d7..3c7eb33962 100644 --- a/deploy/single-v2/all-in-one-enterprise-dbless.yaml +++ b/deploy/single-v2/all-in-one-enterprise-dbless.yaml @@ -16,11 +16,30 @@ spec: kind: KongClusterPlugin listKind: KongClusterPluginList plural: kongclusterplugins + shortNames: + - kcp singular: kongclusterplugin preserveUnknownFields: false scope: Cluster versions: - - name: v1 + - additionalPrinterColumns: + - description: Name of the plugin + jsonPath: .plugin + name: Plugin-Type + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: Indicates if the plugin is disabled + jsonPath: .disabled + name: Disabled + type: boolean + - description: Configuration of the plugin + jsonPath: .config + name: Config + type: string + name: v1 schema: openAPIV3Schema: description: KongClusterPlugin is the Schema for the kongclusterplugins API @@ -32,6 +51,7 @@ spec: type: string config: description: Config contains the plugin configuration. + type: object x-kubernetes-preserve-unknown-fields: true configFrom: description: ConfigFrom references a secret containing the plugin configuration. @@ -72,6 +92,10 @@ spec: namespace: description: The namespace containing the secret type: string + required: + - key + - name + - namespace type: object type: object consumerRef: @@ -94,13 +118,26 @@ spec: protocols: description: Protocols configures plugin to run on requests received on specific protocols. + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls items: type: string type: array run_on: description: RunOn configures the plugin to run on the first or the second or both nodes in case of a service mesh deployment. + enum: + - first + - second + - all type: string + required: + - plugin type: object served: true storage: true @@ -126,11 +163,22 @@ spec: kind: KongConsumer listKind: KongConsumerList plural: kongconsumers + shortNames: + - kc singular: kongconsumer preserveUnknownFields: false scope: Namespaced versions: - - name: v1 + - additionalPrinterColumns: + - description: Username of a Kong Consumer + jsonPath: .username + name: Username + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 schema: openAPIV3Schema: description: KongConsumer is the Schema for the kongconsumers API @@ -177,7 +225,6 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.6.2 - creationTimestamp: null name: kongingresses.configuration.konghq.com spec: group: configuration.konghq.com @@ -185,6 +232,8 @@ spec: kind: KongIngress listKind: KongIngressList plural: kongingresses + shortNames: + - ki singular: kongingress preserveUnknownFields: false scope: Namespaced @@ -192,258 +241,86 @@ spec: - name: v1 schema: openAPIV3Schema: - description: KongIngress is the Schema for the kongingresses 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 proxy: - description: Service represents a Service in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Service-object properties: - ca_certificates: - items: - type: string - type: array - client_certificate: - description: Certificate represents a Certificate in Kong. Read https://getkong.org/docs/0.14.x/admin-api/#certificate-object - properties: - cert: - type: string - created_at: - format: int64 - type: integer - id: - type: string - key: - type: string - snis: - items: - type: string - type: array - tags: - items: - type: string - type: array - type: object connect_timeout: + minimum: 0 type: integer - created_at: - type: integer - host: - type: string - id: - type: string - name: - type: string path: + pattern: ^/.*$ type: string - port: - type: integer protocol: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls type: string read_timeout: + minimum: 0 type: integer retries: + minimum: 0 type: integer - tags: - items: - type: string - type: array - tls_verify: - type: boolean - tls_verify_depth: - type: integer - updated_at: - type: integer - url: - type: string write_timeout: + minimum: 0 type: integer type: object route: - description: Route represents a Route in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Route-object properties: - created_at: - type: integer - destinations: - items: - description: CIDRPort represents a set of CIDR and a port. - properties: - ip: - type: string - port: - type: integer - type: object - type: array headers: additionalProperties: items: type: string type: array type: object - hosts: - items: - type: string - type: array https_redirect_status_code: type: integer - id: - type: string methods: items: type: string type: array - name: - type: string path_handling: + enum: + - v0 + - v1 type: string - paths: - items: - type: string - type: array preserve_host: type: boolean protocols: items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls type: string type: array regex_priority: type: integer request_buffering: - description: "Kong buffers requests and responses by default. Buffering - is not always desired, for instance if large payloads are being - proxied using HTTP 1.1 chunked encoding. \n The request and response - route buffering options are enabled by default and allow the user - to disable buffering if desired for their use case. \n SEE ALSO: - - https://github.com/Kong/kong/pull/6057 - https://docs.konghq.com/2.2.x/admin-api/#route-object" type: boolean response_buffering: type: boolean - service: - description: Service represents a Service in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Service-object - properties: - ca_certificates: - items: - type: string - type: array - client_certificate: - description: Certificate represents a Certificate in Kong. Read - https://getkong.org/docs/0.14.x/admin-api/#certificate-object - properties: - cert: - type: string - created_at: - format: int64 - type: integer - id: - type: string - key: - type: string - snis: - items: - type: string - type: array - tags: - items: - type: string - type: array - type: object - connect_timeout: - type: integer - created_at: - type: integer - host: - type: string - id: - type: string - name: - type: string - path: - type: string - port: - type: integer - protocol: - type: string - read_timeout: - type: integer - retries: - type: integer - tags: - items: - type: string - type: array - tls_verify: - type: boolean - tls_verify_depth: - type: integer - updated_at: - type: integer - url: - type: string - write_timeout: - type: integer - type: object snis: items: type: string type: array - sources: - items: - description: CIDRPort represents a set of CIDR and a port. - properties: - ip: - type: string - port: - type: integer - type: object - type: array strip_path: type: boolean - tags: - items: - type: string - type: array - updated_at: - type: integer - type: object upstream: - description: Upstream represents an Upstream in Kong. properties: algorithm: + enum: + - round-robin + - consistent-hashing + - least-connections type: string - client_certificate: - description: Certificate represents a Certificate in Kong. Read https://getkong.org/docs/0.14.x/admin-api/#certificate-object - properties: - cert: - type: string - created_at: - format: int64 - type: integer - id: - type: string - key: - type: string - snis: - items: - type: string - type: array - tags: - items: - type: string - type: array - type: object - created_at: - format: int64 - type: integer hash_fallback: type: string hash_fallback_header: @@ -457,114 +334,95 @@ spec: hash_on_header: type: string healthchecks: - description: Healthcheck represents a health-check config of an upstream - in Kong. properties: active: - description: ActiveHealthcheck configures active health check - probing. properties: concurrency: + minimum: 1 type: integer healthy: - description: Healthy configures thresholds and HTTP status - codes to mark targets healthy for an upstream. properties: http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object http_path: + pattern: ^/.*$ type: string - https_sni: - type: string - https_verify_certificate: - type: boolean timeout: + minimum: 0 type: integer - type: - type: string unhealthy: - description: Unhealthy configures thresholds and HTTP status - codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer - timeouts: + timeout: + minimum: 0 type: integer type: object type: object passive: - description: PassiveHealthcheck configures passive checks around - passive health checks. properties: healthy: - description: Healthy configures thresholds and HTTP status - codes to mark targets healthy for an upstream. properties: http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object - type: - type: string unhealthy: - description: Unhealthy configures thresholds and HTTP status - codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer - timeouts: + timeout: + minimum: 0 type: integer type: object type: object threshold: - type: number + type: integer type: object host_header: type: string - id: - type: string - name: - type: string slots: + minimum: 10 type: integer - tags: - items: - type: string - type: array type: object - type: object - served: true - storage: true - subresources: - status: {} status: acceptedNames: kind: "" @@ -585,11 +443,30 @@ spec: kind: KongPlugin listKind: KongPluginList plural: kongplugins + shortNames: + - kp singular: kongplugin preserveUnknownFields: false scope: Namespaced versions: - - name: v1 + - additionalPrinterColumns: + - description: Name of the plugin + jsonPath: .plugin + name: Plugin-Type + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: Indicates if the plugin is disabled + jsonPath: .disabled + name: Disabled + type: boolean + - description: Configuration of the plugin + jsonPath: .config + name: Config + type: string + name: v1 schema: openAPIV3Schema: description: KongPlugin is the Schema for the kongplugins API @@ -601,6 +478,7 @@ spec: type: string config: description: Config contains the plugin configuration. + type: object x-kubernetes-preserve-unknown-fields: true configFrom: description: ConfigFrom references a secret containing the plugin configuration. @@ -638,6 +516,9 @@ spec: name: description: the secret containing the key type: string + required: + - key + - name type: object type: object consumerRef: @@ -660,13 +541,26 @@ spec: protocols: description: Protocols configures plugin to run on requests received on specific protocols. + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls items: type: string type: array run_on: description: RunOn configures the plugin to run on the first or the second or both nodes in case of a service mesh deployment. + enum: + - first + - second + - all type: string + required: + - plugin type: object served: true storage: true @@ -696,7 +590,16 @@ spec: preserveUnknownFields: false scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - description: Address of the load balancer + jsonPath: .status.loadBalancer.ingress[*].ip + name: Address + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 schema: openAPIV3Schema: description: TCPIngress is the Schema for the tcpingresses API @@ -732,6 +635,7 @@ spec: type: string servicePort: description: Specifies the port of the referenced service. + format: int32 type: integer required: - serviceName @@ -748,6 +652,7 @@ spec: over TCP sessions and route. It is a required field. If a Host is not specified, the requested are routed based only on Port. + format: int32 maximum: 65535 minimum: 1 type: integer @@ -870,7 +775,16 @@ spec: preserveUnknownFields: false scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - description: Address of the load balancer + jsonPath: .status.loadBalancer.ingress[*].ip + name: Address + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 schema: openAPIV3Schema: description: UDPIngress is the Schema for the udpingresses API @@ -906,6 +820,7 @@ spec: type: string servicePort: description: Specifies the port of the referenced service. + format: int32 type: integer required: - serviceName diff --git a/deploy/single-v2/all-in-one-enterprise-postgres.yaml b/deploy/single-v2/all-in-one-enterprise-postgres.yaml index 330317ff87..00f53c0721 100644 --- a/deploy/single-v2/all-in-one-enterprise-postgres.yaml +++ b/deploy/single-v2/all-in-one-enterprise-postgres.yaml @@ -16,11 +16,30 @@ spec: kind: KongClusterPlugin listKind: KongClusterPluginList plural: kongclusterplugins + shortNames: + - kcp singular: kongclusterplugin preserveUnknownFields: false scope: Cluster versions: - - name: v1 + - additionalPrinterColumns: + - description: Name of the plugin + jsonPath: .plugin + name: Plugin-Type + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: Indicates if the plugin is disabled + jsonPath: .disabled + name: Disabled + type: boolean + - description: Configuration of the plugin + jsonPath: .config + name: Config + type: string + name: v1 schema: openAPIV3Schema: description: KongClusterPlugin is the Schema for the kongclusterplugins API @@ -32,6 +51,7 @@ spec: type: string config: description: Config contains the plugin configuration. + type: object x-kubernetes-preserve-unknown-fields: true configFrom: description: ConfigFrom references a secret containing the plugin configuration. @@ -72,6 +92,10 @@ spec: namespace: description: The namespace containing the secret type: string + required: + - key + - name + - namespace type: object type: object consumerRef: @@ -94,13 +118,26 @@ spec: protocols: description: Protocols configures plugin to run on requests received on specific protocols. + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls items: type: string type: array run_on: description: RunOn configures the plugin to run on the first or the second or both nodes in case of a service mesh deployment. + enum: + - first + - second + - all type: string + required: + - plugin type: object served: true storage: true @@ -126,11 +163,22 @@ spec: kind: KongConsumer listKind: KongConsumerList plural: kongconsumers + shortNames: + - kc singular: kongconsumer preserveUnknownFields: false scope: Namespaced versions: - - name: v1 + - additionalPrinterColumns: + - description: Username of a Kong Consumer + jsonPath: .username + name: Username + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 schema: openAPIV3Schema: description: KongConsumer is the Schema for the kongconsumers API @@ -177,7 +225,6 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.6.2 - creationTimestamp: null name: kongingresses.configuration.konghq.com spec: group: configuration.konghq.com @@ -185,6 +232,8 @@ spec: kind: KongIngress listKind: KongIngressList plural: kongingresses + shortNames: + - ki singular: kongingress preserveUnknownFields: false scope: Namespaced @@ -192,258 +241,86 @@ spec: - name: v1 schema: openAPIV3Schema: - description: KongIngress is the Schema for the kongingresses 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 proxy: - description: Service represents a Service in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Service-object properties: - ca_certificates: - items: - type: string - type: array - client_certificate: - description: Certificate represents a Certificate in Kong. Read https://getkong.org/docs/0.14.x/admin-api/#certificate-object - properties: - cert: - type: string - created_at: - format: int64 - type: integer - id: - type: string - key: - type: string - snis: - items: - type: string - type: array - tags: - items: - type: string - type: array - type: object connect_timeout: + minimum: 0 type: integer - created_at: - type: integer - host: - type: string - id: - type: string - name: - type: string path: + pattern: ^/.*$ type: string - port: - type: integer protocol: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls type: string read_timeout: + minimum: 0 type: integer retries: + minimum: 0 type: integer - tags: - items: - type: string - type: array - tls_verify: - type: boolean - tls_verify_depth: - type: integer - updated_at: - type: integer - url: - type: string write_timeout: + minimum: 0 type: integer type: object route: - description: Route represents a Route in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Route-object properties: - created_at: - type: integer - destinations: - items: - description: CIDRPort represents a set of CIDR and a port. - properties: - ip: - type: string - port: - type: integer - type: object - type: array headers: additionalProperties: items: type: string type: array type: object - hosts: - items: - type: string - type: array https_redirect_status_code: type: integer - id: - type: string methods: items: type: string type: array - name: - type: string path_handling: + enum: + - v0 + - v1 type: string - paths: - items: - type: string - type: array preserve_host: type: boolean protocols: items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls type: string type: array regex_priority: type: integer request_buffering: - description: "Kong buffers requests and responses by default. Buffering - is not always desired, for instance if large payloads are being - proxied using HTTP 1.1 chunked encoding. \n The request and response - route buffering options are enabled by default and allow the user - to disable buffering if desired for their use case. \n SEE ALSO: - - https://github.com/Kong/kong/pull/6057 - https://docs.konghq.com/2.2.x/admin-api/#route-object" type: boolean response_buffering: type: boolean - service: - description: Service represents a Service in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Service-object - properties: - ca_certificates: - items: - type: string - type: array - client_certificate: - description: Certificate represents a Certificate in Kong. Read - https://getkong.org/docs/0.14.x/admin-api/#certificate-object - properties: - cert: - type: string - created_at: - format: int64 - type: integer - id: - type: string - key: - type: string - snis: - items: - type: string - type: array - tags: - items: - type: string - type: array - type: object - connect_timeout: - type: integer - created_at: - type: integer - host: - type: string - id: - type: string - name: - type: string - path: - type: string - port: - type: integer - protocol: - type: string - read_timeout: - type: integer - retries: - type: integer - tags: - items: - type: string - type: array - tls_verify: - type: boolean - tls_verify_depth: - type: integer - updated_at: - type: integer - url: - type: string - write_timeout: - type: integer - type: object snis: items: type: string type: array - sources: - items: - description: CIDRPort represents a set of CIDR and a port. - properties: - ip: - type: string - port: - type: integer - type: object - type: array strip_path: type: boolean - tags: - items: - type: string - type: array - updated_at: - type: integer - type: object upstream: - description: Upstream represents an Upstream in Kong. properties: algorithm: + enum: + - round-robin + - consistent-hashing + - least-connections type: string - client_certificate: - description: Certificate represents a Certificate in Kong. Read https://getkong.org/docs/0.14.x/admin-api/#certificate-object - properties: - cert: - type: string - created_at: - format: int64 - type: integer - id: - type: string - key: - type: string - snis: - items: - type: string - type: array - tags: - items: - type: string - type: array - type: object - created_at: - format: int64 - type: integer hash_fallback: type: string hash_fallback_header: @@ -457,114 +334,95 @@ spec: hash_on_header: type: string healthchecks: - description: Healthcheck represents a health-check config of an upstream - in Kong. properties: active: - description: ActiveHealthcheck configures active health check - probing. properties: concurrency: + minimum: 1 type: integer healthy: - description: Healthy configures thresholds and HTTP status - codes to mark targets healthy for an upstream. properties: http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object http_path: + pattern: ^/.*$ type: string - https_sni: - type: string - https_verify_certificate: - type: boolean timeout: + minimum: 0 type: integer - type: - type: string unhealthy: - description: Unhealthy configures thresholds and HTTP status - codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer - timeouts: + timeout: + minimum: 0 type: integer type: object type: object passive: - description: PassiveHealthcheck configures passive checks around - passive health checks. properties: healthy: - description: Healthy configures thresholds and HTTP status - codes to mark targets healthy for an upstream. properties: http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object - type: - type: string unhealthy: - description: Unhealthy configures thresholds and HTTP status - codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer - timeouts: + timeout: + minimum: 0 type: integer type: object type: object threshold: - type: number + type: integer type: object host_header: type: string - id: - type: string - name: - type: string slots: + minimum: 10 type: integer - tags: - items: - type: string - type: array type: object - type: object - served: true - storage: true - subresources: - status: {} status: acceptedNames: kind: "" @@ -585,11 +443,30 @@ spec: kind: KongPlugin listKind: KongPluginList plural: kongplugins + shortNames: + - kp singular: kongplugin preserveUnknownFields: false scope: Namespaced versions: - - name: v1 + - additionalPrinterColumns: + - description: Name of the plugin + jsonPath: .plugin + name: Plugin-Type + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: Indicates if the plugin is disabled + jsonPath: .disabled + name: Disabled + type: boolean + - description: Configuration of the plugin + jsonPath: .config + name: Config + type: string + name: v1 schema: openAPIV3Schema: description: KongPlugin is the Schema for the kongplugins API @@ -601,6 +478,7 @@ spec: type: string config: description: Config contains the plugin configuration. + type: object x-kubernetes-preserve-unknown-fields: true configFrom: description: ConfigFrom references a secret containing the plugin configuration. @@ -638,6 +516,9 @@ spec: name: description: the secret containing the key type: string + required: + - key + - name type: object type: object consumerRef: @@ -660,13 +541,26 @@ spec: protocols: description: Protocols configures plugin to run on requests received on specific protocols. + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls items: type: string type: array run_on: description: RunOn configures the plugin to run on the first or the second or both nodes in case of a service mesh deployment. + enum: + - first + - second + - all type: string + required: + - plugin type: object served: true storage: true @@ -696,7 +590,16 @@ spec: preserveUnknownFields: false scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - description: Address of the load balancer + jsonPath: .status.loadBalancer.ingress[*].ip + name: Address + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 schema: openAPIV3Schema: description: TCPIngress is the Schema for the tcpingresses API @@ -732,6 +635,7 @@ spec: type: string servicePort: description: Specifies the port of the referenced service. + format: int32 type: integer required: - serviceName @@ -748,6 +652,7 @@ spec: over TCP sessions and route. It is a required field. If a Host is not specified, the requested are routed based only on Port. + format: int32 maximum: 65535 minimum: 1 type: integer @@ -870,7 +775,16 @@ spec: preserveUnknownFields: false scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - description: Address of the load balancer + jsonPath: .status.loadBalancer.ingress[*].ip + name: Address + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 schema: openAPIV3Schema: description: UDPIngress is the Schema for the udpingresses API @@ -906,6 +820,7 @@ spec: type: string servicePort: description: Specifies the port of the referenced service. + format: int32 type: integer required: - serviceName diff --git a/deploy/single-v2/all-in-one-postgres.yaml b/deploy/single-v2/all-in-one-postgres.yaml index fce4aa7aad..e941724fe4 100644 --- a/deploy/single-v2/all-in-one-postgres.yaml +++ b/deploy/single-v2/all-in-one-postgres.yaml @@ -16,11 +16,30 @@ spec: kind: KongClusterPlugin listKind: KongClusterPluginList plural: kongclusterplugins + shortNames: + - kcp singular: kongclusterplugin preserveUnknownFields: false scope: Cluster versions: - - name: v1 + - additionalPrinterColumns: + - description: Name of the plugin + jsonPath: .plugin + name: Plugin-Type + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: Indicates if the plugin is disabled + jsonPath: .disabled + name: Disabled + type: boolean + - description: Configuration of the plugin + jsonPath: .config + name: Config + type: string + name: v1 schema: openAPIV3Schema: description: KongClusterPlugin is the Schema for the kongclusterplugins API @@ -32,6 +51,7 @@ spec: type: string config: description: Config contains the plugin configuration. + type: object x-kubernetes-preserve-unknown-fields: true configFrom: description: ConfigFrom references a secret containing the plugin configuration. @@ -72,6 +92,10 @@ spec: namespace: description: The namespace containing the secret type: string + required: + - key + - name + - namespace type: object type: object consumerRef: @@ -94,13 +118,26 @@ spec: protocols: description: Protocols configures plugin to run on requests received on specific protocols. + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls items: type: string type: array run_on: description: RunOn configures the plugin to run on the first or the second or both nodes in case of a service mesh deployment. + enum: + - first + - second + - all type: string + required: + - plugin type: object served: true storage: true @@ -126,11 +163,22 @@ spec: kind: KongConsumer listKind: KongConsumerList plural: kongconsumers + shortNames: + - kc singular: kongconsumer preserveUnknownFields: false scope: Namespaced versions: - - name: v1 + - additionalPrinterColumns: + - description: Username of a Kong Consumer + jsonPath: .username + name: Username + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 schema: openAPIV3Schema: description: KongConsumer is the Schema for the kongconsumers API @@ -177,7 +225,6 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.6.2 - creationTimestamp: null name: kongingresses.configuration.konghq.com spec: group: configuration.konghq.com @@ -185,6 +232,8 @@ spec: kind: KongIngress listKind: KongIngressList plural: kongingresses + shortNames: + - ki singular: kongingress preserveUnknownFields: false scope: Namespaced @@ -192,258 +241,86 @@ spec: - name: v1 schema: openAPIV3Schema: - description: KongIngress is the Schema for the kongingresses 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 proxy: - description: Service represents a Service in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Service-object properties: - ca_certificates: - items: - type: string - type: array - client_certificate: - description: Certificate represents a Certificate in Kong. Read https://getkong.org/docs/0.14.x/admin-api/#certificate-object - properties: - cert: - type: string - created_at: - format: int64 - type: integer - id: - type: string - key: - type: string - snis: - items: - type: string - type: array - tags: - items: - type: string - type: array - type: object connect_timeout: + minimum: 0 type: integer - created_at: - type: integer - host: - type: string - id: - type: string - name: - type: string path: + pattern: ^/.*$ type: string - port: - type: integer protocol: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls type: string read_timeout: + minimum: 0 type: integer retries: + minimum: 0 type: integer - tags: - items: - type: string - type: array - tls_verify: - type: boolean - tls_verify_depth: - type: integer - updated_at: - type: integer - url: - type: string write_timeout: + minimum: 0 type: integer type: object route: - description: Route represents a Route in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Route-object properties: - created_at: - type: integer - destinations: - items: - description: CIDRPort represents a set of CIDR and a port. - properties: - ip: - type: string - port: - type: integer - type: object - type: array headers: additionalProperties: items: type: string type: array type: object - hosts: - items: - type: string - type: array https_redirect_status_code: type: integer - id: - type: string methods: items: type: string type: array - name: - type: string path_handling: + enum: + - v0 + - v1 type: string - paths: - items: - type: string - type: array preserve_host: type: boolean protocols: items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls type: string type: array regex_priority: type: integer request_buffering: - description: "Kong buffers requests and responses by default. Buffering - is not always desired, for instance if large payloads are being - proxied using HTTP 1.1 chunked encoding. \n The request and response - route buffering options are enabled by default and allow the user - to disable buffering if desired for their use case. \n SEE ALSO: - - https://github.com/Kong/kong/pull/6057 - https://docs.konghq.com/2.2.x/admin-api/#route-object" type: boolean response_buffering: type: boolean - service: - description: Service represents a Service in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Service-object - properties: - ca_certificates: - items: - type: string - type: array - client_certificate: - description: Certificate represents a Certificate in Kong. Read - https://getkong.org/docs/0.14.x/admin-api/#certificate-object - properties: - cert: - type: string - created_at: - format: int64 - type: integer - id: - type: string - key: - type: string - snis: - items: - type: string - type: array - tags: - items: - type: string - type: array - type: object - connect_timeout: - type: integer - created_at: - type: integer - host: - type: string - id: - type: string - name: - type: string - path: - type: string - port: - type: integer - protocol: - type: string - read_timeout: - type: integer - retries: - type: integer - tags: - items: - type: string - type: array - tls_verify: - type: boolean - tls_verify_depth: - type: integer - updated_at: - type: integer - url: - type: string - write_timeout: - type: integer - type: object snis: items: type: string type: array - sources: - items: - description: CIDRPort represents a set of CIDR and a port. - properties: - ip: - type: string - port: - type: integer - type: object - type: array strip_path: type: boolean - tags: - items: - type: string - type: array - updated_at: - type: integer - type: object upstream: - description: Upstream represents an Upstream in Kong. properties: algorithm: + enum: + - round-robin + - consistent-hashing + - least-connections type: string - client_certificate: - description: Certificate represents a Certificate in Kong. Read https://getkong.org/docs/0.14.x/admin-api/#certificate-object - properties: - cert: - type: string - created_at: - format: int64 - type: integer - id: - type: string - key: - type: string - snis: - items: - type: string - type: array - tags: - items: - type: string - type: array - type: object - created_at: - format: int64 - type: integer hash_fallback: type: string hash_fallback_header: @@ -457,114 +334,95 @@ spec: hash_on_header: type: string healthchecks: - description: Healthcheck represents a health-check config of an upstream - in Kong. properties: active: - description: ActiveHealthcheck configures active health check - probing. properties: concurrency: + minimum: 1 type: integer healthy: - description: Healthy configures thresholds and HTTP status - codes to mark targets healthy for an upstream. properties: http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object http_path: + pattern: ^/.*$ type: string - https_sni: - type: string - https_verify_certificate: - type: boolean timeout: + minimum: 0 type: integer - type: - type: string unhealthy: - description: Unhealthy configures thresholds and HTTP status - codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer - timeouts: + timeout: + minimum: 0 type: integer type: object type: object passive: - description: PassiveHealthcheck configures passive checks around - passive health checks. properties: healthy: - description: Healthy configures thresholds and HTTP status - codes to mark targets healthy for an upstream. properties: http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object - type: - type: string unhealthy: - description: Unhealthy configures thresholds and HTTP status - codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer - timeouts: + timeout: + minimum: 0 type: integer type: object type: object threshold: - type: number + type: integer type: object host_header: type: string - id: - type: string - name: - type: string slots: + minimum: 10 type: integer - tags: - items: - type: string - type: array type: object - type: object - served: true - storage: true - subresources: - status: {} status: acceptedNames: kind: "" @@ -585,11 +443,30 @@ spec: kind: KongPlugin listKind: KongPluginList plural: kongplugins + shortNames: + - kp singular: kongplugin preserveUnknownFields: false scope: Namespaced versions: - - name: v1 + - additionalPrinterColumns: + - description: Name of the plugin + jsonPath: .plugin + name: Plugin-Type + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: Indicates if the plugin is disabled + jsonPath: .disabled + name: Disabled + type: boolean + - description: Configuration of the plugin + jsonPath: .config + name: Config + type: string + name: v1 schema: openAPIV3Schema: description: KongPlugin is the Schema for the kongplugins API @@ -601,6 +478,7 @@ spec: type: string config: description: Config contains the plugin configuration. + type: object x-kubernetes-preserve-unknown-fields: true configFrom: description: ConfigFrom references a secret containing the plugin configuration. @@ -638,6 +516,9 @@ spec: name: description: the secret containing the key type: string + required: + - key + - name type: object type: object consumerRef: @@ -660,13 +541,26 @@ spec: protocols: description: Protocols configures plugin to run on requests received on specific protocols. + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls items: type: string type: array run_on: description: RunOn configures the plugin to run on the first or the second or both nodes in case of a service mesh deployment. + enum: + - first + - second + - all type: string + required: + - plugin type: object served: true storage: true @@ -696,7 +590,16 @@ spec: preserveUnknownFields: false scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - description: Address of the load balancer + jsonPath: .status.loadBalancer.ingress[*].ip + name: Address + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 schema: openAPIV3Schema: description: TCPIngress is the Schema for the tcpingresses API @@ -732,6 +635,7 @@ spec: type: string servicePort: description: Specifies the port of the referenced service. + format: int32 type: integer required: - serviceName @@ -748,6 +652,7 @@ spec: over TCP sessions and route. It is a required field. If a Host is not specified, the requested are routed based only on Port. + format: int32 maximum: 65535 minimum: 1 type: integer @@ -870,7 +775,16 @@ spec: preserveUnknownFields: false scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - description: Address of the load balancer + jsonPath: .status.loadBalancer.ingress[*].ip + name: Address + type: string + - description: Age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 schema: openAPIV3Schema: description: UDPIngress is the Schema for the udpingresses API @@ -906,6 +820,7 @@ spec: type: string servicePort: description: Specifies the port of the referenced service. + format: int32 type: integer required: - serviceName From c4dc85cba721cfd03c33d13199af1111cb375193 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Thu, 26 Aug 2021 16:47:17 -0700 Subject: [PATCH 06/10] refactor(apis) use pointers for plugin ConfigFrom Convert KongPlugin and KongClusterPlugin ConfigFrom fields from structs to pointers to structs. Currently, a struct field within another struct with the "omitempty" JSON serialization tag does not truly omit that field when empty. Instead, it creates an empty struct of that type. Ref: https://github.com/golang/go/issues/11939 This is at odds with required fields on optional object fields in a CRD schema. When present, KongPlugin.ConfigFrom is set, KongPlugin.ConfigFrom.secretKeyRef.name and KongPlugin.ConfigFrom.secretKeyRef.key must be set. An omitempty struct creates a KongPlugin.ConfigFrom == SecretValueFromSource{}, failing validation even though the user intent is to set Config instead. Using pointers to these structs avoids these behaviors; the fields are truly omitted. --- internal/admission/validator.go | 5 ++- internal/admission/validator_test.go | 4 +-- internal/kongstate/util.go | 18 ++++------- internal/kongstate/util_test.go | 12 +++---- internal/parser/parser_test.go | 32 +++++++++---------- .../v1/kongclusterplugin_types.go | 2 +- pkg/apis/configuration/v1/kongplugin_types.go | 2 +- .../configuration/v1/zz_generated.deepcopy.go | 12 +++++-- 8 files changed, 44 insertions(+), 43 deletions(-) diff --git a/internal/admission/validator.go b/internal/admission/validator.go index 7bd54f5f1d..f07f5c3400 100644 --- a/internal/admission/validator.go +++ b/internal/admission/validator.go @@ -69,17 +69,16 @@ func (validator KongHTTPValidator) ValidatePlugin(ctx context.Context, if err != nil { return false, ErrTextPluginConfigInvalid, err } - if k8sPlugin.ConfigFrom.SecretValue != (configurationv1.SecretValueFromSource{}) { + if k8sPlugin.ConfigFrom != nil { if len(plugin.Config) > 0 { return false, ErrTextPluginUsesBothConfigTypes, nil } config, err := kongstate.SecretToConfiguration(validator.SecretGetter, - k8sPlugin.ConfigFrom.SecretValue, k8sPlugin.Namespace) + (*k8sPlugin.ConfigFrom).SecretValue, k8sPlugin.Namespace) if err != nil { return false, ErrTextPluginSecretConfigUnretrievable, err } plugin.Config = config - } if k8sPlugin.RunOn != "" { plugin.RunOn = kong.String(k8sPlugin.RunOn) diff --git a/internal/admission/validator_test.go b/internal/admission/validator_test.go index 4a3228e213..9f404f05bf 100644 --- a/internal/admission/validator_test.go +++ b/internal/admission/validator_test.go @@ -325,7 +325,7 @@ func TestKongHTTPValidator_ValidatePlugin(t *testing.T) { Config: apiextensionsv1.JSON{ Raw: []byte(`{"key_names": "whatever"}`), }, - ConfigFrom: configurationv1.ConfigSource{ + ConfigFrom: &configurationv1.ConfigSource{ SecretValue: configurationv1.SecretValueFromSource{ Key: "key-auth-config", Secret: "conf-secret", @@ -343,7 +343,7 @@ func TestKongHTTPValidator_ValidatePlugin(t *testing.T) { args: args{ plugin: configurationv1.KongPlugin{ PluginName: "key-auth", - ConfigFrom: configurationv1.ConfigSource{ + ConfigFrom: &configurationv1.ConfigSource{ SecretValue: configurationv1.SecretValueFromSource{ Key: "key-auth-config", Secret: "conf-secret", diff --git a/internal/kongstate/util.go b/internal/kongstate/util.go index 4ff6a9f819..88e65c106c 100644 --- a/internal/kongstate/util.go +++ b/internal/kongstate/util.go @@ -90,19 +90,16 @@ func kongPluginFromK8SClusterPlugin( return kong.Plugin{}, fmt.Errorf("could not parse KongPlugin %v/%v config: %w", k8sPlugin.Namespace, k8sPlugin.Name, err) } - if k8sPlugin.ConfigFrom.SecretValue != - (configurationv1.NamespacedSecretValueFromSource{}) && - len(config) > 0 { + if k8sPlugin.ConfigFrom != nil && len(config) > 0 { return kong.Plugin{}, fmt.Errorf("KongClusterPlugin '/%v' has both "+ "Config and ConfigFrom set", k8sPlugin.Name) } - if k8sPlugin.ConfigFrom.SecretValue != (configurationv1. - NamespacedSecretValueFromSource{}) { + if k8sPlugin.ConfigFrom != nil { var err error config, err = namespacedSecretToConfiguration( s, - k8sPlugin.ConfigFrom.SecretValue) + (*k8sPlugin.ConfigFrom).SecretValue) if err != nil { return kong.Plugin{}, fmt.Errorf("error parsing config for KongClusterPlugin %v: %w", @@ -134,19 +131,16 @@ func kongPluginFromK8SPlugin( return kong.Plugin{}, fmt.Errorf("could not parse KongPlugin %v/%v config: %w", k8sPlugin.Namespace, k8sPlugin.Name, err) } - if k8sPlugin.ConfigFrom.SecretValue != - (configurationv1.SecretValueFromSource{}) && - len(config) > 0 { + if k8sPlugin.ConfigFrom != nil && len(config) > 0 { return kong.Plugin{}, fmt.Errorf("KongPlugin '%v/%v' has both "+ "Config and ConfigFrom set", k8sPlugin.Namespace, k8sPlugin.Name) } - if k8sPlugin.ConfigFrom.SecretValue != - (configurationv1.SecretValueFromSource{}) { + if k8sPlugin.ConfigFrom != nil { var err error config, err = SecretToConfiguration(s, - k8sPlugin.ConfigFrom.SecretValue, k8sPlugin.Namespace) + (*k8sPlugin.ConfigFrom).SecretValue, k8sPlugin.Namespace) if err != nil { return kong.Plugin{}, fmt.Errorf("error parsing config for KongPlugin '%v/%v': %w", diff --git a/internal/kongstate/util_test.go b/internal/kongstate/util_test.go index c223d5bd34..ec76a9e1bd 100644 --- a/internal/kongstate/util_test.go +++ b/internal/kongstate/util_test.go @@ -63,7 +63,7 @@ func TestKongPluginFromK8SClusterPlugin(t *testing.T) { plugin: configurationv1.KongClusterPlugin{ Protocols: []string{"http"}, PluginName: "correlation-id", - ConfigFrom: configurationv1.NamespacedConfigSource{ + ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ Key: "correlation-id-config", Secret: "conf-secret", @@ -87,7 +87,7 @@ func TestKongPluginFromK8SClusterPlugin(t *testing.T) { plugin: configurationv1.KongClusterPlugin{ Protocols: []string{"http"}, PluginName: "correlation-id", - ConfigFrom: configurationv1.NamespacedConfigSource{ + ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ Key: "correlation-id-config", Secret: "missing", @@ -122,7 +122,7 @@ func TestKongPluginFromK8SClusterPlugin(t *testing.T) { Config: apiextensionsv1.JSON{ Raw: []byte(`{"header_name": "foo"}`), }, - ConfigFrom: configurationv1.NamespacedConfigSource{ + ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ Key: "correlation-id-config", Secret: "conf-secret", @@ -201,7 +201,7 @@ func TestKongPluginFromK8SPlugin(t *testing.T) { }, Protocols: []string{"http"}, PluginName: "correlation-id", - ConfigFrom: configurationv1.ConfigSource{ + ConfigFrom: &configurationv1.ConfigSource{ SecretValue: configurationv1.SecretValueFromSource{ Key: "correlation-id-config", Secret: "conf-secret", @@ -228,7 +228,7 @@ func TestKongPluginFromK8SPlugin(t *testing.T) { }, Protocols: []string{"http"}, PluginName: "correlation-id", - ConfigFrom: configurationv1.ConfigSource{ + ConfigFrom: &configurationv1.ConfigSource{ SecretValue: configurationv1.SecretValueFromSource{ Key: "correlation-id-config", Secret: "missing", @@ -262,7 +262,7 @@ func TestKongPluginFromK8SPlugin(t *testing.T) { Config: apiextensionsv1.JSON{ Raw: []byte(`{"header_name": "foo"}`), }, - ConfigFrom: configurationv1.ConfigSource{ + ConfigFrom: &configurationv1.ConfigSource{ SecretValue: configurationv1.SecretValueFromSource{ Key: "correlation-id-config", Secret: "conf-secret", diff --git a/internal/parser/parser_test.go b/internal/parser/parser_test.go index 3e50b11783..3e495674c7 100644 --- a/internal/parser/parser_test.go +++ b/internal/parser/parser_test.go @@ -364,7 +364,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { Namespace: "default", }, PluginName: "jwt", - ConfigFrom: configurationv1.ConfigSource{ + ConfigFrom: &configurationv1.ConfigSource{ SecretValue: configurationv1.SecretValueFromSource{ Key: "jwt-config", Secret: "conf-secret", @@ -385,7 +385,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { }, Protocols: []string{"http"}, PluginName: "basic-auth", - ConfigFrom: configurationv1.NamespacedConfigSource{ + ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ Key: "basic-auth-config", Secret: "conf-secret", @@ -405,7 +405,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { }, Protocols: []string{"http"}, PluginName: "basic-auth", - ConfigFrom: configurationv1.NamespacedConfigSource{ + ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ Key: "basic-auth-config", Secret: "conf-secret", @@ -419,7 +419,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { }, Protocols: []string{"http"}, PluginName: "basic-auth", - ConfigFrom: configurationv1.NamespacedConfigSource{ + ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ Key: "basic-auth-config", Secret: "conf-secret", @@ -478,7 +478,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { }, }, PluginName: "jwt", - ConfigFrom: configurationv1.ConfigSource{ + ConfigFrom: &configurationv1.ConfigSource{ SecretValue: configurationv1.SecretValueFromSource{ Key: "missing-key", Secret: "conf-secret", @@ -491,7 +491,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { Namespace: "default", }, PluginName: "jwt", - ConfigFrom: configurationv1.ConfigSource{ + ConfigFrom: &configurationv1.ConfigSource{ SecretValue: configurationv1.SecretValueFromSource{ Key: "missing-key", Secret: "conf-secret", @@ -509,7 +509,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { }, Protocols: []string{"http"}, PluginName: "basic-auth", - ConfigFrom: configurationv1.NamespacedConfigSource{ + ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ Key: "basic-auth-config", Secret: "missing-secret", @@ -523,7 +523,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { }, Protocols: []string{"http"}, PluginName: "basic-auth", - ConfigFrom: configurationv1.NamespacedConfigSource{ + ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ Key: "basic-auth-config", Secret: "missing-secret", @@ -570,7 +570,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { Config: apiextensionsv1.JSON{ Raw: []byte(`{"fake": true}`), }, - ConfigFrom: configurationv1.ConfigSource{ + ConfigFrom: &configurationv1.ConfigSource{ SecretValue: configurationv1.SecretValueFromSource{ Key: "jwt-config", Secret: "conf-secret", @@ -586,7 +586,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { Config: apiextensionsv1.JSON{ Raw: []byte(`{"fake": true}`), }, - ConfigFrom: configurationv1.ConfigSource{ + ConfigFrom: &configurationv1.ConfigSource{ SecretValue: configurationv1.SecretValueFromSource{ Key: "jwt-config", Secret: "conf-secret", @@ -607,7 +607,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { Config: apiextensionsv1.JSON{ Raw: []byte(`{"fake": true}`), }, - ConfigFrom: configurationv1.NamespacedConfigSource{ + ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ Key: "basic-auth-config", Secret: "conf-secret", @@ -624,7 +624,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { Config: apiextensionsv1.JSON{ Raw: []byte(`{"fake": true}`), }, - ConfigFrom: configurationv1.NamespacedConfigSource{ + ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ Key: "basic-auth-config", Secret: "conf-secret", @@ -728,7 +728,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { }, }, PluginName: "jwt", - ConfigFrom: configurationv1.ConfigSource{ + ConfigFrom: &configurationv1.ConfigSource{ SecretValue: configurationv1.SecretValueFromSource{ Key: "missing-key", Secret: "conf-secret", @@ -741,7 +741,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { Namespace: "default", }, PluginName: "jwt", - ConfigFrom: configurationv1.ConfigSource{ + ConfigFrom: &configurationv1.ConfigSource{ SecretValue: configurationv1.SecretValueFromSource{ Key: "missing-key", Secret: "conf-secret", @@ -759,7 +759,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { }, Protocols: []string{"http"}, PluginName: "basic-auth", - ConfigFrom: configurationv1.NamespacedConfigSource{ + ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ Key: "basic-auth-config", Secret: "missing-secret", @@ -773,7 +773,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { }, Protocols: []string{"http"}, PluginName: "basic-auth", - ConfigFrom: configurationv1.NamespacedConfigSource{ + ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ Key: "basic-auth-config", Secret: "missing-secret", diff --git a/pkg/apis/configuration/v1/kongclusterplugin_types.go b/pkg/apis/configuration/v1/kongclusterplugin_types.go index 3bc8d77374..49b6017c03 100644 --- a/pkg/apis/configuration/v1/kongclusterplugin_types.go +++ b/pkg/apis/configuration/v1/kongclusterplugin_types.go @@ -50,7 +50,7 @@ type KongClusterPlugin struct { Config apiextensionsv1.JSON `json:"config,omitempty"` // ConfigFrom references a secret containing the plugin configuration. - ConfigFrom NamespacedConfigSource `json:"configFrom,omitempty"` + ConfigFrom *NamespacedConfigSource `json:"configFrom,omitempty"` // PluginName is the name of the plugin to which to apply the config //+kubebuilder:validation:Required diff --git a/pkg/apis/configuration/v1/kongplugin_types.go b/pkg/apis/configuration/v1/kongplugin_types.go index 6519e59093..5b18581229 100644 --- a/pkg/apis/configuration/v1/kongplugin_types.go +++ b/pkg/apis/configuration/v1/kongplugin_types.go @@ -49,7 +49,7 @@ type KongPlugin struct { Config apiextensionsv1.JSON `json:"config,omitempty"` // ConfigFrom references a secret containing the plugin configuration. - ConfigFrom ConfigSource `json:"configFrom,omitempty"` + ConfigFrom *ConfigSource `json:"configFrom,omitempty"` // PluginName is the name of the plugin to which to apply the config //+kubebuilder:validation:Required diff --git a/pkg/apis/configuration/v1/zz_generated.deepcopy.go b/pkg/apis/configuration/v1/zz_generated.deepcopy.go index f619da8198..ce83a304f3 100644 --- a/pkg/apis/configuration/v1/zz_generated.deepcopy.go +++ b/pkg/apis/configuration/v1/zz_generated.deepcopy.go @@ -56,7 +56,11 @@ func (in *KongClusterPlugin) DeepCopyInto(out *KongClusterPlugin) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Config.DeepCopyInto(&out.Config) - out.ConfigFrom = in.ConfigFrom + if in.ConfigFrom != nil { + in, out := &in.ConfigFrom, &out.ConfigFrom + *out = new(NamespacedConfigSource) + **out = **in + } if in.Protocols != nil { in, out := &in.Protocols, &out.Protocols *out = make([]string, len(*in)) @@ -254,7 +258,11 @@ func (in *KongPlugin) DeepCopyInto(out *KongPlugin) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Config.DeepCopyInto(&out.Config) - out.ConfigFrom = in.ConfigFrom + if in.ConfigFrom != nil { + in, out := &in.ConfigFrom, &out.ConfigFrom + *out = new(ConfigSource) + **out = **in + } if in.Protocols != nil { in, out := &in.Protocols, &out.Protocols *out = make([]string, len(*in)) From 452b2a7fdcef477b58a2372e72969ff9ef2fa516 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Thu, 26 Aug 2021 17:08:51 -0700 Subject: [PATCH 07/10] pr(apis) update validation --- .../crd/bases/configuration.konghq.com_kongclusterplugins.yaml | 1 + config/crd/bases/configuration.konghq.com_kongplugins.yaml | 1 + config/crd/bases/configuration.konghq.com_tcpingresses.yaml | 2 ++ config/crd/bases/configuration.konghq.com_udpingresses.yaml | 2 ++ pkg/apis/configuration/v1/kongclusterplugin_types.go | 2 +- pkg/apis/configuration/v1/kongplugin_types.go | 2 +- pkg/apis/configuration/v1beta1/ingress_rules.go | 2 ++ 7 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml index 4335e2401e..28f7ce054c 100644 --- a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml @@ -122,6 +122,7 @@ spec: - grpcs - tcp - tls + - udp items: type: string type: array diff --git a/config/crd/bases/configuration.konghq.com_kongplugins.yaml b/config/crd/bases/configuration.konghq.com_kongplugins.yaml index 79501aed53..89e952c7e7 100644 --- a/config/crd/bases/configuration.konghq.com_kongplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongplugins.yaml @@ -118,6 +118,7 @@ spec: - grpcs - tcp - tls + - udp items: type: string type: array diff --git a/config/crd/bases/configuration.konghq.com_tcpingresses.yaml b/config/crd/bases/configuration.konghq.com_tcpingresses.yaml index bc8cfcb5b9..357c098b95 100644 --- a/config/crd/bases/configuration.konghq.com_tcpingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_tcpingresses.yaml @@ -63,6 +63,8 @@ spec: servicePort: description: Specifies the port of the referenced service. format: int32 + maximum: 65535 + minimum: 1 type: integer required: - serviceName diff --git a/config/crd/bases/configuration.konghq.com_udpingresses.yaml b/config/crd/bases/configuration.konghq.com_udpingresses.yaml index 51bb0b680c..33a41d73e2 100644 --- a/config/crd/bases/configuration.konghq.com_udpingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_udpingresses.yaml @@ -63,6 +63,8 @@ spec: servicePort: description: Specifies the port of the referenced service. format: int32 + maximum: 65535 + minimum: 1 type: integer required: - serviceName diff --git a/pkg/apis/configuration/v1/kongclusterplugin_types.go b/pkg/apis/configuration/v1/kongclusterplugin_types.go index 49b6017c03..0829434400 100644 --- a/pkg/apis/configuration/v1/kongclusterplugin_types.go +++ b/pkg/apis/configuration/v1/kongclusterplugin_types.go @@ -63,7 +63,7 @@ type KongClusterPlugin struct { // Protocols configures plugin to run on requests received on specific // protocols. - //+kubebuilder:validation:Enum=http;https;grpc;grpcs;tcp;tls + //+kubebuilder:validation:Enum=http;https;grpc;grpcs;tcp;tls;udp Protocols []string `json:"protocols,omitempty"` } diff --git a/pkg/apis/configuration/v1/kongplugin_types.go b/pkg/apis/configuration/v1/kongplugin_types.go index 5b18581229..26a4d19fbb 100644 --- a/pkg/apis/configuration/v1/kongplugin_types.go +++ b/pkg/apis/configuration/v1/kongplugin_types.go @@ -62,7 +62,7 @@ type KongPlugin struct { // Protocols configures plugin to run on requests received on specific // protocols. - //+kubebuilder:validation:Enum=http;https;grpc;grpcs;tcp;tls + //+kubebuilder:validation:Enum=http;https;grpc;grpcs;tcp;tls;udp Protocols []string `json:"protocols,omitempty"` } diff --git a/pkg/apis/configuration/v1beta1/ingress_rules.go b/pkg/apis/configuration/v1beta1/ingress_rules.go index e4237aa7df..cd261524f6 100644 --- a/pkg/apis/configuration/v1beta1/ingress_rules.go +++ b/pkg/apis/configuration/v1beta1/ingress_rules.go @@ -53,6 +53,8 @@ type IngressBackend struct { ServiceName string `json:"serviceName"` // Specifies the port of the referenced service. + // +kubebuilder:validation:Minimum=1 + // +kubebuilder:validation:Maximum=65535 // +kubebuilder:validation:Format=int32 // +kubebuilder:validation:Required ServicePort int `json:"servicePort"` From 8a06c8410ce0e8f33ff323617c31d9bc5b5fd2b4 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Thu, 26 Aug 2021 17:09:20 -0700 Subject: [PATCH 08/10] chore(deploy) generate manifests --- deploy/single-v2/all-in-one-dbless.yaml | 6 ++++++ deploy/single-v2/all-in-one-enterprise-dbless.yaml | 6 ++++++ deploy/single-v2/all-in-one-enterprise-postgres.yaml | 6 ++++++ deploy/single-v2/all-in-one-postgres.yaml | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/deploy/single-v2/all-in-one-dbless.yaml b/deploy/single-v2/all-in-one-dbless.yaml index 4557a791ae..982b2249be 100644 --- a/deploy/single-v2/all-in-one-dbless.yaml +++ b/deploy/single-v2/all-in-one-dbless.yaml @@ -125,6 +125,7 @@ spec: - grpcs - tcp - tls + - udp items: type: string type: array @@ -548,6 +549,7 @@ spec: - grpcs - tcp - tls + - udp items: type: string type: array @@ -636,6 +638,8 @@ spec: servicePort: description: Specifies the port of the referenced service. format: int32 + maximum: 65535 + minimum: 1 type: integer required: - serviceName @@ -821,6 +825,8 @@ spec: servicePort: description: Specifies the port of the referenced service. format: int32 + maximum: 65535 + minimum: 1 type: integer required: - serviceName diff --git a/deploy/single-v2/all-in-one-enterprise-dbless.yaml b/deploy/single-v2/all-in-one-enterprise-dbless.yaml index 3c7eb33962..ee3f434de7 100644 --- a/deploy/single-v2/all-in-one-enterprise-dbless.yaml +++ b/deploy/single-v2/all-in-one-enterprise-dbless.yaml @@ -125,6 +125,7 @@ spec: - grpcs - tcp - tls + - udp items: type: string type: array @@ -548,6 +549,7 @@ spec: - grpcs - tcp - tls + - udp items: type: string type: array @@ -636,6 +638,8 @@ spec: servicePort: description: Specifies the port of the referenced service. format: int32 + maximum: 65535 + minimum: 1 type: integer required: - serviceName @@ -821,6 +825,8 @@ spec: servicePort: description: Specifies the port of the referenced service. format: int32 + maximum: 65535 + minimum: 1 type: integer required: - serviceName diff --git a/deploy/single-v2/all-in-one-enterprise-postgres.yaml b/deploy/single-v2/all-in-one-enterprise-postgres.yaml index 00f53c0721..7d7fe78813 100644 --- a/deploy/single-v2/all-in-one-enterprise-postgres.yaml +++ b/deploy/single-v2/all-in-one-enterprise-postgres.yaml @@ -125,6 +125,7 @@ spec: - grpcs - tcp - tls + - udp items: type: string type: array @@ -548,6 +549,7 @@ spec: - grpcs - tcp - tls + - udp items: type: string type: array @@ -636,6 +638,8 @@ spec: servicePort: description: Specifies the port of the referenced service. format: int32 + maximum: 65535 + minimum: 1 type: integer required: - serviceName @@ -821,6 +825,8 @@ spec: servicePort: description: Specifies the port of the referenced service. format: int32 + maximum: 65535 + minimum: 1 type: integer required: - serviceName diff --git a/deploy/single-v2/all-in-one-postgres.yaml b/deploy/single-v2/all-in-one-postgres.yaml index e941724fe4..f39a82103f 100644 --- a/deploy/single-v2/all-in-one-postgres.yaml +++ b/deploy/single-v2/all-in-one-postgres.yaml @@ -125,6 +125,7 @@ spec: - grpcs - tcp - tls + - udp items: type: string type: array @@ -548,6 +549,7 @@ spec: - grpcs - tcp - tls + - udp items: type: string type: array @@ -636,6 +638,8 @@ spec: servicePort: description: Specifies the port of the referenced service. format: int32 + maximum: 65535 + minimum: 1 type: integer required: - serviceName @@ -821,6 +825,8 @@ spec: servicePort: description: Specifies the port of the referenced service. format: int32 + maximum: 65535 + minimum: 1 type: integer required: - serviceName From 234be1b535f2c13cf4c58ec9002d14ac1f5a2283 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Fri, 27 Aug 2021 10:47:05 -0700 Subject: [PATCH 09/10] feat(crd) add printer priorities --- .../bases/configuration.konghq.com_kongclusterplugins.yaml | 2 ++ config/crd/bases/configuration.konghq.com_kongplugins.yaml | 2 ++ pkg/apis/configuration/v1/kongclusterplugin_types.go | 4 ++-- pkg/apis/configuration/v1/kongplugin_types.go | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml index 28f7ce054c..7ac524f534 100644 --- a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml @@ -31,10 +31,12 @@ spec: - description: Indicates if the plugin is disabled jsonPath: .disabled name: Disabled + priority: 1 type: boolean - description: Configuration of the plugin jsonPath: .config name: Config + priority: 1 type: string name: v1 schema: diff --git a/config/crd/bases/configuration.konghq.com_kongplugins.yaml b/config/crd/bases/configuration.konghq.com_kongplugins.yaml index 89e952c7e7..73a8c2b844 100644 --- a/config/crd/bases/configuration.konghq.com_kongplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongplugins.yaml @@ -31,10 +31,12 @@ spec: - description: Indicates if the plugin is disabled jsonPath: .disabled name: Disabled + priority: 1 type: boolean - description: Configuration of the plugin jsonPath: .config name: Config + priority: 1 type: string name: v1 schema: diff --git a/pkg/apis/configuration/v1/kongclusterplugin_types.go b/pkg/apis/configuration/v1/kongclusterplugin_types.go index 0829434400..689738841a 100644 --- a/pkg/apis/configuration/v1/kongclusterplugin_types.go +++ b/pkg/apis/configuration/v1/kongclusterplugin_types.go @@ -31,8 +31,8 @@ import ( //+kubebuilder:validation:Optional //+kubebuilder:printcolumn:name="Plugin-Type",type=string,JSONPath=`.plugin`,description="Name of the plugin" //+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" -//+kubebuilder:printcolumn:name="Disabled",type=boolean,JSONPath=`.disabled`,description="Indicates if the plugin is disabled" -//+kubebuilder:printcolumn:name="Config",type=string,JSONPath=`.config`,description="Configuration of the plugin" +//+kubebuilder:printcolumn:name="Disabled",type=boolean,JSONPath=`.disabled`,description="Indicates if the plugin is disabled",priority=1 +//+kubebuilder:printcolumn:name="Config",type=string,JSONPath=`.config`,description="Configuration of the plugin",priority=1 // KongClusterPlugin is the Schema for the kongclusterplugins API type KongClusterPlugin struct { diff --git a/pkg/apis/configuration/v1/kongplugin_types.go b/pkg/apis/configuration/v1/kongplugin_types.go index 26a4d19fbb..096ef2e461 100644 --- a/pkg/apis/configuration/v1/kongplugin_types.go +++ b/pkg/apis/configuration/v1/kongplugin_types.go @@ -30,8 +30,8 @@ import ( //+kubebuilder:validation:Optional //+kubebuilder:printcolumn:name="Plugin-Type",type=string,JSONPath=`.plugin`,description="Name of the plugin" //+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" -//+kubebuilder:printcolumn:name="Disabled",type=boolean,JSONPath=`.disabled`,description="Indicates if the plugin is disabled" -//+kubebuilder:printcolumn:name="Config",type=string,JSONPath=`.config`,description="Configuration of the plugin" +//+kubebuilder:printcolumn:name="Disabled",type=boolean,JSONPath=`.disabled`,description="Indicates if the plugin is disabled",priority=1 +//+kubebuilder:printcolumn:name="Config",type=string,JSONPath=`.config`,description="Configuration of the plugin",priority=1 // KongPlugin is the Schema for the kongplugins API type KongPlugin struct { From f9a6a883d90952b6859fd4009ee6af060f882497 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Fri, 27 Aug 2021 10:47:23 -0700 Subject: [PATCH 10/10] chore(deploy) rebuild single manifests --- deploy/single-v2/all-in-one-dbless.yaml | 4 ++++ deploy/single-v2/all-in-one-enterprise-dbless.yaml | 4 ++++ deploy/single-v2/all-in-one-enterprise-postgres.yaml | 4 ++++ deploy/single-v2/all-in-one-postgres.yaml | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/deploy/single-v2/all-in-one-dbless.yaml b/deploy/single-v2/all-in-one-dbless.yaml index 982b2249be..0ebe51c399 100644 --- a/deploy/single-v2/all-in-one-dbless.yaml +++ b/deploy/single-v2/all-in-one-dbless.yaml @@ -34,10 +34,12 @@ spec: - description: Indicates if the plugin is disabled jsonPath: .disabled name: Disabled + priority: 1 type: boolean - description: Configuration of the plugin jsonPath: .config name: Config + priority: 1 type: string name: v1 schema: @@ -462,10 +464,12 @@ spec: - description: Indicates if the plugin is disabled jsonPath: .disabled name: Disabled + priority: 1 type: boolean - description: Configuration of the plugin jsonPath: .config name: Config + priority: 1 type: string name: v1 schema: diff --git a/deploy/single-v2/all-in-one-enterprise-dbless.yaml b/deploy/single-v2/all-in-one-enterprise-dbless.yaml index ee3f434de7..4130923490 100644 --- a/deploy/single-v2/all-in-one-enterprise-dbless.yaml +++ b/deploy/single-v2/all-in-one-enterprise-dbless.yaml @@ -34,10 +34,12 @@ spec: - description: Indicates if the plugin is disabled jsonPath: .disabled name: Disabled + priority: 1 type: boolean - description: Configuration of the plugin jsonPath: .config name: Config + priority: 1 type: string name: v1 schema: @@ -462,10 +464,12 @@ spec: - description: Indicates if the plugin is disabled jsonPath: .disabled name: Disabled + priority: 1 type: boolean - description: Configuration of the plugin jsonPath: .config name: Config + priority: 1 type: string name: v1 schema: diff --git a/deploy/single-v2/all-in-one-enterprise-postgres.yaml b/deploy/single-v2/all-in-one-enterprise-postgres.yaml index 7d7fe78813..75329354d6 100644 --- a/deploy/single-v2/all-in-one-enterprise-postgres.yaml +++ b/deploy/single-v2/all-in-one-enterprise-postgres.yaml @@ -34,10 +34,12 @@ spec: - description: Indicates if the plugin is disabled jsonPath: .disabled name: Disabled + priority: 1 type: boolean - description: Configuration of the plugin jsonPath: .config name: Config + priority: 1 type: string name: v1 schema: @@ -462,10 +464,12 @@ spec: - description: Indicates if the plugin is disabled jsonPath: .disabled name: Disabled + priority: 1 type: boolean - description: Configuration of the plugin jsonPath: .config name: Config + priority: 1 type: string name: v1 schema: diff --git a/deploy/single-v2/all-in-one-postgres.yaml b/deploy/single-v2/all-in-one-postgres.yaml index f39a82103f..add59e385e 100644 --- a/deploy/single-v2/all-in-one-postgres.yaml +++ b/deploy/single-v2/all-in-one-postgres.yaml @@ -34,10 +34,12 @@ spec: - description: Indicates if the plugin is disabled jsonPath: .disabled name: Disabled + priority: 1 type: boolean - description: Configuration of the plugin jsonPath: .config name: Config + priority: 1 type: string name: v1 schema: @@ -462,10 +464,12 @@ spec: - description: Indicates if the plugin is disabled jsonPath: .disabled name: Disabled + priority: 1 type: boolean - description: Configuration of the plugin jsonPath: .config name: Config + priority: 1 type: string name: v1 schema: