provider-gcp icon indicating copy to clipboard operation
provider-gcp copied to clipboard

feat: add kustomization for crds

Open Demonsthere opened this issue 2 years ago • 5 comments

Description of your changes

A minor PR adding a kustomization.yaml file allowing for the direct installation of CRDs, similar to the base controller: https://github.com/crossplane/crossplane/blob/master/cluster/kustomization.yaml

Fixes #

I have:

  • [ ] Read and followed Crossplane's contribution process.
  • [ ] Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

Demonsthere avatar May 13 '22 07:05 Demonsthere

What's the use case for this @Demonsthere?

negz avatar Jun 03 '22 00:06 negz

We are using Crossplane in our environments, and wanted to add some integration tests to the pipeline. We do it with the use of a local cluster against which we would like to evaluate our manifests. In order to do this you need to have the CRDs deployed on the cluster. We would like to avoid installing crossplane and the gcp provider for each time, as we only need the CRDs to be installed for the validation to work. This kustomization allows the installation of all CRDs via kustomize with a url like https://github.com/Demonsthere/provider-gcp//package/crds?ref=feat/crd-kustomize instead of having to link to each and every CRD in the directory 😉

Demonsthere avatar Jun 03 '22 06:06 Demonsthere

Isn't it possible to just kubectl apply the folder package/crds?

Feggah avatar Jun 11 '22 19:06 Feggah

It is possible, but please compare the two options:

apiVersion: skaffold/v2beta25
kind: Config
deploy:
  statusCheckDeadlineSeconds: 2400
profiles:
  - name: k3d-helm-validation
    deploy:
      kustomize:
        paths:
          - https://github.com/crossplane/crossplane//cluster?ref=master
          - https://github.com/Demonsthere/provider-gcp//package/crds?ref=feat/crd-kustomize
          - https://github.com/fluxcd/flux2//manifests/crds
          - https://github.com/argoproj/argo-cd//manifests/crds
        hooks:
          after:
            - host:
                command:
                  - sh
                  - -c
                  - |
                    kubectl wait --for condition=established --timeout=120s crd --all
                os:
                  - darwin
                  - linux
      kubectl:
        flags:
          apply:
            - '--server-side'
        manifests:
          - https://raw.githubusercontent.com/prometheus-community/helm-charts/main/charts/kube-prometheus-stack/crds/crd-alertmanagerconfigs.yaml
          - https://raw.githubusercontent.com/prometheus-community/helm-charts/main/charts/kube-prometheus-stack/crds/crd-alertmanagers.yaml
          - https://raw.githubusercontent.com/prometheus-community/helm-charts/main/charts/kube-prometheus-stack/crds/crd-podmonitors.yaml
          - https://raw.githubusercontent.com/prometheus-community/helm-charts/main/charts/kube-prometheus-stack/crds/crd-probes.yaml
          - https://raw.githubusercontent.com/prometheus-community/helm-charts/main/charts/kube-prometheus-stack/crds/crd-prometheuses.yaml
          - https://raw.githubusercontent.com/prometheus-community/helm-charts/main/charts/kube-prometheus-stack/crds/crd-prometheusrules.yaml
          - https://raw.githubusercontent.com/prometheus-community/helm-charts/main/charts/kube-prometheus-stack/crds/crd-servicemonitors.yaml
          - https://raw.githubusercontent.com/prometheus-community/helm-charts/main/charts/kube-prometheus-stack/crds/crd-thanosrulers.yaml
          - https://raw.githubusercontent.com/bitnami-labs/sealed-secrets/main/helm/sealed-secrets/crds/sealedsecret-crd.yaml
          - helm/gloo/charts/gloo-ee/charts/gloo/crds/*.yaml
          - helm/gloo/charts/gloo-ee/charts/gloo-fed/crds/*.yaml

It is simply way easier and readable to use kustomize for it

Demonsthere avatar Jun 15 '22 08:06 Demonsthere

Well, TBH I don't know if this should or shouldn't be merged. I haven't a strong opinion about it, maybe @negz has more context if this should or not go into the repository?

Feggah avatar Jul 01 '22 16:07 Feggah