k8sgpt-ai / k8sgpt-operator

Automatic SRE Superpowers within your Kubernetes cluster
https://k8sgpt.ai
Apache License 2.0
276 stars 73 forks source link

Migrate to kubebuilder go/v4 #437

Open ultram4rine opened 2 months ago

ultram4rine commented 2 months ago

Closes #421

πŸ“‘ Description

Steps:

mv k8sgpt-operator k8sgpt-operator-orig
mkdir k8sgpt-operator && cd k8sgpt-operator
go mod init github.com/k8sgpt-ai/k8sgpt-operator
kubebuilder init --domain k8sgpt.ai --plugins=go/v4,grafana.kubebuilder.io/v1-alpha
cp -r ../k8sgpt-operator-orig/hack .
kubebuilder create api --group core --version v1alpha1 --kind K8sGPT # Resource: yes, Controller: yes
kubebuilder create api --group core --version v1alpha1 --kind Result # Resource: yes, Controller: no

Then copy file by file to new project layout.

βœ… Checks

β„Ή Additional Information

As kubebuilder scaffolded with golangci config I've also added a GH job with it. Ways to fix this CI step:

Also made all k8s imports in form like corev1.