Merge pull request #172 from inercia/inercia/fix_registries_yaml_overwrite
[Fix] Do not try to write the registries.yaml if --enable-registry has not been provided (thanks @inercia)
This commit is contained in:
commit
ecd86ed993
@ -152,8 +152,10 @@ func createServer(spec *ClusterSpec) (string, error) {
|
||||
}
|
||||
|
||||
// copy the registry configuration
|
||||
if err := writeRegistriesConfigInContainer(spec, id); err != nil {
|
||||
return "", err
|
||||
if spec.RegistryEnabled {
|
||||
if err := writeRegistriesConfigInContainer(spec, id); err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
||||
if err := startContainer(id); err != nil {
|
||||
@ -248,8 +250,10 @@ func createWorker(spec *ClusterSpec, postfix int) (string, error) {
|
||||
}
|
||||
|
||||
// copy the registry configuration
|
||||
if err := writeRegistriesConfigInContainer(spec, id); err != nil {
|
||||
return "", err
|
||||
if spec.RegistryEnabled {
|
||||
if err := writeRegistriesConfigInContainer(spec, id); err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
||||
if err := startContainer(id); err != nil {
|
||||
|
||||
@ -8,8 +8,15 @@ source "$CURR_DIR/common.sh"
|
||||
|
||||
#########################################################################################
|
||||
|
||||
FIXTURES_DIR=$CURR_DIR/fixtures
|
||||
|
||||
# a dummy registries.yaml file
|
||||
REGISTRIES_YAML=$FIXTURES_DIR/01-registries-empty.yaml
|
||||
|
||||
#########################################################################################
|
||||
|
||||
info "Creating two clusters..."
|
||||
$EXE create --wait 60 --name "c1" --api-port 6443 || failed "could not create cluster c1"
|
||||
$EXE create --wait 60 --name "c1" --api-port 6443 -v $REGISTRIES_YAML:/etc/rancher/k3s/registries.yaml || failed "could not create cluster c1"
|
||||
$EXE create --wait 60 --name "c2" --api-port 6444 || failed "could not create cluster c2"
|
||||
|
||||
info "Checking we have access to both clusters..."
|
||||
|
||||
@ -58,12 +58,14 @@ check_url() {
|
||||
}
|
||||
|
||||
check_k3d_clusters() {
|
||||
[ -n "$EXE" ] || abort "EXE is not defined"
|
||||
for c in "c1" "c2" ; do
|
||||
kc=$($EXE get-kubeconfig --name "$c")
|
||||
if kubectl --kubeconfig=$kc cluster-info ; then
|
||||
passed "cluster $c is reachable"
|
||||
[ -n "$kc" ] || abort "could not obtain a kubeconfig for $c"
|
||||
if kubectl --kubeconfig="$kc" cluster-info ; then
|
||||
passed "cluster $c is reachable (with kubeconfig=$kc)"
|
||||
else
|
||||
warn "could not obtain cluster info for $c with kubeconfig=$kc. Contents:\n$(cat $kc)"
|
||||
warn "could not obtain cluster info for $c (with kubeconfig=$kc). Contents:\n$(cat $kc)"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
4
tests/fixtures/01-registries-empty.yaml
vendored
Normal file
4
tests/fixtures/01-registries-empty.yaml
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
mirrors:
|
||||
"dummy.local":
|
||||
endpoint:
|
||||
- http://localhost:32000
|
||||
Loading…
x
Reference in New Issue
Block a user