karmada-io / karmada

Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration
https://karmada.io
Apache License 2.0
4.11k stars 805 forks source link

introduce `--private-image-registry` flag to `karmadactl init` #2655

Closed helen-frank closed 1 year ago

helen-frank commented 1 year ago

What type of PR is this? /kind feature

What this PR does / why we need it: At present, it is mainly used for offline installation karmada to simplify installation commands. Which issue(s) this PR fixes: Fixes # Port of #2541 Special notes for your reviewer: Test

# go run cmd/karmadactl/karmadactl.go init --image-registry=xxx/xxx --crds /root/crds.tar.gz
I1019 00:34:22.710879 1942695 deploy.go:188] kubeconfig file: /root/.kube/config, kubernetes: https://10.29.12.229:44230
I1019 00:34:22.732691 1942695 deploy.go:208] karmada apiserver ip: [172.18.0.4]
I1019 00:34:23.492457 1942695 cert.go:229] Generate ca certificate success.
I1019 00:34:23.695980 1942695 cert.go:229] Generate karmada certificate success.
I1019 00:34:24.011098 1942695 cert.go:229] Generate apiserver certificate success.
I1019 00:34:24.497476 1942695 cert.go:229] Generate front-proxy-ca certificate success.
I1019 00:34:24.798200 1942695 cert.go:229] Generate front-proxy-client certificate success.
I1019 00:34:25.060485 1942695 cert.go:229] Generate etcd-ca certificate success.
I1019 00:34:25.309735 1942695 cert.go:229] Generate etcd-server certificate success.
I1019 00:34:25.391543 1942695 cert.go:229] Generate etcd-client certificate success.
...
------------------------------------------------------------------------------------------------------
 █████   ████   █████████   ███████████   ██████   ██████   █████████   ██████████     █████████
░░███   ███░   ███░░░░░███ ░░███░░░░░███ ░░██████ ██████   ███░░░░░███ ░░███░░░░███   ███░░░░░███
 ░███  ███    ░███    ░███  ░███    ░███  ░███░█████░███  ░███    ░███  ░███   ░░███ ░███    ░███
 ░███████     ░███████████  ░██████████   ░███░░███ ░███  ░███████████  ░███    ░███ ░███████████
 ░███░░███    ░███░░░░░███  ░███░░░░░███  ░███ ░░░  ░███  ░███░░░░░███  ░███    ░███ ░███░░░░░███
 ░███ ░░███   ░███    ░███  ░███    ░███  ░███      ░███  ░███    ░███  ░███    ███  ░███    ░███
 █████ ░░████ █████   █████ █████   █████ █████     █████ █████   █████ ██████████   █████   █████
░░░░░   ░░░░ ░░░░░   ░░░░░ ░░░░░   ░░░░░ ░░░░░     ░░░░░ ░░░░░   ░░░░░ ░░░░░░░░░░   ░░░░░   ░░░░░
------------------------------------------------------------------------------------------------------
Karmada is installed successfully.

Register Kubernetes cluster to Karmada control plane.

Register cluster with 'Push' mode

Does this PR introduce a user-facing change?:

`karmadactl`: `init` add `--image-registry` flags
helen-frank commented 1 year ago
swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-controller-manager:v1.3.0
swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-scheduler:v1.3.0
swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-webhook:v1.3.0
swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-aggregated-apiserver:v1.3.0
docker.io/alpine:3.15.1
registry.cn-hangzhou.aliyuncs.com/google_containers/etcd:3.5.3-0
registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.25.2
registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager:v1.25.2

Currently testing image-registry needs to push these images into the image repository.

helen-frank commented 1 year ago
swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-controller-manager:v1.3.0
swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-scheduler:v1.3.0
swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-webhook:v1.3.0
swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-aggregated-apiserver:v1.3.0
docker.io/alpine:3.15.1
registry.cn-hangzhou.aliyuncs.com/google_containers/etcd:3.5.3-0
registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.25.2
registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager:v1.25.2

