Skip to content
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

Creating container images registry is supported #955

Merged
merged 1 commit into from Jan 8, 2022

Conversation

pixiake
Copy link
Collaborator

@pixiake pixiake commented Jan 3, 2022

What does this PR do ?

Support installation of container images registry (docker registry or harbor) using kubekey.

How to use ?

Initialize a local images registry.

./kk init registry [(-f | --filename) path]

Add registry to spec.roleGroups of the configuration file.
example:

apiVersion: kubekey.kubesphere.io/v1alpha2
kind: Cluster
metadata:
  name: sample
spec:
  hosts:
  - {name: node1, address: 192.168.6.6, internalAddress: 192.168.6.6, password: Qcloud@123}
  roleGroups:
    etcd:
    - node1
    master:
    - node1
    worker:
    - node1
    ## Specify the node role as registry. Only one node can be set as registry.
    registry:
    - node1
  controlPlaneEndpoint:
    ##Internal loadbalancer for apiservers
    #internalLoadbalancer: haproxy

    domain: lb.kubesphere.local
    address: ""
    port: 6443
  kubernetes: 
    version: v1.21.5
    clusterName: cluster.local
  network:
    plugin: calico
    kubePodsCIDR: 10.233.64.0/18
    kubeServiceCIDR: 10.233.0.0/18
    # multus support. https://github.com/k8snetworkplumbingwg/multus-cni
    enableMultusCNI: false
  registry:
    ## `docker registry` is used to create local registry by default.  
    ## `harbor` can be also set for type.
    # type: ""  
    privateRegistry: dockerhub.kubekey.local
    registryMirrors: []
    insecureRegistries: []
  addons: []

Signed-off-by: pixiake guofeng@yunify.com

@ks-ci-bot ks-ci-bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 3, 2022
@@ -0,0 +1,67 @@
/*
Copyright 2020 The KubeSphere Authors.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should 2021 or 2022 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Has been changed to 2022.

@pixiake pixiake force-pushed the registry branch 2 times, most recently from e93f845 to 0aaca2c Compare January 7, 2022 03:18
func (k *RegistryPackageDownload) Execute(runtime connector.Runtime) error {
arch := runtime.GetHostsByRole(common.Registry)[0].GetArch()

packageDir := filepath.Join(runtime.GetWorkDir(), arch)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you think modifying the path as kubekey/registry/amd64/xxxx.tar.gz? That will be the same as the kk k8s binaries path(kubekey/v1.21.5/amd64/xxxx.tar.gz).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not recommended to put it in the k8s version directory. If there are multiple versions in the offline package, the files will be saved repeatedly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these files (helm / etcd / cni / docker / crictl ...) should also be stored in a separate directory.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not recommended to put it in the k8s version directory. If there are multiple versions in the offline package, the files will be saved repeatedly.

I mean put it in a dir which named registry not in the k8s version dir.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Signed-off-by: pixiake <guofeng@yunify.com>
@24sama
Copy link
Collaborator

24sama commented Jan 8, 2022

/lgtm
/approve

@ks-ci-bot ks-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Jan 8, 2022
@ks-ci-bot
Copy link
Collaborator

LGTM label has been added.

Git tree hash: 59d35df3975b869b1d5b622d22357fdc1007b8d5

@ks-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 24sama, pixiake

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ks-ci-bot ks-ci-bot merged commit cbdef5a into kubesphere:master Jan 8, 2022
@24sama
Copy link
Collaborator

24sama commented Jan 10, 2022

/cherrypick release-2.0

@ks-ci-bot
Copy link
Collaborator

@24sama: new pull request created: #979

In response to this:

/cherrypick release-2.0

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants