-
Notifications
You must be signed in to change notification settings - Fork 31
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
ngctl: add check command and doc #39
Conversation
kqzh
commented
Jul 6, 2021
•
edited
Loading
edited
- add check command
- support list command to list nebulacluster sub resources
- add ngctl doc
- add unit test
doc/user/ngctl_guide.md
Outdated
@@ -0,0 +1,89 @@ | |||
|
|||
# Overview | |||
ngctl is a terminal cmd tool for nebula-operator, it has the following commands: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this better? for nebula-operator
sounds like management nebula-operator
.
ngctl
is a terminal cmd tool for Nebula Graph managed by nebula-operator, it has the following commands:
doc/user/ngctl_guide.md
Outdated
# specify a nebula cluster to use | ||
ngctl use demo-cluster | ||
|
||
# specify kubernetes context and namespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thanks this is just specify namespace
, and don't support specify kubernetes context now.
Please remove the kubernetes context
as well as in go source file.
pkg/ngctl/cmd/check/check.go
Outdated
Namespace string | ||
NebulaClusterName string | ||
ResourceType string | ||
AllNamespaces bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused
pkg/ngctl/cmd/check/check.go
Outdated
ngctl check pods --nebulacluster=nebula`) | ||
) | ||
|
||
const resourceType = "nebulacluster" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also need in 'list.go', share it?
pkg/ngctl/cmd/check/check.go
Outdated
if o.ResourceType == "" { | ||
o.ResourceType = resourceType | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is need to check the o.ResourceType
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If user don't specify the resourceType, we can use "nebulacluster" as a default type
pkg/ngctl/cmd/util/factory_test.go
Outdated
}, | ||
factory: &factoryImpl{ | ||
nebulaClusterName: "", | ||
nebulaClusterConfigFile: "~/.kube/config1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is recommended to put it in a temporary directory os.CreateTemp
.
And remove it after tested.
As well as config_test.go
.
pkg/ngctl/cmd/util/factory.go
Outdated
// GetNebulaClusterName() (string, error) | ||
GetNebulaClusterName() (string, error) | ||
// GetNebulaClusterNameWithoutConfig() string | ||
// GetNamespace() (string, error) | ||
GetNamespace() (string, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetNebulaClusterName
and GetNamespace
may cause out of sync, can you use GetNebulaClusterNameAndNamespace
instead?
@veezhang Fixed all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM