-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove k8s dependencies from core module
- Loading branch information
Showing
13 changed files
with
516 additions
and
281 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 |
---|---|---|
@@ -1,13 +1,9 @@ | ||
module github.com/linode/linodego | ||
|
||
require ( | ||
github.com/dnaeon/go-vcr v1.0.1 | ||
github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48 | ||
github.com/google/go-cmp v0.4.0 | ||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 | ||
k8s.io/api v0.18.3 | ||
k8s.io/apimachinery v0.18.3 | ||
k8s.io/client-go v0.18.3 | ||
) | ||
|
||
go 1.13 |
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,12 @@ | ||
module github.com/linode/linodego/k8s | ||
|
||
require ( | ||
github.com/linode/linodego v0.20.1 | ||
k8s.io/api v0.18.3 | ||
k8s.io/apimachinery v0.18.3 | ||
k8s.io/client-go v0.18.3 | ||
) | ||
|
||
replace github.com/linode/linodego => ../ | ||
|
||
go 1.13 |
Large diffs are not rendered by default.
Oops, something went wrong.
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,43 @@ | ||
package condition | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
"fmt" | ||
|
||
"github.com/linode/linodego" | ||
"github.com/linode/linodego/k8s" | ||
corev1 "k8s.io/api/core/v1" | ||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// ClusterHasReadyNode is a ClusterConditionFunc which polls for at least one node to have the | ||
// condition NodeReady=True. | ||
func ClusterHasReadyNode(ctx context.Context, options linodego.ClusterConditionOptions) (bool, error) { | ||
clientset, err := k8s.BuildClientsetFromConfig(options.LKEClusterKubeconfig, options.TransportWrapper) | ||
if err != nil { | ||
return false, err | ||
} | ||
|
||
nodes, err := clientset.CoreV1().Nodes().List(ctx, v1.ListOptions{}) | ||
if err != nil { | ||
return false, fmt.Errorf("failed to get nodes for cluster: %s", err) | ||
} | ||
|
||
for _, node := range nodes.Items { | ||
for _, condition := range node.Status.Conditions { | ||
if condition.Type == corev1.NodeReady && condition.Status == corev1.ConditionTrue { | ||
return true, nil | ||
} | ||
} | ||
} | ||
|
||
return false, errors.New("no nodes in cluster are ready") | ||
} | ||
|
||
// WaitForLKEClusterReady polls with a given timeout for the LKE Cluster's api-server | ||
// to be healthy and for the cluster to have at least one node with the NodeReady | ||
// condition true. | ||
func WaitForLKEClusterReady(ctx context.Context, client linodego.Client, clusterID int, options linodego.LKEClusterPollOptions) error { | ||
return client.WaitForLKEClusterConditions(ctx, clusterID, options, ClusterHasReadyNode) | ||
} |
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
.PHONY: test | ||
|
||
test: | ||
@LINODE_FIXTURE_MODE="play" \ | ||
LINODE_TOKEN="awesometokenawesometokenawesometoken" \ | ||
LINODE_API_VERSION="v4beta" \ | ||
GO111MODULE="on" \ | ||
go test -v ./integration $(ARGS) |
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,17 @@ | ||
module test | ||
|
||
go 1.13 | ||
|
||
require ( | ||
github.com/dnaeon/go-vcr v1.0.1 | ||
github.com/google/go-cmp v0.5.2 | ||
github.com/linode/linodego v0.20.1 | ||
github.com/linode/linodego/k8s v0.0.0-00010101000000-000000000000 | ||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d | ||
gopkg.in/yaml.v2 v2.3.0 // indirect | ||
k8s.io/client-go v0.18.3 | ||
) | ||
|
||
replace github.com/linode/linodego => ../ | ||
|
||
replace github.com/linode/linodego/k8s => ../k8s |
Oops, something went wrong.