-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor copy packages command to support regional ECR
- Loading branch information
Showing
9 changed files
with
332 additions
and
169 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package cmd | ||
|
||
import ( | ||
"net/http" | ||
"testing" | ||
|
||
"oras.land/oras-go/v2/registry/remote" | ||
"oras.land/oras-go/v2/registry/remote/auth" | ||
) | ||
|
||
func TestGetTagsFromChartValues(t *testing.T) { | ||
res := make(map[string]string) | ||
chartValues := map[string]any{ | ||
"controller1": map[string]any{ | ||
"tag": "testtag1", | ||
"digest": "testdiget1", | ||
}, | ||
"controller2": map[string]any{ | ||
"tag": "testtag2", | ||
"digest": "testdiget2", | ||
"controller3": map[string]any{ | ||
"tag": "testtag3", | ||
"digest": "testdiget3", | ||
}, | ||
}, | ||
} | ||
err := getTagsFromChartValues(chartValues, res) | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
if res["testdiget1"] != "testtag1" { | ||
t.Errorf("Expected tag has not be found") | ||
} | ||
if res["testdiget2"] != "testtag2" { | ||
t.Errorf("Expected tag has not be found") | ||
} | ||
if res["testdiget3"] != "testtag3" { | ||
t.Errorf("Expected tag has not be found") | ||
} | ||
} | ||
|
||
func TestGetPackageBundleTag(t *testing.T) { | ||
tag := getPackageBundleTag("1.27") | ||
if tag != "v1-27-latest" { | ||
t.Errorf("Expected tag v1-27-latest, got %s", tag) | ||
} | ||
} | ||
|
||
func TestSetupDstRepo(t *testing.T) { | ||
dst, err := remote.NewRepository("localhost:5000/hello-world") | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
cpc := ©PackagesConfig{dstPlainHTTP: true, dstInsecure: true} | ||
setUpDstRepo(dst, cpc) | ||
if dst.PlainHTTP != true { | ||
t.Errorf("Expect PlainHTTP to be true") | ||
} | ||
|
||
if dst.Client.(*auth.Client).Client.Transport.(*http.Transport).TLSClientConfig.InsecureSkipVerify != true { | ||
t.Errorf("Expect InsecureSkipVerify to be true") | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
docs/content/en/docs/getting-started/airgapped/airgap-packages.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
toc_hide: true | ||
--- | ||
|
||
If your EKSA cluster is running in an airgapped environment and you set up a local registry mirror, you can copy curated packages from Amazon ECR to your local registry mirror with the following command. | ||
|
||
The `$REGISTRY_MIRROR_URL` value must have the same endpoint and port as of the values defined in `registryMirrorConfiguration` of your EKS Anywhere cluster specification. And `$KUBEVERSION` must equals to the `spec.kubernetesVersion` of your EKS Anywhere cluster specification. | ||
|
||
The `copy packages` command uses the credentials in your docker config file. So you must `docker login` the source registries and the destination registry before running the command. | ||
|
||
```bash | ||
eksctl anywhere copy packages \ | ||
${REGISTRY_MIRROR_URL} | ||
--kube-version $KUBEVERSION \ | ||
--src-chart-registry public.ecr.aws/eks-anywhere \ | ||
--src-image-registry 783794618700.dkr.ecr.us-west-2.amazonaws.com | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule docsy
updated
from 033225 to 891efb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.