Currently testing image-registry needs to push these images into the image repository.

I will develop image-tag after this pr (tentative name)

helen-frank commented 1 year ago

For quick testing, I have provided a mirror warehouse here.

./karmadactl init --image-registry=daocloud.io/atsctoo
lonelyCZ commented 1 year ago

Thanks for your contribute. I will review it!

/assign

helen-frank commented 1 year ago
export karmada_registry="harbor.xxx.xx/xxx"

karmadactl init --etcd-image=$karmada_registry/etcd:3.5.3-0 \
--etcd-init-image=$karmada_registry/alpine:3.15.1 \
--karmada-aggregated-apiserver-image=$karmada_registry/karmada-aggregated-apiserver:v1.3.1 \
--karmada-apiserver-image=$karmada_registry/kube-apiserver:v1.18.20 \
--karmada-controller-manager-image=$karmada_registry/karmada-controller-manager:v1.3.1 \
--karmada-kube-controller-manager-image=$karmada_registry/kube-controller-manager:v1.18.20 \
--karmada-scheduler-image=$karmada_registry/karmada-scheduler:v1.3.1 \
--karmada-webhook-image=$karmada_registry/karmada-webhook:v1.3.1 \
--crds=./crds.tar.gz

In yesterday's document, I need to give the command of karmada offline installation, which makes me a little painful.🥲 /cc @RainbowMango

helen-frank commented 1 year ago

/cc @RainbowMango

RainbowMango commented 1 year ago

@lonelyCZ Do you have any other comments?

lonelyCZ commented 1 year ago

Looks good, I will test it in my env today.

lonelyCZ commented 1 year ago

Hi, @helen-frank could you please help to resolve the conflicts? I will test it ASAP.

helen-frank commented 1 year ago

resolve conflicts and test @lonelyCZ

helen-frank commented 1 year ago

./karmadactl init --image-registry=daocloud.io/atsctoo @lonelyCZ

lonelyCZ commented 1 year ago

Thanks @helen-frank , it works fine in my env.

/lgtm

RainbowMango commented 1 year ago

/assign

RainbowMango commented 1 year ago

By the way, I see the words from PR description that seems this PR is part of #2541, and the comment at https://github.com/karmada-io/karmada/pull/2655#issuecomment-1282710770.

What's another flag look like?

helen-frank commented 1 year ago

virtual-image-tag or private-image-tag ? @RainbowMango

helen-frank commented 1 year ago

By the way, I see the words from PR description that seems this PR is part of #2541, and the comment at #2655 (comment).

What's another flag look like?

I suddenly realized that users may not care about the versions of karmada and etcd. I think the scope of image-tag can be reduced to kube. More compatibility issues are on kube.

What do you think of kube-image-tag? @RainbowMango

helen-frank commented 1 year ago
Private image registry. Choose a container registry to pull control plane images from. Including all images required to karmada init, recommended for use when deploying karmada in privatized environments. This is a minimum priority parameter. For example, you can use kube-image-registry=registry.cn-hangzh to change the image related to kube

The description has some long ... @RainbowMango

RainbowMango commented 1 year ago

Generally looks good to me. But I didn't test it on my side. Leave approval to @lonelyCZ

lonelyCZ commented 1 year ago

It works fine in my env. :)

Thanks @helen-frank

/lgtm /approve

And please update Does this PR introduce a user-facing change? in this PR.

RainbowMango commented 1 year ago

/retitle introduce --private-image-registry flag to karmadactl init

RainbowMango commented 1 year ago

In addition to the release notes that @lonelyCZ asked for above, please also update the PR descriptions as per the latest content.

helen-frank commented 1 year ago

OK, I rested earlier yesterday and updated it immediately.

karmada-bot commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lonelyCZ

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: - ~~[pkg/karmadactl/cmdinit/OWNERS](https://github.com/karmada-io/karmada/blob/master/pkg/karmadactl/cmdinit/OWNERS)~~ [lonelyCZ] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
lonelyCZ commented 1 year ago

/lgtm