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

CCE resource exports kube_config_raw #512

Merged
merged 1 commit into from
Sep 14, 2020

Conversation

Jason-Zhang9309
Copy link
Collaborator

fixes #469

@@ -147,6 +147,10 @@ func resourceCCEClusterV3() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"kube_config_raw": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add StateFunc function will be better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems the StateFunc won't be called until d.Set( ) succeed,but r.Body can't be set directly as TypeString

@@ -323,7 +327,12 @@ func resourceCCEClusterV3Read(d *schema.ResourceData, meta interface{}) error {
d.Set("security_group_id", n.Spec.HostNetwork.SecurityGroup)
d.Set("region", GetRegion(d, config))

cert, err := clusters.GetCert(cceClient, d.Id()).Extract()
r := clusters.GetCert(cceClient, d.Id())
kubeConfigRaw, _ := jsonMarshal(r.Body)
Copy link
Collaborator

Choose a reason for hiding this comment

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

the error result should be judged here if the r.Body is abnormal.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@niuzhenguo niuzhenguo merged commit 8565a73 into huaweicloud:master Sep 14, 2020
@Jason-Zhang9309 Jason-Zhang9309 deleted the dev-cce-export-kube branch September 14, 2020 06:15
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.

Feature request: CCE resource exports raw kube config content
3 participants