From 5a794a68a2413dc5e2047501c699da2aae771052 Mon Sep 17 00:00:00 2001 From: Prajyot Parab Date: Fri, 25 Nov 2022 12:44:05 +0530 Subject: [PATCH] Revert: Deprecate SSHKeys in favor of SSHKeysRef variable (#976) Signed-off-by: Prajyot-Parab Signed-off-by: Prajyot-Parab --- api/v1alpha3/conversion.go | 65 +-------- api/v1alpha3/zz_generated.conversion.go | 1 - api/v1alpha4/ibmvpc_conversion.go | 66 +-------- api/v1alpha4/zz_generated.conversion.go | 1 - api/v1beta1/ibmvpcmachine_types.go | 21 --- api/v1beta1/zz_generated.deepcopy.go | 36 ----- cloud/scope/machine.go | 43 ------ cloud/scope/machine_test.go | 133 ------------------ ...cture.cluster.x-k8s.io_ibmvpcmachines.yaml | 22 +-- ...uster.x-k8s.io_ibmvpcmachinetemplates.yaml | 23 +-- pkg/cloud/services/vpc/mock/vpc_generated.go | 16 --- pkg/cloud/services/vpc/service.go | 5 - pkg/cloud/services/vpc/vpc.go | 1 - 13 files changed, 12 insertions(+), 421 deletions(-) diff --git a/api/v1alpha3/conversion.go b/api/v1alpha3/conversion.go index c83094aa6..92b5a0757 100644 --- a/api/v1alpha3/conversion.go +++ b/api/v1alpha3/conversion.go @@ -23,7 +23,6 @@ import ( capiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" ) @@ -63,41 +62,13 @@ func (dst *IBMVPCClusterList) ConvertFrom(srcRaw conversion.Hub) error { func (src *IBMVPCMachine) ConvertTo(dstRaw conversion.Hub) error { dst := dstRaw.(*infrav1beta1.IBMVPCMachine) - if err := Convert_v1alpha3_IBMVPCMachine_To_v1beta1_IBMVPCMachine(src, dst, nil); err != nil { - return err - } - - for _, sshKey := range src.Spec.SSHKeys { - dst.Spec.SSHKeysRef = append(dst.Spec.SSHKeysRef, &infrav1beta1.IBMVPCResourceReference{ - ID: sshKey, - }) - } - - return nil + return Convert_v1alpha3_IBMVPCMachine_To_v1beta1_IBMVPCMachine(src, dst, nil) } func (dst *IBMVPCMachine) ConvertFrom(srcRaw conversion.Hub) error { src := srcRaw.(*infrav1beta1.IBMVPCMachine) - if err := Convert_v1beta1_IBMVPCMachine_To_v1alpha3_IBMVPCMachine(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion except for metadata - if err := utilconversion.MarshalData(src, dst); err != nil { - return err - } - - if src.Spec.SSHKeysRef != nil { - for _, sshKey := range src.Spec.SSHKeysRef { - if sshKey.ID != nil { - // Only source keys with ID will be converted - dst.Spec.SSHKeys = append(dst.Spec.SSHKeys, sshKey.ID) - } - } - } - - return nil + return Convert_v1beta1_IBMVPCMachine_To_v1alpha3_IBMVPCMachine(src, dst, nil) } func (src *IBMVPCMachineList) ConvertTo(dstRaw conversion.Hub) error { @@ -115,41 +86,13 @@ func (dst *IBMVPCMachineList) ConvertFrom(srcRaw conversion.Hub) error { func (src *IBMVPCMachineTemplate) ConvertTo(dstRaw conversion.Hub) error { dst := dstRaw.(*infrav1beta1.IBMVPCMachineTemplate) - if err := Convert_v1alpha3_IBMVPCMachineTemplate_To_v1beta1_IBMVPCMachineTemplate(src, dst, nil); err != nil { - return err - } - - for _, sshKey := range src.Spec.Template.Spec.SSHKeys { - dst.Spec.Template.Spec.SSHKeysRef = append(dst.Spec.Template.Spec.SSHKeysRef, &infrav1beta1.IBMVPCResourceReference{ - ID: sshKey, - }) - } - - return nil + return Convert_v1alpha3_IBMVPCMachineTemplate_To_v1beta1_IBMVPCMachineTemplate(src, dst, nil) } func (dst *IBMVPCMachineTemplate) ConvertFrom(srcRaw conversion.Hub) error { src := srcRaw.(*infrav1beta1.IBMVPCMachineTemplate) - if err := Convert_v1beta1_IBMVPCMachineTemplate_To_v1alpha3_IBMVPCMachineTemplate(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion except for metadata - if err := utilconversion.MarshalData(src, dst); err != nil { - return err - } - - if src.Spec.Template.Spec.SSHKeysRef != nil { - for _, sshKey := range src.Spec.Template.Spec.SSHKeysRef { - if sshKey.ID != nil { - // Only source keys with ID will be converted - dst.Spec.Template.Spec.SSHKeys = append(dst.Spec.Template.Spec.SSHKeys, sshKey.ID) - } - } - } - - return nil + return Convert_v1beta1_IBMVPCMachineTemplate_To_v1alpha3_IBMVPCMachineTemplate(src, dst, nil) } func (src *IBMVPCMachineTemplateList) ConvertTo(dstRaw conversion.Hub) error { diff --git a/api/v1alpha3/zz_generated.conversion.go b/api/v1alpha3/zz_generated.conversion.go index a7c13554b..be53b8c52 100644 --- a/api/v1alpha3/zz_generated.conversion.go +++ b/api/v1alpha3/zz_generated.conversion.go @@ -446,7 +446,6 @@ func autoConvert_v1beta1_IBMVPCMachineSpec_To_v1alpha3_IBMVPCMachineSpec(in *v1b return err } out.SSHKeys = *(*[]*string)(unsafe.Pointer(&in.SSHKeys)) - // WARNING: in.SSHKeysRef requires manual conversion: does not exist in peer-type return nil } diff --git a/api/v1alpha4/ibmvpc_conversion.go b/api/v1alpha4/ibmvpc_conversion.go index 86aa77b6e..b9fe2301e 100644 --- a/api/v1alpha4/ibmvpc_conversion.go +++ b/api/v1alpha4/ibmvpc_conversion.go @@ -21,8 +21,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/conversion" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" ) @@ -53,41 +51,13 @@ func (dst *IBMVPCClusterList) ConvertFrom(srcRaw conversion.Hub) error { func (src *IBMVPCMachine) ConvertTo(dstRaw conversion.Hub) error { dst := dstRaw.(*infrav1beta1.IBMVPCMachine) - if err := Convert_v1alpha4_IBMVPCMachine_To_v1beta1_IBMVPCMachine(src, dst, nil); err != nil { - return err - } - - for _, sshKey := range src.Spec.SSHKeys { - dst.Spec.SSHKeysRef = append(dst.Spec.SSHKeysRef, &infrav1beta1.IBMVPCResourceReference{ - ID: sshKey, - }) - } - - return nil + return Convert_v1alpha4_IBMVPCMachine_To_v1beta1_IBMVPCMachine(src, dst, nil) } func (dst *IBMVPCMachine) ConvertFrom(srcRaw conversion.Hub) error { src := srcRaw.(*infrav1beta1.IBMVPCMachine) - if err := Convert_v1beta1_IBMVPCMachine_To_v1alpha4_IBMVPCMachine(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion except for metadata - if err := utilconversion.MarshalData(src, dst); err != nil { - return err - } - - if src.Spec.SSHKeysRef != nil { - for _, sshKey := range src.Spec.SSHKeysRef { - if sshKey.ID != nil { - // Only source keys with ID will be converted - dst.Spec.SSHKeys = append(dst.Spec.SSHKeys, sshKey.ID) - } - } - } - - return nil + return Convert_v1beta1_IBMVPCMachine_To_v1alpha4_IBMVPCMachine(src, dst, nil) } func (src *IBMVPCMachineList) ConvertTo(dstRaw conversion.Hub) error { @@ -105,41 +75,13 @@ func (dst *IBMVPCMachineList) ConvertFrom(srcRaw conversion.Hub) error { func (src *IBMVPCMachineTemplate) ConvertTo(dstRaw conversion.Hub) error { dst := dstRaw.(*infrav1beta1.IBMVPCMachineTemplate) - if err := Convert_v1alpha4_IBMVPCMachineTemplate_To_v1beta1_IBMVPCMachineTemplate(src, dst, nil); err != nil { - return err - } - - for _, sshKey := range src.Spec.Template.Spec.SSHKeys { - dst.Spec.Template.Spec.SSHKeysRef = append(dst.Spec.Template.Spec.SSHKeysRef, &infrav1beta1.IBMVPCResourceReference{ - ID: sshKey, - }) - } - - return nil + return Convert_v1alpha4_IBMVPCMachineTemplate_To_v1beta1_IBMVPCMachineTemplate(src, dst, nil) } func (dst *IBMVPCMachineTemplate) ConvertFrom(srcRaw conversion.Hub) error { src := srcRaw.(*infrav1beta1.IBMVPCMachineTemplate) - if err := Convert_v1beta1_IBMVPCMachineTemplate_To_v1alpha4_IBMVPCMachineTemplate(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion except for metadata - if err := utilconversion.MarshalData(src, dst); err != nil { - return err - } - - if src.Spec.Template.Spec.SSHKeysRef != nil { - for _, sshKey := range src.Spec.Template.Spec.SSHKeysRef { - if sshKey.ID != nil { - // Only source keys with ID will be converted - dst.Spec.Template.Spec.SSHKeys = append(dst.Spec.Template.Spec.SSHKeys, sshKey.ID) - } - } - } - - return nil + return Convert_v1beta1_IBMVPCMachineTemplate_To_v1alpha4_IBMVPCMachineTemplate(src, dst, nil) } func (src *IBMVPCMachineTemplateList) ConvertTo(dstRaw conversion.Hub) error { diff --git a/api/v1alpha4/zz_generated.conversion.go b/api/v1alpha4/zz_generated.conversion.go index bccc6d73b..b3946948f 100644 --- a/api/v1alpha4/zz_generated.conversion.go +++ b/api/v1alpha4/zz_generated.conversion.go @@ -1001,7 +1001,6 @@ func autoConvert_v1beta1_IBMVPCMachineSpec_To_v1alpha4_IBMVPCMachineSpec(in *v1b return err } out.SSHKeys = *(*[]*string)(unsafe.Pointer(&in.SSHKeys)) - // WARNING: in.SSHKeysRef requires manual conversion: does not exist in peer-type return nil } diff --git a/api/v1beta1/ibmvpcmachine_types.go b/api/v1beta1/ibmvpcmachine_types.go index 4df6d1c36..dd0e58904 100644 --- a/api/v1beta1/ibmvpcmachine_types.go +++ b/api/v1beta1/ibmvpcmachine_types.go @@ -58,28 +58,7 @@ type IBMVPCMachineSpec struct { PrimaryNetworkInterface NetworkInterface `json:"primaryNetworkInterface,omitempty"` // SSHKeys is the SSH pub keys that will be used to access VM. - // Deprecated: Use SSHKeysRef instead - // +optional SSHKeys []*string `json:"sshKeys,omitempty"` - - // SSHKeysRef is the SSH pub keys that will be used to access VM. - // +optional - SSHKeysRef []*IBMVPCResourceReference `json:"sshKeysRef,omitempty"` -} - -// IBMVPCResourceReference is a reference to a specific VPC resource by ID or Name -// Only one of ID or Name may be specified. Specifying more than one will result in -// a validation error. -type IBMVPCResourceReference struct { - // ID of resource - // +kubebuilder:validation:MinLength=1 - // +optional - ID *string `json:"id,omitempty"` - - // Name of resource - // +kubebuilder:validation:MinLength=1 - // +optional - Name *string `json:"name,omitempty"` } // IBMVPCMachineStatus defines the observed state of IBMVPCMachine. diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 8616988e2..d032651f4 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -785,17 +785,6 @@ func (in *IBMVPCMachineSpec) DeepCopyInto(out *IBMVPCMachineSpec) { } } } - if in.SSHKeysRef != nil { - in, out := &in.SSHKeysRef, &out.SSHKeysRef - *out = make([]*IBMVPCResourceReference, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(IBMVPCResourceReference) - (*in).DeepCopyInto(*out) - } - } - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IBMVPCMachineSpec. @@ -918,31 +907,6 @@ func (in *IBMVPCMachineTemplateSpec) DeepCopy() *IBMVPCMachineTemplateSpec { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IBMVPCResourceReference) DeepCopyInto(out *IBMVPCResourceReference) { - *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 - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IBMVPCResourceReference. -func (in *IBMVPCResourceReference) DeepCopy() *IBMVPCResourceReference { - if in == nil { - return nil - } - out := new(IBMVPCResourceReference) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NetworkInterface) DeepCopyInto(out *NetworkInterface) { *out = *in diff --git a/cloud/scope/machine.go b/cloud/scope/machine.go index 6207c77ec..c36abf01a 100644 --- a/cloud/scope/machine.go +++ b/cloud/scope/machine.go @@ -157,22 +157,6 @@ func (m *MachineScope) CreateMachine() (*vpcv1.Instance, error) { } } - if m.IBMVPCMachine.Spec.SSHKeysRef != nil { - if instancePrototype.Keys == nil { - instancePrototype.Keys = []vpcv1.KeyIdentityIntf{} - } - for _, sshKey := range m.IBMVPCMachine.Spec.SSHKeysRef { - keyID, err := fetchKeyID(sshKey, m) - if err != nil { - return nil, fmt.Errorf("error while fetching SSHKey: %v error: %v", sshKey, err) - } - key := &vpcv1.KeyIdentity{ - ID: keyID, - } - instancePrototype.Keys = append(instancePrototype.Keys, key) - } - } - options.SetInstancePrototype(instancePrototype) instance, _, err := m.IBMVPCClient.CreateInstance(options) if err != nil { @@ -343,30 +327,3 @@ func (m *MachineScope) GetBootstrapData() (string, error) { } return string(value), nil } - -func fetchKeyID(key *infrav1beta1.IBMVPCResourceReference, m *MachineScope) (*string, error) { - if key.ID != nil { - return key.ID, nil - } - - if key.Name != nil { - keys, _, err := m.IBMVPCClient.ListKeys(&vpcv1.ListKeysOptions{}) - if err != nil { - m.Logger.Error(err, "Failed to get keys") - return nil, err - } - - for _, k := range keys.Keys { - if *k.Name == *key.Name { - m.Logger.V(3).Info("Key found with ID", "Key", *k.Name, "ID", *k.ID) - return k.ID, nil - } - } - } - - if key.ID == nil && key.Name == nil { - return nil, fmt.Errorf("both ID and Name can't be nil") - } - - return nil, fmt.Errorf("sshkey does not exist - failed to find Key ID") -} diff --git a/cloud/scope/machine_test.go b/cloud/scope/machine_test.go index 008e8a03a..e3a5aea7f 100644 --- a/cloud/scope/machine_test.go +++ b/cloud/scope/machine_test.go @@ -232,139 +232,6 @@ func TestCreateMachine(t *testing.T) { _, err := scope.CreateMachine() g.Expect(err).To(Not(BeNil())) }) - - t.Run("Error when both ID and Name are nil", func(t *testing.T) { - g := NewWithT(t) - mockController, mockvpc := setup(t) - t.Cleanup(mockController.Finish) - scope := setupMachineScope(clusterName, machineName, mockvpc) - vpcMachine := infrav1beta1.IBMVPCMachine{ - Spec: infrav1beta1.IBMVPCMachineSpec{ - SSHKeysRef: []*infrav1beta1.IBMVPCResourceReference{ - {}, - }, - }, - } - scope.IBMVPCMachine.Spec = vpcMachine.Spec - mockvpc.EXPECT().ListInstances(gomock.AssignableToTypeOf(&vpcv1.ListInstancesOptions{})).Return(&vpcv1.InstanceCollection{}, &core.DetailedResponse{}, nil) - _, err := scope.CreateMachine() - g.Expect(err).To(Not(BeNil())) - }) - - t.Run("Error when listing SSHKeys", func(t *testing.T) { - g := NewWithT(t) - mockController, mockvpc := setup(t) - t.Cleanup(mockController.Finish) - scope := setupMachineScope(clusterName, machineName, mockvpc) - vpcMachine := infrav1beta1.IBMVPCMachine{ - Spec: infrav1beta1.IBMVPCMachineSpec{ - SSHKeysRef: []*infrav1beta1.IBMVPCResourceReference{ - { - Name: core.StringPtr("foo-ssh-key"), - }, - }, - }, - } - scope.IBMVPCMachine.Spec = vpcMachine.Spec - mockvpc.EXPECT().ListInstances(gomock.AssignableToTypeOf(&vpcv1.ListInstancesOptions{})).Return(&vpcv1.InstanceCollection{}, &core.DetailedResponse{}, nil) - mockvpc.EXPECT().ListKeys(gomock.AssignableToTypeOf(&vpcv1.ListKeysOptions{})).Return(nil, &core.DetailedResponse{}, errors.New("Failed when creating instance")) - _, err := scope.CreateMachine() - g.Expect(err).To(Not(BeNil())) - }) - - t.Run("Error when SSHKey does not exist", func(t *testing.T) { - g := NewWithT(t) - mockController, mockvpc := setup(t) - t.Cleanup(mockController.Finish) - scope := setupMachineScope(clusterName, machineName, mockvpc) - keyCollection := &vpcv1.KeyCollection{ - Keys: []vpcv1.Key{ - { - Name: core.StringPtr("foo-ssh-key-1"), - ID: core.StringPtr("foo-ssh-key-id"), - }, - }, - } - vpcMachine := infrav1beta1.IBMVPCMachine{ - Spec: infrav1beta1.IBMVPCMachineSpec{ - SSHKeysRef: []*infrav1beta1.IBMVPCResourceReference{ - { - Name: core.StringPtr("foo-ssh-key"), - }, - }, - }, - } - scope.IBMVPCMachine.Spec = vpcMachine.Spec - mockvpc.EXPECT().ListInstances(gomock.AssignableToTypeOf(&vpcv1.ListInstancesOptions{})).Return(&vpcv1.InstanceCollection{}, &core.DetailedResponse{}, nil) - mockvpc.EXPECT().ListKeys(gomock.AssignableToTypeOf(&vpcv1.ListKeysOptions{})).Return(keyCollection, &core.DetailedResponse{}, nil) - _, err := scope.CreateMachine() - g.Expect(err).To(Not(BeNil())) - }) - - t.Run("Should create Machine with SSHKeysRef (ID)", func(t *testing.T) { - g := NewWithT(t) - mockController, mockvpc := setup(t) - t.Cleanup(mockController.Finish) - scope := setupMachineScope(clusterName, machineName, mockvpc) - expectedOutput := &vpcv1.Instance{ - Name: core.StringPtr("foo-machine"), - } - vpcMachine := infrav1beta1.IBMVPCMachine{ - Spec: infrav1beta1.IBMVPCMachineSpec{ - SSHKeysRef: []*infrav1beta1.IBMVPCResourceReference{ - { - ID: core.StringPtr("foo-ssh-key-id"), - }, - }, - }, - } - scope.IBMVPCMachine.Spec = vpcMachine.Spec - instance := &vpcv1.Instance{ - Name: &scope.Machine.Name, - } - mockvpc.EXPECT().ListInstances(gomock.AssignableToTypeOf(&vpcv1.ListInstancesOptions{})).Return(&vpcv1.InstanceCollection{}, &core.DetailedResponse{}, nil) - mockvpc.EXPECT().CreateInstance(gomock.AssignableToTypeOf(&vpcv1.CreateInstanceOptions{})).Return(instance, &core.DetailedResponse{}, nil) - out, err := scope.CreateMachine() - g.Expect(err).To(BeNil()) - require.Equal(t, expectedOutput, out) - }) - - t.Run("Should create Machine with SSHKeysRef (Name)", func(t *testing.T) { - g := NewWithT(t) - mockController, mockvpc := setup(t) - t.Cleanup(mockController.Finish) - scope := setupMachineScope(clusterName, machineName, mockvpc) - expectedOutput := &vpcv1.Instance{ - Name: core.StringPtr("foo-machine"), - } - keyCollection := &vpcv1.KeyCollection{ - Keys: []vpcv1.Key{ - { - Name: core.StringPtr("foo-ssh-key"), - ID: core.StringPtr("foo-ssh-key-id"), - }, - }, - } - vpcMachine := infrav1beta1.IBMVPCMachine{ - Spec: infrav1beta1.IBMVPCMachineSpec{ - SSHKeysRef: []*infrav1beta1.IBMVPCResourceReference{ - { - Name: core.StringPtr("foo-ssh-key"), - }, - }, - }, - } - scope.IBMVPCMachine.Spec = vpcMachine.Spec - instance := &vpcv1.Instance{ - Name: &scope.Machine.Name, - } - mockvpc.EXPECT().ListInstances(gomock.AssignableToTypeOf(&vpcv1.ListInstancesOptions{})).Return(&vpcv1.InstanceCollection{}, &core.DetailedResponse{}, nil) - mockvpc.EXPECT().ListKeys(gomock.AssignableToTypeOf(&vpcv1.ListKeysOptions{})).Return(keyCollection, &core.DetailedResponse{}, nil) - mockvpc.EXPECT().CreateInstance(gomock.AssignableToTypeOf(&vpcv1.CreateInstanceOptions{})).Return(instance, &core.DetailedResponse{}, nil) - out, err := scope.CreateMachine() - g.Expect(err).To(BeNil()) - require.Equal(t, expectedOutput, out) - }) }) } diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml index 5a5bde87d..88cb89a99 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml @@ -269,28 +269,10 @@ spec: cloud provider. type: string sshKeys: - description: 'SSHKeys is the SSH pub keys that will be used to access - VM. Deprecated: Use SSHKeysRef instead' - items: - type: string - type: array - sshKeysRef: - description: SSHKeysRef is the SSH pub keys that will be used to access + description: SSHKeys is the SSH pub keys that will be used to access VM. items: - description: IBMVPCResourceReference is a reference to a specific - VPC resource by ID or Name Only one of ID or Name may be specified. - Specifying more than one will result in a validation error. - properties: - id: - description: ID of resource - minLength: 1 - type: string - name: - description: Name of resource - minLength: 1 - type: string - type: object + type: string type: array zone: description: 'Zone is the place where the instance should be created. diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml index 1994c7390..18d6f0a3c 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml @@ -235,29 +235,10 @@ spec: by the cloud provider. type: string sshKeys: - description: 'SSHKeys is the SSH pub keys that will be used - to access VM. Deprecated: Use SSHKeysRef instead' - items: - type: string - type: array - sshKeysRef: - description: SSHKeysRef is the SSH pub keys that will be used + description: SSHKeys is the SSH pub keys that will be used to access VM. items: - description: IBMVPCResourceReference is a reference to a - specific VPC resource by ID or Name Only one of ID or - Name may be specified. Specifying more than one will result - in a validation error. - properties: - id: - description: ID of resource - minLength: 1 - type: string - name: - description: Name of resource - minLength: 1 - type: string - type: object + type: string type: array zone: description: 'Zone is the place where the instance should diff --git a/pkg/cloud/services/vpc/mock/vpc_generated.go b/pkg/cloud/services/vpc/mock/vpc_generated.go index 89cb96e24..81da9b78f 100644 --- a/pkg/cloud/services/vpc/mock/vpc_generated.go +++ b/pkg/cloud/services/vpc/mock/vpc_generated.go @@ -379,22 +379,6 @@ func (mr *MockVpcMockRecorder) ListInstances(options interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstances", reflect.TypeOf((*MockVpc)(nil).ListInstances), options) } -// ListKeys mocks base method. -func (m *MockVpc) ListKeys(options *vpcv1.ListKeysOptions) (*vpcv1.KeyCollection, *core.DetailedResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListKeys", options) - ret0, _ := ret[0].(*vpcv1.KeyCollection) - ret1, _ := ret[1].(*core.DetailedResponse) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// ListKeys indicates an expected call of ListKeys. -func (mr *MockVpcMockRecorder) ListKeys(options interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListKeys", reflect.TypeOf((*MockVpc)(nil).ListKeys), options) -} - // ListLoadBalancerPoolMembers mocks base method. func (m *MockVpc) ListLoadBalancerPoolMembers(options *vpcv1.ListLoadBalancerPoolMembersOptions) (*vpcv1.LoadBalancerPoolMemberCollection, *core.DetailedResponse, error) { m.ctrl.T.Helper() diff --git a/pkg/cloud/services/vpc/service.go b/pkg/cloud/services/vpc/service.go index b089ec3e6..6a80dc8b8 100644 --- a/pkg/cloud/services/vpc/service.go +++ b/pkg/cloud/services/vpc/service.go @@ -168,11 +168,6 @@ func (s *Service) ListLoadBalancerPoolMembers(options *vpcv1.ListLoadBalancerPoo return s.vpcService.ListLoadBalancerPoolMembers(options) } -// ListKeys returns list of keys in a region. -func (s *Service) ListKeys(options *vpcv1.ListKeysOptions) (*vpcv1.KeyCollection, *core.DetailedResponse, error) { - return s.vpcService.ListKeys(options) -} - // NewService returns a new VPC Service. func NewService(svcEndpoint string) (Vpc, error) { service := &Service{} diff --git a/pkg/cloud/services/vpc/vpc.go b/pkg/cloud/services/vpc/vpc.go index 459f0f604..41cba1e2b 100644 --- a/pkg/cloud/services/vpc/vpc.go +++ b/pkg/cloud/services/vpc/vpc.go @@ -54,5 +54,4 @@ type Vpc interface { CreateLoadBalancerPoolMember(options *vpcv1.CreateLoadBalancerPoolMemberOptions) (*vpcv1.LoadBalancerPoolMember, *core.DetailedResponse, error) DeleteLoadBalancerPoolMember(options *vpcv1.DeleteLoadBalancerPoolMemberOptions) (*core.DetailedResponse, error) ListLoadBalancerPoolMembers(options *vpcv1.ListLoadBalancerPoolMembersOptions) (*vpcv1.LoadBalancerPoolMemberCollection, *core.DetailedResponse, error) - ListKeys(options *vpcv1.ListKeysOptions) (*vpcv1.KeyCollection, *core.DetailedResponse, error) }