GoogleCloudPlatform / flink-on-k8s-operator

[DEPRECATED] Kubernetes operator for managing the lifecycle of Apache Flink and Beam applications.
Apache License 2.0
658 stars 266 forks source link

Controller incompatible with Kubernetes 1.22 #476

Open phoerious opened 2 years ago

phoerious commented 2 years ago

This issue is related to #462

I tried fixing up the controller to be compatible with Kubernetes 1.22, but it seems to be an endless rabbit hole and I am not familiar enough with the internals of this controller to sketch up a working PR.

apiextensions.k8s.io/v1beta1 has been removed in 1.22 and therefore, I can no longer install the CRDs. Patching v1beta1 out involves at least:

  1. Changing all apiVersion fields in YAML files
  2. Updating controller-tools to something less ancient than 0.3.0
    • 0.7.0 has removed support for k8s < 1.22 and you need to remove trivialVersions=true from CRD_OPTIONS
  3. Tweaking kubebuilder markers in api/v1beta/flinkcluster_webhook.go

Step 3 is where I'm struggling, because I am neither familiar with what these web hooks are supposed to do nor with kubebuilder itself. I figured out that you at least need to add these definitions to lines 44 and 66:

...,admissionReviewVersions=["v1beta"],sideEffects=None

yet I don't know if the values are correct for what the controllers do. After adding these values, I am one step further, but now I am having trouble with unapproved APIs:

kubectl apply -f config/crd/bases
The CustomResourceDefinition "flinkclusters.flinkoperator.k8s.io" is invalid: metadata.annotations[api-approved.kubernetes.io]: Required value: protected groups must have approval annotation "api-approved.kubernetes.io", see https://github.com/kubernetes/enhancements/pull/1111

I am not sure how to fix that, because config/crd/bases/* gets recreated by controller-gen and I don't think this API is approved in the first place.

phoerious commented 2 years ago

Seems to work with this fork: https://github.com/spotify/flink-on-k8s-operator

I guess this repo is mostly unmaintained.