Skip to content

Commit

Permalink
deps: upgrade to k8s 1.21.1
Browse files Browse the repository at this point in the history
Breaking Changes:
* Refactor client init to not use `ClientBuilder`
  (see kubernetes-sigs/controller-runtime#1409)
* Add stub `RemoveStreams` method on `fakePortForward`

Mechanical Changes:
* Upgrade K8s dependencies to v0.21.1 (aka 1.21.1)
* Upgrade controller-runtime to 0.9.0 (required for K8s v0.21.1 deps)
* Upgrade tilt-apiserver to v0.4.0 (requires for K8s v0.21.1 deps)
* Remove `moby/term` replace (bug was fixed upstream and older
  version no longer compiles)
  • Loading branch information
milas committed Jun 8, 2021
1 parent bc91f22 commit 07a04b9
Show file tree
Hide file tree
Showing 2,244 changed files with 258,981 additions and 499,553 deletions.
37 changes: 16 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
github.com/go-openapi/swag v0.19.13 // indirect
github.com/go-sql-driver/mysql v1.5.0 // indirect
github.com/gofrs/uuid v3.2.0+incompatible // indirect
github.com/gogo/protobuf v1.3.1
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.2
github.com/google/go-cmp v0.5.5
github.com/google/uuid v1.1.2
Expand All @@ -43,7 +43,7 @@ require (
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
github.com/jinzhu/gorm v1.9.12 // indirect
github.com/jonboulle/clockwork v0.2.2
github.com/json-iterator/go v1.1.10
github.com/json-iterator/go v1.1.11
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
github.com/looplab/tarjan v0.0.0-20161115091335-9cc6d6cebfb5
github.com/mattn/go-colorable v0.1.7
Expand All @@ -69,17 +69,15 @@ require (
github.com/tilt-dev/go-get v0.0.0-20200911222649-1acd29546527
github.com/tilt-dev/localregistry-go v0.0.0-20200615231835-07e386f4ebd7
github.com/tilt-dev/probe v0.2.0
github.com/tilt-dev/tilt-apiserver v0.3.3
github.com/tilt-dev/tilt-apiserver v0.4.0
github.com/tilt-dev/wmclient v0.0.0-20201109174454-1839d0355fbc
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea
github.com/whilp/git-urls v0.0.0-20160530060445-31bac0d230fa
github.com/wojas/genericr v0.2.0
go.opencensus.io v0.22.4
go.opentelemetry.io/otel v0.2.0
go.starlark.net v0.0.0-20200615180055-61b64bc45990
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208
golang.org/x/text v0.3.5 // indirect
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a
google.golang.org/grpc v1.29.1
gopkg.in/d4l3k/messagediff.v1 v1.2.1
Expand All @@ -89,17 +87,17 @@ require (
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
helm.sh/helm/v3 v3.4.1
k8s.io/api v0.20.2
k8s.io/apimachinery v0.20.2
k8s.io/apiserver v0.20.2
k8s.io/cli-runtime v0.20.2
k8s.io/client-go v0.20.2
k8s.io/code-generator v0.20.2
k8s.io/api v0.21.1
k8s.io/apimachinery v0.21.1
k8s.io/apiserver v0.21.1
k8s.io/cli-runtime v0.21.1
k8s.io/client-go v0.21.1
k8s.io/code-generator v0.21.1
k8s.io/klog/v2 v2.8.0
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd
k8s.io/kubectl v0.20.2
sigs.k8s.io/controller-runtime v0.8.2
sigs.k8s.io/kustomize/api v0.7.2
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7
k8s.io/kubectl v0.21.1
sigs.k8s.io/controller-runtime v0.9.0
sigs.k8s.io/kustomize/api v0.8.8
sigs.k8s.io/yaml v1.2.0
vbom.ml/util v0.0.0-20180919145318-efcd4e0f9787 // indirect
)
Expand All @@ -120,6 +118,7 @@ replace (

// controller-runtime uses a newer gnostic but apiserver + kube-openapi require an older version
// due to an incompatible change from yaml.v2 -> yaml.v3
// see https://github.com/kubernetes-sigs/controller-runtime/issues/1498
github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.4.1

// can remove if/when https://github.com/pkg/browser/pull/30 is merged
Expand All @@ -128,9 +127,5 @@ replace (
go.opencensus.io => github.com/tilt-dev/opencensus-go v0.22.5-0.20200904175236-275b1754f353
golang.org/x/crypto => golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413

// Workaround for:
// https://github.com/moby/term/issues/15
golang.org/x/sys => golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6

k8s.io/apimachinery => github.com/tilt-dev/apimachinery v0.20.2-tilt-20210505
k8s.io/apimachinery => github.com/tilt-dev/apimachinery v0.21.1-tilt-20210608
)
341 changes: 210 additions & 131 deletions go.sum

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions internal/cli/wire_gen.go

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

34 changes: 0 additions & 34 deletions internal/controllers/client_builder.go

This file was deleted.

22 changes: 0 additions & 22 deletions internal/controllers/fake/fake.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
package fake

import (
"k8s.io/client-go/rest"

"github.com/tilt-dev/tilt/pkg/apis/core/v1alpha1"

"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/cluster"
)

func NewTiltClient() ctrlclient.Client {
Expand All @@ -21,20 +16,3 @@ func NewTiltClient() ctrlclient.Client {
Client: c,
}
}

func NewClientBuilder(client ctrlclient.Client) *fakeClientBuilder {
return &fakeClientBuilder{client: client}
}

// A stub builder that returns a pre-populated client.
type fakeClientBuilder struct {
client ctrlclient.Client
}

func (b *fakeClientBuilder) WithUncached(objs ...client.Object) cluster.ClientBuilder {
return b
}

func (b *fakeClientBuilder) Build(cache cache.Cache, config *rest.Config, options client.Options) (client.Client, error) {
return b.client, nil
}
29 changes: 20 additions & 9 deletions internal/controllers/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,24 @@ import (
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/cluster"

"github.com/tilt-dev/tilt/internal/hud/server"
"github.com/tilt-dev/tilt/internal/store"
"github.com/tilt-dev/tilt/pkg/logger"
)

type UncachedObjects []ctrlclient.Object

func ProvideUncachedObjects() UncachedObjects {
return nil
}

type TiltServerControllerManager struct {
config *rest.Config
scheme *runtime.Scheme
builder cluster.ClientBuilder
config *rest.Config
scheme *runtime.Scheme
deferredClient *DeferredClient
uncachedObjects UncachedObjects

manager ctrl.Manager
cancel context.CancelFunc
}
Expand All @@ -30,11 +37,12 @@ var _ store.SetUpper = &TiltServerControllerManager{}
var _ store.Subscriber = &TiltServerControllerManager{}
var _ store.TearDowner = &TiltServerControllerManager{}

func NewTiltServerControllerManager(config *server.APIServerConfig, scheme *runtime.Scheme, builder cluster.ClientBuilder) (*TiltServerControllerManager, error) {
func NewTiltServerControllerManager(config *server.APIServerConfig, scheme *runtime.Scheme, deferredClient *DeferredClient, uncachedObjects UncachedObjects) (*TiltServerControllerManager, error) {
return &TiltServerControllerManager{
config: config.GenericConfig.LoopbackClientConfig,
scheme: scheme,
builder: builder,
config: config.GenericConfig.LoopbackClientConfig,
scheme: scheme,
deferredClient: deferredClient,
uncachedObjects: uncachedObjects,
}, nil
}

Expand Down Expand Up @@ -85,14 +93,17 @@ func (m *TiltServerControllerManager) SetUp(ctx context.Context, st store.RStore
LeaderElection: false,
LeaderElectionID: "tilt-apiserver-ctrl",

ClientBuilder: m.builder,
ClientDisableCacheFor: m.uncachedObjects,
Logger: logr,
GracefulShutdownTimeout: &timeout,
})
if err != nil {
return fmt.Errorf("unable to create controller manager: %v", err)
}

// provide the deferred client with the real client now that it has been initialized
m.deferredClient.initialize(mgr.GetClient())

go func() {
if err := mgr.Start(ctx); err != nil && !errors.Is(err, context.Canceled) {
err = fmt.Errorf("controller manager stopped unexpectedly: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var WireSet = wire.NewSet(

v1alpha1.NewScheme,
NewControllerBuilder,
NewClientBuilder,
ProvideUncachedObjects,

ProvideDeferredClient,
wire.Bind(new(ctrlclient.Client), new(*DeferredClient)),
Expand Down
7 changes: 5 additions & 2 deletions internal/engine/upper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3970,7 +3970,6 @@ func newTestFixture(t *testing.T) *testFixture {
env := k8s.EnvDockerDesktop
plm := runtimelog.NewPodLogManager(cdc)
plsc := podlogstream.NewController(ctx, cdc, st, b.kClient)
ccb := controllers.NewClientBuilder(cdc).WithUncached(&v1alpha1.FileWatch{})
fwms := fswatch.NewManifestSubscriber(cdc)
pfs := portforward.NewSubscriber(b.kClient, cdc)
pfs.DisableForTesting()
Expand Down Expand Up @@ -4011,7 +4010,11 @@ func newTestFixture(t *testing.T) *testFixture {
tp := prompt.NewTerminalPrompt(ta, prompt.TTYOpen, openurl.BrowserOpen,
log, "localhost", model.WebURL{})
h := hud.NewFakeHud()
tscm, err := controllers.NewTiltServerControllerManager(serverOptions, v1alpha1.NewScheme(), ccb)
tscm, err := controllers.NewTiltServerControllerManager(
serverOptions,
v1alpha1.NewScheme(),
cdc,
controllers.UncachedObjects{&v1alpha1.FileWatch{}})
require.NoError(t, err, "Failed to create Tilt API server controller manager")

wsl := server.NewWebsocketList()
Expand Down
5 changes: 5 additions & 0 deletions internal/k8s/portforward/portforward_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ type fakeConnection struct {
closeChan chan bool
}

var _ httpstream.Connection = &fakeConnection{}

func newFakeConnection() httpstream.Connection {
return &fakeConnection{
closeChan: make(chan bool),
Expand All @@ -59,6 +61,9 @@ func (c *fakeConnection) CreateStream(headers http.Header) (httpstream.Stream, e
return nil, nil
}

func (c *fakeConnection) RemoveStreams(_ ...httpstream.Stream) {
}

func (c *fakeConnection) Close() error {
if !c.closed {
c.closed = true
Expand Down
17 changes: 14 additions & 3 deletions vendor/github.com/Azure/go-autorest/autorest/authorization.go

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

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

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

11 changes: 8 additions & 3 deletions vendor/github.com/Azure/go-autorest/autorest/azure/async.go

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

Loading

0 comments on commit 07a04b9

Please sign in to comment.