Skip to content

Commit a8cad3f

Browse files
authored
Merge pull request #190 from che-incubator/go121
feat: Switch to go 1.21
2 parents fd7cbf9 + 3fb5017 commit a8cad3f

File tree

2,895 files changed

+1075525
-114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,895 files changed

+1075525
-114
lines changed

go.mod

+47-21
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,55 @@
11
module github.com/che-incubator/kubernetes-image-puller
22

3-
go 1.15
3+
go 1.21
4+
5+
require (
6+
github.com/google/go-cmp v0.6.0
7+
github.com/stretchr/testify v1.8.0
8+
k8s.io/api v0.26.1
9+
k8s.io/apimachinery v0.26.1
10+
k8s.io/client-go v0.26.1
11+
)
412

513
require (
614
github.com/davecgh/go-spew v1.1.1 // indirect
7-
github.com/evanphx/json-patch v4.5.0+incompatible // indirect
8-
github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415 // indirect
9-
github.com/google/btree v0.0.0-20160524151835-7d79101e329e // indirect
10-
github.com/google/go-cmp v0.4.0
11-
github.com/gregjones/httpcache v0.0.0-20170728041850-787624de3eb7 // indirect
15+
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
16+
github.com/go-logr/logr v1.2.3 // indirect
17+
github.com/go-openapi/jsonpointer v0.19.5 // indirect
18+
github.com/go-openapi/jsonreference v0.20.0 // indirect
19+
github.com/go-openapi/swag v0.19.14 // indirect
20+
github.com/gogo/protobuf v1.3.2 // indirect
21+
github.com/golang/protobuf v1.5.2 // indirect
22+
github.com/google/gnostic v0.5.7-v3refs // indirect
23+
github.com/google/gofuzz v1.1.0 // indirect
1224
github.com/imdario/mergo v0.3.8 // indirect
13-
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
14-
github.com/pkg/errors v0.9.1 // indirect
25+
github.com/josharian/intern v1.0.0 // indirect
26+
github.com/json-iterator/go v1.1.12 // indirect
27+
github.com/mailru/easyjson v0.7.6 // indirect
28+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
29+
github.com/modern-go/reflect2 v1.0.2 // indirect
30+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
31+
github.com/pmezard/go-difflib v1.0.0 // indirect
1532
github.com/spf13/pflag v1.0.5 // indirect
16-
github.com/stretchr/testify v1.4.0
17-
golang.org/x/crypto v0.0.0-20180808211826-de0752318171 // indirect
18-
golang.org/x/oauth2 v0.0.0-20170412232759-a6bd8cefa181 // indirect
19-
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect
20-
golang.org/x/sys v0.0.0-20171031081856-95c657629925 // indirect
21-
golang.org/x/time v0.0.0-20161028155119-f51c12702a4d // indirect
22-
google.golang.org/appengine v1.4.1-0.20190208184732-99bc4335fe23 // indirect
23-
gopkg.in/inf.v0 v0.9.0 // indirect
24-
k8s.io/api v0.0.0-20181204000039-89a74a8d264d
25-
k8s.io/apimachinery v0.0.0-20181127025237-2b1284ed4c93
26-
k8s.io/client-go v10.0.0+incompatible
27-
k8s.io/klog v0.0.0-20181108234604-8139d8cb77af // indirect
28-
k8s.io/kube-openapi v0.0.0-20200204173128-addea2498afe // indirect
33+
golang.org/x/net v0.23.0 // indirect
34+
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
35+
golang.org/x/sys v0.18.0 // indirect
36+
golang.org/x/term v0.18.0 // indirect
37+
golang.org/x/text v0.14.0 // indirect
38+
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
39+
google.golang.org/appengine v1.6.7 // indirect
40+
google.golang.org/protobuf v1.34.1 // indirect
41+
gopkg.in/inf.v0 v0.9.1 // indirect
42+
gopkg.in/yaml.v2 v2.4.0 // indirect
43+
gopkg.in/yaml.v3 v3.0.1 // indirect
44+
k8s.io/klog/v2 v2.80.1 // indirect
45+
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
46+
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect
47+
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
48+
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
49+
sigs.k8s.io/yaml v1.3.0 // indirect
50+
)
51+
52+
replace (
53+
golang.org/x/net => golang.org/x/net v0.23.0
54+
google.golang.org/protobuf => google.golang.org/protobuf v1.34.1
2955
)

go.sum

+421-81
Large diffs are not rendered by default.

utils/clusterutils.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright (c) 2019 Red Hat, Inc.
2+
// Copyright (c) 2019-2024 Red Hat, Inc.
33
// This program and the accompanying materials are made
44
// available under the terms of the Eclipse Public License 2.0
55
// which is available at https://www.eclipse.org/legal/epl-2.0/
@@ -13,6 +13,7 @@
1313
package utils
1414

