Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package client

const (
ACKClusterConfigSpecType = "ackClusterConfigSpec"
ACKClusterConfigSpecFieldAddons = "addons"
ACKClusterConfigSpecFieldAliyunCredentialSecret = "aliyun_credential_secret"
ACKClusterConfigSpecFieldCloudMonitorFlags = "cloudMonitorFlags"
ACKClusterConfigSpecFieldClusterID = "cluster_id"
ACKClusterConfigSpecFieldClusterIsUpgrading = "clusterIsUpgrading"
ACKClusterConfigSpecFieldClusterSpec = "clusterSpec"
ACKClusterConfigSpecFieldClusterType = "clusterType"
ACKClusterConfigSpecFieldContainerCidr = "containerCidr"
ACKClusterConfigSpecFieldDisableRollback = "disableRollback"
Expand All @@ -30,23 +32,27 @@ const (
ACKClusterConfigSpecFieldOsType = "osType"
ACKClusterConfigSpecFieldPauseClusterUpgrade = "pauseClusterUpgrade"
ACKClusterConfigSpecFieldPlatform = "platform"
ACKClusterConfigSpecFieldPodVswitchIds = "podVswitchIds"
ACKClusterConfigSpecFieldProxyMode = "proxyMode"
ACKClusterConfigSpecFieldRegionID = "regionId"
ACKClusterConfigSpecFieldResourceGroupID = "resourceGroupId"
ACKClusterConfigSpecFieldSSHFlags = "sshFlags"
ACKClusterConfigSpecFieldSecurityGroupID = "securityGroupId"
ACKClusterConfigSpecFieldServiceCidr = "serviceCidr"
ACKClusterConfigSpecFieldSnatEntry = "snatEntry"
ACKClusterConfigSpecFieldTaskId = "taskId"
ACKClusterConfigSpecFieldTimeoutMins = "timeoutMins"
ACKClusterConfigSpecFieldVpcID = "vpcId"
ACKClusterConfigSpecFieldVswitchIds = "vswitchIds"
)

type ACKClusterConfigSpec struct {
Addons []Addon `json:"addons,omitempty" yaml:"addons,omitempty"`
AliyunCredentialSecret string `json:"aliyun_credential_secret,omitempty" yaml:"aliyun_credential_secret,omitempty"`
CloudMonitorFlags bool `json:"cloudMonitorFlags,omitempty" yaml:"cloudMonitorFlags,omitempty"`
ClusterID string `json:"cluster_id,omitempty" yaml:"cluster_id,omitempty"`
ClusterIsUpgrading bool `json:"clusterIsUpgrading,omitempty" yaml:"clusterIsUpgrading,omitempty"`
ClusterSpec string `json:"clusterSpec,omitempty" yaml:"clusterSpec,omitempty"`
ClusterType string `json:"clusterType,omitempty" yaml:"clusterType,omitempty"`
ContainerCidr string `json:"containerCidr,omitempty" yaml:"containerCidr,omitempty"`
DisableRollback bool `json:"disableRollback,omitempty" yaml:"disableRollback,omitempty"`
Expand All @@ -71,13 +77,15 @@ type ACKClusterConfigSpec struct {
OsType string `json:"osType,omitempty" yaml:"osType,omitempty"`
PauseClusterUpgrade bool `json:"pauseClusterUpgrade,omitempty" yaml:"pauseClusterUpgrade,omitempty"`
Platform string `json:"platform,omitempty" yaml:"platform,omitempty"`
PodVswitchIds []string `json:"podVswitchIds,omitempty" yaml:"podVswitchIds,omitempty"`
ProxyMode string `json:"proxyMode,omitempty" yaml:"proxyMode,omitempty"`
RegionID string `json:"regionId,omitempty" yaml:"regionId,omitempty"`
ResourceGroupID string `json:"resourceGroupId,omitempty" yaml:"resourceGroupId,omitempty"`
SSHFlags bool `json:"sshFlags,omitempty" yaml:"sshFlags,omitempty"`
SecurityGroupID string `json:"securityGroupId,omitempty" yaml:"securityGroupId,omitempty"`
ServiceCidr string `json:"serviceCidr,omitempty" yaml:"serviceCidr,omitempty"`
SnatEntry bool `json:"snatEntry,omitempty" yaml:"snatEntry,omitempty"`
TaskId string `json:"taskId,omitempty" yaml:"taskId,omitempty"`
TimeoutMins int64 `json:"timeoutMins,omitempty" yaml:"timeoutMins,omitempty"`
VpcID string `json:"vpcId,omitempty" yaml:"vpcId,omitempty"`
VswitchIds []string `json:"vswitchIds,omitempty" yaml:"vswitchIds,omitempty"`
Expand Down
12 changes: 12 additions & 0 deletions clients/rancher/generated/management/v3/zz_generated_addon.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package client

const (
AddonType = "addon"
AddonFieldConfig = "config"
AddonFieldName = "name"
)

type Addon struct {
Config string `json:"config,omitempty" yaml:"config,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const (
NodePoolInfoFieldPeriod = "period"
NodePoolInfoFieldPeriodUnit = "period_unit"
NodePoolInfoFieldPlatform = "platform"
NodePoolInfoFieldRuntime = "runtime"
NodePoolInfoFieldRuntimeVersion = "runtime_version"
NodePoolInfoFieldScalingType = "scaling_type"
NodePoolInfoFieldSystemDiskCategory = "system_disk_category"
NodePoolInfoFieldSystemDiskSize = "system_disk_size"
Expand All @@ -41,6 +43,8 @@ type NodePoolInfo struct {
Period int64 `json:"period,omitempty" yaml:"period,omitempty"`
PeriodUnit string `json:"period_unit,omitempty" yaml:"period_unit,omitempty"`
Platform string `json:"platform,omitempty" yaml:"platform,omitempty"`
Runtime string `json:"runtime,omitempty" yaml:"runtime,omitempty"`
RuntimeVersion string `json:"runtime_version,omitempty" yaml:"runtime_version,omitempty"`
ScalingType string `json:"scaling_type,omitempty" yaml:"scaling_type,omitempty"`
SystemDiskCategory string `json:"system_disk_category,omitempty" yaml:"system_disk_category,omitempty"`
SystemDiskSize int64 `json:"system_disk_size,omitempty" yaml:"system_disk_size,omitempty"`
Expand Down
27 changes: 27 additions & 0 deletions extensions/clusters/ack/ack_cluster_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type ClusterConfig struct {
ClusterID string `json:"cluster_id,omitempty" yaml:"cluster_id,omitempty"`
ClusterIsUpgrading bool `json:"clusterIsUpgrading,omitempty" yaml:"clusterIsUpgrading,omitempty"`
ClusterType string `json:"clusterType,omitempty" yaml:"clusterType,omitempty"`
ClusterSpec string `json:"clusterSpec,omitempty" yaml:"clusterSpec,omitempty"`
ContainerCidr string `json:"containerCidr,omitempty" yaml:"containerCidr,omitempty"`
DisableRollback bool `json:"disableRollback,omitempty" yaml:"disableRollback,omitempty"`
EndpointPublicAccess bool `json:"endpointPublicAccess,omitempty" yaml:"endpointPublicAccess,omitempty"`
Expand Down Expand Up @@ -49,6 +50,13 @@ type ClusterConfig struct {
TimeoutMins int64 `json:"timeoutMins,omitempty" yaml:"timeoutMins,omitempty"`
VpcID string `json:"vpcId,omitempty" yaml:"vpcId,omitempty"`
VswitchIds []string `json:"vswitchIds,omitempty" yaml:"vswitchIds,omitempty"`
Addons []Addon `json:"addons,omitempty" yaml:"addons,omitempty"`
PodVswitchIds []string `json:"podVswitchIds,omitempty" yaml:"podVswitchIds,omitempty"`
}

type Addon struct {
Config string `json:"config,omitempty" yaml:"config,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
}

// NodePool is the configuration needed to an ACK node pool
Expand All @@ -73,6 +81,8 @@ type NodePoolInfo struct {
SystemDiskCategory string `json:"system_disk_category,omitempty" yaml:"system_disk_category,omitempty"`
SystemDiskSize int64 `json:"system_disk_size,omitempty" yaml:"system_disk_size,omitempty"`
VSwitchIds []string `json:"v_switch_ids,omitempty" yaml:"v_switch_ids,omitempty"`
Runtime string `json:"runtime,omitempty" yaml:"runtime,omitempty"`
RuntimeVersion string `json:"runtime_version,omitempty" yaml:"runtime_version,omitempty"`
}

type DiskInfo struct {
Expand Down Expand Up @@ -111,18 +121,33 @@ func ackNodePoolConstructor(ackNodePoolConfigs *[]NodePoolInfo) []management.Nod
SystemDiskSize: ackNodePoolConfig.SystemDiskSize,
DataDisk: ackDiskInfoConstructor(&ackNodePoolConfig.DataDisk),
VSwitchIds: ackNodePoolConfig.VSwitchIds,
Runtime: ackNodePoolConfig.Runtime,
RuntimeVersion: ackNodePoolConfig.RuntimeVersion,
}
ackNodePools = append(ackNodePools, ackNodePool)
}
return ackNodePools
}

func addonConstructor(ackClusterConfig *ClusterConfig) []management.Addon {
if ackClusterConfig.Addons == nil || len(ackClusterConfig.Addons) == 0 {
return []management.Addon{}
}
return []management.Addon{
{
Name: ackClusterConfig.Addons[0].Name,
Config: ackClusterConfig.Addons[0].Config,
},
}
}

func HostClusterConfig(displayName, cloudCredentialID string, ackClusterConfig ClusterConfig) *management.ACKClusterConfigSpec {

return &management.ACKClusterConfigSpec{
Name: displayName,
AliyunCredentialSecret: cloudCredentialID,
ClusterType: ackClusterConfig.ClusterType,
ClusterSpec: ackClusterConfig.ClusterSpec,
RegionID: ackClusterConfig.RegionID,
ContainerCidr: ackClusterConfig.ContainerCidr,
ServiceCidr: ackClusterConfig.ServiceCidr,
Expand All @@ -143,6 +168,8 @@ func HostClusterConfig(displayName, cloudCredentialID string, ackClusterConfig C
VpcID: ackClusterConfig.VpcID,
MasterVswitchIds: ackClusterConfig.MasterVswitchIds,
KeyPair: ackClusterConfig.KeyPair,
PodVswitchIds: ackClusterConfig.PodVswitchIds,
Addons: addonConstructor(&ackClusterConfig),
NodePoolList: ackNodePoolConstructor(&ackClusterConfig.NodePoolList),
}
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ replace (

require (
github.com/Masterminds/semver/v3 v3.3.0
github.com/aliyun/alibaba-cloud-sdk-go v1.62.591
github.com/aliyun/alibaba-cloud-sdk-go v1.63.88
github.com/aws/aws-sdk-go v1.50.38
github.com/cnrancher/cce-operator v0.6.0-beta.1
github.com/creasty/defaults v1.5.2
Expand Down Expand Up @@ -79,7 +79,7 @@ require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/cnrancher/ack-operator v0.0.5-0.20241128064712-80cd5c093154 // indirect
github.com/cnrancher/ack-operator v0.0.5-0.20250401014136-d5f811965a0c // indirect
github.com/cnrancher/tke-operator v0.0.0-20241220083730-57e5f4df8c62 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/containerd/containerd v1.6.27 // indirect
Expand Down
11 changes: 4 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1387,8 +1387,8 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0=
github.com/aliyun/alibaba-cloud-sdk-go v1.62.591 h1:r30izVxfKxlAct6sq3m+Ehr+SwScQv7qnAoHGCpCJjo=
github.com/aliyun/alibaba-cloud-sdk-go v1.62.591/go.mod h1:CJJYa1ZMxjlN/NbXEwmejEnBkhi0DV+Yb3B2lxf+74o=
github.com/aliyun/alibaba-cloud-sdk-go v1.63.88 h1:87jNTxliGqU2yB3H09xCd4U3cZCmR4AkOMqWgaluo5Q=
github.com/aliyun/alibaba-cloud-sdk-go v1.63.88/go.mod h1:SOSDHfe1kX91v3W5QiBsWSLqeLxImobbMX1mxrFHsVQ=
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
Expand Down Expand Up @@ -1485,8 +1485,8 @@ github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101/go.mod h1:eXthEFrGJvWH
github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM=
github.com/cncf/xds/go v0.0.0-20240318125728-8a4994d93e50/go.mod h1:5e1+Vvlzido69INQaVO6d87Qn543Xr6nooe9Kz7oBFM=
github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8=
github.com/cnrancher/ack-operator v0.0.5-0.20241128064712-80cd5c093154 h1:aV8mqPARdX9QgM2/ncFmvFfE7BA2BaViShpxIcugwPU=
github.com/cnrancher/ack-operator v0.0.5-0.20241128064712-80cd5c093154/go.mod h1:uZtcnAx556xHJgt9Kj2GFMLyhYj6GzYVlFxMKBD2UQ4=
github.com/cnrancher/ack-operator v0.0.5-0.20250401014136-d5f811965a0c h1:5UgtR46DBaIzj0XjdZBZRwXVqj4FW8kqGVrcJdr/X6E=
github.com/cnrancher/ack-operator v0.0.5-0.20250401014136-d5f811965a0c/go.mod h1:vMX9LU+H5z3mERt9+33QvCJURoeaK+wgQv3r0yy6SdQ=
github.com/cnrancher/cce-operator v0.6.0-beta.1 h1:LC0bhrFjsojyGVnWJdyyHfJk0HiXpso6NRAor7R519Q=
github.com/cnrancher/cce-operator v0.6.0-beta.1/go.mod h1:vdmp1fRPwFhuId76lYJKH/MG/94h9YPcVUTloZJ2JlQ=
github.com/cnrancher/pandaria-norman v0.0.0-20250408033459-1465790374a3 h1:0qLlWcw1iAKn2tPebplQGqWPWO3LGfQkzs36p5g5E00=
Expand Down Expand Up @@ -2037,7 +2037,6 @@ github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLf
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
Expand All @@ -2048,7 +2047,6 @@ github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUB
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
Expand Down Expand Up @@ -3713,7 +3711,6 @@ gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKW
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
Expand Down
Loading