-
Notifications
You must be signed in to change notification settings - Fork 32
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
feature: allow relocating images with relok8s lib #115
Conversation
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.
Perfect, could you add an issue about documenting this feature?
klog.Errorf("unable to build %q chart dependencies: %+v", id, err) | ||
errs = multierror.Append(errs, errors.Trace(err)) | ||
if s.relocateContainerImages { | ||
packagedChartPath, err = s.SyncWithRelok8s(ch, outdir) |
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.
I like how you encapsulated the methods SyncWithRelok8s and SyncWithChartsSyncer :)
@@ -133,3 +109,90 @@ func (s *Syncer) SyncPendingCharts(names ...string) error { | |||
|
|||
return errors.Trace(errs) | |||
} | |||
|
|||
func (s *Syncer) SyncWithRelok8s(chart *Chart, outdir string) (string, 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.
It would be nice to add a comment on top of this method explaining what it does, its requirements and so on
|
||
func (s *Syncer) SyncWithRelok8s(chart *Chart, outdir string) (string, error) { | ||
outputChartPath := filepath.Join(outdir, "%s-%s.relocated.tgz") | ||
packagedChartPath := filepath.Join(outdir, fmt.Sprintf("%s-%s.relocated.tgz", chart.Name, chart.Version)) |
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.
I'd add a TODO comment saying to change it once vmware-tanzu/asset-relocation-tool-for-kubernetes#94 is fixed
Target: mover.Target{ | ||
Rules: mover.RewriteRules{ | ||
Registry: s.target.GetContainerRegistry(), | ||
RepositoryPrefix: s.target.GetContainerRepository(), |
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.
You can now add ForcePush if you update to v0.3.45
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.
Thanks!
This PR adds a new feature to charts-syncer.
It is possible to do a full relocation of the chart (including container images) thanks to the integration with the relok8s library.
For that we should only add
relocateContainerImages: true
to our config file. However, in order to relok8s to work properly, it requires that the source chart includes an image hints file. Currently, this file should be called.relok8s-images.yaml
and should be packaged inside the chart. If this file is not found, the sync for that specific chart will be skipped.If relocateContainerImages is not set or set to false, charts-syncer will continue working as of today. This is, it will sync chart packages (but no container images) if source charts fulfil the documented requirements
Usage: