Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #94 from FabianKramm/master
Browse files Browse the repository at this point in the history
chore: update kubernetes dependencies to v1.19.3
  • Loading branch information
FabianKramm authored Dec 17, 2020
2 parents 9cb338c + a68ef73 commit f856c3c
Show file tree
Hide file tree
Showing 1,258 changed files with 59,483 additions and 40,747 deletions.
5 changes: 3 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ chart/
config/
hack/
devspace.yaml
.git/
docs/
/.git
/docs
/test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ default.etcd/
.devspace/
/main
/profile.out
/test
2 changes: 1 addition & 1 deletion chart/templates/webhook.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- if .Values.webhook }}
{{- if .Values.webhook.create }}
apiVersion: admissionregistration.k8s.io/v1beta1
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: kiosk
Expand Down
10 changes: 6 additions & 4 deletions cmd/kiosk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"
"os"
client2 "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"

configv1alpha1 "github.com/kiosk-sh/kiosk/pkg/apis/config/v1alpha1"
"github.com/kiosk-sh/kiosk/pkg/manager/controllers"
Expand Down Expand Up @@ -106,7 +107,7 @@ func main() {

// create the manager
mgr, err := ctrl.NewManager(config, ctrl.Options{
NewClient: blockingcacheclient.NewCacheClient,
ClientBuilder: blockingcacheclient.NewCacheClientBuilder(),
Scheme: scheme,
MetricsBindAddress: ":8080",
CertDir: certhelper.WebhookCertFolder,
Expand Down Expand Up @@ -134,7 +135,8 @@ func main() {
os.Exit(1)
}

stopChan := ctrl.SetupSignalHandler()
stopChan := make(chan struct{})
ctx := signals.SetupSignalHandler()
ctrlCtx := controllers.NewControllerContext(mgr, stopChan)

// Register generic controllers
Expand Down Expand Up @@ -164,14 +166,14 @@ func main() {
// Start the local manager
go func() {
setupLog.Info("starting manager")
err = mgr.Start(stopChan)
err = mgr.Start(ctx)
if err != nil {
panic(err)
}
}()

// Make sure the manager is synced
mgr.GetCache().WaitForCacheSync(stopChan)
mgr.GetCache().WaitForCacheSync(ctx)

// Start the api server
go func() {
Expand Down
37 changes: 19 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,46 @@ module github.com/kiosk-sh/kiosk

require (
github.com/Azure/go-autorest v13.0.0+incompatible // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
github.com/evanphx/json-patch v4.9.0+incompatible
github.com/ghodss/yaml v1.0.0
github.com/go-logr/logr v0.1.0
github.com/go-logr/logr v0.3.0
github.com/go-openapi/loads v0.19.4
github.com/go-openapi/spec v0.19.3
github.com/hashicorp/golang-lru v0.5.4
github.com/juju/errors v0.0.0-20190930114154-d42613fe1ab9 // indirect
github.com/lib/pq v1.2.0 // indirect
github.com/mattn/go-sqlite3 v1.11.0 // indirect
github.com/petar/GoLLRB v0.0.0-20130427215148-53be0d36a84c // indirect
github.com/pkg/errors v0.8.1
github.com/pkg/errors v0.9.1
github.com/rancher/kine v0.3.2 // indirect
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.5
github.com/sirupsen/logrus v1.6.0
github.com/spf13/cobra v1.0.0
github.com/spf13/pflag v1.0.5
gomodules.xyz/jsonpatch v2.0.0+incompatible // indirect
gotest.tools v2.2.0+incompatible
k8s.io/api v0.18.6
k8s.io/apiextensions-apiserver v0.18.6
k8s.io/apimachinery v0.18.6
k8s.io/apiserver v0.18.6
k8s.io/cli-runtime v0.18.6
k8s.io/client-go v0.18.6
k8s.io/component-base v0.18.6
k8s.io/gengo v0.0.0-20200114144118-36b2048a9120
k8s.io/api v0.19.3
k8s.io/apiextensions-apiserver v0.19.3
k8s.io/apimachinery v0.19.3
k8s.io/apiserver v0.19.3
k8s.io/cli-runtime v0.19.3
k8s.io/client-go v0.19.3
k8s.io/component-base v0.19.3
k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14
k8s.io/klog v1.0.0
k8s.io/kube-aggregator v0.18.6
k8s.io/kube-controller-manager v0.18.6
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6
k8s.io/kubectl v0.18.6
k8s.io/kube-aggregator v0.19.3
k8s.io/kube-controller-manager v0.19.3
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6
k8s.io/kubectl v0.19.3
sigs.k8s.io/apiserver-builder-alpha v1.18.0
sigs.k8s.io/controller-runtime v0.6.3
sigs.k8s.io/controller-runtime v0.7.0
)

go 1.13

replace github.com/kubernetes-incubator/reference-docs => github.com/kubernetes-sigs/reference-docs v0.0.0-20170929004150-fcf65347b256

replace github.com/markbates/inflect => github.com/markbates/inflect v1.0.4

replace github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.4.1
264 changes: 264 additions & 0 deletions go.sum

Large diffs are not rendered by default.

18 changes: 5 additions & 13 deletions pkg/apiserver/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"flag"
"fmt"
"github.com/kiosk-sh/kiosk/pkg/util/certhelper"
"io"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -101,7 +100,7 @@ func StartApiServerWithOptions(opts *StartOptions) error {

signalCh := genericapiserver.SetupSignalHandler()
// To disable providers, manually specify the list provided by getKnownProviders()
cmd, _ := NewCommandStartServer(opts.EtcdPath, os.Stdout, os.Stderr, opts.Apis, signalCh,
cmd, _ := NewCommandStartServer(opts.EtcdPath, opts.Apis, signalCh,
opts.Title, opts.Version, opts.TweakConfigFuncs...)

errors := []error{}
Expand All @@ -123,7 +122,7 @@ func StartApiServerWithOptions(opts *StartOptions) error {
return nil
}

func NewServerOptions(etcdPath, title, version string, b []*builders.APIGroupBuilder) *ServerOptions {
func NewServerOptions(etcdPath string, b []*builders.APIGroupBuilder) *ServerOptions {
versions := []schema.GroupVersion{}
for _, b := range b {
versions = append(versions, b.GetLegacyCodec()...)
Expand All @@ -133,7 +132,6 @@ func NewServerOptions(etcdPath, title, version string, b []*builders.APIGroupBui
RecommendedOptions: genericoptions.NewRecommendedOptions(
etcdPath,
builders.Codecs.LegacyCodec(versions...),
genericoptions.NewProcessInfo(title, version),
),
APIBuilders: b,
RunDelegatedAuth: false,
Expand All @@ -159,9 +157,9 @@ func NewServerOptions(etcdPath, title, version string, b []*builders.APIGroupBui
}

// NewCommandStartMaster provides a CLI handler for 'start master' command
func NewCommandStartServer(etcdPath string, out, errOut io.Writer, builders []*builders.APIGroupBuilder,
func NewCommandStartServer(etcdPath string, builders []*builders.APIGroupBuilder,
stopCh <-chan struct{}, title, version string, tweakConfigFuncs ...func(apiServer *apiserver.Config) error) (*cobra.Command, *ServerOptions) {
o := NewServerOptions(etcdPath, title, version, builders)
o := NewServerOptions(etcdPath, builders)

// for pluginName := range AggregatedAdmissionPlugins {
// o.RecommendedOptions.Admission.RecommendedPluginOrder = append(o.RecommendedOptions.Admission.RecommendedPluginOrder, pluginName)
Expand Down Expand Up @@ -270,13 +268,7 @@ func (o ServerOptions) Config(tweakConfigFuncs ...func(config *apiserver.Config)
return o.RecommendedOptions.SecureServing.ApplyTo(&cfg.SecureServing, &cfg.LoopbackClientConfig)
},
func(cfg *genericapiserver.Config) error {
return o.RecommendedOptions.Audit.ApplyTo(
&serverConfig.Config,
loopbackKubeConfig,
kubeInformerFactory,
o.RecommendedOptions.ProcessInfo,
nil,
)
return o.RecommendedOptions.Audit.ApplyTo(&serverConfig.Config)
},
o.RecommendedOptions.Features.ApplyTo,
)
Expand Down
8 changes: 7 additions & 1 deletion pkg/authorization/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package authorization

import (
"context"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/meta"
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
Expand Down Expand Up @@ -43,7 +44,12 @@ func (f *filter) List(ctx context.Context, list runtime.Object, groupVersionReso
Continue: options.Continue,
}

err = f.client.List(ctx, list, listOptions)
clientList, ok := list.(client.ObjectList)
if !ok {
return nil, errors.Errorf("unexpected type: %v", list)
}

err = f.client.List(ctx, clientList, listOptions)
if err != nil {
return nil, err
}
Expand Down
54 changes: 33 additions & 21 deletions pkg/manager/blockingcacheclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,25 @@ import (
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
"sigs.k8s.io/controller-runtime/pkg/manager"
"time"
)

func NewCacheClientBuilder() manager.ClientBuilder {
return &CacheClientBuilder{}
}

type CacheClientBuilder struct{}

// TODO: implement this
func (c *CacheClientBuilder) WithUncached(objs ...client.Object) manager.ClientBuilder {
return c
}

func (c *CacheClientBuilder) Build(cache cache.Cache, config *rest.Config, options client.Options) (client.Client, error) {
return NewCacheClient(cache, config, options)
}

// CacheClient makes sure that the Create/Update/Patch/Delete functions block until the local cache is updated
type CacheClient struct {
client.Client
Expand Down Expand Up @@ -43,17 +59,13 @@ func defaultNewClient(cache cache.Cache, config *rest.Config, options client.Opt
return nil, err
}

return &client.DelegatingClient{
Reader: &client.DelegatingReader{
CacheReader: cache,
ClientReader: c,
},
Writer: c,
StatusClient: c,
}, nil
return client.NewDelegatingClient(client.NewDelegatingClientInput{
CacheReader: cache,
Client: c,
})
}

func (c *CacheClient) poll(obj runtime.Object, condition func(newObj runtime.Object, oldAccessor metav1.Object) (bool, error)) error {
func (c *CacheClient) poll(obj runtime.Object, condition func(newObj client.Object, oldAccessor metav1.Object) (bool, error)) error {
_, ok := obj.(*unstructured.Unstructured)
if ok {
return nil
Expand All @@ -75,12 +87,12 @@ func (c *CacheClient) poll(obj runtime.Object, condition func(newObj runtime.Obj
}

return wait.PollImmediate(time.Millisecond*10, time.Second*2, func() (bool, error) {
return condition(newObj, accessor)
return condition(newObj.(client.Object), accessor)
})
}

func (c *CacheClient) blockCreate(ctx context.Context, obj runtime.Object) error {
return c.poll(obj, func(newObj runtime.Object, oldAccessor metav1.Object) (bool, error) {
func (c *CacheClient) blockCreate(ctx context.Context, obj client.Object) error {
return c.poll(obj, func(newObj client.Object, oldAccessor metav1.Object) (bool, error) {
err := c.Client.Get(ctx, types.NamespacedName{Namespace: oldAccessor.GetNamespace(), Name: oldAccessor.GetName()}, newObj)
if err != nil {
if runtime.IsNotRegisteredError(err) {
Expand All @@ -96,8 +108,8 @@ func (c *CacheClient) blockCreate(ctx context.Context, obj runtime.Object) error
})
}

func (c *CacheClient) blockUpdate(ctx context.Context, obj runtime.Object) error {
return c.poll(obj, func(newObj runtime.Object, oldAccessor metav1.Object) (bool, error) {
func (c *CacheClient) blockUpdate(ctx context.Context, obj client.Object) error {
return c.poll(obj, func(newObj client.Object, oldAccessor metav1.Object) (bool, error) {
err := c.Client.Get(ctx, types.NamespacedName{Namespace: oldAccessor.GetNamespace(), Name: oldAccessor.GetName()}, newObj)
if err != nil {
if runtime.IsNotRegisteredError(err) {
Expand All @@ -119,7 +131,7 @@ func (c *CacheClient) blockUpdate(ctx context.Context, obj runtime.Object) error
}

func (c *CacheClient) blockDelete(ctx context.Context, obj runtime.Object) error {
return c.poll(obj, func(newObj runtime.Object, oldAccessor metav1.Object) (bool, error) {
return c.poll(obj, func(newObj client.Object, oldAccessor metav1.Object) (bool, error) {
err := c.Client.Get(ctx, types.NamespacedName{Namespace: oldAccessor.GetNamespace(), Name: oldAccessor.GetName()}, newObj)
if err != nil {
if runtime.IsNotRegisteredError(err) {
Expand All @@ -139,7 +151,7 @@ func (c *CacheClient) blockDelete(ctx context.Context, obj runtime.Object) error
})
}

func (c *CacheClient) Create(ctx context.Context, obj runtime.Object, opts ...client.CreateOption) error {
func (c *CacheClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error {
err := c.Client.Create(ctx, obj, opts...)
if err != nil {
return err
Expand All @@ -148,7 +160,7 @@ func (c *CacheClient) Create(ctx context.Context, obj runtime.Object, opts ...cl
return c.blockCreate(ctx, obj)
}

func (c *CacheClient) Patch(ctx context.Context, obj runtime.Object, patch client.Patch, opts ...client.PatchOption) error {
func (c *CacheClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error {
err := c.Client.Patch(ctx, obj, patch, opts...)
if err != nil {
return err
Expand All @@ -157,7 +169,7 @@ func (c *CacheClient) Patch(ctx context.Context, obj runtime.Object, patch clien
return c.blockUpdate(ctx, obj)
}

func (c *CacheClient) Update(ctx context.Context, obj runtime.Object, opts ...client.UpdateOption) error {
func (c *CacheClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error {
err := c.Client.Update(ctx, obj, opts...)
if err != nil {
return err
Expand All @@ -166,7 +178,7 @@ func (c *CacheClient) Update(ctx context.Context, obj runtime.Object, opts ...cl
return c.blockUpdate(ctx, obj)
}

func (c *CacheClient) Delete(ctx context.Context, obj runtime.Object, opts ...client.DeleteOption) error {
func (c *CacheClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error {
err := c.Client.Delete(ctx, obj, opts...)
if err != nil {
return err
Expand All @@ -188,7 +200,7 @@ type CacheStatusClient struct {
Cache *CacheClient
}

func (c *CacheStatusClient) Update(ctx context.Context, obj runtime.Object, opts ...client.UpdateOption) error {
func (c *CacheStatusClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error {
err := c.Cache.Client.Status().Update(ctx, obj, opts...)
if err != nil {
return err
Expand All @@ -197,7 +209,7 @@ func (c *CacheStatusClient) Update(ctx context.Context, obj runtime.Object, opts
return c.Cache.blockUpdate(ctx, obj)
}

func (c *CacheStatusClient) Patch(ctx context.Context, obj runtime.Object, patch client.Patch, opts ...client.PatchOption) error {
func (c *CacheStatusClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error {
err := c.Cache.Client.Status().Patch(ctx, obj, patch, opts...)
if err != nil {
return err
Expand Down
Loading

0 comments on commit f856c3c

Please sign in to comment.