-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added kubernetes releases and upgrades
- Loading branch information
1 parent
14171e5
commit 9dc7354
Showing
6 changed files
with
258 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
"github.com/transip/gotransip/v6" | ||
"github.com/transip/gotransip/v6/kubernetes" | ||
) | ||
|
||
func main() { | ||
client, err := gotransip.NewClient(gotransip.DemoClientConfiguration) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
k8sRepo := kubernetes.Repository{Client: client} | ||
|
||
// List all clusters with nodepools | ||
log.Println("List all clusters and the acccompanying nodepools") | ||
clusters, err := k8sRepo.GetClusters() | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
for _, c := range clusters { | ||
fmt.Printf("Cluster: %s\n", c.Name) | ||
nodepools, err := k8sRepo.GetNodePools(c.Name) | ||
if err != nil { | ||
continue | ||
} | ||
for _, n := range nodepools { | ||
fmt.Printf( | ||
"\tNodePool: [description=%s, zone=%s, spec=%s, nodeCount=%s]\n", | ||
n.Description, n.AvailabilityZone, n.NodeSpec, n.DesiredNodeCount, | ||
) | ||
} | ||
|
||
} | ||
|
||
log.Println("Create new cluster and wait for it to be available") | ||
clusters, err = k8sRepo.GetClusters() | ||
if err != nil { | ||
panic(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package kubernetes | ||
|
||
import ( | ||
"github.com/transip/gotransip/v6/rest" | ||
) | ||
|
||
// Release is a Kubernetes release version | ||
type Release struct { | ||
Version string `json:"version"` | ||
ReleaseDate rest.Date `json:"releaseDate"` | ||
MaintenanceModeDate rest.Date `json:"maintenanceModeDate"` | ||
EndOfLifeDate rest.Date `json:"endOfLifeDate"` | ||
} | ||
|
||
type releaseWrapper struct { | ||
Release Release `json:"release"` | ||
} | ||
|
||
type releasesWrapper struct { | ||
Releases []Release `json:"releases"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters