Skip to content

Commit

Permalink
Upgrade kube client.
Browse files Browse the repository at this point in the history
  • Loading branch information
udhos committed Mar 20, 2024
1 parent 6cb0278 commit e9e86b6
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 90 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ groupcachePort := ":5000"
// 1. get my groupcache URL
myURL, errURL = kubegroup.FindMyURL(groupcachePort)

workspace := groupcache.NewWorkspace()

// 2. spawn groupcache peering server
pool := groupcache.NewHTTPPoolOpts(myURL, &groupcache.HTTPPoolOptions{})
pool := groupcache.NewHTTPPoolOptsWithWorkspace(workspace, myURL, &groupcache.HTTPPoolOptions{})
server := &http.Server{Addr: groupcachePort, Handler: pool}
go func() {
log.Printf("groupcache server: listening on %s", groupcachePort)
Expand Down
24 changes: 9 additions & 15 deletions examples/kubegroup-example/groupcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,16 @@ func startGroupcache(app *application) {
// create groupcache pool
//

var myURL string
for myURL == "" {
var errURL error
myURL, errURL = kubegroup.FindMyURL(app.groupCachePort)
if errURL != nil {
log.Printf("my URL: %v", errURL)
}
if myURL == "" {
const cooldown = 5 * time.Second
log.Printf("could not find my URL, sleeping %v", cooldown)
time.Sleep(cooldown)
}
myURL, errURL := kubegroup.FindMyURL(app.groupCachePort)
if errURL != nil {
log.Fatalf("my URL: %v", errURL)
}

log.Printf("groupcache my URL: %s", myURL)

pool := groupcache.NewHTTPPoolOpts(myURL, &groupcache.HTTPPoolOptions{})
workspace := groupcache.NewWorkspace()

pool := groupcache.NewHTTPPoolOptsWithWorkspace(workspace, myURL,
&groupcache.HTTPPoolOptions{})

//
// start groupcache server
Expand Down Expand Up @@ -107,5 +100,6 @@ func startGroupcache(app *application) {
// https://talks.golang.org/2013/oscon-dl.slide#46
//
// 64 MB max per-node memory usage
app.cache = groupcache.NewGroup("files", app.groupCacheSizeBytes, getter)
app.cache = groupcache.NewGroupWithWorkspace(workspace, "files",
app.groupCacheSizeBytes, getter)
}
46 changes: 22 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,57 @@ module github.com/udhos/kubegroup
go 1.22.1

require (
github.com/modernprogram/groupcache/v2 v2.5.6
github.com/prometheus/client_golang v1.18.0
github.com/udhos/kube v0.0.0
github.com/modernprogram/groupcache/v2 v2.6.0
github.com/prometheus/client_golang v1.19.0
github.com/udhos/kube v0.0.1
github.com/udhos/kubepodinformer v0.0.3
k8s.io/client-go v0.29.2
k8s.io/client-go v0.29.3
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.2 // indirect
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-openapi/jsonpointer v0.20.2 // indirect
github.com/go-openapi/jsonreference v0.20.4 // indirect
github.com/go-openapi/swag v0.22.9 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.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/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.50.0 // indirect
github.com/prometheus/procfs v0.13.0 // indirect
github.com/segmentio/fasthash v1.0.3 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/oauth2 v0.18.0 // 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.5.0 // indirect
golang.org/x/tools v0.17.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.32.0 // indirect
google.golang.org/protobuf v1.33.0 // 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/api v0.29.2 // indirect
k8s.io/apimachinery v0.29.2 // indirect
k8s.io/api v0.29.3 // indirect
k8s.io/apimachinery v0.29.3 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/kube-openapi v0.0.0-20240209001042-7a0d5b415232 // indirect
k8s.io/utils v0.0.0-20240102154912-e7106e64919e // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
Expand Down
Loading

0 comments on commit e9e86b6

Please sign in to comment.