Files
sealos/pkg/runtime/registry.go
T
fengxsong eff2fbfaa1 feat: support registries HA (#2096)
* feat: support multiple registries

Signed-off-by: fengxsong <fengxsong@outlook.com>

* ci: remove unused functions

Signed-off-by: fengxsong <fengxsong@outlook.com>

* docs: add proposal doc

Signed-off-by: fengxsong <fengxsong@outlook.com>

* fix: adjust helper functions

Signed-off-by: fengxsong <fengxsong@outlook.com>

* refactor: bootstrap module

Signed-off-by: fengxsong <fengxsong@outlook.com>

* refactor dep to applier

Signed-off-by: fengxsong <fengxsong@outlook.com>

* refactor: split registry mirroring from mountrootfs

Signed-off-by: fengxsong <fengxsong@outlook.com>

* fix: format code

Signed-off-by: fengxsong <fengxsong@outlook.com>

* docs: add limitations section in proposal doc

Signed-off-by: fengxsong <fengxsong@outlook.com>

Signed-off-by: fengxsong <fengxsong@outlook.com>
2022-11-23 12:33:52 +08:00

38 lines
1.1 KiB
Go

// Copyright © 2021 Alibaba Group Holding Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package runtime
import (
"fmt"
"github.com/labring/sealos/pkg/utils/iputils"
"github.com/labring/sealos/pkg/utils/logger"
)
func (k *KubeadmRuntime) registryAuth(ip string) error {
logger.Info("registry auth in node %s", ip)
registry := k.getRegistry()
err := k.execHostsAppend(ip, iputils.GetHostIP(registry.IP), registry.Domain)
if err != nil {
return fmt.Errorf("add registry hosts failed %v", err)
}
err = k.execAuth(ip)
if err != nil {
return fmt.Errorf("exec auth.sh failed %v", err)
}
return nil
}