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

feat: add profile/install/uninstall/upgrade command #538

Merged
merged 1 commit into from
Sep 21, 2023

Conversation

2456868764
Copy link
Collaborator

Ⅰ. Describe what this PR did

Add profile/install/uninstall/upgrade command

  1. command list
A command line utility for operating Higress

Usage:
  hgctl [command]

Available Commands:
  completion     generate the autocompletion script for the specified shell
  gateway-config Retrieve Higress Gateway configuration.
  help           Help about any command
  install        Applies an higress manifest, installing or reconfiguring higress on a cluster.
  profile        Commands related to higress configuration profiles
  uninstall      Uninstall higress from a cluster
  upgrade        Upgrade Higress in-place
  version        Show version

  1. profile command
(base) ➜  hgctl git:(hgctl-install) ✗ ./hgctl profile --help
The profile command lists, dumps or diffs higress configuration profiles.

Usage:
  hgctl profile [command]

Examples:
hgctl profile list
hgctl install --set profile=local-k8s  # Use a profile from the list

Available Commands:
  dump        Dumps an higress configuration profile
  list        Lists available higress configuration profiles

Flags:
  -h, --help   help for profile


  1. install command

The install command generates an higress install manifest and applies it to a cluster.

Usage:
  hgctl install [flags]

Examples:
  # Apply a default higress installation
  hgctl install

  # Install higress on local kubernetes cluster 
  hgctl install --set profile=local-k8s 

  # To override profile setting
  hgctl install --set profile=local-k8s  --set global.enableIstioAPI=true --set gateway.replicas=2"

  # To override helm setting
  hgctl install --set profile=local-k8s  --set values.global.proxy.resources.requsts.cpu=500m"



Flags:
      --context string      The name of the kubeconfig context to use.
  -h, --help                help for install
      --kubeconfig string   Path to the kubeconfig file to use for CLI requests.
  -d, --manifests string    Specify a path to a directory of profiles
                            (e.g. ~/Downloads/higress/manifests).
  -s, --set stringArray     Override an higress profile value, e.g. to choose a profile
                            (--set profile=local-k8s), or override profile values (--set gateway.replicas=2), or override helm values (--set values.global.proxy.resources.requsts.cpu=500m).


  1. upgrade command
The upgrade command is an alias for the install command that performs additional upgrade-related checks.

Usage:
  hgctl upgrade [flags]

Flags:
      --context string      The name of the kubeconfig context to use.
  -h, --help                help for upgrade
      --kubeconfig string   Path to the kubeconfig file to use for CLI requests.
  -d, --manifests string    Specify a path to a directory of profiles
                            (e.g. ~/Downloads/higress/manifests).
  -s, --set stringArray     Override an higress profile value, e.g. to choose a profile
                            (--set profile=local-k8s), or override profile values (--set gateway.replicas=2), or override helm values (--set values.global.proxy.resources.requsts.cpu=500m).

  1. uninstall command
Usage:
  hgctl uninstall [flags]

Examples:
  # Uninstall higress 
  hgctl uninstall 

  # Uninstall higress by special namespace
  hgctl uninstall --namespace=higress-system
  
  # Uninstall higress and istio CRD
  hgctl uninstall --purge-istio-crd  --istio-namespace=istio-system

Flags:
      --context string           The name of the kubeconfig context to use.
  -h, --help                     help for uninstall
      --istio-namespace string   The namespace of Istio Control Plane. (default "istio-system")
      --kubeconfig string        Path to the kubeconfig file to use for CLI requests.
  -n, --namespace string         The namespace of higress (default "higress-system")
  -p, --purge-istio-crd          Delete  all of Istio resources

Ⅱ. Does this pull request fix one issue?

#229

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@johnlanni
Copy link
Collaborator

cc @Xunzhuo

Copy link
Collaborator

@Xunzhuo Xunzhuo left a comment

Choose a reason for hiding this comment

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

  • Add missing licenses
  • Make sure make go.test.coverage is passing before sending a PR.

@codecov-commenter
Copy link

codecov-commenter commented Sep 19, 2023

Codecov Report

Merging #538 (f35a4c9) into main (8747e1d) will decrease coverage by 0.84%.
Report is 7 commits behind head on main.
The diff coverage is 35.86%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #538      +/-   ##
==========================================
- Coverage   39.99%   39.15%   -0.84%     
==========================================
  Files          45       59      +14     
  Lines        6186     7776    +1590     
==========================================
+ Hits         2474     3045     +571     
- Misses       3539     4488     +949     
- Partials      173      243      +70     
Files Changed Coverage Δ
pkg/cmd/hgctl/install.go 0.00% <0.00%> (ø)
pkg/cmd/hgctl/profile.go 0.00% <0.00%> (ø)
pkg/cmd/hgctl/profileDump.go 0.00% <0.00%> (ø)
pkg/cmd/hgctl/profileList.go 0.00% <0.00%> (ø)
pkg/cmd/hgctl/root.go 0.00% <0.00%> (ø)
pkg/cmd/hgctl/uninstall.go 0.00% <0.00%> (ø)
pkg/cmd/hgctl/upgrade.go 0.00% <0.00%> (ø)
pkg/cmd/hgctl/util/reflect.go 0.00% <0.00%> (ø)
pkg/cmd/hgctl/util/util.go 0.00% <0.00%> (ø)
pkg/cmd/hgctl/version.go 0.00% <ø> (ø)
... and 6 more

... and 1 file with indirect coverage changes

@2456868764 2456868764 force-pushed the hgctl-install branch 3 times, most recently from 2651a4c to 4fc87e4 Compare September 19, 2023 05:50
@2456868764
Copy link
Collaborator Author

  • Add missing licenses
  • Make sure make go.test.coverage is passing before sending a PR.

i've updated, please review again

@2456868764 2456868764 force-pushed the hgctl-install branch 2 times, most recently from 1f066b8 to f35a4c9 Compare September 20, 2023 06:55
@Xunzhuo Xunzhuo mentioned this pull request Sep 21, 2023
18 tasks
Copy link
Collaborator

@Xunzhuo Xunzhuo left a comment

Choose a reason for hiding this comment

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

Generally looks good, thanks for working on it and adding init support to hgctl, I do not want to block this for too long, so I would like leave a couple of follow-up tasks.

Improve UX

  • opt install/uninstall/profile logs
  • add logging animation/color
  • support multi log-levels

Add waiting between components

  • make sure components are running well.

Clean code

@johnlanni johnlanni merged commit 587267a into alibaba:main Sep 21, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants