Skip to content

Commit

Permalink
Add methods to support CRUD operations on CSE Kubernetes clusters (#645)
Browse files Browse the repository at this point in the history
* Added the type 'CseKubernetesCluster' to manage Container Service Extension Kubernetes clusters for versions 4.1.0, 4.1.1, 4.2.0 and 4.2.1
* Added methods 'Org.CseCreateKubernetesCluster' and 'Org.CseCreateKubernetesClusterAsync' to create Kubernetes clusters in a VCD appliance with Container Service Extension installed
* Added methods 'VCDClient.CseGetKubernetesClusterById' and 'Org.CseGetKubernetesClustersByName' to retrieve a Container Service Extension Kubernetes cluster
* Added the method 'CseKubernetesCluster.GetKubeconfig' to retrieve the *kubeconfig* of a provisioned Container Service Extension Kubernetes cluster
* Added the method 'CseKubernetesCluster.Refresh' to refresh the information and properties of an existing Container Service Extension Kubernetes cluster
* Added methods to update a Container Service Extension Kubernetes cluster: 'CseKubernetesCluster.UpdateWorkerPools', 'CseKubernetesCluster.AddWorkerPools', 'CseKubernetesCluster.UpdateControlPlane', 'CseKubernetesCluster.UpgradeCluster', 'CseKubernetesCluster.SetNodeHealthCheck' and 'CseKubernetesCluster.SetAutoRepairOnErrors'
* Added the method  'CseKubernetesCluster.GetSupportedUpgrades' to retrieve all the valid TKGm OVAs that a given Container Service Extension Kubernetes cluster can use to be upgraded
* Added the method 'CseKubernetesCluster.Delete' to delete a cluster
* Added types 'CseClusterSettings', 'CseControlPlaneSettings', 'CseWorkerPoolSettings' and 'CseDefaultStorageClassSettings' to configure the Container Service Extension Kubernetes clusters creation process
* Added types 'CseClusterUpdateInput', 'CseControlPlaneUpdateInput' and 'CseWorkerPoolUpdateInput' to configure the Container Service Extension Kubernetes clusters update process

Signed-off-by: abarreiro <abarreiro@vmware.com>
  • Loading branch information
adambarreiro authored Mar 8, 2024
1 parent e0a8d86 commit a49f044
Show file tree
Hide file tree
Showing 34 changed files with 4,998 additions and 60 deletions.
20 changes: 20 additions & 0 deletions .changes/v2.23.0/645-features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
* Added the type `CseKubernetesCluster` to manage Container Service Extension Kubernetes clusters for versions 4.1.0, 4.1.1,
4.2.0 and 4.2.1 [GH-645]
* Added methods `Org.CseCreateKubernetesCluster` and `Org.CseCreateKubernetesClusterAsync` to create Kubernetes clusters
in a VCD appliance with Container Service Extension installed [GH-645]
* Added methods `VCDClient.CseGetKubernetesClusterById` and `Org.CseGetKubernetesClustersByName` to retrieve a
Container Service Extension Kubernetes cluster [GH-645]
* Added the method `CseKubernetesCluster.GetKubeconfig` to retrieve the *kubeconfig* of a provisioned Container Service
Extension Kubernetes cluster [GH-645]
* Added the method `CseKubernetesCluster.Refresh` to refresh the information and properties of an existing Container
Service Extension Kubernetes cluster [GH-645]
* Added methods to update a Container Service Extension Kubernetes cluster: `CseKubernetesCluster.UpdateWorkerPools`,
`CseKubernetesCluster.AddWorkerPools`, `CseKubernetesCluster.UpdateControlPlane`, `CseKubernetesCluster.UpgradeCluster`,
`CseKubernetesCluster.SetNodeHealthCheck` and `CseKubernetesCluster.SetAutoRepairOnErrors` [GH-645]
* Added the method `CseKubernetesCluster.GetSupportedUpgrades` to retrieve all the valid TKGm OVAs that a given Container
Service Extension Kubernetes cluster can use to be upgraded [GH-645]
* Added the method `CseKubernetesCluster.Delete` to delete a cluster [GH-645]
* Added types `CseClusterSettings`, `CseControlPlaneSettings`, `CseWorkerPoolSettings` and `CseDefaultStorageClassSettings`
to configure the Container Service Extension Kubernetes clusters creation process [GH-645]
* Added types `CseClusterUpdateInput`, `CseControlPlaneUpdateInput` and `CseWorkerPoolUpdateInput` to configure the
Container Service Extension Kubernetes clusters update process [GH-645]
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ require (
github.com/peterhellberg/link v1.1.0
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
gopkg.in/yaml.v2 v2.4.0
sigs.k8s.io/yaml v1.4.0
)

require (
github.com/howeyc/crc16 v0.0.0-20171223171357-2b2a61e366a6
github.com/kr/text v0.1.0 // indirect
github.com/stretchr/testify v1.5.1 // indirect
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ github.com/go-check/check v0.0.0-20201130134442-10cb98267c6c h1:3LdnoQiW6yLkxRIw
github.com/go-check/check v0.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
github.com/go-yaml/yaml/v2 v2.2.2 h1:uw2m9KuKRscWGAkuyoBGQcZSdibhmuXKSJ3+9Tj3zXc=
github.com/go-yaml/yaml/v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E=
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/howeyc/crc16 v0.0.0-20171223171357-2b2a61e366a6 h1:IIVxLyDUYErC950b8kecjoqDet8P5S4lcVRUOM6rdkU=
github.com/howeyc/crc16 v0.0.0-20171223171357-2b2a61e366a6/go.mod h1:JslaLRrzGsOKJgFEPBP65Whn+rdwDQSk0I0MCRFe2Zw=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
Expand All @@ -26,3 +26,5 @@ golang.org/x/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRj
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
15 changes: 13 additions & 2 deletions govcd/api_vcd_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build api || openapi || functional || catalog || vapp || gateway || network || org || query || extnetwork || task || vm || vdc || system || disk || lb || lbAppRule || lbAppProfile || lbServerPool || lbServiceMonitor || lbVirtualServer || user || search || nsxv || nsxt || auth || affinity || role || alb || certificate || vdcGroup || metadata || providervdc || rde || vsphere || uiPlugin || ALL
//go:build api || openapi || functional || catalog || vapp || gateway || network || org || query || extnetwork || task || vm || vdc || system || disk || lb || lbAppRule || lbAppProfile || lbServerPool || lbServiceMonitor || lbVirtualServer || user || search || nsxv || nsxt || auth || affinity || role || alb || certificate || vdcGroup || metadata || providervdc || rde || vsphere || uiPlugin || cse || ALL

/*
* Copyright 2022 VMware, Inc. All rights reserved. Licensed under the Apache v2 License.
Expand All @@ -11,6 +11,7 @@ import (
"encoding/json"
"flag"
"fmt"
"gopkg.in/yaml.v2"
"net/http"
"net/url"
"os"
Expand All @@ -23,7 +24,6 @@ import (
"time"

. "gopkg.in/check.v1"
"gopkg.in/yaml.v2"

"github.com/vmware/go-vcloud-director/v2/types/v56"
"github.com/vmware/go-vcloud-director/v2/util"
Expand Down Expand Up @@ -239,6 +239,17 @@ type TestConfig struct {
MediaUdfTypePath string `yaml:"mediaUdfTypePath,omitempty"`
UiPluginPath string `yaml:"uiPluginPath,omitempty"`
} `yaml:"media"`
Cse struct {
Version string `yaml:"version,omitempty"`
SolutionsOrg string `yaml:"solutionsOrg,omitempty"`
TenantOrg string `yaml:"tenantOrg,omitempty"`
TenantVdc string `yaml:"tenantVdc,omitempty"`
RoutedNetwork string `yaml:"routedNetwork,omitempty"`
EdgeGateway string `yaml:"edgeGateway,omitempty"`
StorageProfile string `yaml:"storageProfile,omitempty"`
OvaCatalog string `yaml:"ovaCatalog,omitempty"`
OvaName string `yaml:"ovaName,omitempty"`
} `yaml:"cse,omitempty"`
}

// Test struct for vcloud-director.
Expand Down
5 changes: 4 additions & 1 deletion govcd/catalogitem.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,12 @@ func queryVappTemplateListWithFilter(client *Client, filter map[string]string) (
for k, v := range filter {
filterEncoded += fmt.Sprintf("%s==%s;", url.QueryEscape(k), url.QueryEscape(v))
}
if len(filterEncoded) > 0 {
filterEncoded = filterEncoded[:len(filterEncoded)-1] // Removes the trailing ';'
}
results, err := client.cumulativeQuery(vappTemplateType, nil, map[string]string{
"type": vappTemplateType,
"filter": filterEncoded[:len(filterEncoded)-1], // Removes the trailing ';'
"filter": filterEncoded,
})
if err != nil {
return nil, fmt.Errorf("error querying vApp templates %s", err)
Expand Down
2 changes: 1 addition & 1 deletion govcd/common_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build api || auth || functional || catalog || vapp || gateway || network || org || query || extnetwork || task || vm || vdc || system || disk || lb || lbAppRule || lbAppProfile || lbServerPool || lbServiceMonitor || lbVirtualServer || user || role || nsxv || nsxt || openapi || affinity || search || alb || certificate || vdcGroup || metadata || providervdc || rde || uiPlugin || vsphere || ALL
//go:build api || auth || functional || catalog || vapp || gateway || network || org || query || extnetwork || task || vm || vdc || system || disk || lb || lbAppRule || lbAppProfile || lbServerPool || lbServiceMonitor || lbVirtualServer || user || role || nsxv || nsxt || openapi || affinity || search || alb || certificate || vdcGroup || metadata || providervdc || rde || uiPlugin || vsphere || cse || ALL

/*
* Copyright 2021 VMware, Inc. All rights reserved. Licensed under the Apache v2 License.
Expand Down
Loading

0 comments on commit a49f044

Please sign in to comment.