Skip to content

Commit

Permalink
Bump up civogo version
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Anarse <[email protected]>
  • Loading branch information
vishalanarase committed Jun 1, 2022
1 parent 641b3a3 commit fb20b45
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 146 deletions.
8 changes: 7 additions & 1 deletion cluster-autoscaler/cloudprovider/civo/civo_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ import (
"k8s.io/klog/v2"
)

var (
Region string
)

type nodeGroupClient interface {
// ListKubernetesClusterPools lists all node pools in the Kubernetes cluster.
ListKubernetesClusterPools(clusterID string) ([]civogo.KubernetesPool, error)
// UpdateKubernetesClusterPool updates an existing Kubernetes cluster pool with the Civo API.
UpdateKubernetesClusterPool(cid, pid string, config *civogo.KubernetesClusterPoolConfig) (*civogo.KubernetesPool, error)
UpdateKubernetesClusterPool(cid, pid string, config *civogo.KubernetesClusterPoolUpdateConfig) (*civogo.KubernetesPool, error)
// DeleteKubernetesClusterPoolInstance deletes a instance from pool
DeleteKubernetesClusterPoolInstance(clusterID, poolID, instanceID string) (*civogo.SimpleResponse, error)
}
Expand Down Expand Up @@ -94,6 +98,8 @@ func newManager(configReader io.Reader, discoveryOpts cloudprovider.NodeGroupDis
return nil, errors.New("region was not provided")
}

Region = cfg.Region

civoClient, err := civogo.NewClientWithURL(cfg.ApiKey, cfg.ApiURL, cfg.Region)
if err != nil {
return nil, fmt.Errorf("couldn't initialize Civo client: %s", err)
Expand Down
12 changes: 7 additions & 5 deletions cluster-autoscaler/cloudprovider/civo/civo_node_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ func (n *NodeGroup) IncreaseSize(delta int) error {
n.nodePool.Count, targetSize, n.MaxSize())
}

req := &civogo.KubernetesClusterPoolConfig{
Count: targetSize,
req := &civogo.KubernetesClusterPoolUpdateConfig{
Count: targetSize,
Region: Region,
}
updatedNodePool, err := n.client.UpdateKubernetesClusterPool(n.clusterID, n.id, req)
if err != nil {
Expand Down Expand Up @@ -135,8 +136,9 @@ func (n *NodeGroup) DecreaseTargetSize(delta int) error {
n.nodePool.Count, targetSize, n.MinSize())
}

req := &civogo.KubernetesClusterPoolConfig{
Count: targetSize,
req := &civogo.KubernetesClusterPoolUpdateConfig{
Count: targetSize,
Region: Region,
}

updatedNodePool, err := n.client.UpdateKubernetesClusterPool(n.clusterID, n.id, req)
Expand Down Expand Up @@ -241,7 +243,7 @@ func toInstanceStatus(nodeState string) *cloudprovider.InstanceStatus {

st := &cloudprovider.InstanceStatus{}
switch nodeState {
case "BUILD", "BUILD_PENDING":
case "BUILDING":
st.State = cloudprovider.InstanceCreating
case "ACTIVE":
st.State = cloudprovider.InstanceRunning
Expand Down
2 changes: 1 addition & 1 deletion cluster-autoscaler/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/Azure/go-autorest/autorest/to v0.4.0
github.com/Azure/skewer v0.0.14
github.com/aws/aws-sdk-go v1.38.49
github.com/civo/civogo v0.2.77
github.com/civo/civogo v0.2.81
github.com/digitalocean/godo v1.27.0
github.com/ghodss/yaml v1.0.0
github.com/gofrs/uuid v4.0.0+incompatible
Expand Down
4 changes: 2 additions & 2 deletions cluster-autoscaler/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn
github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs=
github.com/cilium/ebpf v0.7.0 h1:1k/q3ATgxSXRdrmPfH8d7YK0GfqVsEKZAX9dQZvs56k=
github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA=
github.com/civo/civogo v0.2.77 h1:r2fF0bBPbjeLBSFV+m3NWohwVZbdMZjZgxTwnxOcv6M=
github.com/civo/civogo v0.2.77/go.mod h1:WUgi+GbpYlgXTbpU5Lx4scLc2XuoYhb9o20FMwPalBo=
github.com/civo/civogo v0.2.81 h1:2v/+JvkNtOyfAdjOT01cm7V2ALCrNMKNpk//NL5ZEwM=
github.com/civo/civogo v0.2.81/go.mod h1:WUgi+GbpYlgXTbpU5Lx4scLc2XuoYhb9o20FMwPalBo=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/clusterhq/flocker-go v0.0.0-20160920122132-2b8b7259d313 h1:eIHD9GNM3Hp7kcRW5mvcz7WTR3ETeoYYKwpgA04kaXE=
github.com/clusterhq/flocker-go v0.0.0-20160920122132-2b8b7259d313/go.mod h1:P1wt9Z3DP8O6W3rvwCt0REIlshg1InHImaLW0t3ObY0=
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cluster-autoscaler/vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ github.com/cilium/ebpf/internal
github.com/cilium/ebpf/internal/btf
github.com/cilium/ebpf/internal/unix
github.com/cilium/ebpf/link
# github.com/civo/civogo v0.2.77
# github.com/civo/civogo v0.2.81
## explicit
github.com/civo/civogo
github.com/civo/civogo/utils
Expand Down

0 comments on commit fb20b45

Please sign in to comment.