Conversation
|
Welcome @thebigbone! It looks like this is your first PR to kmesh-net/kmesh 🎉 |
ctl/main.go
Outdated
| rootCmd.AddCommand(waypoint.NewCmd()) | ||
| rootCmd.AddCommand(version.NewCmd()) | ||
| rootCmd.AddCommand(accesslog.NewCmd()) | ||
| rootCmd.AddCommand(install.NewCmd()) |
ctl/install/install.go
Outdated
| log.Fatal(err) | ||
| } | ||
|
|
||
| kubeconfig := os.Getenv("HOME") + "/.kube/config" |
There was a problem hiding this comment.
Use existing (tools)[https://github.com/kmesh-net/kmesh/blob/main/ctl/utils/utils.go#L31] to create k8s client direclty which has built-in method for applying yaml files.
There was a problem hiding this comment.
So, I should remove the custom doServerSideApply function?
| @@ -0,0 +1,167 @@ | |||
| package install | |||
ctl/install/install.go
Outdated
| "log" | ||
| "os" | ||
|
|
||
| "k8s.io/apimachinery/pkg/api/meta" |
There was a problem hiding this comment.
Arrange the dependency order, put the standard lib together, put Kmesh lib together and put third-party dependencies together.
ctl/install/install.go
Outdated
| func NewCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "install", | ||
| Short: "install kmesh with all the resources", |
There was a problem hiding this comment.
Add examples, refer to other subcommands.
ctl/install/install.go
Outdated
| panic(err.Error()) | ||
| } | ||
|
|
||
| resources := []Resource{ |
There was a problem hiding this comment.
Why not just apply all files in the yaml diretory instead of listing each files which may change in the future?
There was a problem hiding this comment.
You could get all yaml contents and call this function
There was a problem hiding this comment.
I don't know if there is an elegant way to direclty get the contents of all files under yaml directory or to know which files are in this directory and download them one by one.
There was a problem hiding this comment.
I don't know if there is an elegant way to direclty get the contents of all files under yaml directory or to know which files are in this directory and download them one by one.
curl -s "https://api.github.com/repos/kmesh-net/kmesh/contents/deploy/yaml" | jq -r '.[] | .download_url'
There was a problem hiding this comment.
The ApplyYAMLContents function works fine but it requires namespace argument. For now, I can separate the kmesh-system and istio but it can break in the future because there could be a new yaml file with a different namespace.
There was a problem hiding this comment.
I think you could specify namespace as "", so that it will direcly use the ns specified in yaml.
There was a problem hiding this comment.
Oh, that's helpful. I was parsing the namespace field in every file.
ctl/install/install.go
Outdated
| {Name: "serviceAccount", URL: getURL(version, "serviceaccount.yaml")}, | ||
| } | ||
|
|
||
| fmt.Println("using version: ", version) |
There was a problem hiding this comment.
nit:install kmesh version:
Codecov ReportAll modified and coverable lines are covered by tests ✅
see 35 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
| # Install a specific version of kmesh | ||
| kmeshctl install --version 0.5`, | ||
| Run: func(cmd *cobra.Command, args []string) { | ||
| version, err := cmd.Flags().GetString("version") |
There was a problem hiding this comment.
We still have issue #949.
@YaoZengzeng Has this problem been fixed?
There was a problem hiding this comment.
No, I hope this issue could be fixed with the solution of #892, but it seems that this problem is not being addressed now. If no one has dealt it by then, I will fix it.
ctl/install/install.go
Outdated
|
|
||
| deployYaml, err := io.ReadAll(resp.Body) | ||
| if err != nil { | ||
| log.Fatalf("yamlFile.Get err #%v ", err) |
There was a problem hiding this comment.
| log.Fatalf("yamlFile.Get err #%v ", err) | |
| log.Fatalf("yamlFile.Get err: %v ", err) |
ctl/install/install.go
Outdated
| func NewCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "install", | ||
| Short: "install kmesh with all the resources", |
There was a problem hiding this comment.
Descriptive content use Kmesh, with the first letter capitalized.
|
The overall framework seems fine for me, @hzxuzhonghu PTAL. |
ctl/install/install.go
Outdated
| func getYAMLFile(version string) string { | ||
| var url string | ||
| if version != "main" { | ||
| url = fmt.Sprintf("https://api.github.com/repos/kmesh-net/kmesh/contents/deploy/yaml?ref=release-%s", version) |
There was a problem hiding this comment.
I donot think this is quite correct, because?:
- we didn't update the image tag
- should not use the github branch, but use the tag instead
So in short should we use helm chart https://github.com/kmesh-net/kmesh/releases/download/v0.5.0/kmesh-helm-v0.5.0.tgz
or the OCI chart image https://github.com/orgs/kmesh-net/packages/container/package/kmesh-helm
There was a problem hiding this comment.
It is using release tag? Using helm will introduce new dependency which is totally unnecessary.
There was a problem hiding this comment.
See the released version above
|
ping @hzxuzhonghu |
|
please see above comment, when you set version-=0.5, then you will install kmesh with latest image https://github.com/kmesh-net/kmesh/blob/release-0.5/deploy/yaml/kmesh.yaml#L72 This is not expected, can you replace that image? I would suggest we support v0.5.0 or 0.5.0 rather than 0.5, see our releases |
Should I just replace the image and get the yaml files from |
This probably not work, think of the case that a yaml is updated because of some new features. The old image may cannot work with the new daemonset yaml |
Signed-off-by: thebigbone <pacman@duck.com>
Signed-off-by: thebigbone <pacman@duck.com>
Signed-off-by: thebigbone <pacman@duck.com>
Signed-off-by: thebigbone <pacman@duck.com>
Signed-off-by: thebigbone <pacman@duck.com>
Signed-off-by: thebigbone <pacman@duck.com>
Co-authored-by: Tiger Xu / Zhonghu Xu <xuzhonghu@huawei.com> Signed-off-by: thebigbone <pacman@duck.com>
Signed-off-by: thebigbone <pacman@duck.com>
|
Removed the branch and instead using tags now. |
hzxuzhonghu
left a comment
There was a problem hiding this comment.
/lgtm
YOu can fix it later
| if err != nil { | ||
| log.Fatal(err) | ||
| } | ||
| defer resp.Body.Close() |
There was a problem hiding this comment.
nit: not use defer in a for loop
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
New changes are detected. LGTM label has been removed. |
|
Adding label DetailsInstructions 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. |
|
The kube package was changed so it's not able to find |
|
Can you implement this method? Or use helm client https://github.com/kurator-dev/kurator/blob/ac68f35c8799773aea22643e39ca032a20e65fb7/pkg/client/client.go#L66 |
|
@thebigbone This PR can be merged after you pass CI. |
Should I use the istio's implementation directly in |
|
ping @LiZhenCheng9527 |
| log.Fatal(err) | ||
| } | ||
| } else { | ||
| err = cli.ApplyYAMLContents("", combinedYAMLFile) |
There was a problem hiding this comment.
There is no ApplyYamlContents in kmesh's kube pkg.
After fixing this problem, this PR can be merged.
There was a problem hiding this comment.
Yes, which is why I asked if I should use the istio's implementation or the previous doServerSideApply function which I used at the beginning.
There was a problem hiding this comment.
Perhaps we can implement applyYamlContents in Kmesh. If that doesn't work, we can switch back to the doServerSideApply function.
|
I have implemented the method @LiZhenCheng9527 |
What type of PR is this?
/kind feature
What this PR does / why we need it:
adds install command for
kmeshctlwhich will install all the resources for kmesh in a k8s clusterWhich issue(s) this PR fixes:
Fixes #552
Does this PR introduce a user-facing change?: