-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Replace the Helm command #4852
Replace the Helm command #4852
Conversation
Hi @nioshield. Thanks for your PR. I'm waiting for a kubesphere member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/ok-to-test |
@nioshield Thanks for your contribution! The job |
/cc @kubesphere/sig-apps |
/cc @zheng1 |
/retest |
Stdout: stdout, | ||
} | ||
klog.V(2).Infof("namespace: %s, name: %s, run command success", c.Namespace, c.ReleaseName) | ||
klog.V(8).Infof("namespace: %s, name: %s, run command success, release: %v", c.Namespace, c.ReleaseName, rel) |
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.
rel
is a struct, if we use %v
to format it, the output is difficult to read.
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.
We should encode rel
to string.
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.
yes,It's enough to output rel.Manifest here
if kubeconfig != "" { | ||
cfg, _ := clientcmd.RESTConfigFromKubeConfig([]byte(kubeconfig)) | ||
flags = genericclioptions.NewConfigFlags(false) | ||
flags.APIServer = &cfg.Host | ||
flags.BearerToken = &cfg.BearerToken | ||
flags.CAFile = &cfg.CAFile | ||
flags.WithDiscoveryBurst(cfg.Burst) | ||
if sa := cfg.Impersonate.UserName; sa != "" { | ||
flags.Impersonate = &sa | ||
} | ||
} |
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.
The following code will cause a cert error if the kubefonfig includes certificate-authority-data.
E0513 11:24:17.485511 1 helm_wrapper.go:107] namespace: z1, name: redis-emjr1v, run command failed, error: Kubernetes cluster unreachable: Get "https://10.233.0.1:443/version?timeout=32s": x509: certificate signed by unknown authority
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.
Wrapped RESTClientGetter
ttype restClientGetter struct {
config clientcmd.ClientConfig
}
func (r *restClientGetter) ToRawKubeConfigLoader() clientcmd.ClientConfig {
return r.config
}
func (r *restClientGetter) ToRESTConfig() (*rest.Config, error) {
return r.ToRawKubeConfigLoader().ClientConfig()
}
func (r *restClientGetter) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error) {
config, err := r.ToRESTConfig()
if err != nil {
return nil, err
}
discoveryClient, err := discovery.NewDiscoveryClientForConfig(config)
if err != nil {
return nil, err
}
clientset := memory.NewMemCacheClient(discoveryClient)
return clientset, nil
}
if kubeconfig != "" { | ||
cfg, _ := clientcmd.RESTConfigFromKubeConfig([]byte(kubeconfig)) | ||
flags = genericclioptions.NewConfigFlags(false) | ||
flags.APIServer = &cfg.Host | ||
flags.BearerToken = &cfg.BearerToken | ||
flags.CAFile = &cfg.CAFile | ||
flags.WithDiscoveryBurst(cfg.Burst) | ||
if sa := cfg.Impersonate.UserName; sa != "" { | ||
flags.Impersonate = &sa | ||
} | ||
} |
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.
The following code will cause a cert error if the kubefonfig includes certificate-authority-data.
E0513 11:24:17.485511 1 helm_wrapper.go:107] namespace: z1, name: redis-emjr1v, run command failed, error: Kubernetes cluster unreachable: Get "https://10.233.0.1:443/version?timeout=32s": x509: certificate signed by unknown authority
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.
Thanks for your reply.the multi cluster kubeconfig havn't check err,i will fix this err.In addition how can i fast to mock a multi cluster env
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.
Thanks for your reply.the multi cluster kubeconfig havn't check err,i will fix this err.In addition how can i fast to mock a multi cluster env
sigs.k8s.io/controller-runtime/pkg/envtest
may be helpful for you.
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.
Thanks to your help, I created the MemoryRESTClientGetter to solve this problem
LGTM @xyz-li Any comments? |
Merge after v3.3.0 is released. |
/hold |
LGTM label has been added. Git tree hash: 4c6a057aa056469ed7cddb5af8a307a3a8cc1e3d
|
Hi, @nioshield have you tried installing the following chart? |
/retest |
I have verified this pr, it works. |
/unhold |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nioshield, wansir 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 |
* Replace the helm command line with helm action * fix log misspelling * helm wrapper formate log msg * fix: helm action faild in multi cluster
What type of PR is this?
/kind feature
What this PR does / why we need it:
Use Helm action package directly to manage Helm Releases, avoiding dependency on helm/kustomize Command.The Helm can be flexibly configured
Which issue(s) this PR fixes:
Fixes #
Special notes for reviewers:
Does this PR introduced a user-facing change?
Additional documentation, usage docs, etc.: