-
Notifications
You must be signed in to change notification settings - Fork 426
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
feat: add name & labels mapping store #1973
Conversation
✅ Deploy Preview for vcluster-docs canceled.
|
86f4e38
to
c55f5d5
Compare
c55f5d5
to
f556163
Compare
e3726f4
to
d199c06
Compare
d199c06
to
291dc9f
Compare
94e8583
to
fc137d5
Compare
@@ -143,6 +142,10 @@ func (s *importer) Syncer() syncertypes.Sync[client.Object] { | |||
return syncer.ToGenericSyncer[*unstructured.Unstructured](s) | |||
} | |||
|
|||
func (s *importer) Migrate(_ *synccontext.RegisterContext, _ synccontext.Mapper) error { |
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.
what is this for ?
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.
Migrate replaces basically the index we had before. Since we startup without "knowing" anymore what objects were how translated, we have the migrate function that initially populates the store with the virtual <-> host mappings
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.
Maybe we can call the function MigrateMappings to make this more clear
@@ -16,8 +16,8 @@ import ( | |||
"sigs.k8s.io/controller-runtime/pkg/client" | |||
) | |||
|
|||
func New(ctx *synccontext.RegisterContext) (syncertypes.Object, error) { | |||
mapper, err := ctx.Mappings.ByGVK(mappings.CSIDrivers()) | |||
func New(_ *synccontext.RegisterContext) (syncertypes.Object, error) { |
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.
can't we just remove the parameter?
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.
this needs to adhere to the create syncer type function that uses this parameter for other syncers
PermitWithoutStream: true, | ||
Endpoints: endpoints, | ||
Context: ctx, | ||
DialTimeout: 5 * time.Second, |
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.
why is it changed?
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.
This causes issues if you just want to query etcd for values as its trying to reach all peers
if len(watches) == 0 { | ||
return | ||
} | ||
|
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.
isn't that redundant?
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.
Its avoiding a goroutine creation so I guess the small check is worth it
fc137d5
to
d4a13e7
Compare
7a3005b
to
774dc77
Compare
774dc77
to
9bea0d4
Compare
What issue type does this pull request address? (keep at least one, remove the others)
/kind feature
Please provide a short message that should be published in the vcluster release notes
This PR adds a mapping store to vCluster that saves name and label mappings on the fly in a mapping store backend. This can be used to translate back resources including their metadata and simplifies importing as well as customising mappings.