diff --git a/config/master-machine-with-tags.yaml b/config/master-machine-with-tags.yaml index 6fdeb9a1..2f61553e 100644 --- a/config/master-machine-with-tags.yaml +++ b/config/master-machine-with-tags.yaml @@ -19,22 +19,24 @@ spec: regionId: FILLIN zoneId: FILLIN securityGroups: - - tags: - - key: Name - value: ocp-test-sg - - key: "kubernetes.io/cluster/abc-def" - value: owned - - key: OCP - value: ISVAlibaba + - type: Tags + tags: + - key: Name + value: ocp-test-sg + - key: "kubernetes.io/cluster/abc-def" + value: owned + - key: OCP + value: ISVAlibaba vpcId: FILLIN vSwitch: + type: Tags tags: - - key: Name - value: ocp-test-vswitch - - key: "kubernetes.io/cluster/abc-def" - value: owned - - key: OCP - value: ISVAlibaba + - key: Name + value: ocp-test-vswitch + - key: "kubernetes.io/cluster/abc-def" + value: owned + - key: OCP + value: ISVAlibaba systemDiskCategory: FILLIN systemDiskSize: FILLIN internetMaxBandwidthOut: FILLIN diff --git a/config/worker-machine-with-tags.yaml b/config/worker-machine-with-tags.yaml index d014fc7a..0936938a 100644 --- a/config/worker-machine-with-tags.yaml +++ b/config/worker-machine-with-tags.yaml @@ -19,7 +19,8 @@ spec: regionId: FILLIN zoneId: FILLIN securityGroups: - - tags: + - type: Tags + tags: - key: Name value: ocp-test-sg - key: "kubernetes.io/cluster/abc-def" @@ -28,6 +29,7 @@ spec: value: ISVAlibaba vpcId: FILLIN vSwitch: + type: Tags tags: - key: Name value: ocp-test-vswitch diff --git a/go.mod b/go.mod index 0814cf1f..8de74ab8 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/go-logr/logr v1.2.2 github.com/golang/mock v1.6.0 github.com/onsi/gomega v1.17.0 - github.com/openshift/api v0.0.0-20211222145011-3bf13cf5081a + github.com/openshift/api v0.0.0-20220124143425-d74727069f6f github.com/openshift/machine-api-operator v0.2.1-0.20220119165902-b88b83bb15f9 github.com/stretchr/testify v1.7.0 k8s.io/api v0.23.0 diff --git a/go.sum b/go.sum index efa134c1..839b4b96 100644 --- a/go.sum +++ b/go.sum @@ -558,8 +558,9 @@ github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQ github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/openshift/api v0.0.0-20211209135129-c58d9f695577/go.mod h1:DoslCwtqUpr3d/gsbq4ZlkaMEdYqKxuypsDjorcHhME= -github.com/openshift/api v0.0.0-20211222145011-3bf13cf5081a h1:lJQ6mKlpoUn19dmaLY/ldRm2Mwi+WtTJ2MD6bteLa4o= github.com/openshift/api v0.0.0-20211222145011-3bf13cf5081a/go.mod h1:F/eU6jgr6Q2VhMu1mSpMmygxAELd7+BUxs3NHZ25jV4= +github.com/openshift/api v0.0.0-20220124143425-d74727069f6f h1:iOTv1WudhVm2UsoST+L+ZrA5A9w57h9vmQsdlBuqG6g= +github.com/openshift/api v0.0.0-20220124143425-d74727069f6f/go.mod h1:F/eU6jgr6Q2VhMu1mSpMmygxAELd7+BUxs3NHZ25jV4= github.com/openshift/build-machinery-go v0.0.0-20210712174854-1bb7fd1518d3/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE= github.com/openshift/build-machinery-go v0.0.0-20211213093930-7e33a7eb4ce3/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE= github.com/openshift/client-go v0.0.0-20211209144617-7385dd6338e3 h1:SG1aqwleU6bGD0X4mhkTNupjVnByMYYuW4XbnCPavQU= diff --git a/pkg/actuators/machine/instances.go b/pkg/actuators/machine/instances.go index f9cf6d0b..c7c27e38 100644 --- a/pkg/actuators/machine/instances.go +++ b/pkg/actuators/machine/instances.go @@ -115,8 +115,11 @@ func runInstances(machine *machinev1beta1.Machine, machineProviderConfig *machin runInstancesRequest.RegionId = machineProviderConfig.RegionID // ResourceGroupID - if machineProviderConfig.ResourceGroupID != "" { - runInstancesRequest.ResourceGroupId = machineProviderConfig.ResourceGroupID + if groupId, err := getResourceGroupId(machineProviderConfig); err != nil { + klog.Errorf("Unable to determine resource group ID for machine %q, err %q", machine.Name, err) + return nil, mapierrors.InvalidMachineConfiguration("Unable to determine resource group ID for machine: %q", machine.Name) + } else { + runInstancesRequest.ResourceGroupId = groupId } // SecurityGroupIDs @@ -367,16 +370,21 @@ func getSecurityGroupIDs(machine runtimeclient.ObjectKey, machineProviderConfig } for _, sg := range machineProviderConfig.SecurityGroups { - if sg.ID != "" { - securityGroupIDs = append(securityGroupIDs, sg.ID) - } else { - if sg.Tags != nil { - ids, err := getSecurityGroupIDByTags(machine, machineProviderConfig, sg.Tags, client) - if err != nil { - return nil, err - } - securityGroupIDs = append(securityGroupIDs, ids...) + switch sg.Type { + case machinev1.AlibabaResourceReferenceTypeID: + if sg.ID != nil && *sg.ID != "" { + securityGroupIDs = append(securityGroupIDs, *sg.ID) + } else { + return nil, mapierrors.InvalidMachineConfiguration("No security group ID provided") + } + case machinev1.AlibabaResourceReferenceTypeTags: + ids, err := getSecurityGroupIDByTags(machine, machineProviderConfig, sg.Tags, client) + if err != nil { + return nil, err } + securityGroupIDs = append(securityGroupIDs, ids...) + default: + return nil, mapierrors.InvalidMachineConfiguration("Unknown security group resource reference type: %s", sg.Type) } } if len(securityGroupIDs) == 0 { @@ -385,12 +393,20 @@ func getSecurityGroupIDs(machine runtimeclient.ObjectKey, machineProviderConfig return &securityGroupIDs, nil } -func getSecurityGroupIDByTags(machine runtimeclient.ObjectKey, machineProviderConfig *machinev1.AlibabaCloudMachineProviderConfig, tags []machinev1.Tag, client alibabacloudClient.Client) ([]string, error) { +func getSecurityGroupIDByTags(machine runtimeclient.ObjectKey, machineProviderConfig *machinev1.AlibabaCloudMachineProviderConfig, tags *[]machinev1.Tag, client alibabacloudClient.Client) ([]string, error) { + if tags == nil { + return nil, mapierrors.InvalidMachineConfiguration("No tags provided for security group ID search for machine: %q", machine.Name) + } request := ecs.CreateDescribeSecurityGroupsRequest() request.VpcId = machineProviderConfig.VpcID - request.ResourceGroupId = machineProviderConfig.ResourceGroupID + if groupId, err := getResourceGroupId(machineProviderConfig); err != nil { + klog.Errorf("Unable to determine resource group ID for machine %q, err %q", machine.Name, err) + return nil, mapierrors.InvalidMachineConfiguration("Unable to determine resource group ID for machine: %q", machine.Name) + } else { + request.ResourceGroupId = groupId + } request.RegionId = machineProviderConfig.RegionID - request.Tag = buildDescribeSecurityGroupsTag(tags) + request.Tag = buildDescribeSecurityGroupsTag(*tags) request.Scheme = "https" response, err := client.DescribeSecurityGroups(request) @@ -440,28 +456,30 @@ func buildDescribeSecurityGroupsTag(tags []machinev1.Tag) *[]ecs.DescribeSecurit func getVSwitchID(machine runtimeclient.ObjectKey, machineProviderConfig *machinev1.AlibabaCloudMachineProviderConfig, client alibabacloudClient.Client) (string, error) { klog.Infof("validate vswitch in region %s", machineProviderConfig.RegionID) - if machineProviderConfig.VSwitch.ID == "" && len(machineProviderConfig.VSwitch.Tags) == 0 { - return "", errors.New("no vswitch configuration provided") - } - - if machineProviderConfig.VSwitch.ID != "" { - return machineProviderConfig.VSwitch.ID, nil - } - - if machineProviderConfig.VSwitch.Tags != nil { + switch machineProviderConfig.VSwitch.Type { + case machinev1.AlibabaResourceReferenceTypeID: + if machineProviderConfig.VSwitch.ID != nil && *machineProviderConfig.VSwitch.ID != "" { + return *machineProviderConfig.VSwitch.ID, nil + } else { + return "", mapierrors.InvalidMachineConfiguration("No vswitch resource id provided") + } + case machinev1.AlibabaResourceReferenceTypeTags: return getVSwitchIDFromTags(machine, machineProviderConfig, client) + default: + return "", mapierrors.InvalidMachineConfiguration("Unknown vswitch resource reference type: %s", machineProviderConfig.VSwitch.Type) } - - return "", fmt.Errorf("no vSwitch found from configuration") } func getVSwitchIDFromTags(machine runtimeclient.ObjectKey, mpc *machinev1.AlibabaCloudMachineProviderConfig, client alibabacloudClient.Client) (string, error) { + if mpc.VSwitch.Tags == nil { + return "", mapierrors.InvalidMachineConfiguration("No tags provided for VSwitch ID search for machine: %q", machine.Name) + } // Build a request to fetch the vSwitchID from the tags provided describeVSwitchesRequest := vpc.CreateDescribeVSwitchesRequest() describeVSwitchesRequest.Scheme = "https" describeVSwitchesRequest.RegionId = mpc.RegionID describeVSwitchesRequest.VpcId = mpc.VpcID - describeVSwitchesRequest.Tag = buildDescribeVSwitchesTag(mpc.VSwitch.Tags) + describeVSwitchesRequest.Tag = buildDescribeVSwitchesTag(*mpc.VSwitch.Tags) describeVSwitchesResponse, err := client.DescribeVSwitches(describeVSwitchesRequest) if err != nil { metrics.RegisterFailedInstanceCreate(&metrics.MachineLabels{ @@ -801,3 +819,21 @@ func correctExistingTags(machine *machinev1beta1.Machine, regionID string, insta return nil } + +// getResourceGroupId takes an AlibabaCloudMachineProviderConfig and will return the +// resource group id if available, or determine the group id by using the search tags. +// An error will be returned if no group id can be found, or if multiple groups are +// found from the search tags. +func getResourceGroupId(machineProviderConfig *machinev1.AlibabaCloudMachineProviderConfig) (string, error) { + switch machineProviderConfig.ResourceGroup.Type { + case machinev1.AlibabaResourceReferenceTypeID: + if machineProviderConfig.ResourceGroup.ID != nil && *machineProviderConfig.ResourceGroup.ID != "" { + return *machineProviderConfig.ResourceGroup.ID, nil + } else { + return "", mapierrors.InvalidMachineConfiguration("No resource group ID provided") + } + // TODO add name search lookup case here + default: + return "", mapierrors.InvalidMachineConfiguration("unknown resource group reference type: %s", machineProviderConfig.ResourceGroup.Type) + } +} diff --git a/pkg/actuators/machine/stubs.go b/pkg/actuators/machine/stubs.go index 7a073848..8d5ba5ff 100644 --- a/pkg/actuators/machine/stubs.go +++ b/pkg/actuators/machine/stubs.go @@ -57,16 +57,23 @@ func stubAlibabaCloudCredentialsSecret() *corev1.Secret { } func stubProviderConfig() *machinev1.AlibabaCloudMachineProviderConfig { + vSwitchID := stubVSwitchID return &machinev1.AlibabaCloudMachineProviderConfig{ InstanceType: stubInstanceType, ImageID: stubImageID, RegionID: stubRegionID, ZoneID: stubZoneID, SecurityGroups: []machinev1.AlibabaResourceReference{ - {ID: stubVSwitchID}, + { + Type: machinev1.AlibabaResourceReferenceTypeID, + ID: &vSwitchID, + }, + }, + VpcID: stubVpcID, + VSwitch: machinev1.AlibabaResourceReference{ + Type: machinev1.AlibabaResourceReferenceTypeID, + ID: &vSwitchID, }, - VpcID: stubVpcID, - VSwitch: machinev1.AlibabaResourceReference{ID: stubVSwitchID}, SystemDisk: machinev1.SystemDiskProperties{ Category: stubSystemDiskCategory, Size: stubSystemDiskSize, diff --git a/vendor/github.com/openshift/api/config/v1/types_feature.go b/vendor/github.com/openshift/api/config/v1/types_feature.go index 149cf8e6..03267306 100644 --- a/vendor/github.com/openshift/api/config/v1/types_feature.go +++ b/vendor/github.com/openshift/api/config/v1/types_feature.go @@ -121,7 +121,6 @@ var FeatureSets = map[FeatureSet]*FeatureGateEnabledDisabled{ with("CSIMigrationAzureFile"). // sig-storage, fbertina, Kubernetes feature gate with("CSIMigrationvSphere"). // sig-storage, fbertina, Kubernetes feature gate with("ExternalCloudProvider"). // sig-cloud-provider, jspeed, OCP specific - with("InsightsOperatorPullingSCA"). // insights-operator/ccx, tremes, OCP specific with("CSIDriverSharedResource"). // sig-build, adkaplan, OCP specific with("BuildCSIVolumes"). // sig-build, adkaplan, OCP specific with("NodeSwap"). // sig-node, ehashman, Kubernetes feature gate @@ -143,14 +142,16 @@ var defaultFeatures = &FeatureGateEnabledDisabled{ Enabled: []string{ "APIPriorityAndFairness", // sig-apimachinery, deads2k "RotateKubeletServerCertificate", // sig-pod, sjenning - "SupportPodPidsLimit", // sig-pod, sjenning - "NodeDisruptionExclusion", // sig-scheduling, ccoleman - "ServiceNodeExclusion", // sig-scheduling, ccoleman "DownwardAPIHugePages", // sig-node, rphillips "PodSecurity", // sig-auth, s-urbaniak }, Disabled: []string{ - "LegacyNodeRoleBehavior", // sig-scheduling, ccoleman + "CSIMigrationAWS", // sig-storage, jsafrane + "CSIMigrationOpenStack", // sig-storage, jsafrane + "CSIMigrationGCE", // sig-storage, jsafrane + "CSIMigrationAzureDisk", // sig-storage, jsafrane + "CSIMigrationAzureFile", // sig-storage, jsafrane + "CSIMigrationvSphere", // sig-storage, jsafrane }, } diff --git a/vendor/github.com/openshift/api/machine/v1/types_alibabaprovider.go b/vendor/github.com/openshift/api/machine/v1/types_alibabaprovider.go index 5f8bb0db..dc5d5b27 100644 --- a/vendor/github.com/openshift/api/machine/v1/types_alibabaprovider.go +++ b/vendor/github.com/openshift/api/machine/v1/types_alibabaprovider.go @@ -33,6 +33,9 @@ type AlibabaDiskEncryptionMode string // AlibabaDiskPreservationPolicy enum attribute to describe whether to preserve or delete a disk upon instance removal type AlibabaDiskPreservationPolicy string +// AlibabaResourceReferenceType enum attribute to identify the type of resource reference +type AlibabaResourceReferenceType string + const ( // DeleteWithInstance enum property to delete disk with instance deletion DeleteWithInstance AlibabaDiskPreservationPolicy = "DeleteWithInstance" @@ -61,6 +64,13 @@ const ( AlibabaDiskCatagoryESSD AlibabaDiskCategory = "cloud_essd" // AlibabaDiskCategoryBasic enum proprty to set the category of disk to basic AlibabaDiskCatagoryBasic AlibabaDiskCategory = "cloud" + + // AlibabaResourceReferenceTypeID enum property to identify an ID type resource reference + AlibabaResourceReferenceTypeID AlibabaResourceReferenceType = "ID" + // AlibabaResourceReferenceTypeName enum property to identify an Name type resource reference + AlibabaResourceReferenceTypeName AlibabaResourceReferenceType = "Name" + // AlibabaResourceReferenceTypeTags enum property to identify a tags type resource reference + AlibabaResourceReferenceTypeTags AlibabaResourceReferenceType = "Tags" ) // +genclient @@ -81,8 +91,7 @@ type AlibabaCloudMachineProviderConfig struct { InstanceType string `json:"instanceType"` // The ID of the vpc - // +optional - VpcID string `json:"vpcId,omitempty"` + VpcID string `json:"vpcId"` // The ID of the region in which to create the instance. You can call the DescribeRegions operation to query the most recent region list. RegionID string `json:"regionId"` @@ -97,10 +106,12 @@ type AlibabaCloudMachineProviderConfig struct { // +optional DataDisks []DataDiskProperties `json:"dataDisk,omitempty"` - // SecurityGroups is a list of security group references to assign to the instance. A reference holds either the security group ID - // or the required tags to search. The limit of N values varies based on the maximum number of security groups to which an instance can belong. + // SecurityGroups is a list of security group references to assign to the instance. + // A reference holds either the security group ID, the resource name, or the required tags to search. + // When more than one security group is returned for a tag search, all the groups are associated with the instance up to the + // maximum number of security groups to which an instance can belong. // For more information, see the "Security group limits" section in Limits. - // https://www.alibabacloud.com/help/doc-detail/101348.htm?spm=a2c63.p38356.879954.48.78f0199aX3dfIE + // https://www.alibabacloud.com/help/en/doc-detail/25412.htm SecurityGroups []AlibabaResourceReference `json:"securityGroups,omitempty"` // Bandwidth describes the internet bandwidth strategy for the instance @@ -111,18 +122,22 @@ type AlibabaCloudMachineProviderConfig struct { // +optional SystemDisk SystemDiskProperties `json:"systemDisk,omitempty"` - // VSwitch is a reference to the vswitch to use for this instance + // VSwitch is a reference to the vswitch to use for this instance. + // A reference holds either the vSwitch ID, the resource name, or the required tags to search. + // When more than one vSwitch is returned for a tag search, only the first vSwitch returned will be used. // This parameter is required when you create an instance of the VPC type. // You can call the DescribeVSwitches operation to query the created vSwitches. - VSwitch AlibabaResourceReference `json:"vSwitch,omitempty"` + VSwitch AlibabaResourceReference `json:"vSwitch"` // RAMRoleName is the name of the instance Resource Access Management (RAM) role. This allows the instance to perform API calls as this specified RAM role. // +optional RAMRoleName string `json:"ramRoleName,omitempty"` - // ResourceGroupID is the unique ID of the resource group to which to assign the instance. - // +optional - ResourceGroupID string `json:"resourceGroupId,omitempty"` + // ResourceGroup references the resource group to which to assign the instance. + // A reference holds either the resource group ID, the resource name, or the required tags to search. + // When more than one resource group are returned for a search, an error will be produced and the Machine will not be created. + // Resource Groups do not support searching by tags. + ResourceGroup AlibabaResourceReference `json:"resourceGroup"` // Tenancy specifies whether to create the instance on a dedicated host. // Valid values: @@ -153,13 +168,21 @@ type AlibabaCloudMachineProviderConfig struct { // Only one of ID or Tags may be specified. Specifying more than one will result in // a validation error. type AlibabaResourceReference struct { + // type identifies the resource reference type for this entry. + Type AlibabaResourceReferenceType `json:"type"` + // ID of resource // +optional - ID string `json:"id,omitempty"` + ID *string `json:"id,omitempty"` + + // Name of the resource + // +optional + Name *string `json:"name,omitempty"` - // Tags is a set of metadata based upon ECS object tags used to identify a resource + // Tags is a set of metadata based upon ECS object tags used to identify a resource. + // For details about usage when multiple resources are found, please see the owning parent field documentation. // +optional - Tags []Tag `json:"tags,omitempty"` + Tags *[]Tag `json:"tags,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vendor/github.com/openshift/api/machine/v1/zz_generated.deepcopy.go b/vendor/github.com/openshift/api/machine/v1/zz_generated.deepcopy.go new file mode 100644 index 00000000..99063423 --- /dev/null +++ b/vendor/github.com/openshift/api/machine/v1/zz_generated.deepcopy.go @@ -0,0 +1,244 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlibabaCloudMachineProviderConfig) DeepCopyInto(out *AlibabaCloudMachineProviderConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.DataDisks != nil { + in, out := &in.DataDisks, &out.DataDisks + *out = make([]DataDiskProperties, len(*in)) + copy(*out, *in) + } + if in.SecurityGroups != nil { + in, out := &in.SecurityGroups, &out.SecurityGroups + *out = make([]AlibabaResourceReference, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + out.Bandwidth = in.Bandwidth + out.SystemDisk = in.SystemDisk + in.VSwitch.DeepCopyInto(&out.VSwitch) + in.ResourceGroup.DeepCopyInto(&out.ResourceGroup) + if in.UserDataSecret != nil { + in, out := &in.UserDataSecret, &out.UserDataSecret + *out = new(corev1.LocalObjectReference) + **out = **in + } + if in.CredentialsSecret != nil { + in, out := &in.CredentialsSecret, &out.CredentialsSecret + *out = new(corev1.LocalObjectReference) + **out = **in + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make([]Tag, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlibabaCloudMachineProviderConfig. +func (in *AlibabaCloudMachineProviderConfig) DeepCopy() *AlibabaCloudMachineProviderConfig { + if in == nil { + return nil + } + out := new(AlibabaCloudMachineProviderConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AlibabaCloudMachineProviderConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlibabaCloudMachineProviderConfigList) DeepCopyInto(out *AlibabaCloudMachineProviderConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AlibabaCloudMachineProviderConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlibabaCloudMachineProviderConfigList. +func (in *AlibabaCloudMachineProviderConfigList) DeepCopy() *AlibabaCloudMachineProviderConfigList { + if in == nil { + return nil + } + out := new(AlibabaCloudMachineProviderConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AlibabaCloudMachineProviderConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlibabaCloudMachineProviderStatus) DeepCopyInto(out *AlibabaCloudMachineProviderStatus) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.InstanceID != nil { + in, out := &in.InstanceID, &out.InstanceID + *out = new(string) + **out = **in + } + if in.InstanceState != nil { + in, out := &in.InstanceState, &out.InstanceState + *out = new(string) + **out = **in + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlibabaCloudMachineProviderStatus. +func (in *AlibabaCloudMachineProviderStatus) DeepCopy() *AlibabaCloudMachineProviderStatus { + if in == nil { + return nil + } + out := new(AlibabaCloudMachineProviderStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AlibabaCloudMachineProviderStatus) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlibabaResourceReference) DeepCopyInto(out *AlibabaResourceReference) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = new([]Tag) + if **in != nil { + in, out := *in, *out + *out = make([]Tag, len(*in)) + copy(*out, *in) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlibabaResourceReference. +func (in *AlibabaResourceReference) DeepCopy() *AlibabaResourceReference { + if in == nil { + return nil + } + out := new(AlibabaResourceReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BandwidthProperties) DeepCopyInto(out *BandwidthProperties) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BandwidthProperties. +func (in *BandwidthProperties) DeepCopy() *BandwidthProperties { + if in == nil { + return nil + } + out := new(BandwidthProperties) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataDiskProperties) DeepCopyInto(out *DataDiskProperties) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataDiskProperties. +func (in *DataDiskProperties) DeepCopy() *DataDiskProperties { + if in == nil { + return nil + } + out := new(DataDiskProperties) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SystemDiskProperties) DeepCopyInto(out *SystemDiskProperties) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SystemDiskProperties. +func (in *SystemDiskProperties) DeepCopy() *SystemDiskProperties { + if in == nil { + return nil + } + out := new(SystemDiskProperties) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Tag) DeepCopyInto(out *Tag) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Tag. +func (in *Tag) DeepCopy() *Tag { + if in == nil { + return nil + } + out := new(Tag) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/openshift/api/machine/v1beta1/0000_10_machine.crd.yaml b/vendor/github.com/openshift/api/machine/v1beta1/0000_10_machine.crd.yaml index eebdf90c..0b5cab53 100644 --- a/vendor/github.com/openshift/api/machine/v1beta1/0000_10_machine.crd.yaml +++ b/vendor/github.com/openshift/api/machine/v1beta1/0000_10_machine.crd.yaml @@ -95,6 +95,9 @@ spec: type: string maxLength: 512 minLength: 3 + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map preTerminate: description: PreTerminate hooks prevent the machine from being terminated. PreTerminate hooks be actioned after the Machine has been drained. type: array @@ -116,6 +119,9 @@ spec: type: string maxLength: 512 minLength: 3 + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map metadata: description: ObjectMeta will autopopulate the Node created. Use this to indicate what labels, annotations, name prefix, etc., should be used when creating the Node. type: object diff --git a/vendor/github.com/openshift/api/machine/v1beta1/0000_10_machineset.crd.yaml b/vendor/github.com/openshift/api/machine/v1beta1/0000_10_machineset.crd.yaml index d61e4ed3..de27d232 100644 --- a/vendor/github.com/openshift/api/machine/v1beta1/0000_10_machineset.crd.yaml +++ b/vendor/github.com/openshift/api/machine/v1beta1/0000_10_machineset.crd.yaml @@ -188,6 +188,9 @@ spec: type: string maxLength: 512 minLength: 3 + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map preTerminate: description: PreTerminate hooks prevent the machine from being terminated. PreTerminate hooks be actioned after the Machine has been drained. type: array @@ -209,6 +212,9 @@ spec: type: string maxLength: 512 minLength: 3 + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map metadata: description: ObjectMeta will autopopulate the Node created. Use this to indicate what labels, annotations, name prefix, etc., should be used when creating the Node. type: object diff --git a/vendor/github.com/openshift/api/machine/v1beta1/types_machine.go b/vendor/github.com/openshift/api/machine/v1beta1/types_machine.go index 91e9d32d..6cbc07f8 100644 --- a/vendor/github.com/openshift/api/machine/v1beta1/types_machine.go +++ b/vendor/github.com/openshift/api/machine/v1beta1/types_machine.go @@ -204,11 +204,15 @@ type MachineSpec struct { type LifecycleHooks struct { // PreDrain hooks prevent the machine from being drained. // This also blocks further lifecycle events, such as termination. + // +listType=map + // +listMapKey=name // +optional PreDrain []LifecycleHook `json:"preDrain,omitempty"` // PreTerminate hooks prevent the machine from being terminated. // PreTerminate hooks be actioned after the Machine has been drained. + // +listType=map + // +listMapKey=name // +optional PreTerminate []LifecycleHook `json:"preTerminate,omitempty"` } diff --git a/vendor/modules.txt b/vendor/modules.txt index 268fc110..8a47206f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -186,7 +186,7 @@ github.com/onsi/gomega/matchers/support/goraph/edge github.com/onsi/gomega/matchers/support/goraph/node github.com/onsi/gomega/matchers/support/goraph/util github.com/onsi/gomega/types -# github.com/openshift/api v0.0.0-20211222145011-3bf13cf5081a +# github.com/openshift/api v0.0.0-20220124143425-d74727069f6f ## explicit; go 1.16 github.com/openshift/api/config/v1 github.com/openshift/api/machine/v1