1515
import (
16+
"context"
1617
"fmt"
1718
"log"
1819
"os"
@@ -54,9 +55,9 @@ var (
5455
// Set up watch on daemonset
5556
func watchDaemonset(clientset *kubernetes.Clientset) watch.Interface {
5657
cfg := cfg.GetConfig()
57-
watch, err := clientset.AppsV1().DaemonSets(cfg.Namespace).Watch(metav1.ListOptions{
58-
FieldSelector: fmt.Sprintf("metadata.name=%s", cfg.DaemonsetName),
59-
IncludeUninitialized: true,
58+
watch, err := clientset.AppsV1().DaemonSets(cfg.Namespace).Watch(context.Background(), metav1.ListOptions{
59+
FieldSelector: fmt.Sprintf("metadata.name=%s", cfg.DaemonsetName),
60+
//IncludeUninitialized: true,
6061
})
6162
if err != nil {
6263
log.Fatalf("Failed to set up watch on daemonsets: %s", err.Error())
@@ -71,7 +72,7 @@ func getImagePullerDeployment(clientset *kubernetes.Clientset) *appsv1.Deploymen
7172
log.Fatalf("DEPLOYMENT_NAME is not set for the image puller deployment")
7273
}
7374

74-
deployment, err := clientset.AppsV1().Deployments(cfg.Namespace).Get(deploymentName, metav1.GetOptions{})
75+
deployment, err := clientset.AppsV1().Deployments(cfg.Namespace).Get(context.Background(), deploymentName, metav1.GetOptions{})
7576
if err != nil {
7677
log.Fatalf("Failed to get Deployment: %v", err)
7778
}
@@ -150,7 +151,7 @@ func createDaemonset(clientset *kubernetes.Clientset) error {
150151
defer dsWatch.Stop()
151152
watchChan := dsWatch.ResultChan()
152153

153-
_, err := clientset.AppsV1().DaemonSets(cfg.Namespace).Create(toCreate)
154+
_, err := clientset.AppsV1().DaemonSets(cfg.Namespace).Create(context.Background(), toCreate, metav1.CreateOptions{})
154155
if err != nil {
155156
log.Fatalf("Failed to create daemonset: %s", err.Error())
156157
} else {
@@ -194,7 +195,7 @@ func checkDaemonsetReadiness(clientset *kubernetes.Clientset) {
194195
cfg := cfg.GetConfig()
195196
// Loop 30 times, sleeping for 3 seconds each time -- 90 seconds total wait.
196197
for i := 0; i < 30; i++ {
197-
ds, err := clientset.AppsV1().DaemonSets(cfg.Namespace).Get(cfg.DaemonsetName, metav1.GetOptions{
198+
ds, err := clientset.AppsV1().DaemonSets(cfg.Namespace).Get(context.Background(), cfg.DaemonsetName, metav1.GetOptions{
198199
// IncludeUninitialized: true,
199200
})
200201
if err != nil {
@@ -225,7 +226,7 @@ func deleteDaemonset(clientset *kubernetes.Clientset) {
225226
defer dsWatch.Stop()
226227
watchChan := dsWatch.ResultChan()
227228

228-
err := clientset.AppsV1().DaemonSets(cfg.Namespace).Delete(cfg.DaemonsetName, &metav1.DeleteOptions{
229+
err := clientset.AppsV1().DaemonSets(cfg.Namespace).Delete(context.Background(), cfg.DaemonsetName, metav1.DeleteOptions{
229230
PropagationPolicy: &propagationPolicy,
230231
})
231232
if err != nil {

utils/operations.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright (c) 2019 Red Hat, Inc.
2+
// Copyright (c) 2019-2024 Red Hat, Inc.
33
// This program and the accompanying materials are made
44
// available under the terms of the Eclipse Public License 2.0
55
// which is available at https://www.eclipse.org/legal/epl-2.0/
@@ -13,6 +13,7 @@
1313
package utils
1414

1515
import (
16+
"context"
1617
"log"
1718

1819
"github.com/che-incubator/kubernetes-image-puller/cfg"
@@ -52,7 +53,7 @@ func EnsureDaemonsetExists(clientset *kubernetes.Clientset) {
5253
clientset.
5354
AppsV1().
5455
DaemonSets(cfg.Namespace).
55-
Get(cfg.DaemonsetName, metav1.GetOptions{})
56+
Get(context.Background(), cfg.DaemonsetName, metav1.GetOptions{})
5657
if err != nil || daemonset == nil {
5758
log.Printf("Recreating daemonset due to error")
5859
DeleteDaemonsetIfExists(clientset)
@@ -69,7 +70,7 @@ func DeleteDaemonsetIfExists(clientset *kubernetes.Clientset) {
6970
clientset.
7071
AppsV1().
7172
DaemonSets(cfg.Namespace).
72-
Get(cfg.DaemonsetName, metav1.GetOptions{})
73+
Get(context.Background(), cfg.DaemonsetName, metav1.GetOptions{})
7374
if errors.IsNotFound(err) {
7475
return
7576
} else if statusError, isStatus := err.(*errors.StatusError); isStatus {
@@ -90,7 +91,7 @@ func LogNumNodesScheduled(clientset *kubernetes.Clientset, user string) {
9091
clientset.
9192
AppsV1().
9293
DaemonSets(cfg.Namespace).
93-
Get(cfg.DaemonsetName, metav1.GetOptions{})
94+
Get(context.Background(), cfg.DaemonsetName, metav1.GetOptions{})
9495
if err != nil {
9596
log.Printf("Failed to get daemonset for user '%s': %s", user, err)
9697
}

vendor/github.com/davecgh/go-spew/LICENSE

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/davecgh/go-spew/spew/bypass.go

+145
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/davecgh/go-spew/spew/bypasssafe.go

+38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)