Skip to content

Commit

Permalink
support use aliyuncs for manifest (#2436)
Browse files Browse the repository at this point in the history
Signed-off-by: pixiake <[email protected]>
  • Loading branch information
pixiake authored Oct 29, 2024
1 parent f548861 commit bedbeb2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
21 changes: 8 additions & 13 deletions cmd/kk/pkg/artifact/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ import (
"bufio"
"context"
"fmt"
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/connector"
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/files"
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/images"
"os"
"sort"
"strings"

"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/connector"
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/files"
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/images"

mapset "github.com/deckarep/golang-set"
"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -276,7 +277,7 @@ func CreateManifestSpecifyVersion(arg common.Argument, name, version string, reg
}, &common.KubeConf{
Cluster: &kubekeyv1alpha2.ClusterSpec{
Kubernetes: kubekeyv1alpha2.Kubernetes{Version: v},
Registry: kubekeyv1alpha2.RegistryConfig{PrivateRegistry: "docker.io"},
Registry: kubekeyv1alpha2.RegistryConfig{PrivateRegistry: images.DefaultRegistry()},
},
}, imageName).ImageName()
if !imageIsExist(repo, imageArr) {
Expand All @@ -287,15 +288,9 @@ func CreateManifestSpecifyVersion(arg common.Argument, name, version string, reg
}

options := &templates.Options{
Name: name,
Arches: arch,
OperatingSystems: []kubekeyv1alpha2.OperatingSystem{{
Arch: "amd64",
Type: "linux",
Id: "ubuntu",
Version: "20.04",
OsImage: "Ubuntu 20.04.6 LTS",
}},
Name: name,
Arches: arch,
OperatingSystems: []kubekeyv1alpha2.OperatingSystem{},
KubernetesDistributions: kubernetesDistribution,
Components: kubekeyv1alpha2.Components{
Helm: kubekeyv1alpha2.Helm{Version: kubekeyv1alpha2.DefaultHelmVersion},
Expand Down
8 changes: 8 additions & 0 deletions cmd/kk/pkg/images/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,11 @@ func (images *Images) PullImages(runtime connector.Runtime, kubeConf *common.Kub
}
return nil
}

// DefaultRegistry is used to get default registry address.
func DefaultRegistry() string {
if os.Getenv("KKZONE") == "cn" {
return cnRegistry
}
return "docker.io"
}

0 comments on commit bedbeb2

Please sign in to comment.