-
Notifications
You must be signed in to change notification settings - Fork 6
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
Look into providing container credentials #30
Comments
So at the API level I think the ide would be to go from: func NewChartMover(chartPath string, imageHintsFile string, rules *RewriteRules, opts ...Option) (*ChartMover, error) { To func NewChartMover(ChartMoveRequest req, imageHintsFile string, opts ...Option) (*ChartMover, error) { Where I will play a bit on a merge request. |
WIP here: #70 |
I am not convinced by this change. To me, opts are optional modifiers. If the rewriteRules (and soon the creds/repo defs) are required, that should be a required parameter. Could we evolve the signature to instead accept a struct that encapsulates both the source and targets? I'd keep in mind that whatever we model should leave room to source/targets that are potentially something different than OCI registries, i.e for Airgap envs. To me, chart syncer does a good job defining these inputs https://github.com/bitnami-labs/charts-syncer/blob/master/api/config.proto |
For testing maybe we can spin up a local registry with some injected creds: I will be testing that next. |
I think it can be done. I can run a docker-compose with the registry and relok8s using it. We can create a password beforehand and then docker-compose up -d could run some test passing creds on the CLI... bu that requires to implement the CLI arg passing as well. I will first get it working "manually" in my laptop. |
I am trying to automate a test that spins up a local registry, with a random password generated on the fly, but I hit a more fundamental issue...
go: finding module for package github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/pkg/mover
go: finding module for package github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/internal/internalfakes
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes imports
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/internal/yamlops: no matching versions for query "latest"
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes imports
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/pkg/mover: no matching versions for query "latest"
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/internalfakes imports
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/internal: no matching versions for query "latest"
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes tested by
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes.test imports
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/test: no matching versions for query "latest"
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/mover tested by
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/mover.test imports
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/internal/internalfakes: no matching versions for query "latest"
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/mover tested by
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/mover.test imports
github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/pkg/mover/moverfakes: no matching versions for query "latest"
make: *** [Makefile:57: vendor/modules.txt] Error 1 I have to stop the yak shaving here for today. If any of you have a hint on why I am hitting that error, it will be most welcome. |
Fair enough. The docker build expects that you've already built the binary. Do you have a branch with your build stage? I could try and iterate on it. |
Never mind, it was me not using a proper folder name for the build files. |
I was trying # Copyright 2021 VMware, Inc.
# SPDX-License-Identifier: BSD-2-Clause
FROM golang:1.16
COPY Makefile go.* build cmd pkg internal test vendor /asset-relocation-tool-for-kubernetes/
ENV GOPATH=
WORKDIR /asset-relocation-tool-for-kubernetes/
RUN make test && make build
... After setting the folder it is still failing the same way, maybe I typed it wrong? I need to leave now. |
https://newbedev.com/how-to-copy-multiple-files-in-one-layer-using-a-dockerfile |
Sorry I am missing some context. What is it of the new change that require having a local docker env? Or is it that you want to add additional testing for different combinations of credentials for both source and target? |
Sorry, let me back up in the yak shaving sequence a bit... So this change in draft for providing credentials as inputs needs some testing....
|
Just to make sure, your build step should probably accept an |
ah yes I will have to fix that there ^ I was more focused on the registry test, that got more complex again, I cannot avoid TLS config apparently, so I need to create "proper" cert for the test... I will fix that PR tomorrow as well |
https://github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/tree/registry-tests I am close now to get the regular "docker based creds tests" working. In fact I am getting 401 for not good reason, as the docker login is said to be "successful?!" Not sure why is still failing. |
Hi, Thanks for the proposal #70 (comment) , I like it and I think it is on the right direction, I went ahead and came up with a modified version of it that, which changes can be summarized as
Let me know your thoughts, Thanks!! Examples:Example 1
NOTE: This represents the current default behavior of relok8s source:
hintsFile: images.yaml
chart:
local:
path: "chart.tgz"
target:
containerRewrites:
registry: "final-dest.harbor.vmware.com"
prefix: /custom Example 2
source:
hintsFile: images.yaml
chart:
local:
path: "chart.tgz"
target:
containerRewrites:
registry: "final-dest.harbor.vmware.com"
prefix: /custom
chart:
local:
path: "my-path/*.relocated.tgz" Example 3
source:
hintsFile: images.yaml
chart:
local:
path: "./chart.tgz"
containers:
repositories:
- server: internal.harbor.vmware.com
username: foobar
password: deadbeef
target:
containerRewrites:
registry: "final-dest.harbor.vmware.com"
prefix: /custom
containers:
repositories:
- server: final-dest.harbor.vmware.com
username: foobar
password: deadbeef Example 4: Two steps relocation
# First leg
source:
hintsFile: ./images.yaml
chart:
local:
path: "./tarball.tgz"
containers:
repositories:
- server: internal.harbor.vmware.com
username: foobar
password: deadbeef
target:
chart:
# The bundle contains the Helm Chart, it's container images as well as the hints file
partialRelocationBundle:
uri: internal.harbor.vmware.com/chart-bundle:1.0
username: foobar
password: deadbeef
# Second leg
source:
chart:
partialRelocationBundle:
uri: internal.harbor.vmware.com/chart-bundle:1.0
username: foobar
password: deadbeef
target:
containerRewrites:
registry: "final-dest.harbor.vmware.com"
prefix: /custom
chart:
local:
path: "./tarball-v1.0.relocated.tgz"
containers:
repositories:
- server: final-dest.harbor.vmware.com
username: foobar
password: deadbeef
All the optionssource:
hintsFile: ./images.yaml
chart:
# one of these is required
local:
path: "./tarball.tgz"
HelmRepository:
name: "mychart"
repository:
url: https://charts.bitnami.com/bitnami
username: optional
password: deadbeef
HelmOCI:
uri: internal.harbor.vmware.com/tests/mychart
username: foo
password: bar
partialRelocationBundle: # Used for intermediate
uri: internal.harbor.vmware.com/chart-bundle
username: foobar
password: deadbeef
containers:
repositories:
- server: internal.harbor.vmware.com
username: foobar
password: deadbeef
target:
containerRewrites:
registry: "final-dest.harbor.vmware.com"
prefix: /custom
chart:
local:
path: "my-path/*.relocated.tgz"
# + OCI + Chart Museum
containers:
repositories:
- server: final-dest.harbor.vmware.com
username: foobar
password: deadbeef
|
Thanks I now understand what you were after and why. Let me write down the minimum structure we are to support now: source:
hintsFile: images.yaml # Optional: can be in the original chart itself
chart:
local: # we will also support `helmRepo` and `helmOCI`
path: "./tarball.tgz"
containers:
repository: # we mentioned going for a single authenticated source repo initially
server: internal.harbor.vmware.com
username: foobar # auth can be of other types, but for now we just support user/password
password: deadbeef
target:
containerRewrites:
registry: "final-dest.harbor.vmware.com"
prefix: /custom
chart:
local:
path: "my-path/*.relocated.tgz"
containers:
repository:
server: final-dest.harbor.vmware.com
username: foobar
password: deadbeef Notes:
|
At this point API credentials are supported at the API level. We are not going to add support at the CLI level for now, as we are prioritizing the Airgap support case instead for now. |
Currently we load them through the environment, we want to look into supporting explicit providing of credentials maybe via config files.
The text was updated successfully, but these errors were encountered: