Skip to content

Commit

Permalink
Merge pull request #72 from mnaser/go/1.18
Browse files Browse the repository at this point in the history
Add support for Golang 1.18
  • Loading branch information
mnaser committed Nov 14, 2022
2 parents 7b1aa99 + cf6203b commit 7714782
Show file tree
Hide file tree
Showing 8 changed files with 738 additions and 86 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: weekly
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: test

on:
push:
tags:
- v*
branches:
- main
pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
cache: true
- run: go test -v ./...
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions cmd/kail/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ func main() {

log := createLog()

cs, rc := createKubeClient()

dsb := createDSBuilder()

ctx := logutil.NewContext(context.Background(), log)

ctx, cancel := context.WithCancel(ctx)

cs, rc := createKubeClient(ctx)

sigch := watchSignals(ctx, cancel)

ds := createDS(ctx, cs, dsb)
Expand Down Expand Up @@ -164,7 +164,7 @@ func createLog() logutil.Log {
return logutil_logrus.New(parent).WithComponent("kail.main")
}

func createKubeClient() (kubernetes.Interface, *rest.Config) {
func createKubeClient(ctx context.Context) (kubernetes.Interface, *rest.Config) {

config, err := rest.InClusterConfig()
switch {
Expand Down Expand Up @@ -196,7 +196,7 @@ func createKubeClient() (kubernetes.Interface, *rest.Config) {
cs, err := kubernetes.NewForConfig(rc)
kingpin.FatalIfError(err, "Error building kubernetes config")

_, err = cs.CoreV1().Namespaces().List(metav1.ListOptions{})
_, err = cs.CoreV1().Namespaces().List(ctx, metav1.ListOptions{})
if err != nil && !apierrors.IsForbidden(err) {
kingpin.FatalIfError(err, "Can't connnect to kubernetes")
}
Expand Down
2 changes: 1 addition & 1 deletion ds_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (b *dsBuilder) Create(ctx context.Context, cs kubernetes.Interface) (DS, er
// but if the namespace does not exist (or any other problem) we watch namespaces to wait for it
if len(b.namespaces) == 1 {
namespace = b.namespaces[0]
_, err := cs.CoreV1().Namespaces().Get(namespace, metav1.GetOptions{})
_, err := cs.CoreV1().Namespaces().Get(ctx, namespace, metav1.GetOptions{})
if err != nil {
log.Warnf("could not tail the namespace %s: %v", namespace, err)
namespace = ""
Expand Down
87 changes: 77 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,19 +1,86 @@
module github.com/boz/kail

go 1.13
go 1.18

require (
github.com/boz/go-lifecycle v0.1.0
github.com/boz/go-logutil v0.1.0
github.com/boz/kcache v0.4.1-0.20200916082658-69f5988adb8d
github.com/dgrijalva/jwt-go v0.0.0-20170608005149-a539ee1a749a // indirect
github.com/fatih/color v1.7.0
github.com/googleapis/gnostic v0.0.0-20170807220725-57b029087370 // indirect
github.com/boz/kcache v0.5.0
github.com/fatih/color v1.13.0
github.com/goreleaser/godownloader v0.0.0-20190525212044-f9a1d47be7eb
github.com/sirupsen/logrus v1.4.1
github.com/stretchr/testify v1.3.0
github.com/sirupsen/logrus v1.9.0
github.com/stretchr/testify v1.8.0
gopkg.in/alecthomas/kingpin.v2 v2.2.6
k8s.io/api v0.0.0-20190515023547-db5a9d1c40eb
k8s.io/apimachinery v0.0.0-20190515023456-b74e4c97951f
k8s.io/client-go v0.0.0-20190514184034-dd7f3ad83f18
k8s.io/api v0.24.3
k8s.io/apimachinery v0.24.3
k8s.io/client-go v0.24.3
)

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/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
github.com/apex/log v1.1.0 // indirect
github.com/aws/aws-sdk-go v1.15.64 // indirect
github.com/blakesmith/ar v0.0.0-20150311145944-8bd4349a67f2 // indirect
github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e // indirect
github.com/client9/codegen v0.0.0-20180316044450-92480ce66a06 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
github.com/go-logr/logr v1.2.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-github/v25 v25.0.1 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/goreleaser/goreleaser v0.107.0 // indirect
github.com/goreleaser/nfpm v0.11.0 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kamilsk/retry/v4 v4.0.0 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-zglob v0.0.0-20180803001819-2ea3427bfa53 // indirect
github.com/mitchellh/go-homedir v1.0.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // 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.1 // indirect
k8s.io/klog/v2 v2.60.1 // indirect
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)

0 comments on commit 7714782

Please sign in to comment.