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

CSK cluster support RBAC #3495

Merged
merged 8 commits into from
Apr 28, 2021
Merged

CSK cluster support RBAC #3495

merged 8 commits into from
Apr 28, 2021

Conversation

anserhyb
Copy link
Contributor

No description provided.

},
"permissions": {
Optional: true,
Type: schema.TypeList,
Copy link
Member

Choose a reason for hiding this comment

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

I think its type should be TypeSet

Copy link
Contributor Author

@anserhyb anserhyb Apr 28, 2021

Choose a reason for hiding this comment

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

_, _ = describeUserPermission(client, uid)
//if _err != nil {
// return WrapErrorf(err, DefaultErrorMsg, ResourceName, "DescribeUserPermission", err)
//}
Copy link
Member

Choose a reason for hiding this comment

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

If there is an error, it should be return.

Copy link
Contributor Author

@anserhyb anserhyb Apr 28, 2021

Choose a reason for hiding this comment

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

这段去掉了:8883421

}

// Query existing permissions, DescribeUserPermission
uid := d.Get("uid").(string)
Copy link
Member

Choose a reason for hiding this comment

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

uid can be got by d.Id()

Copy link
Contributor Author

@anserhyb anserhyb Apr 28, 2021

Choose a reason for hiding this comment

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

return WrapErrorf(err, DefaultErrorMsg, ResourceName, "InitializeClient", err)
}

uid := d.Get("uid").(string)
Copy link
Member

Choose a reason for hiding this comment

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

still applies

Copy link
Contributor Author

@anserhyb anserhyb Apr 28, 2021

Choose a reason for hiding this comment

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

return nil
}

func initCsClient(meta interface{}) (*cs.Client, error) {
Copy link
Member

Choose a reason for hiding this comment

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

I think it should be inited in the client.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

将这段逻辑支持,在connectivity里支持了。

vswitch_name = "${var.name}"
vpc_id = "${alicloud_vpc.default.id}"
cidr_block = "10.1.1.0/24"
availability_zone = "${data.alicloud_zones.default.zones.0.id}"
Copy link
Member

Choose a reason for hiding this comment

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

Please use zone_id

Copy link
Contributor Author

@anserhyb anserhyb Apr 28, 2021

Choose a reason for hiding this comment

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

}

data "alicloud_instance_types" "default" {
availability_zone = "${data.alicloud_zones.default.zones.0.id}"
Copy link
Member

Choose a reason for hiding this comment

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

There is no need to using grammar "${}" and just using data.alicloud_zones.default.zones.0.id or var.name is ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已经更正:8883421

-> **NOTE:** If you call this operation as a RAM user, make sure that this RAM user has the permissions to grant other RAM users the permissions to manage ACK clusters. Otherwise, the `StatusForbidden` or `ForbiddenGrantPermissions` errors will be returned. For more information, see [Use a RAM user to grant RBAC permissions to other RAM users](https://www.alibabacloud.com/help/faq-detail/119035.htm).

-> **NOTE:** This operation overwrites the permissions that have been granted to the specified RAM user. When you call this operation, make sure that the required permissions are included.

Copy link
Member

Choose a reason for hiding this comment

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

Please adds an availability note.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

}

func dataAlicloudCSKubernetesPermissionsRead(d *schema.ResourceData, meta interface{}) error {
client, err := cs.NewClient(&openapi.Config{
Copy link
Member

Choose a reason for hiding this comment

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

Please move the client to connectivity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

update in :cf231d5

}

func resourceAlicloudCSKubernetesPermissionsCreate(d *schema.ResourceData, meta interface{}) error {
client, err := cs.NewClient(&openapi.Config{
Copy link
Member

Choose a reason for hiding this comment

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

still applies

Copy link
Contributor Author

Choose a reason for hiding this comment

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

update in: cf231d5

}

addDebug("GrantPermissions", grantPermissionsRequest, err)
_ = d.Set("uid", uid)
Copy link
Member

Choose a reason for hiding this comment

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

The line 93 is useless and please delete it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Schema: map[string]*schema.Schema{
"uid": {
Type: schema.TypeString,
Required: true,
Copy link
Member

Choose a reason for hiding this comment

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

the uid should be ForceNew

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@xiaozhu36 xiaozhu36 merged commit 08bbd35 into aliyun:master Apr 28, 2021
@anserhyb anserhyb deleted the rbac branch November 23, 2021 07:36
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.

2 participants