diff --git a/pkg/handlers/handlers_test.go b/pkg/handlers/handlers_test.go index 91bd7c0731..9d4ee77a74 100644 --- a/pkg/handlers/handlers_test.go +++ b/pkg/handlers/handlers_test.go @@ -1210,54 +1210,65 @@ var HandlerPolicyTests = map[string][]HandlerPolicyTest{ }, "HelmVM": {}, // Not implemented - "GenerateHelmVMNodeJoinCommandSecondary": { + "GenerateK0sNodeJoinCommand": { { Roles: []rbactypes.Role{rbac.ClusterAdminRole}, SessionRoles: []string{rbac.ClusterAdminRoleID}, Calls: func(storeRecorder *mock_store.MockStoreMockRecorder, handlerRecorder *mock_handlers.MockKOTSHandlerMockRecorder) { - handlerRecorder.GenerateHelmVMNodeJoinCommandSecondary(gomock.Any(), gomock.Any()) + handlerRecorder.GenerateK0sNodeJoinCommand(gomock.Any(), gomock.Any()) }, ExpectStatus: http.StatusOK, }, }, - "GenerateHelmVMNodeJoinCommandPrimary": { + "DrainHelmVMNode": { { + Vars: map[string]string{"nodeName": "node-name"}, Roles: []rbactypes.Role{rbac.ClusterAdminRole}, SessionRoles: []string{rbac.ClusterAdminRoleID}, Calls: func(storeRecorder *mock_store.MockStoreMockRecorder, handlerRecorder *mock_handlers.MockKOTSHandlerMockRecorder) { - handlerRecorder.GenerateHelmVMNodeJoinCommandPrimary(gomock.Any(), gomock.Any()) + handlerRecorder.DrainHelmVMNode(gomock.Any(), gomock.Any()) }, ExpectStatus: http.StatusOK, }, }, - "DrainHelmVMNode": { + "DeleteHelmVMNode": { { Vars: map[string]string{"nodeName": "node-name"}, Roles: []rbactypes.Role{rbac.ClusterAdminRole}, SessionRoles: []string{rbac.ClusterAdminRoleID}, Calls: func(storeRecorder *mock_store.MockStoreMockRecorder, handlerRecorder *mock_handlers.MockKOTSHandlerMockRecorder) { - handlerRecorder.DrainHelmVMNode(gomock.Any(), gomock.Any()) + handlerRecorder.DeleteHelmVMNode(gomock.Any(), gomock.Any()) }, ExpectStatus: http.StatusOK, }, }, - "DeleteHelmVMNode": { + "GetHelmVMNodes": { + { + Roles: []rbactypes.Role{rbac.ClusterAdminRole}, + SessionRoles: []string{rbac.ClusterAdminRoleID}, + Calls: func(storeRecorder *mock_store.MockStoreMockRecorder, handlerRecorder *mock_handlers.MockKOTSHandlerMockRecorder) { + handlerRecorder.GetHelmVMNodes(gomock.Any(), gomock.Any()) + }, + ExpectStatus: http.StatusOK, + }, + }, + "GetHelmVMNode": { { Vars: map[string]string{"nodeName": "node-name"}, Roles: []rbactypes.Role{rbac.ClusterAdminRole}, SessionRoles: []string{rbac.ClusterAdminRoleID}, Calls: func(storeRecorder *mock_store.MockStoreMockRecorder, handlerRecorder *mock_handlers.MockKOTSHandlerMockRecorder) { - handlerRecorder.DeleteHelmVMNode(gomock.Any(), gomock.Any()) + handlerRecorder.GetHelmVMNode(gomock.Any(), gomock.Any()) }, ExpectStatus: http.StatusOK, }, }, - "GetHelmVMNodes": { + "GetK0sNodeJoinCommand": { { Roles: []rbactypes.Role{rbac.ClusterAdminRole}, SessionRoles: []string{rbac.ClusterAdminRoleID}, Calls: func(storeRecorder *mock_store.MockStoreMockRecorder, handlerRecorder *mock_handlers.MockKOTSHandlerMockRecorder) { - handlerRecorder.GetHelmVMNodes(gomock.Any(), gomock.Any()) + handlerRecorder.GetK0sNodeJoinCommand(gomock.Any(), gomock.Any()) }, ExpectStatus: http.StatusOK, }, diff --git a/pkg/handlers/interface.go b/pkg/handlers/interface.go index 0a1fa800fe..81945a41ac 100644 --- a/pkg/handlers/interface.go +++ b/pkg/handlers/interface.go @@ -144,6 +144,7 @@ type KOTSHandler interface { DeleteHelmVMNode(w http.ResponseWriter, r *http.Request) GetHelmVMNodes(w http.ResponseWriter, r *http.Request) GetHelmVMNode(w http.ResponseWriter, r *http.Request) + GetK0sNodeJoinCommand(w http.ResponseWriter, r *http.Request) // Prometheus SetPrometheusAddress(w http.ResponseWriter, r *http.Request) diff --git a/pkg/handlers/mock/mock.go b/pkg/handlers/mock/mock.go index 0898775f70..2d47a3af6f 100644 --- a/pkg/handlers/mock/mock.go +++ b/pkg/handlers/mock/mock.go @@ -442,14 +442,14 @@ func (mr *MockKOTSHandlerMockRecorder) GarbageCollectImages(w, r interface{}) *g return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GarbageCollectImages", reflect.TypeOf((*MockKOTSHandler)(nil).GarbageCollectImages), w, r) } -// GenerateHelmVMNodeJoinCommand mocks base method. +// GenerateK0sNodeJoinCommand mocks base method. func (m *MockKOTSHandler) GenerateK0sNodeJoinCommand(w http.ResponseWriter, r *http.Request) { m.ctrl.T.Helper() m.ctrl.Call(m, "GenerateK0sNodeJoinCommand", w, r) } -// GenerateHelmVMNodeJoinCommand indicates an expected call of GenerateHelmVMNodeJoinCommand. -func (mr *MockKOTSHandlerMockRecorder) GenerateHelmVMNodeJoinCommand(w, r interface{}) *gomock.Call { +// GenerateK0sNodeJoinCommand indicates an expected call of GenerateK0sNodeJoinCommand. +func (mr *MockKOTSHandlerMockRecorder) GenerateK0sNodeJoinCommand(w, r interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateK0sNodeJoinCommand", reflect.TypeOf((*MockKOTSHandler)(nil).GenerateK0sNodeJoinCommand), w, r) } @@ -814,6 +814,18 @@ func (mr *MockKOTSHandlerMockRecorder) GetInstanceSnapshotConfig(w, r interface{ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInstanceSnapshotConfig", reflect.TypeOf((*MockKOTSHandler)(nil).GetInstanceSnapshotConfig), w, r) } +// GetK0sNodeJoinCommand mocks base method. +func (m *MockKOTSHandler) GetK0sNodeJoinCommand(w http.ResponseWriter, r *http.Request) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "GetK0sNodeJoinCommand", w, r) +} + +// GetK0sNodeJoinCommand indicates an expected call of GetK0sNodeJoinCommand. +func (mr *MockKOTSHandlerMockRecorder) GetK0sNodeJoinCommand(w, r interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetK0sNodeJoinCommand", reflect.TypeOf((*MockKOTSHandler)(nil).GetK0sNodeJoinCommand), w, r) +} + // GetKotsadmRegistry mocks base method. func (m *MockKOTSHandler) GetKotsadmRegistry(w http.ResponseWriter, r *http.Request) { m.ctrl.T.Helper()