Skip to content

Commit

Permalink
support ack-erdma-controller addon rrsa configs (#471)
Browse files Browse the repository at this point in the history
Signed-off-by: bingshen.wbs <[email protected]>
  • Loading branch information
BSWANG authored Nov 28, 2024
1 parent 4b538fd commit 77ad4c5
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions pkg/ctl/rrsa/setupaddon/addon/ack-erdma-controller.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package addon

import (
"fmt"
"github.com/AliyunContainerService/ack-ram-tool/pkg/types"
)

func init() {
registryAddon(&AckErdmaController{})
}

const (
addonName = "ack-erdma-controller"
)

type AckErdmaController struct{}

func (a *AckErdmaController) AddonName() string {
return addonName
}

func (a *AckErdmaController) RoleName(clusterId string) string {
return addonName + "-" + clusterId
}

func (a *AckErdmaController) RamPolicy() types.RamPolicy {
policy := types.MakeRamPolicyDocument([]types.RamPolicyStatement{
{
"Effect": "Allow",
"Action": []string{
"ecs:DescribeInstances",
"ecs:DescribeInstanceTypes",
"ecs:DescribeNetworkInterfaces",
"ecs:ModifyNetworkInterfaceAttribute",
"ecs:CreateNetworkInterface",
"ecs:AttachNetworkInterface",
},
"Resource": "*",
},
})
return types.RamPolicy{
Description: fmt.Sprintf("policy for ack cluster addon %s", a.AddonName()),
PolicyDocument: &policy,
PolicyName: fmt.Sprintf("ack-addon-policy-%s", a.AddonName()),
PolicyType: types.RamPolicyTypeCustom,
}
}

func (a *AckErdmaController) NameSpace() string {
return addonName
}

func (a *AckErdmaController) ServiceAccountName() string {
return addonName
}

0 comments on commit 77ad4c5

Please sign in to comment.