diff --git a/Makefile b/Makefile index a9e797b6a8..c69adfa63c 100644 --- a/Makefile +++ b/Makefile @@ -224,7 +224,7 @@ ns1-secret: .PHONY: install install: $(call manifest) - $(KUSTOMIZE_PATH) build config/crd | kubectl apply -f - + kubectl apply -f chart/k8gb/templates/k8gb.absa.oss_gslbs.yaml # run all linters from .golangci.yaml; see: https://golangci-lint.run/usage/install/#local-installation .PHONY: lint @@ -410,7 +410,7 @@ define generate endef define manifest - $(call controller-gen,crd:crdVersions=v1 paths="./..." output:crd:artifacts:config=config/crd/bases) + $(call controller-gen,crd:crdVersions=v1 paths="./..." output:crd:artifacts:config=chart/k8gb/templates/) endef # function retrieves controller-gen path or installs controller-gen@v3.0.0 and retrieve new path in case it is not installed diff --git a/config/crd/bases/k8gb.absa.oss_gslbs.yaml b/chart/k8gb/templates/k8gb.absa.oss_gslbs.yaml similarity index 100% rename from config/crd/bases/k8gb.absa.oss_gslbs.yaml rename to chart/k8gb/templates/k8gb.absa.oss_gslbs.yaml diff --git a/chart/k8gb/templates/k8gb.absa.oss_gslbs_crd.yaml b/chart/k8gb/templates/k8gb.absa.oss_gslbs_crd.yaml deleted file mode 100644 index 2abd4db00f..0000000000 --- a/chart/k8gb/templates/k8gb.absa.oss_gslbs_crd.yaml +++ /dev/null @@ -1,221 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: gslbs.k8gb.absa.oss -spec: - group: k8gb.absa.oss - names: - kind: Gslb - listKind: GslbList - plural: gslbs - singular: gslb - scope: Namespaced - subresources: - status: {} - validation: - openAPIV3Schema: - description: Gslb is the Schema for the gslbs API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: GslbSpec defines the desired state of Gslb - properties: - ingress: - description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - Important: Run "operator-sdk generate k8s" to regenerate code after - modifying this file Add custom validation using kubebuilder tags: - https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html' - properties: - backend: - description: A default backend capable of servicing requests that - don't match any rule. At least one of 'backend' or 'rules' must - be specified. This field is optional to allow the loadbalancer - controller or defaulting logic to specify a global default. - properties: - serviceName: - description: Specifies the name of the referenced service. - type: string - servicePort: - anyOf: - - type: integer - - type: string - description: Specifies the port of the referenced service. - x-kubernetes-int-or-string: true - required: - - serviceName - - servicePort - type: object - rules: - description: A list of host rules used to configure the Ingress. - If unspecified, or no rule matches, all traffic is sent to the - default backend. - items: - description: IngressRule represents the rules mapping the paths - under a specified host to the related backend services. Incoming - requests are first evaluated for a host match, then routed to - the backend associated with the matching IngressRuleValue. - required: - - "http" - properties: - host: - description: "Host is the fully qualified domain name of a - network host, as defined by RFC 3986. Note the following - deviations from the \"host\" part of the URI as defined - in the RFC: 1. IPs are not allowed. Currently an IngressRuleValue - can only apply to the \t IP in the Spec of the parent Ingress. - 2. The `:` delimiter is not respected because ports are - not allowed. \t Currently the port of an Ingress is implicitly - :80 for http and \t :443 for https. Both these may change - in the future. Incoming requests are matched against the - host before the IngressRuleValue. If the host is unspecified, - the Ingress routes all traffic based on the specified IngressRuleValue." - type: string - http: - description: 'HTTPIngressRuleValue is a list of http selectors - pointing to backends. In the example: http:///? - -> backend where where parts of the url correspond to RFC - 3986, this resource will be used to match against everything - after the last ''/'' and before the first ''?'' or ''#''.' - required: - - "paths" - properties: - paths: - description: A collection of paths that map requests to - backends. - items: - description: HTTPIngressPath associates a path regex - with a backend. Incoming urls matching the path are - forwarded to the backend. - properties: - backend: - description: Backend defines the referenced service - endpoint to which the traffic will be forwarded - to. - properties: - serviceName: - description: Specifies the name of the referenced - service. - type: string - servicePort: - anyOf: - - type: integer - - type: string - description: Specifies the port of the referenced - service. - x-kubernetes-int-or-string: true - required: - - serviceName - - servicePort - type: object - path: - description: Path is an extended POSIX regex as - defined by IEEE Std 1003.1, (i.e this follows - the egrep/unix syntax, not the perl syntax) matched - against the path of an incoming request. Currently - it can contain characters disallowed from the - conventional "path" part of a URL as defined by - RFC 3986. Paths must begin with a '/'. If unspecified, - the path defaults to a catch all sending traffic - to the backend. - type: string - required: - - backend - type: object - type: array - required: - - paths - type: object - type: object - type: array - tls: - description: TLS configuration. Currently the Ingress only supports - a single TLS port, 443. If multiple members of this list specify - different hosts, they will be multiplexed on the same port according - to the hostname specified through the SNI TLS extension, if the - ingress controller fulfilling the ingress supports SNI. - items: - description: IngressTLS describes the transport layer security - associated with an Ingress. - properties: - hosts: - description: Hosts are a list of hosts included in the TLS - certificate. The values in this list must match the name/s - used in the tlsSecret. Defaults to the wildcard host setting - for the loadbalancer controller fulfilling this Ingress, - if left unspecified. - items: - type: string - type: array - secretName: - description: SecretName is the name of the secret used to - terminate SSL traffic on 443. Field is left optional to - allow SSL routing based on SNI hostname alone. If the SNI - host in a listener conflicts with the "Host" header field - used by an IngressRule, the SNI host is used for termination - and value of the Host header is used for routing. - type: string - type: object - type: array - type: object - strategy: - description: Strategy defines Gslb behavior - properties: - dnsTtlSeconds: - description: Defines DNS record TTL in seconds - type: integer - primaryGeoTag: - type: string - splitBrainThresholdSeconds: - description: Split brain TXT record expiration in seconds - type: integer - type: - type: string - required: - - type - type: object - required: - - ingress - - strategy - type: object - status: - description: GslbStatus defines the observed state of Gslb - properties: - geoTag: - description: cluster Geo Tag to help determine where the operator runs - type: string - healthyRecords: - additionalProperties: - items: - type: string - type: array - type: object - serviceHealth: - additionalProperties: - type: string - description: 'INSERT ADDITIONAL STATUS FIELD - define observed state - of cluster Important: Run "operator-sdk generate k8s" to regenerate - code after modifying this file Add custom validation using kubebuilder - tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html' - type: object - required: - - geoTag - - healthyRecords - - serviceHealth - type: object - type: object - version: v1beta1 - versions: - - name: v1beta1 - served: true - storage: true diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml deleted file mode 100644 index 1b7298ce22..0000000000 --- a/config/crd/kustomization.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# This kustomization.yaml is not intended to be run by itself, -# since it depends on service name and namespace that are out of this kustomize package. -# It should be run by config/default -resources: -- bases/k8gb.absa.oss_gslbs.yaml -# +kubebuilder:scaffold:crdkustomizeresource - -patchesStrategicMerge: -# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. -# patches here are for enabling the conversion webhook for each CRD -#- patches/webhook_in_gslbs.yaml -# +kubebuilder:scaffold:crdkustomizewebhookpatch - -# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix. -# patches here are for enabling the CA injection for each CRD -#- patches/cainjection_in_gslbs.yaml -# +kubebuilder:scaffold:crdkustomizecainjectionpatch - -# the following config is for teaching kustomize how to do kustomization for CRDs. -configurations: -- kustomizeconfig.yaml diff --git a/config/crd/kustomizeconfig.yaml b/config/crd/kustomizeconfig.yaml deleted file mode 100644 index 6f83d9a94b..0000000000 --- a/config/crd/kustomizeconfig.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# This file is for teaching kustomize how to substitute name and namespace reference in CRD -nameReference: -- kind: Service - version: v1 - fieldSpecs: - - kind: CustomResourceDefinition - group: apiextensions.k8s.io - path: spec/conversion/webhookClientConfig/service/name - -namespace: -- kind: CustomResourceDefinition - group: apiextensions.k8s.io - path: spec/conversion/webhookClientConfig/service/namespace - create: false - -varReference: -- path: metadata/annotations diff --git a/config/crd/patches/cainjection_in_gslbs.yaml b/config/crd/patches/cainjection_in_gslbs.yaml deleted file mode 100644 index 6fab3ff9ea..0000000000 --- a/config/crd/patches/cainjection_in_gslbs.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# The following patch adds a directive for certmanager to inject CA into the CRD -# CRD conversion requires k8s 1.13 or later. -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - annotations: - cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) - name: gslbs.k8gb.absa.oss diff --git a/config/crd/patches/webhook_in_gslbs.yaml b/config/crd/patches/webhook_in_gslbs.yaml deleted file mode 100644 index 8c51b8a4c1..0000000000 --- a/config/crd/patches/webhook_in_gslbs.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# The following patch enables conversion webhook for CRD -# CRD conversion requires k8s 1.13 or later. -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: gslbs.k8gb.absa.oss -spec: - conversion: - strategy: Webhook - webhookClientConfig: - # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, - # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) - caBundle: Cg== - service: - namespace: system - name: webhook-service - path: /convert