How to use Create method of vmware Package

Best Syzkaller code snippet using vmware.Create

get_cluster_test.go

Source:get_cluster_test.go Github

copy

Full Screen

...33 kubeconfig string34 clusterInfo []ClusterInfo35 )36 BeforeEach(func() {37 tkgClient, err = CreateTKGClient("../fakes/config/config.yaml", testingDir, defaultTKGBoMFileForTesting, 2*time.Second)38 Expect(err).NotTo(HaveOccurred())39 crtClientFactory = &fakes.CrtClientFactory{}40 includeMC = false41 mgmtClusterName = fakeManagementClusterName42 kubeconfig = fakehelper.GetFakeKubeConfigFilePath(testingDir, "../fakes/config/kubeconfig/config1.yaml")43 clusterClientOptions = clusterclient.NewOptions(getFakePoller(), crtClientFactory, getFakeDiscoveryFactory(), nil)44 })45 Describe("get clusters tests for CP, Worker count, and Cluster Status", func() {46 JustBeforeEach(func() {47 // create a fake controller-runtime cluster with the []runtime.Object mentioned with createClusterOptions48 fakeClientSet = fake.NewFakeClientWithScheme(scheme, fakehelper.GetAllCAPIClusterObjects(createClusterOptions)...)49 crtClientFactory.NewClientReturns(fakeClientSet, nil)50 regionalClusterClient, err = clusterclient.NewClient(kubeconfig, "", clusterClientOptions)51 Expect(err).NotTo(HaveOccurred())52 listOptions = &crtclient.ListOptions{}53 if searchNamespace != "" {54 listOptions.Namespace = searchNamespace55 }56 clusterInfo, err = tkgClient.GetClusterObjects(regionalClusterClient, listOptions, mgmtClusterName, includeMC)57 })58 Context("When cluster is in deleting state", func() {59 BeforeEach(func() {60 createClusterOptions = fakehelper.TestAllClusterComponentOptions{61 ClusterName: "cluster-1",62 Namespace: constants.DefaultNamespace,63 Labels: map[string]string{64 TkgLabelClusterRolePrefix + TkgLabelClusterRoleWorkload: "",65 },66 ClusterOptions: fakehelper.TestClusterOptions{67 Phase: "deleting",68 InfrastructureReady: true,69 ControlPlaneInitialized: true,70 ControlPlaneReady: true,71 },72 CPOptions: fakehelper.TestCPOptions{73 SpecReplicas: 1,74 ReadyReplicas: 1,75 UpdatedReplicas: 1,76 Replicas: 1,77 K8sVersion: "v1.18.2+vmware.1",78 },79 ListMDOptions: fakehelper.GetListMDOptionsFromMDOptions(fakehelper.TestMDOptions{80 SpecReplicas: 1,81 ReadyReplicas: 1,82 UpdatedReplicas: 1,83 Replicas: 1,84 }),85 MachineOptions: []fakehelper.TestMachineOptions{86 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},87 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},88 },89 }90 })91 It("should not return an error and all status should be correct", func() {92 Expect(err).NotTo(HaveOccurred())93 Expect(len(clusterInfo)).To(Equal(1))94 Expect(clusterInfo[0].Name).To(Equal(createClusterOptions.ClusterName))95 Expect(clusterInfo[0].Namespace).To(Equal(createClusterOptions.Namespace))96 Expect(clusterInfo[0].ControlPlaneCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.CPOptions.ReadyReplicas, createClusterOptions.CPOptions.SpecReplicas)))97 Expect(clusterInfo[0].WorkerCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.ListMDOptions[0].ReadyReplicas, createClusterOptions.ListMDOptions[0].SpecReplicas)))98 Expect(clusterInfo[0].K8sVersion).To(Equal(createClusterOptions.CPOptions.K8sVersion))99 Expect(clusterInfo[0].Roles).To(Equal([]string{TkgLabelClusterRoleWorkload}))100 Expect(clusterInfo[0].Status).To(Equal(string(TKGClusterPhaseDeleting)))101 })102 })103 Context("When cluster is in creating state: InfrastructureReady=false", func() {104 BeforeEach(func() {105 createClusterOptions = fakehelper.TestAllClusterComponentOptions{106 ClusterName: "cluster-1",107 Namespace: constants.DefaultNamespace,108 Labels: map[string]string{109 TkgLabelClusterRolePrefix + TkgLabelClusterRoleWorkload: "",110 },111 ClusterOptions: fakehelper.TestClusterOptions{112 Phase: "provisioning",113 InfrastructureReady: false,114 ControlPlaneInitialized: false,115 ControlPlaneReady: false,116 },117 CPOptions: fakehelper.TestCPOptions{118 SpecReplicas: 1,119 ReadyReplicas: 0,120 UpdatedReplicas: 0,121 Replicas: 0,122 K8sVersion: "v1.18.2+vmware.1",123 },124 ListMDOptions: fakehelper.GetListMDOptionsFromMDOptions(fakehelper.TestMDOptions{125 SpecReplicas: 1,126 ReadyReplicas: 0,127 UpdatedReplicas: 0,128 Replicas: 0,129 }),130 MachineOptions: []fakehelper.TestMachineOptions{},131 }132 })133 It("should not return an error and all status should be correct", func() {134 Expect(err).NotTo(HaveOccurred())135 Expect(len(clusterInfo)).To(Equal(1))136 Expect(clusterInfo[0].Name).To(Equal(createClusterOptions.ClusterName))137 Expect(clusterInfo[0].Namespace).To(Equal(createClusterOptions.Namespace))138 Expect(clusterInfo[0].ControlPlaneCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.CPOptions.ReadyReplicas, createClusterOptions.CPOptions.SpecReplicas)))139 Expect(clusterInfo[0].WorkerCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.ListMDOptions[0].ReadyReplicas, createClusterOptions.ListMDOptions[0].SpecReplicas)))140 Expect(clusterInfo[0].K8sVersion).To(Equal(createClusterOptions.CPOptions.K8sVersion))141 Expect(clusterInfo[0].Roles).To(Equal([]string{TkgLabelClusterRoleWorkload}))142 Expect(clusterInfo[0].Status).To(Equal(string(TKGClusterPhaseCreating)))143 })144 })145 Context("When cluster is in creating state: InfrastructureReady=true ControlPlaneInitialized=false", func() {146 BeforeEach(func() {147 createClusterOptions = fakehelper.TestAllClusterComponentOptions{148 ClusterName: "cluster-1",149 Namespace: constants.DefaultNamespace,150 Labels: map[string]string{151 TkgLabelClusterRolePrefix + TkgLabelClusterRoleWorkload: "",152 },153 ClusterOptions: fakehelper.TestClusterOptions{154 Phase: "provisioning",155 InfrastructureReady: true,156 ControlPlaneInitialized: false,157 ControlPlaneReady: false,158 },159 CPOptions: fakehelper.TestCPOptions{160 SpecReplicas: 1,161 ReadyReplicas: 0,162 UpdatedReplicas: 0,163 Replicas: 0,164 K8sVersion: "v1.18.2+vmware.1",165 },166 ListMDOptions: fakehelper.GetListMDOptionsFromMDOptions(fakehelper.TestMDOptions{167 SpecReplicas: 1,168 ReadyReplicas: 0,169 UpdatedReplicas: 0,170 Replicas: 0,171 }),172 MachineOptions: []fakehelper.TestMachineOptions{},173 }174 })175 It("should not return an error and all status should be correct", func() {176 Expect(err).NotTo(HaveOccurred())177 Expect(len(clusterInfo)).To(Equal(1))178 Expect(clusterInfo[0].Name).To(Equal(createClusterOptions.ClusterName))179 Expect(clusterInfo[0].Namespace).To(Equal(createClusterOptions.Namespace))180 Expect(clusterInfo[0].ControlPlaneCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.CPOptions.ReadyReplicas, createClusterOptions.CPOptions.SpecReplicas)))181 Expect(clusterInfo[0].WorkerCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.ListMDOptions[0].ReadyReplicas, createClusterOptions.ListMDOptions[0].SpecReplicas)))182 Expect(clusterInfo[0].K8sVersion).To(Equal(createClusterOptions.CPOptions.K8sVersion))183 Expect(clusterInfo[0].Roles).To(Equal([]string{TkgLabelClusterRoleWorkload}))184 Expect(clusterInfo[0].Status).To(Equal(string(TKGClusterPhaseCreating)))185 })186 })187 Context("When cluster is in creating state: InfrastructureReady=true ControlPlaneInitialized=true MD.Status.ReadyReplicas=0", func() {188 BeforeEach(func() {189 createClusterOptions = fakehelper.TestAllClusterComponentOptions{190 ClusterName: "cluster-1",191 Namespace: constants.DefaultNamespace,192 Labels: map[string]string{193 TkgLabelClusterRolePrefix + TkgLabelClusterRoleWorkload: "",194 },195 ClusterOptions: fakehelper.TestClusterOptions{196 Phase: "provisioned",197 InfrastructureReady: true,198 ControlPlaneInitialized: true,199 ControlPlaneReady: false,200 OperationType: clusterclient.OperationTypeCreate,201 OperationtTimeout: 30 * 60, // 30 minutes202 StartTimestamp: time.Now().UTC().Add(-2 * time.Hour).String(),203 // Subtract 15 minutes from current time204 // indicates more then 30m has not passed from last observed time205 // so should still return creating state206 LastObservedTimestamp: time.Now().UTC().Add(-15 * time.Minute).String(),207 },208 CPOptions: fakehelper.TestCPOptions{209 SpecReplicas: 3,210 ReadyReplicas: 1,211 UpdatedReplicas: 1,212 Replicas: 1,213 K8sVersion: "v1.18.2+vmware.1",214 },215 ListMDOptions: fakehelper.GetListMDOptionsFromMDOptions(fakehelper.TestMDOptions{216 SpecReplicas: 3,217 ReadyReplicas: 0,218 UpdatedReplicas: 0,219 Replicas: 0,220 }),221 MachineOptions: []fakehelper.TestMachineOptions{222 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},223 },224 }225 })226 It("should not return an error and all status should be correct", func() {227 Expect(err).NotTo(HaveOccurred())228 Expect(len(clusterInfo)).To(Equal(1))229 Expect(clusterInfo[0].Name).To(Equal(createClusterOptions.ClusterName))230 Expect(clusterInfo[0].Namespace).To(Equal(createClusterOptions.Namespace))231 Expect(clusterInfo[0].ControlPlaneCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.CPOptions.ReadyReplicas, createClusterOptions.CPOptions.SpecReplicas)))232 Expect(clusterInfo[0].WorkerCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.ListMDOptions[0].ReadyReplicas, createClusterOptions.ListMDOptions[0].SpecReplicas)))233 Expect(clusterInfo[0].K8sVersion).To(Equal(createClusterOptions.CPOptions.K8sVersion))234 Expect(clusterInfo[0].Roles).To(Equal([]string{TkgLabelClusterRoleWorkload}))235 Expect(clusterInfo[0].Status).To(Equal(string(TKGClusterPhaseCreating)))236 })237 })238 Context("When cluster is in running state: #CP=1 #Worker=1", func() {239 BeforeEach(func() {240 createClusterOptions = fakehelper.TestAllClusterComponentOptions{241 ClusterName: "cluster-1",242 Namespace: constants.DefaultNamespace,243 Labels: map[string]string{244 TkgLabelClusterRolePrefix + TkgLabelClusterRoleWorkload: "",245 },246 ClusterOptions: fakehelper.TestClusterOptions{247 Phase: "provisioned",248 InfrastructureReady: true,249 ControlPlaneInitialized: true,250 ControlPlaneReady: true,251 OperationType: clusterclient.OperationTypeCreate,252 OperationtTimeout: 30 * 60, // 30 minutes253 StartTimestamp: time.Now().UTC().Add(-2 * time.Hour).String(),254 // when cluster is in running state opeationType & lastObserved state255 // should not matter even if more then timout time has elapsed256 LastObservedTimestamp: time.Now().UTC().Add(-1 * time.Hour).String(),257 },258 CPOptions: fakehelper.TestCPOptions{259 SpecReplicas: 1,260 ReadyReplicas: 1,261 UpdatedReplicas: 1,262 Replicas: 1,263 K8sVersion: "v1.18.2+vmware.1",264 },265 ListMDOptions: fakehelper.GetListMDOptionsFromMDOptions(fakehelper.TestMDOptions{266 SpecReplicas: 1,267 ReadyReplicas: 1,268 UpdatedReplicas: 1,269 Replicas: 1,270 }),271 MachineOptions: []fakehelper.TestMachineOptions{272 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},273 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},274 },275 }276 })277 It("should not return an error and all status should be correct", func() {278 Expect(err).NotTo(HaveOccurred())279 Expect(len(clusterInfo)).To(Equal(1))280 Expect(clusterInfo[0].Name).To(Equal(createClusterOptions.ClusterName))281 Expect(clusterInfo[0].Namespace).To(Equal(createClusterOptions.Namespace))282 Expect(clusterInfo[0].ControlPlaneCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.CPOptions.ReadyReplicas, createClusterOptions.CPOptions.SpecReplicas)))283 Expect(clusterInfo[0].WorkerCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.ListMDOptions[0].ReadyReplicas, createClusterOptions.ListMDOptions[0].SpecReplicas)))284 Expect(clusterInfo[0].K8sVersion).To(Equal(createClusterOptions.CPOptions.K8sVersion))285 Expect(clusterInfo[0].Roles).To(Equal([]string{TkgLabelClusterRoleWorkload}))286 Expect(clusterInfo[0].Status).To(Equal(string(TKGClusterPhaseRunning)))287 })288 })289 Context("When cluster is in running state #CP=3 #Worker=3", func() {290 BeforeEach(func() {291 createClusterOptions = fakehelper.TestAllClusterComponentOptions{292 ClusterName: "cluster-1",293 Namespace: constants.DefaultNamespace,294 Labels: map[string]string{295 TkgLabelClusterRolePrefix + TkgLabelClusterRoleWorkload: "",296 },297 ClusterOptions: fakehelper.TestClusterOptions{298 Phase: "provisioned",299 InfrastructureReady: true,300 ControlPlaneInitialized: true,301 ControlPlaneReady: true,302 },303 CPOptions: fakehelper.TestCPOptions{304 SpecReplicas: 3,305 ReadyReplicas: 3,306 UpdatedReplicas: 3,307 Replicas: 3,308 K8sVersion: "v1.18.2+vmware.1",309 },310 ListMDOptions: fakehelper.GetListMDOptionsFromMDOptions(fakehelper.TestMDOptions{311 SpecReplicas: 3,312 ReadyReplicas: 3,313 UpdatedReplicas: 3,314 Replicas: 3,315 }),316 MachineOptions: []fakehelper.TestMachineOptions{317 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},318 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},319 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},320 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},321 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},322 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},323 },324 }325 })326 It("should not return an error and all status should be correct", func() {327 Expect(err).NotTo(HaveOccurred())328 Expect(len(clusterInfo)).To(Equal(1))329 Expect(clusterInfo[0].Name).To(Equal(createClusterOptions.ClusterName))330 Expect(clusterInfo[0].Namespace).To(Equal(createClusterOptions.Namespace))331 Expect(clusterInfo[0].ControlPlaneCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.CPOptions.ReadyReplicas, createClusterOptions.CPOptions.SpecReplicas)))332 Expect(clusterInfo[0].WorkerCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.ListMDOptions[0].ReadyReplicas, createClusterOptions.ListMDOptions[0].SpecReplicas)))333 Expect(clusterInfo[0].K8sVersion).To(Equal(createClusterOptions.CPOptions.K8sVersion))334 Expect(clusterInfo[0].Roles).To(Equal([]string{TkgLabelClusterRoleWorkload}))335 Expect(clusterInfo[0].Status).To(Equal(string(TKGClusterPhaseRunning)))336 })337 })338 Context("If creation is in stalled state", func() {339 BeforeEach(func() {340 createClusterOptions = fakehelper.TestAllClusterComponentOptions{341 ClusterName: "cluster-1",342 Namespace: constants.DefaultNamespace,343 Labels: map[string]string{344 TkgLabelClusterRolePrefix + TkgLabelClusterRoleWorkload: "",345 },346 ClusterOptions: fakehelper.TestClusterOptions{347 Phase: "provisioned",348 InfrastructureReady: true,349 ControlPlaneInitialized: true,350 ControlPlaneReady: true,351 OperationType: clusterclient.OperationTypeCreate,352 OperationtTimeout: 30 * 60, // 30 minutes353 StartTimestamp: time.Now().UTC().Add(-2 * time.Hour).String(),354 // Subtract 1 hour from current time355 // indicates more then 30m has passed from last observed time356 LastObservedTimestamp: time.Now().UTC().Add(-time.Hour).String(),357 },358 CPOptions: fakehelper.TestCPOptions{359 SpecReplicas: 3,360 ReadyReplicas: 0,361 UpdatedReplicas: 0,362 Replicas: 0,363 K8sVersion: "v1.18.2+vmware.1",364 },365 ListMDOptions: fakehelper.GetListMDOptionsFromMDOptions(fakehelper.TestMDOptions{366 SpecReplicas: 3,367 ReadyReplicas: 0,368 UpdatedReplicas: 0,369 Replicas: 0,370 }),371 MachineOptions: []fakehelper.TestMachineOptions{372 {Phase: "provisioning", K8sVersion: "v1.18.2+vmware.1", IsCP: true},373 },374 }375 })376 It("should not return an error and all status should be correct", func() {377 Expect(err).NotTo(HaveOccurred())378 Expect(len(clusterInfo)).To(Equal(1))379 Expect(clusterInfo[0].Name).To(Equal(createClusterOptions.ClusterName))380 Expect(clusterInfo[0].Namespace).To(Equal(createClusterOptions.Namespace))381 Expect(clusterInfo[0].ControlPlaneCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.CPOptions.ReadyReplicas, createClusterOptions.CPOptions.SpecReplicas)))382 Expect(clusterInfo[0].WorkerCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.ListMDOptions[0].ReadyReplicas, createClusterOptions.ListMDOptions[0].SpecReplicas)))383 Expect(clusterInfo[0].K8sVersion).To(Equal(createClusterOptions.CPOptions.K8sVersion))384 Expect(clusterInfo[0].Roles).To(Equal([]string{TkgLabelClusterRoleWorkload}))385 Expect(clusterInfo[0].Status).To(Equal(string(TKGClusterPhaseCreationStalled)))386 })387 })388 Context("When cluster is in updating state. All controlplane & worker nodes are not ready", func() {389 BeforeEach(func() {390 createClusterOptions = fakehelper.TestAllClusterComponentOptions{391 ClusterName: "cluster-1",392 Namespace: constants.DefaultNamespace,393 Labels: map[string]string{394 TkgLabelClusterRolePrefix + TkgLabelClusterRoleWorkload: "",395 },396 ClusterOptions: fakehelper.TestClusterOptions{397 Phase: "provisioned",398 InfrastructureReady: true,399 ControlPlaneInitialized: true,400 ControlPlaneReady: false,401 },402 CPOptions: fakehelper.TestCPOptions{403 SpecReplicas: 3,404 ReadyReplicas: 2,405 UpdatedReplicas: 2,406 Replicas: 2,407 K8sVersion: "v1.18.2+vmware.1",408 },409 ListMDOptions: fakehelper.GetListMDOptionsFromMDOptions(fakehelper.TestMDOptions{410 SpecReplicas: 3,411 ReadyReplicas: 1,412 UpdatedReplicas: 1,413 Replicas: 1,414 }),415 MachineOptions: []fakehelper.TestMachineOptions{416 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},417 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},418 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},419 },420 }421 })422 It("should not return an error and all status should be correct", func() {423 Expect(err).NotTo(HaveOccurred())424 Expect(len(clusterInfo)).To(Equal(1))425 Expect(clusterInfo[0].Name).To(Equal(createClusterOptions.ClusterName))426 Expect(clusterInfo[0].Namespace).To(Equal(createClusterOptions.Namespace))427 Expect(clusterInfo[0].ControlPlaneCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.CPOptions.ReadyReplicas, createClusterOptions.CPOptions.SpecReplicas)))428 Expect(clusterInfo[0].WorkerCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.ListMDOptions[0].ReadyReplicas, createClusterOptions.ListMDOptions[0].SpecReplicas)))429 Expect(clusterInfo[0].K8sVersion).To(Equal(createClusterOptions.CPOptions.K8sVersion))430 Expect(clusterInfo[0].Roles).To(Equal([]string{TkgLabelClusterRoleWorkload}))431 Expect(clusterInfo[0].Status).To(Equal(string(TKGClusterPhaseUpdating)))432 })433 })434 Context("When cluster is in updating state. Controlplane is ready but worker nodes are not ready", func() {435 BeforeEach(func() {436 createClusterOptions = fakehelper.TestAllClusterComponentOptions{437 ClusterName: "cluster-1",438 Namespace: constants.DefaultNamespace,439 Labels: map[string]string{440 TkgLabelClusterRolePrefix + TkgLabelClusterRoleWorkload: "",441 },442 ClusterOptions: fakehelper.TestClusterOptions{443 Phase: "provisioned",444 InfrastructureReady: true,445 ControlPlaneInitialized: true,446 ControlPlaneReady: true,447 },448 CPOptions: fakehelper.TestCPOptions{449 SpecReplicas: 3,450 ReadyReplicas: 3,451 UpdatedReplicas: 3,452 Replicas: 3,453 K8sVersion: "v1.18.2+vmware.1",454 },455 ListMDOptions: fakehelper.GetListMDOptionsFromMDOptions(fakehelper.TestMDOptions{456 SpecReplicas: 3,457 ReadyReplicas: 1,458 UpdatedReplicas: 1,459 Replicas: 1,460 }),461 MachineOptions: []fakehelper.TestMachineOptions{462 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},463 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},464 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},465 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},466 },467 }468 })469 It("should not return an error and all status should be correct", func() {470 Expect(err).NotTo(HaveOccurred())471 Expect(len(clusterInfo)).To(Equal(1))472 Expect(clusterInfo[0].Name).To(Equal(createClusterOptions.ClusterName))473 Expect(clusterInfo[0].Namespace).To(Equal(createClusterOptions.Namespace))474 Expect(clusterInfo[0].ControlPlaneCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.CPOptions.ReadyReplicas, createClusterOptions.CPOptions.SpecReplicas)))475 Expect(clusterInfo[0].WorkerCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.ListMDOptions[0].ReadyReplicas, createClusterOptions.ListMDOptions[0].SpecReplicas)))476 Expect(clusterInfo[0].K8sVersion).To(Equal(createClusterOptions.CPOptions.K8sVersion))477 Expect(clusterInfo[0].Roles).To(Equal([]string{TkgLabelClusterRoleWorkload}))478 Expect(clusterInfo[0].Status).To(Equal(string(TKGClusterPhaseUpdating)))479 })480 })481 Context("When cluster is in updating state. Controlplane is ready, All worker machine objects are there but not in running state", func() {482 BeforeEach(func() {483 createClusterOptions = fakehelper.TestAllClusterComponentOptions{484 ClusterName: "cluster-1",485 Namespace: constants.DefaultNamespace,486 Labels: map[string]string{487 TkgLabelClusterRolePrefix + TkgLabelClusterRoleWorkload: "",488 },489 ClusterOptions: fakehelper.TestClusterOptions{490 Phase: "provisioned",491 InfrastructureReady: true,492 ControlPlaneInitialized: true,493 ControlPlaneReady: true,494 },495 CPOptions: fakehelper.TestCPOptions{496 SpecReplicas: 3,497 ReadyReplicas: 3,498 UpdatedReplicas: 3,499 Replicas: 3,500 K8sVersion: "v1.18.2+vmware.1",501 },502 ListMDOptions: fakehelper.GetListMDOptionsFromMDOptions(fakehelper.TestMDOptions{503 SpecReplicas: 3,504 ReadyReplicas: 2,505 UpdatedReplicas: 2,506 Replicas: 2,507 }),508 MachineOptions: []fakehelper.TestMachineOptions{509 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},510 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},511 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},512 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},513 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},514 {Phase: "provisioning", K8sVersion: "v1.18.2+vmware.1", IsCP: false},515 },516 }517 })518 It("should not return an error and all status should be correct", func() {519 Expect(err).NotTo(HaveOccurred())520 Expect(len(clusterInfo)).To(Equal(1))521 Expect(clusterInfo[0].Name).To(Equal(createClusterOptions.ClusterName))522 Expect(clusterInfo[0].Namespace).To(Equal(createClusterOptions.Namespace))523 Expect(clusterInfo[0].ControlPlaneCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.CPOptions.ReadyReplicas, createClusterOptions.CPOptions.SpecReplicas)))524 Expect(clusterInfo[0].WorkerCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.ListMDOptions[0].ReadyReplicas, createClusterOptions.ListMDOptions[0].SpecReplicas)))525 Expect(clusterInfo[0].K8sVersion).To(Equal(createClusterOptions.CPOptions.K8sVersion))526 Expect(clusterInfo[0].Roles).To(Equal([]string{TkgLabelClusterRoleWorkload}))527 Expect(clusterInfo[0].Status).To(Equal(string(TKGClusterPhaseUpdating)))528 })529 })530 Context("When cluster is in updating state. Upgrade is under progress. KCP.K8sVersion != Machine.K8sVersion, start of upgrade", func() {531 BeforeEach(func() {532 createClusterOptions = fakehelper.TestAllClusterComponentOptions{533 ClusterName: "cluster-1",534 Namespace: constants.DefaultNamespace,535 Labels: map[string]string{536 TkgLabelClusterRolePrefix + TkgLabelClusterRoleWorkload: "",537 },538 ClusterOptions: fakehelper.TestClusterOptions{539 Phase: "provisioned",540 InfrastructureReady: true,541 ControlPlaneInitialized: true,542 ControlPlaneReady: true,543 },544 CPOptions: fakehelper.TestCPOptions{545 SpecReplicas: 3,546 ReadyReplicas: 3,547 UpdatedReplicas: 3,548 Replicas: 3,549 K8sVersion: "v1.18.3+vmware.1",550 },551 ListMDOptions: fakehelper.GetListMDOptionsFromMDOptions(fakehelper.TestMDOptions{552 SpecReplicas: 3,553 ReadyReplicas: 3,554 UpdatedReplicas: 3,555 Replicas: 3,556 }),557 MachineOptions: []fakehelper.TestMachineOptions{558 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},559 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},560 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},561 {Phase: "running", K8sVersion: "v1.18.3+vmware.1", IsCP: true}, // upgrading562 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},563 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},564 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},565 },566 }567 })568 It("should not return an error and all status should be correct", func() {569 Expect(err).NotTo(HaveOccurred())570 Expect(len(clusterInfo)).To(Equal(1))571 Expect(clusterInfo[0].Name).To(Equal(createClusterOptions.ClusterName))572 Expect(clusterInfo[0].Namespace).To(Equal(createClusterOptions.Namespace))573 Expect(clusterInfo[0].ControlPlaneCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.CPOptions.ReadyReplicas, createClusterOptions.CPOptions.SpecReplicas)))574 Expect(clusterInfo[0].WorkerCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.ListMDOptions[0].ReadyReplicas, createClusterOptions.ListMDOptions[0].SpecReplicas)))575 Expect(clusterInfo[0].K8sVersion).To(Equal(createClusterOptions.CPOptions.K8sVersion))576 Expect(clusterInfo[0].Roles).To(Equal([]string{TkgLabelClusterRoleWorkload}))577 Expect(clusterInfo[0].Status).To(Equal(string(TKGClusterPhaseUpdating)))578 })579 })580 Context("When cluster is in updating state. Upgrade is under progress. KCP.K8sVersion != Machine.K8sVersion, end Phase of upgrade", func() {581 BeforeEach(func() {582 createClusterOptions = fakehelper.TestAllClusterComponentOptions{583 ClusterName: "cluster-1",584 Namespace: constants.DefaultNamespace,585 Labels: map[string]string{586 TkgLabelClusterRolePrefix + TkgLabelClusterRoleWorkload: "",587 },588 ClusterOptions: fakehelper.TestClusterOptions{589 Phase: "provisioned",590 InfrastructureReady: true,591 ControlPlaneInitialized: true,592 ControlPlaneReady: true,593 },594 CPOptions: fakehelper.TestCPOptions{595 SpecReplicas: 3,596 ReadyReplicas: 3,597 UpdatedReplicas: 3,598 Replicas: 3,599 K8sVersion: "v1.18.3+vmware.1",600 },601 ListMDOptions: fakehelper.GetListMDOptionsFromMDOptions(fakehelper.TestMDOptions{602 SpecReplicas: 3,603 ReadyReplicas: 3,604 UpdatedReplicas: 3,605 Replicas: 4,606 }),607 MachineOptions: []fakehelper.TestMachineOptions{608 {Phase: "running", K8sVersion: "v1.18.3+vmware.1", IsCP: true},609 {Phase: "running", K8sVersion: "v1.18.3+vmware.1", IsCP: true},610 {Phase: "running", K8sVersion: "v1.18.3+vmware.1", IsCP: true},611 {Phase: "running", K8sVersion: "v1.18.3+vmware.1", IsCP: true},612 {Phase: "running", K8sVersion: "v1.18.3+vmware.1", IsCP: false},613 {Phase: "running", K8sVersion: "v1.18.3+vmware.1", IsCP: false},614 {Phase: "running", K8sVersion: "v1.18.3+vmware.1", IsCP: false},615 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false}, // old k8s version machine still present616 },617 }618 })619 It("should not return an error and all status should be correct", func() {620 Expect(err).NotTo(HaveOccurred())621 Expect(len(clusterInfo)).To(Equal(1))622 Expect(clusterInfo[0].Name).To(Equal(createClusterOptions.ClusterName))623 Expect(clusterInfo[0].Namespace).To(Equal(createClusterOptions.Namespace))624 Expect(clusterInfo[0].ControlPlaneCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.CPOptions.ReadyReplicas, createClusterOptions.CPOptions.SpecReplicas)))625 Expect(clusterInfo[0].WorkerCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.ListMDOptions[0].ReadyReplicas, createClusterOptions.ListMDOptions[0].SpecReplicas)))626 Expect(clusterInfo[0].K8sVersion).To(Equal(createClusterOptions.CPOptions.K8sVersion))627 Expect(clusterInfo[0].Roles).To(Equal([]string{TkgLabelClusterRoleWorkload}))628 Expect(clusterInfo[0].Status).To(Equal(string(TKGClusterPhaseUpdating)))629 })630 })631 Context("After upgrade is complete. Cluster should be in running state", func() {632 BeforeEach(func() {633 createClusterOptions = fakehelper.TestAllClusterComponentOptions{634 ClusterName: "cluster-1",635 Namespace: constants.DefaultNamespace,636 Labels: map[string]string{637 TkgLabelClusterRolePrefix + TkgLabelClusterRoleWorkload: "",638 },639 ClusterOptions: fakehelper.TestClusterOptions{640 Phase: "provisioned",641 InfrastructureReady: true,642 ControlPlaneInitialized: true,643 ControlPlaneReady: true,644 },645 CPOptions: fakehelper.TestCPOptions{646 SpecReplicas: 3,647 ReadyReplicas: 3,648 UpdatedReplicas: 3,649 Replicas: 3,650 K8sVersion: "v1.18.3+vmware.1",651 },652 ListMDOptions: fakehelper.GetListMDOptionsFromMDOptions(fakehelper.TestMDOptions{653 SpecReplicas: 3,654 ReadyReplicas: 3,655 UpdatedReplicas: 3,656 Replicas: 3,657 }),658 MachineOptions: []fakehelper.TestMachineOptions{659 {Phase: "running", K8sVersion: "v1.18.3+vmware.1", IsCP: true},660 {Phase: "running", K8sVersion: "v1.18.3+vmware.1", IsCP: true},661 {Phase: "running", K8sVersion: "v1.18.3+vmware.1", IsCP: true},662 {Phase: "running", K8sVersion: "v1.18.3+vmware.1", IsCP: true},663 {Phase: "running", K8sVersion: "v1.18.3+vmware.1", IsCP: false},664 {Phase: "running", K8sVersion: "v1.18.3+vmware.1", IsCP: false},665 {Phase: "running", K8sVersion: "v1.18.3+vmware.1", IsCP: false},666 },667 }668 })669 It("should not return an error and all status should be correct", func() {670 Expect(err).NotTo(HaveOccurred())671 Expect(len(clusterInfo)).To(Equal(1))672 Expect(clusterInfo[0].Name).To(Equal(createClusterOptions.ClusterName))673 Expect(clusterInfo[0].Namespace).To(Equal(createClusterOptions.Namespace))674 Expect(clusterInfo[0].ControlPlaneCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.CPOptions.ReadyReplicas, createClusterOptions.CPOptions.SpecReplicas)))675 Expect(clusterInfo[0].WorkerCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.ListMDOptions[0].ReadyReplicas, createClusterOptions.ListMDOptions[0].SpecReplicas)))676 Expect(clusterInfo[0].K8sVersion).To(Equal(createClusterOptions.CPOptions.K8sVersion))677 Expect(clusterInfo[0].Roles).To(Equal([]string{TkgLabelClusterRoleWorkload}))678 Expect(clusterInfo[0].Status).To(Equal(string(TKGClusterPhaseRunning)))679 })680 })681 Context("If upgrade is in stalled state, should return status as updateStalled", func() {682 BeforeEach(func() {683 createClusterOptions = fakehelper.TestAllClusterComponentOptions{684 ClusterName: "cluster-1",685 Namespace: constants.DefaultNamespace,686 Labels: map[string]string{687 TkgLabelClusterRolePrefix + TkgLabelClusterRoleWorkload: "",688 },689 ClusterOptions: fakehelper.TestClusterOptions{690 Phase: "provisioned",691 InfrastructureReady: true,692 ControlPlaneInitialized: true,693 ControlPlaneReady: true,694 OperationType: clusterclient.OperationTypeUpgrade,695 OperationtTimeout: 30 * 60, // 30 minutes696 StartTimestamp: time.Now().UTC().Add(-2 * time.Hour).String(),697 // Subtract 1 hour from current time698 // indicates more then 30m has passed from last observed time699 LastObservedTimestamp: time.Now().UTC().Add(-time.Hour).String(),700 },701 CPOptions: fakehelper.TestCPOptions{702 SpecReplicas: 3,703 ReadyReplicas: 3,704 UpdatedReplicas: 3,705 Replicas: 3,706 K8sVersion: "v1.18.3+vmware.1",707 },708 ListMDOptions: fakehelper.GetListMDOptionsFromMDOptions(fakehelper.TestMDOptions{709 SpecReplicas: 3,710 ReadyReplicas: 3,711 UpdatedReplicas: 3,712 Replicas: 3,713 }),714 MachineOptions: []fakehelper.TestMachineOptions{715 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},716 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},717 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},718 {Phase: "provisioning", K8sVersion: "v1.18.3+vmware.1", IsCP: true},719 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},720 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},721 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},722 },723 }724 })725 It("should not return an error and all status should be correct", func() {726 Expect(err).NotTo(HaveOccurred())727 Expect(len(clusterInfo)).To(Equal(1))728 Expect(clusterInfo[0].Name).To(Equal(createClusterOptions.ClusterName))729 Expect(clusterInfo[0].Namespace).To(Equal(createClusterOptions.Namespace))730 Expect(clusterInfo[0].ControlPlaneCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.CPOptions.ReadyReplicas, createClusterOptions.CPOptions.SpecReplicas)))731 Expect(clusterInfo[0].WorkerCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.ListMDOptions[0].ReadyReplicas, createClusterOptions.ListMDOptions[0].SpecReplicas)))732 Expect(clusterInfo[0].K8sVersion).To(Equal(createClusterOptions.CPOptions.K8sVersion))733 Expect(clusterInfo[0].Roles).To(Equal([]string{TkgLabelClusterRoleWorkload}))734 Expect(clusterInfo[0].Status).To(Equal(string(TKGClusterPhaseUpdateStalled)))735 Expect(clusterInfo[0].Labels).Should(Equal(createClusterOptions.Labels))736 })737 })738 Context("When cluster is in running state and Cluster Role label is missing", func() {739 BeforeEach(func() {740 createClusterOptions = fakehelper.TestAllClusterComponentOptions{741 ClusterName: "cluster-1",742 Namespace: constants.DefaultNamespace,743 Labels: map[string]string{},744 ClusterOptions: fakehelper.TestClusterOptions{745 Phase: "provisioned",746 InfrastructureReady: true,747 ControlPlaneInitialized: true,748 ControlPlaneReady: true,749 },750 CPOptions: fakehelper.TestCPOptions{751 SpecReplicas: 3,752 ReadyReplicas: 3,753 UpdatedReplicas: 3,754 Replicas: 3,755 K8sVersion: "v1.18.2+vmware.1",756 },757 ListMDOptions: fakehelper.GetListMDOptionsFromMDOptions(fakehelper.TestMDOptions{758 SpecReplicas: 3,759 ReadyReplicas: 3,760 UpdatedReplicas: 3,761 Replicas: 3,762 }),763 MachineOptions: []fakehelper.TestMachineOptions{764 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},765 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},766 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: true},767 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},768 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},769 {Phase: "running", K8sVersion: "v1.18.2+vmware.1", IsCP: false},770 },771 }772 })773 It("should not return an error and all status should be correct", func() {774 Expect(err).NotTo(HaveOccurred())775 Expect(len(clusterInfo)).To(Equal(1))776 Expect(clusterInfo[0].Name).To(Equal(createClusterOptions.ClusterName))777 Expect(clusterInfo[0].Namespace).To(Equal(createClusterOptions.Namespace))778 Expect(clusterInfo[0].ControlPlaneCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.CPOptions.ReadyReplicas, createClusterOptions.CPOptions.SpecReplicas)))779 Expect(clusterInfo[0].WorkerCount).To(Equal(fmt.Sprintf("%v/%v", createClusterOptions.ListMDOptions[0].ReadyReplicas, createClusterOptions.ListMDOptions[0].SpecReplicas)))780 Expect(clusterInfo[0].K8sVersion).To(Equal(createClusterOptions.CPOptions.K8sVersion))781 Expect(clusterInfo[0].Roles).To(Equal([]string{}))782 Expect(clusterInfo[0].Status).To(Equal(string(TKGClusterPhaseRunning)))783 })784 })785 })786 Describe("get clusters tests for name and Namespace", func() {787 JustBeforeEach(func() {788 fakeClientSet = fake.NewFakeClientWithScheme(scheme, testClusters...)789 crtClientFactory.NewClientReturns(fakeClientSet, nil)790 regionalClusterClient, err = clusterclient.NewClient(kubeconfig, "", clusterClientOptions)791 Expect(err).NotTo(HaveOccurred())792 listOptions = &crtclient.ListOptions{}793 if searchNamespace != "" {794 listOptions.Namespace = searchNamespace795 }796 clusterInfo, err = tkgClient.GetClusterObjects(regionalClusterClient, listOptions, mgmtClusterName, includeMC)797 })798 Context("When there are 3 clusters in different Namespace and no Namespace is specified", func() {799 BeforeEach(func() {800 cluster1Objects := fakehelper.CreateDummyClusterObjects("cluster-1", constants.DefaultNamespace)801 cluster2Objects := fakehelper.CreateDummyClusterObjects("cluster-2", "test")802 mgmtObjects := fakehelper.CreateDummyClusterObjects(mgmtClusterName, "tkg-system")803 testClusters = []runtime.Object{}804 testClusters = append(testClusters, cluster1Objects...)805 testClusters = append(testClusters, cluster2Objects...)806 testClusters = append(testClusters, mgmtObjects...)807 searchNamespace = ""808 })809 It("should not return an error and 2 clusters should be returned and management cluster should not be returned", func() {810 Expect(err).NotTo(HaveOccurred())811 Expect(len(clusterInfo)).To(Equal(2))812 })813 })814 Context("When there are 3 clusters in different Namespace and Namespace is specified as test", func() {815 BeforeEach(func() {816 cluster1Objects := fakehelper.CreateDummyClusterObjects("cluster-1", constants.DefaultNamespace)817 cluster2Objects := fakehelper.CreateDummyClusterObjects("cluster-2", "test")818 mgmtObjects := fakehelper.CreateDummyClusterObjects(mgmtClusterName, "tkg-system")819 testClusters = []runtime.Object{}820 testClusters = append(testClusters, cluster1Objects...)821 testClusters = append(testClusters, cluster2Objects...)822 testClusters = append(testClusters, mgmtObjects...)823 searchNamespace = "test"824 })825 It("should not return an error and only 1 clusters should be returned and management cluster should not be returned", func() {826 Expect(err).NotTo(HaveOccurred())827 Expect(len(clusterInfo)).To(Equal(1))828 })829 })830 Context("When there are 3 clusters in different Namespace and Namespace is specified as test", func() {831 BeforeEach(func() {832 cluster1Objects := fakehelper.CreateDummyClusterObjects("cluster-1", constants.DefaultNamespace)833 cluster2Objects := fakehelper.CreateDummyClusterObjects("cluster-2", "test")834 mgmtObjects := fakehelper.CreateDummyClusterObjects(mgmtClusterName, "tkg-system")835 testClusters = []runtime.Object{}836 testClusters = append(testClusters, cluster1Objects...)837 testClusters = append(testClusters, cluster2Objects...)838 testClusters = append(testClusters, mgmtObjects...)839 searchNamespace = ""840 includeMC = true841 })842 It("should not return an error and 3 clusters should be returned including management cluster", func() {843 Expect(err).NotTo(HaveOccurred())844 Expect(len(clusterInfo)).To(Equal(3))845 })846 })847 })848 Describe("get clusters tests for Pacific", func() {...

Full Screen

Full Screen

app.go

Source:app.go Github

copy

Full Screen

...60 a.VsphereGetVSphereDatacentersHandler = vsphere.GetVSphereDatacentersHandlerFunc(app.GetVSphereDatacenters)61 a.VsphereGetVSphereDatastoresHandler = vsphere.GetVSphereDatastoresHandlerFunc(app.GetVSphereDatastores)62 a.VsphereGetVSphereNetworksHandler = vsphere.GetVSphereNetworksHandlerFunc(app.GetVSphereNetworks)63 a.VsphereGetVSphereResourcePoolsHandler = vsphere.GetVSphereResourcePoolsHandlerFunc(app.GetVSphereResourcePools)64 a.VsphereCreateVSphereRegionalClusterHandler = vsphere.CreateVSphereRegionalClusterHandlerFunc(app.CreateVSphereRegionalCluster)65 a.VsphereGetVSphereOSImagesHandler = vsphere.GetVSphereOSImagesHandlerFunc(app.GetVsphereOSImages)66 a.VsphereGetVSphereFoldersHandler = vsphere.GetVSphereFoldersHandlerFunc(app.GetVSphereFolders)67 a.VsphereGetVSphereComputeResourcesHandler = vsphere.GetVSphereComputeResourcesHandlerFunc(app.GetVsphereComputeResources)68 a.VsphereApplyTKGConfigForVsphereHandler = vsphere.ApplyTKGConfigForVsphereHandlerFunc(app.ApplyTKGConfigForVsphere)69 a.VsphereGetVsphereThumbprintHandler = vsphere.GetVsphereThumbprintHandlerFunc(app.GetVsphereThumbprint)70 a.AwsSetAWSEndpointHandler = aws.SetAWSEndpointHandlerFunc(app.SetAWSEndPoint)71 a.AwsGetVPCsHandler = aws.GetVPCsHandlerFunc(app.GetVPCs)72 a.AwsGetAWSAvailabilityZonesHandler = aws.GetAWSAvailabilityZonesHandlerFunc(app.GetAWSAvailabilityZones)73 a.AwsGetAWSRegionsHandler = aws.GetAWSRegionsHandlerFunc(app.GetAWSRegions)74 a.AwsCreateAWSRegionalClusterHandler = aws.CreateAWSRegionalClusterHandlerFunc(app.CreateAWSRegionalCluster)75 a.AwsGetAWSSubnetsHandler = aws.GetAWSSubnetsHandlerFunc(app.GetAWSSubnets)76 a.AwsApplyTKGConfigForAWSHandler = aws.ApplyTKGConfigForAWSHandlerFunc(app.ApplyTKGConfigForAWS)77 a.AwsGetAWSNodeTypesHandler = aws.GetAWSNodeTypesHandlerFunc(app.GetAWSNodeTypes)78 a.AwsGetAWSCredentialProfilesHandler = aws.GetAWSCredentialProfilesHandlerFunc(app.GetAWSCredentialProfiles)79 a.AwsGetAWSOSImagesHandler = aws.GetAWSOSImagesHandlerFunc(app.GetAWSOSImages)80 a.AzureGetAzureEndpointHandler = azure.GetAzureEndpointHandlerFunc(app.GetAzureEndpoint)81 a.AzureSetAzureEndpointHandler = azure.SetAzureEndpointHandlerFunc(app.SetAzureEndPoint)82 a.AzureGetAzureResourceGroupsHandler = azure.GetAzureResourceGroupsHandlerFunc(app.GetAzureResourceGroups)83 a.AzureCreateAzureResourceGroupHandler = azure.CreateAzureResourceGroupHandlerFunc(app.CreateAzureResourceGroup)84 a.AzureGetAzureVnetsHandler = azure.GetAzureVnetsHandlerFunc(app.GetAzureVirtualNetworks)85 a.AzureCreateAzureVirtualNetworkHandler = azure.CreateAzureVirtualNetworkHandlerFunc(app.CreateAzureVirtualNetwork)86 a.AzureGetAzureRegionsHandler = azure.GetAzureRegionsHandlerFunc(app.GetAzureRegions)87 a.AzureGetAzureInstanceTypesHandler = azure.GetAzureInstanceTypesHandlerFunc(app.GetAzureInstanceTypes)88 a.AzureApplyTKGConfigForAzureHandler = azure.ApplyTKGConfigForAzureHandlerFunc(app.ApplyTKGConfigForAzure)89 a.AzureCreateAzureRegionalClusterHandler = azure.CreateAzureRegionalClusterHandlerFunc(app.CreateAzureRegionalCluster)90 a.AzureGetAzureOSImagesHandler = azure.GetAzureOSImagesHandlerFunc(app.GetAzureOSImages)91 a.DockerCheckIfDockerDaemonAvailableHandler = docker.CheckIfDockerDaemonAvailableHandlerFunc(app.IsDockerDaemonAvailable)92 a.DockerApplyTKGConfigForDockerHandler = docker.ApplyTKGConfigForDockerHandlerFunc(app.ApplyTKGConfigForDocker)93 a.DockerCreateDockerRegionalClusterHandler = docker.CreateDockerRegionalClusterHandlerFunc(app.CreateDockerRegionalCluster)94 a.FeaturesGetFeatureFlagsHandler = features.GetFeatureFlagsHandlerFunc(app.GetFeatureFlags)95 a.EditionGetTanzuEditionHandler = edition.GetTanzuEditionHandlerFunc(app.GetTanzuEdition)96 a.AviVerifyAccountHandler = avi.VerifyAccountHandlerFunc(app.VerifyAccount)97 a.AviGetAviCloudsHandler = avi.GetAviCloudsHandlerFunc(app.GetAviClouds)98 a.AviGetAviServiceEngineGroupsHandler = avi.GetAviServiceEngineGroupsHandlerFunc(app.GetAviServiceEngineGroups)99 a.AviGetAviVipNetworksHandler = avi.GetAviVipNetworksHandlerFunc(app.GetAviVipNetworks)100 a.TmcRetrieveTMCInstallYmlHandler = tmc.RetrieveTMCInstallYmlHandlerFunc(app.RetrieveTMCInstallYml)101 a.LdapVerifyLdapConnectHandler = ldap.VerifyLdapConnectHandlerFunc(app.VerifyLdapConnect)102 a.LdapVerifyLdapBindHandler = ldap.VerifyLdapBindHandlerFunc(app.VerifyLdapBind)103 a.LdapVerifyLdapUserSearchHandler = ldap.VerifyLdapUserSearchHandlerFunc(app.VerifyUserSearch)104 a.LdapVerifyLdapGroupSearchHandler = ldap.VerifyLdapGroupSearchHandlerFunc(app.VerifyGroupSearch)105 a.LdapVerifyLdapCloseConnectionHandler = ldap.VerifyLdapCloseConnectionHandlerFunc(app.VerifyLdapCloseConnection)106}107// StartSendingLogsToUI creates logchannel passes it to tkg logger...

Full Screen

Full Screen

client_v1.go

Source:client_v1.go Github

copy

Full Screen

...13 start *string, 14 filter *string)(15 *models.ListVMBackupsResponse, *apiutils.APIError)16 17 // CreateBackupVmwareVm Performs an on-demand backup for the specified VM.18 CreateBackupVmwareVm(19 body models.CreateBackupVmwareVmV1Request)(20 interface{}, *apiutils.APIError)21 22 // ReadBackupVmwareVm Returns a representation of the specified VM backup.23 ReadBackupVmwareVm(24 backupId int64)(25 *models.ReadVMBackupResponse, *apiutils.APIError)26 27}28// NewBackupVmwareVmsV1 returns BackupVmwareVmsV1Client29func NewBackupVmwareVmsV1(config config.Config) BackupVmwareVmsV1Client {30 client := new(BackupVmwareVmsV1)31 client.config = config32 return client33}...

Full Screen

Full Screen

Create

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 ctx, cancel := context.WithCancel(context.Background())4 defer cancel()5 if err != nil {6 log.Fatal(err)7 }8 u.User = url.UserPassword("

Full Screen

Full Screen

Create

Using AI Code Generation

copy

Full Screen

1import "fmt"2import "vmware"3func main() {4 fmt.Println("Welcome to vmware")5 v := vmware.Create()6 v.CreateVM("Ubuntu")7 v.CreateVM("Windows")8 v.CreateVM("CentOS")9}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Syzkaller automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful