eks-anywhere icon indicating copy to clipboard operation
eks-anywhere copied to clipboard

Ability to import eksa scheme in other projects

Open blacksails opened this issue 10 months ago • 0 comments

We want to make controller logic which reacts to changes to the eksa cluster resource. The issue is that the current EKSA go module does not support being imported in other code.

package main

import (
	"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
	"k8s.io/apimachinery/pkg/runtime"
)

func main() {
	s := runtime.NewScheme()
	v1alpha1.AddToScheme(s)
}

Cannot compile:

❯ go build
# github.com/aws/eks-anywhere/pkg/api/v1alpha1
../../../../pkg/mod/github.com/aws/[email protected]/pkg/api/v1alpha1/hostosconfig_types.go:28:22: undefined: v1beta1.BottlerocketKubernetesSettings
../../../../pkg/mod/github.com/aws/[email protected]/pkg/api/v1alpha1/hostosconfig_types.go:31:18: undefined: v1beta1.BottlerocketKernelSettings
../../../../pkg/mod/github.com/aws/[email protected]/pkg/api/v1alpha1/hostosconfig_types.go:34:16: undefined: v1beta1.BottlerocketBootSettings
../../../../pkg/mod/github.com/aws/[email protected]/pkg/api/v1alpha1/hostosconfig.go:101:59: undefined: v1beta1.BottlerocketKubernetesSettings
../../../../pkg/mod/github.com/aws/[email protected]/pkg/api/v1alpha1/hostosconfig.go:125:62: undefined: v1beta1.BottlerocketKernelSettings
../../../../pkg/mod/github.com/aws/[email protected]/pkg/api/v1alpha1/hostosconfig.go:138:68: undefined: v1beta1.BottlerocketBootSettings
../../../../pkg/mod/github.com/aws/[email protected]/pkg/api/v1alpha1/zz_generated.deepcopy.go:248:22: undefined: v1beta1.BottlerocketKubernetesSettings
../../../../pkg/mod/github.com/aws/[email protected]/pkg/api/v1alpha1/zz_generated.deepcopy.go:253:22: undefined: v1beta1.BottlerocketKernelSettings
../../../../pkg/mod/github.com/aws/[email protected]/pkg/api/v1alpha1/zz_generated.deepcopy.go:258:22: undefined: v1beta1.BottlerocketBootSettings

I would like to be able to import the scheme so that we can use the k8s client like we do for all other resources. Right now we have to do the code without the scheme, which means that we need to use unstructured datastructures.

blacksails avatar May 01 '25 08:05 blacksails