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

karmadactl: Fixed init commands can not select default release version issue. #1456

Merged
merged 2 commits into from
Mar 16, 2022

Conversation

prodanlabs
Copy link
Member

@prodanlabs prodanlabs commented Mar 8, 2022

Signed-off-by: prodan pengshihaoren@gmail.com

What type of PR is this?
/kind bug

What this PR does / why we need it:
The images and crd versions of karmadactl init are consistent with the karmadactl version
Which issue(s) this PR fixes:
Fixes #1340

Special notes for your reviewer:

kubectl-karmada version is v0.10.1-547-g0190fda9-dirty

$ ./kubectl-karmada version
kubectl karmada version: version.Info{GitVersion:"v0.10.1-547-g0190fda9-dirty", GitCommit:"0190fda99632c04888ec52fc828985f601bd61a0", GitTreeState:"dirty", BuildDate:"2022-03-08T15:38:46Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"linux/amd64"}

crd and images version by default

Flags:
      --cert-external-dns string                         the external DNS of Karmada certificate (e.g localhost,localhost.com)
      --cert-external-ip string                          the external IP of Karmada certificate (e.g 192.168.1.2,172.16.1.2)
      --crds string                                      Karmada crds resource.(local file e.g. --crds /root/crds.tar.gz) (default "https://github.com/karmada-io/karmada/releases/download/v0.10.0/crds.tar.gz")
      --etcd-data string                                 etcd data path,valid in hostPath mode. (default "/var/lib/karmada-etcd")
      --etcd-image string                                etcd image (default "k8s.gcr.io/etcd:3.5.1-0")
      --etcd-init-image string                           etcd init container image (default "docker.io/alpine:3.14.3")
      --etcd-node-selector-labels string                 etcd pod select the labels of the node. valid in hostPath mode ( e.g. --etcd-node-selector-labels karmada.io/etcd=true)
      --etcd-pvc-size string                             etcd data path,valid in pvc mode. (default "5Gi")
      --etcd-replicas int32                              etcd replica set, cluster 3,5...singular (default 1)
      --etcd-storage-mode string                         etcd data storage mode(emptyDir,hostPath,PVC). value is PVC, specify --storage-classes-name (default "emptyDir")
  -h, --help                                             help for init
      --karmada-aggregated-apiserver-image string        karmada aggregated apiserver image (default "swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-aggregated-apiserver:v0.10.1")
      --karmada-aggregated-apiserver-replicas int32      karmada aggregated apiserver replica set (default 1)
      --karmada-apiserver-image string                   Kubernetes apiserver image (default "k8s.gcr.io/kube-apiserver:v1.21.7")
      --karmada-apiserver-replicas int32                 karmada apiserver replica set (default 1)
      --karmada-controller-manager-image string          karmada controller manager  image (default "swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-controller-manager:v0.10.1")
      --karmada-controller-manager-replicas int32        karmada controller manager replica set (default 1)
  -d, --karmada-data string                              karmada data path. kubeconfig cert and crds files (default "/etc/karmada")
      --karmada-kube-controller-manager-image string     Kubernetes controller manager image (default "k8s.gcr.io/kube-controller-manager:v1.21.7")
      --karmada-kube-controller-manager-replicas int32   karmada kube controller manager replica set (default 1)
      --karmada-scheduler-image string                   karmada scheduler image (default "swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-scheduler:latest:v0.10.1")
      --karmada-scheduler-replicas int32                 karmada scheduler replica set (default 1)
      --karmada-webhook-image string                     karmada webhook image (default "swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-webhook:v0.10.1")
      --karmada-webhook-replicas int32                   karmada webhook replica set (default 1)
  -n, --namespace string                                 Kubernetes namespace (default "karmada-system")
  -p, --port int32                                       Karmada apiserver service node port (default 32443)
      --storage-classes-name string                      Kubernetes StorageClasses Name

Does this PR introduce a user-facing change?:

`karmadactl`: Fixed `init` commands can not select default release version issue.

/cc @RainbowMango
@zach593

@karmada-bot karmada-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. labels Mar 8, 2022
@karmada-bot
Copy link
Collaborator

@prodanlabs: GitHub didn't allow me to request PR reviews from the following users: zach593.

Note that only karmada-io members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

Signed-off-by: prodan pengshihaoren@gmail.com

What type of PR is this?
/kind bug

What this PR does / why we need it:
The images and crd versions of karmadactl init are consistent with the karmadactl version
Which issue(s) this PR fixes:
Fixes #1430

Special notes for your reviewer:

kubectl-karmada version is v0.10.1-547-g0190fda9-dirty

$ ./kubectl-karmada version
kubectl karmada version: version.Info{GitVersion:"v0.10.1-547-g0190fda9-dirty", GitCommit:"0190fda99632c04888ec52fc828985f601bd61a0", GitTreeState:"dirty", BuildDate:"2022-03-08T15:38:46Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"linux/amd64"}

crd and images version by default

Flags:
     --cert-external-dns string                         the external DNS of Karmada certificate (e.g localhost,localhost.com)
     --cert-external-ip string                          the external IP of Karmada certificate (e.g 192.168.1.2,172.16.1.2)
     --crds string                                      Karmada crds resource.(local file e.g. --crds /root/crds.tar.gz) (default "https://github.com/karmada-io/karmada/releases/download/v0.10.0/crds.tar.gz")
     --etcd-data string                                 etcd data path,valid in hostPath mode. (default "/var/lib/karmada-etcd")
     --etcd-image string                                etcd image (default "k8s.gcr.io/etcd:3.5.1-0")
     --etcd-init-image string                           etcd init container image (default "docker.io/alpine:3.14.3")
     --etcd-node-selector-labels string                 etcd pod select the labels of the node. valid in hostPath mode ( e.g. --etcd-node-selector-labels karmada.io/etcd=true)
     --etcd-pvc-size string                             etcd data path,valid in pvc mode. (default "5Gi")
     --etcd-replicas int32                              etcd replica set, cluster 3,5...singular (default 1)
     --etcd-storage-mode string                         etcd data storage mode(emptyDir,hostPath,PVC). value is PVC, specify --storage-classes-name (default "emptyDir")
 -h, --help                                             help for init
     --karmada-aggregated-apiserver-image string        karmada aggregated apiserver image (default "swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-aggregated-apiserver:v0.10.1")
     --karmada-aggregated-apiserver-replicas int32      karmada aggregated apiserver replica set (default 1)
     --karmada-apiserver-image string                   Kubernetes apiserver image (default "k8s.gcr.io/kube-apiserver:v1.21.7")
     --karmada-apiserver-replicas int32                 karmada apiserver replica set (default 1)
     --karmada-controller-manager-image string          karmada controller manager  image (default "swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-controller-manager:v0.10.1")
     --karmada-controller-manager-replicas int32        karmada controller manager replica set (default 1)
 -d, --karmada-data string                              karmada data path. kubeconfig cert and crds files (default "/etc/karmada")
     --karmada-kube-controller-manager-image string     Kubernetes controller manager image (default "k8s.gcr.io/kube-controller-manager:v1.21.7")
     --karmada-kube-controller-manager-replicas int32   karmada kube controller manager replica set (default 1)
     --karmada-scheduler-image string                   karmada scheduler image (default "swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-scheduler:latest:v0.10.1")
     --karmada-scheduler-replicas int32                 karmada scheduler replica set (default 1)
     --karmada-webhook-image string                     karmada webhook image (default "swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-webhook:v0.10.1")
     --karmada-webhook-replicas int32                   karmada webhook replica set (default 1)
 -n, --namespace string                                 Kubernetes namespace (default "karmada-system")
 -p, --port int32                                       Karmada apiserver service node port (default 32443)
     --storage-classes-name string                      Kubernetes StorageClasses Name

Does this PR introduce a user-facing change?:


The images and crd versions of `karmadactl init` are the same as the karmadactl version by default

/cc @RainbowMango @zach593

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.

@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 8, 2022
@prodanlabs prodanlabs force-pushed the karmadactl-init-fix branch 3 times, most recently from 2894640 to 3eed758 Compare March 8, 2022 16:46
@RainbowMango
Copy link
Member

So quick!!! Thanks @prodanlabs

I'll look at it tomorrow. Looks good after a quick look.

Comment on lines 22 to 30
func GetInitVersion(version string) InitVersion {
// CRD version e.g. v0.10.1-547-g0190fda9-dirty -> v0.10.0
n := strings.LastIndex(version, ".") + 1

return InitVersion{
ImageVersion: initImageVersion(version),
CRDVersion: fmt.Sprintf("%s%s", string([]byte(version)[:n]), "0"),
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I guess there will be some tools/packages to handle the git version thing. I'll try to investigate it.

flags.StringVar(&opts.CRDs, "crds", crdURL, "Karmada crds resource.(local file e.g. --crds /root/crds.tar.gz)")
flags.Int32VarP(&opts.KarmadaAPIServerNodePort, "port", "p", 32443, "Karmada apiserver service node port")
flags.StringVarP(&opts.KarmadaDataPath, "karmada-data", "d", "/etc/karmada", "karmada data path. kubeconfig cert and crds files")
flags.StringVarP(&opts.KarmadaAPIServerImage, "karmada-apiserver-image", "", "k8s.gcr.io/kube-apiserver:v1.21.7", "Kubernetes apiserver image")
flags.Int32VarP(&opts.KarmadaAPIServerReplicas, "karmada-apiserver-replicas", "", 1, "karmada apiserver replica set")
flags.StringVarP(&opts.KarmadaSchedulerImage, "karmada-scheduler-image", "", "swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-scheduler:latest", "karmada scheduler image")
flags.StringVarP(&opts.KarmadaSchedulerImage, "karmada-scheduler-image", "", fmt.Sprintf("swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-scheduler:latest:%s", v.ImageVersion), "karmada scheduler image")
Copy link
Contributor

Choose a reason for hiding this comment

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

:latest:%s

Copy link
Member Author

Choose a reason for hiding this comment

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

oh my fault.

@@ -24,3 +25,11 @@ func TestDownloadFile(t *testing.T) {
panic(err)
}
}

// TestGetInitVersion test GetInitVersion
func TestGetInitVersion(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

make it failable, so it could be useful in CI

Copy link
Member Author

@prodanlabs prodanlabs Mar 10, 2022

Choose a reason for hiding this comment

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

make it failable, so it could be useful in CI

The version number is passed in when compiling, I feel like I can't do anything in go test.
https://github.com/karmada-io/karmada/blob/master/Makefile#L15

Copy link
Contributor

Choose a reason for hiding this comment

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

GetInitVersion() get "GitVersion" from param, at least we could still check that the shift logic is correct or not

Signed-off-by: prodan <pengshihaoren@gmail.com>
@zach593
Copy link
Contributor

zach593 commented Mar 10, 2022

The images and crd versions of karmadactl init are the same as the karmadactl version by default

and builds by makefile from master branch will refer to latest release version (with best effort)

Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
@karmada-bot karmada-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 14, 2022
@RainbowMango
Copy link
Member

Hi @prodanlabs I appended a commit on yours, cloud you please help to confirm?

@prodanlabs
Copy link
Member Author

Cool!

@RainbowMango
Copy link
Member

/retitle karmadactl: Fixed init commands can not select default release version issue.

@karmada-bot karmada-bot changed the title fix init image and crd default version karmadactl: Fixed init commands can not select default release version issue. Mar 15, 2022
Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

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

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 16, 2022
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/approve

@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

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

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 16, 2022
@karmada-bot karmada-bot merged commit df93b7d into karmada-io:master Mar 16, 2022
karmada-bot added a commit that referenced this pull request Mar 16, 2022
…k-of-#1456-#1495-upstream-release-1.1

Automated cherry pick of #1456: fix init image and crd default version
#1495: Fix failling test due to outdate vendor
karmada-bot added a commit that referenced this pull request Mar 17, 2022
…k-of-#1456-#1495-upstream-release-1.0

Automated cherry pick of #1456: fix init image and crd default version
#1495: Fix failling test due to outdate vendor
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. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[karmada init] prepare karmada failed.failed download file
5 participants