-
Notifications
You must be signed in to change notification settings - Fork 12
✨ Add workspace paths as annotations to synced objects #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
dca5fbe
511599c
9736d94
ea71042
778b49e
4b4d9d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,10 @@ import ( | |
| "github.com/kcp-dev/logicalcluster/v3" | ||
| "go.uber.org/zap" | ||
|
|
||
| kcpdevcorev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/core/v1alpha1" | ||
|
|
||
| "k8s.io/apimachinery/pkg/api/meta" | ||
| "k8s.io/apimachinery/pkg/runtime" | ||
| "k8s.io/client-go/rest" | ||
| "sigs.k8s.io/controller-runtime/pkg/cache" | ||
| ctrlruntimeclient "sigs.k8s.io/controller-runtime/pkg/client" | ||
|
|
@@ -130,7 +133,14 @@ func NewCluster(address string, baseRestConfig *rest.Config) (*Cluster, error) { | |
| return newClusterAwareRoundTripper(rt) | ||
| }) | ||
|
|
||
| scheme := runtime.NewScheme() | ||
|
|
||
| if err := kcpdevcorev1alpha1.AddToScheme(scheme); err != nil { | ||
| return nil, fmt.Errorf("failed to register scheme %s: %w", kcpdevcorev1alpha1.SchemeGroupVersion, err) | ||
| } | ||
|
Comment on lines
+138
to
+140
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remind me, does adding the scheme require it to be available in the endpoint? Will this fail on setups that don't enable this optional flag?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To my knowledge, this simply prepares the local client to work with types from the given scheme. This does not change anything about the wire protocol between us and the apiserver. The client will not suddenly do an API discovery and fail if the type doesn't exist. |
||
|
|
||
| clusterObj, err := cluster.New(config, func(o *cluster.Options) { | ||
| o.Scheme = scheme | ||
| o.NewCache = kcp.NewClusterAwareCache | ||
| o.NewAPIReader = kcp.NewClusterAwareAPIReader | ||
| o.NewClient = kcp.NewClusterAwareClient | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we handle the case that this annotation is empty and throw an error? Is this a valid or invalid scenario?