Skip to content

Commit

Permalink
Merge pull request #190 from che-incubator/go121
Browse files Browse the repository at this point in the history
feat: Switch to go 1.21
  • Loading branch information
SDawley authored Nov 22, 2024
2 parents fd7cbf9 + 3fb5017 commit a8cad3f
Show file tree
Hide file tree
Showing 2,895 changed files with 1,075,525 additions and 114 deletions.
68 changes: 47 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,29 +1,55 @@
module github.com/che-incubator/kubernetes-image-puller

go 1.15
go 1.21

require (
github.com/google/go-cmp v0.6.0
github.com/stretchr/testify v1.8.0
k8s.io/api v0.26.1
k8s.io/apimachinery v0.26.1
k8s.io/client-go v0.26.1
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch v4.5.0+incompatible // indirect
github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415 // indirect
github.com/google/btree v0.0.0-20160524151835-7d79101e329e // indirect
github.com/google/go-cmp v0.4.0
github.com/gregjones/httpcache v0.0.0-20170728041850-787624de3eb7 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // 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/gofuzz v1.1.0 // indirect
github.com/imdario/mergo v0.3.8 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.6 // 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/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.4.0
golang.org/x/crypto v0.0.0-20180808211826-de0752318171 // indirect
golang.org/x/oauth2 v0.0.0-20170412232759-a6bd8cefa181 // indirect
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect
golang.org/x/sys v0.0.0-20171031081856-95c657629925 // indirect
golang.org/x/time v0.0.0-20161028155119-f51c12702a4d // indirect
google.golang.org/appengine v1.4.1-0.20190208184732-99bc4335fe23 // indirect
gopkg.in/inf.v0 v0.9.0 // indirect
k8s.io/api v0.0.0-20181204000039-89a74a8d264d
k8s.io/apimachinery v0.0.0-20181127025237-2b1284ed4c93
k8s.io/client-go v10.0.0+incompatible
k8s.io/klog v0.0.0-20181108234604-8139d8cb77af // indirect
k8s.io/kube-openapi v0.0.0-20200204173128-addea2498afe // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.34.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.80.1 // indirect
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace (
golang.org/x/net => golang.org/x/net v0.23.0
google.golang.org/protobuf => google.golang.org/protobuf v1.34.1
)
502 changes: 421 additions & 81 deletions go.sum

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions utils/clusterutils.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2019 Red Hat, Inc.
// Copyright (c) 2019-2024 Red Hat, Inc.
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
Expand All @@ -13,6 +13,7 @@
package utils

import (
"context"
"fmt"
"log"
"os"
Expand Down Expand Up @@ -54,9 +55,9 @@ var (
// Set up watch on daemonset
func watchDaemonset(clientset *kubernetes.Clientset) watch.Interface {
cfg := cfg.GetConfig()
watch, err := clientset.AppsV1().DaemonSets(cfg.Namespace).Watch(metav1.ListOptions{
FieldSelector: fmt.Sprintf("metadata.name=%s", cfg.DaemonsetName),
IncludeUninitialized: true,
watch, err := clientset.AppsV1().DaemonSets(cfg.Namespace).Watch(context.Background(), metav1.ListOptions{
FieldSelector: fmt.Sprintf("metadata.name=%s", cfg.DaemonsetName),
//IncludeUninitialized: true,
})
if err != nil {
log.Fatalf("Failed to set up watch on daemonsets: %s", err.Error())
Expand All @@ -71,7 +72,7 @@ func getImagePullerDeployment(clientset *kubernetes.Clientset) *appsv1.Deploymen
log.Fatalf("DEPLOYMENT_NAME is not set for the image puller deployment")
}

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

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

err := clientset.AppsV1().DaemonSets(cfg.Namespace).Delete(cfg.DaemonsetName, &metav1.DeleteOptions{
err := clientset.AppsV1().DaemonSets(cfg.Namespace).Delete(context.Background(), cfg.DaemonsetName, metav1.DeleteOptions{
PropagationPolicy: &propagationPolicy,
})
if err != nil {
Expand Down
9 changes: 5 additions & 4 deletions utils/operations.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2019 Red Hat, Inc.
// Copyright (c) 2019-2024 Red Hat, Inc.
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
Expand All @@ -13,6 +13,7 @@
package utils

import (
"context"
"log"

"github.com/che-incubator/kubernetes-image-puller/cfg"
Expand Down Expand Up @@ -52,7 +53,7 @@ func EnsureDaemonsetExists(clientset *kubernetes.Clientset) {
clientset.
AppsV1().
DaemonSets(cfg.Namespace).
Get(cfg.DaemonsetName, metav1.GetOptions{})
Get(context.Background(), cfg.DaemonsetName, metav1.GetOptions{})
if err != nil || daemonset == nil {
log.Printf("Recreating daemonset due to error")
DeleteDaemonsetIfExists(clientset)
Expand All @@ -69,7 +70,7 @@ func DeleteDaemonsetIfExists(clientset *kubernetes.Clientset) {
clientset.
AppsV1().
DaemonSets(cfg.Namespace).
Get(cfg.DaemonsetName, metav1.GetOptions{})
Get(context.Background(), cfg.DaemonsetName, metav1.GetOptions{})
if errors.IsNotFound(err) {
return
} else if statusError, isStatus := err.(*errors.StatusError); isStatus {
Expand All @@ -90,7 +91,7 @@ func LogNumNodesScheduled(clientset *kubernetes.Clientset, user string) {
clientset.
AppsV1().
DaemonSets(cfg.Namespace).
Get(cfg.DaemonsetName, metav1.GetOptions{})
Get(context.Background(), cfg.DaemonsetName, metav1.GetOptions{})
if err != nil {
log.Printf("Failed to get daemonset for user '%s': %s", user, err)
}
Expand Down
15 changes: 15 additions & 0 deletions vendor/github.com/davecgh/go-spew/LICENSE

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

145 changes: 145 additions & 0 deletions vendor/github.com/davecgh/go-spew/spew/bypass.go

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

38 changes: 38 additions & 0 deletions vendor/github.com/davecgh/go-spew/spew/bypasssafe.go

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

Loading

0 comments on commit a8cad3f

Please sign in to comment.