diff --git a/pkg/apis/v1alpha1/ecsnodeclass.go b/pkg/apis/v1alpha1/ecsnodeclass.go index cff68a4..3b977d8 100644 --- a/pkg/apis/v1alpha1/ecsnodeclass.go +++ b/pkg/apis/v1alpha1/ecsnodeclass.go @@ -71,6 +71,10 @@ type ECSNodeClassSpec struct { // +kubebuilder:validation:XValidation:message="tag contains a restricted tag matching karpenter.k8s.alibabacloud/ecsnodeclass",rule="self.all(k, k !='karpenter.k8s.alibabacloud/ecsnodeclass')" // +optional Tags map[string]string `json:"tags,omitempty"` + // ResourceGroupID is the resource group id in ECS + // +kubebuilder:validation:Pattern:="rg-[0-9a-z]+" + // +optional + ResourceGroupID string `json:"resourceGroupId,omitempty"` } // VSwitchSelectorTerm defines selection logic for a vSwitch used by Karpenter to launch nodes. diff --git a/pkg/providers/instance/instance.go b/pkg/providers/instance/instance.go index a1eddfe..c3a8bab 100644 --- a/pkg/providers/instance/instance.go +++ b/pkg/providers/instance/instance.go @@ -487,6 +487,7 @@ func (p *DefaultProvider) getProvisioningGroup(ctx context.Context, nodeClass *v // TODO: AutoProvisioningGroup is not compatible with SecurityGroupIds, waiting for Aliyun developers to fix it, // so here we only take the first one. + ResourceGroupId: tea.String(nodeClass.Spec.ResourceGroupID), SecurityGroupId: securityGroupIDs[0], SystemDiskSize: systemDisk.Size, SystemDiskPerformanceLevel: systemDisk.PerformanceLevel,