aws / aws/eks-anywhere

Ability to import eksa scheme in other projects

Open
#9,704 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
2.1k
Forks
328
Avg merge
1d 4h
Merged PRs (30d)
9

Description

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.

```go
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/eks-anywhere@v0.22.4/pkg/api/v1alpha1/hostosconfig_types.go:28:22: undefined: v1beta1.BottlerocketKubernetesSettings
../../../../pkg/mod/github.com/aws/eks-anywhere@v0.22.4/pkg/api/v1alpha1/hostosconfig_types.go:31:18: undefined: v1beta1.BottlerocketKernelSettings
../../../../pkg/mod/github.com/aws/eks-anywhere@v0.22.4/pkg/api/v1alpha1/hostosconfig_types.go:34:16: undefined: v1beta1.BottlerocketBootSettings
../../../../pkg/mod/github.com/aws/eks-anywhere@v0.22.4/pkg/api/v1alpha1/hostosconfig.go:101:59: undefined: v1beta1.BottlerocketKubernetesSettings
../../../../pkg/mod/github.com/aws/eks-anywhere@v0.22.4/pkg/api/v1alpha1/hostosconfig.go:125:62: undefined: v1beta1.BottlerocketKernelSettings
../../../../pkg/mod/github.com/aws/eks-anywhere@v0.22.4/pkg/api/v1alpha1/hostosconfig.go:138:68: undefined: v1beta1.BottlerocketBootSettings
../../../../pkg/mod/github.com/aws/eks-anywhere@v0.22.4/pkg/api/v1alpha1/zz_generated.deepcopy.go:248:22: undefined: v1beta1.BottlerocketKubernetesSettings
../../../../pkg/mod/github.com/aws/eks-anywhere@v0.22.4/pkg/api/v1alpha1/zz_generated.deepcopy.go:253:22: undefined: v1beta1.BottlerocketKernelSettings
../../../../pkg/mod/github.com/aws/eks-anywhere@v0.22.4/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.

Contributor guide

Open the contributing guide

Research direction

Inspect pkg/api/v1alpha1 and the generated deepcopy and type files named in the compiler output, starting with AddToScheme in v1alpha1. Reproduce the Go build from the example and trace why the Bottlerocket settings types are unavailable to an external import. Done means the example builds and the Kubernetes client can register the EKSA scheme without unstructured data.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.