Skip to content
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: Support specify the image matching rule file to move the container images too #180

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 27 additions & 17 deletions api/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions api/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ message Repo {
// Whether to use a charts index to find charts
bool use_charts_index = 6 [deprecated=true];
bool disable_charts_index = 7;
string image_hints_file = 8;
}


Expand Down
4 changes: 4 additions & 0 deletions charts-syncer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ source:
kind: HELM
# url is the url of the chart repository
url: http://localhost:8080 # local test source repo

# auth is used if the source repository is protected with basic auth (Optional section)
auth:
# username is the username used to authenticate against the source chart repo
Expand All @@ -20,6 +21,9 @@ source:
# Options for repositories of kind=OCI
# disableChartsIndex: false
# chartsIndex: my-oci-registry.io/my-project/my-custom-index:prod

# imageHintsFile specify the image matching rule file the Charts to move the container images rule too
# imageHintsFile: "example/image-hints.yaml"
# target includes relevant information about the target chart repository
target:
# repoName is used to modify the README of the chart. Default value: `myrepo`
Expand Down
3 changes: 3 additions & 0 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var (
syncWorkdir string
syncSkipDependencies bool
syncLatestVersionOnly bool
syncMatchVersion string
)

var (
Expand Down Expand Up @@ -90,6 +91,7 @@ func newSyncCmd() *cobra.Command {
syncer.WithSkipDependencies(syncSkipDependencies),
syncer.WithLatestVersionOnly(syncLatestVersionOnly),
syncer.WithSkipCharts(c.SkipCharts),
syncer.WithMatchVersion(syncMatchVersion),
}
s, err := syncer.New(c.GetSource(), c.GetTarget(), syncerOptions...)
if err != nil {
Expand All @@ -104,6 +106,7 @@ func newSyncCmd() *cobra.Command {
cmd.Flags().StringVar(&syncWorkdir, "workdir", syncer.DefaultWorkdir(), "Working directory")
cmd.Flags().BoolVar(&syncSkipDependencies, "skip-dependencies", false, "Skip syncing chart dependencies")
cmd.Flags().BoolVar(&syncLatestVersionOnly, "latest-version-only", false, "Sync only latest version of each chart")
cmd.Flags().StringVar(&syncMatchVersion, "match-version", ".*", "Sync matching version of each chart")

return cmd
}
5 changes: 5 additions & 0 deletions examples/image-hints.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
# Every rule, once interpolated, must represent a valid container image URI
- "{{ .image.registry }}/{{ .image.repository }}:{{ .image.tag }}"
#- "{{ .metrics.image.registry }}/{{ .metrics.image.repository }}:{{ .metrics.image.tag }}"
#- "{{ .volumePermissions.image.registry }}/{{ .volumePermissions.image.repository }}:{{ .volumePermissions.image.tag }}"
30 changes: 17 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ go 1.19

// Needed so we can require asset-relocation-tool-for-kubernetes packages
// https://github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/issues/89
replace gopkg.in/yaml.v3 => github.com/atomatt/yaml v0.0.0-20200403124456-7b932d16ab90
replace (
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes v0.5.0 => github.com/yidaqiang/asset-relocation-tool-for-kubernetes v0.5.0-1
gopkg.in/yaml.v3 => github.com/atomatt/yaml v0.0.0-20200403124456-7b932d16ab90
)

require (
github.com/Masterminds/semver/v3 v3.1.1
github.com/bitnami-labs/pbjson v1.1.0
github.com/containerd/containerd v1.6.12
github.com/distribution/distribution/v3 v3.0.0-20220526142353-ffbd94cbe269
github.com/golang/protobuf v1.5.2
github.com/google/go-cmp v0.5.8
github.com/google/go-cmp v0.5.9
github.com/google/go-containerregistry v0.7.0
github.com/juju/errors v0.0.0-20200330140219-3fe23663418f
github.com/juju/testing v0.0.0-20200923013621-75df6121fbb0 // indirect
Expand All @@ -24,14 +27,16 @@ require (
github.com/spf13/cobra v1.5.0
github.com/spf13/viper v1.10.0
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes v0.5.0
google.golang.org/protobuf v1.28.0
google.golang.org/protobuf v1.28.1
gopkg.in/yaml.v2 v2.4.0
helm.sh/helm/v3 v3.10.3
k8s.io/klog v1.0.0
oras.land/oras-go v1.2.0
sigs.k8s.io/yaml v1.3.0
)

require gopkg.in/yaml.v3 v3.0.1

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/BurntSushi/toml v1.1.0 // indirect
Expand All @@ -49,7 +54,7 @@ require (
github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd // indirect
github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b // indirect
github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.10.0 // indirect
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
Expand Down Expand Up @@ -83,7 +88,7 @@ require (
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gosuri/uitable v0.0.4 // indirect
Expand Down Expand Up @@ -146,19 +151,18 @@ require (
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/oauth2 v0.4.0 // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 // indirect
google.golang.org/grpc v1.47.0 // indirect
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
google.golang.org/grpc v1.53.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.25.2 // indirect
k8s.io/apiextensions-apiserver v0.25.2 // indirect
k8s.io/apimachinery v0.25.2 // indirect
Expand Down
Loading