Skip to content

Commit

Permalink
Merge pull request #16 from kolikons/go-1.17
Browse files Browse the repository at this point in the history
Upgrade go version fix discovery auth
kolikons authored Feb 20, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 433a681 + cfd9e40 commit 8d4d3fb
Showing 8 changed files with 443 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ jobs:

- uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17

- run: go mod download

2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17

- name: Import GPG key
id: import_gpg
4 changes: 2 additions & 2 deletions charts/label-watch/Chart.yaml
Original file line number Diff line number Diff line change
@@ -7,5 +7,5 @@ maintainers:
url: https://github.com/kolikons/label-watch
sources:
- https://github.com/kolikons/label-watch
version: 0.0.1
appVersion: "0.0.1"
version: 0.0.2
appVersion: "0.0.2"
2 changes: 1 addition & 1 deletion charts/label-watch/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# label-watch

![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.1](https://img.shields.io/badge/AppVersion-0.0.1-informational?style=flat-square)
![Version: 0.0.2](https://img.shields.io/badge/Version-0.0.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.2](https://img.shields.io/badge/AppVersion-0.0.2-informational?style=flat-square)

label-watch checks a specific label on worker node then create an label

3 changes: 2 additions & 1 deletion cmd/cmd.go
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ package cmd
import (
"errors"
"flag"
"path/filepath"

"k8s.io/client-go/util/homedir"
)
@@ -62,7 +63,7 @@ $ kubectl get node NODE -o jsonpath='{.metadata.labels}' | jq
flag.StringVar(
&c.Kubeconfig,
"kubeconfig",
"",
filepath.Join(home, ".kube", "config"),
"(optional) absolute path to the kubeconfig file",
)
} else {
54 changes: 48 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,55 @@
module github.com/kolikons/label-watch

go 1.16
go 1.17

replace k8s.io/client-go => k8s.io/client-go v0.19.4
replace k8s.io/client-go => k8s.io/client-go v0.23.4

replace k8s.io/apimachinery => k8s.io/apimachinery v0.19.4
replace k8s.io/apimachinery => k8s.io/apimachinery v0.23.4

require (
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
k8s.io/apimachinery v0.19.4
k8s.io/client-go v0.0.0-00010101000000-000000000000
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
k8s.io/apimachinery v0.23.4
k8s.io/client-go v1.5.2
)

require (
cloud.google.com/go v0.81.0 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.18 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.13 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
github.com/go-logr/logr v1.2.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/imdario/mergo v0.3.5 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e // indirect
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/api v0.23.4 // indirect
k8s.io/klog/v2 v2.30.0 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
k8s.io/utils v0.0.0-20211116205334-6203023598ed // indirect
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)
452 changes: 380 additions & 72 deletions go.sum

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions pkg/label/label.go
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes"
v1 "k8s.io/client-go/kubernetes/typed/core/v1"
_ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
)
@@ -23,7 +24,7 @@ type patchStringValue struct {

var updateErr error

// Kubeconfig falg of path to kube config
// Kubeconfig flag of path to kube config
var Kubeconfig *string

// APISet alias to connection k8s
@@ -32,15 +33,14 @@ var APISet func() v1.CoreV1Interface
func getClient(p string) (*kubernetes.Clientset, error) {
var c *rest.Config
var e error
if p == "" {
// in cluster
c, e = rest.InClusterConfig()
} else {
// in cluster
c, e = rest.InClusterConfig()
if e != nil {
// out cluster
c, e = clientcmd.BuildConfigFromFlags("", p)
}
if e != nil {
return nil, e
if e != nil {
return nil, e
}
}
return kubernetes.NewForConfig(c)
}

0 comments on commit 8d4d3fb

Please sign in to comment.