From 465341356076a55f1b63869302872bcf3eb87cfe Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Mon, 25 Oct 2021 12:04:18 -0700 Subject: [PATCH 01/21] feat(types) add dedicated KongIngress subtypes Add Route, Service, and Upstream types for KongIngress. These types contain fields identical to the same-name fields in the go-kong Route, Service, and Upstream types, but limited to the fields that the overrideByKongIngress() functions can actually override. --- internal/kongstate/route.go | 2 +- internal/kongstate/route_test.go | 28 +-- internal/kongstate/service_test.go | 26 +-- internal/kongstate/upstream.go | 39 +++- internal/kongstate/upstream_test.go | 3 +- internal/parser/parser_test.go | 4 +- .../configuration/v1/kongingress_types.go | 55 ++++- .../configuration/v1/zz_generated.deepcopy.go | 214 +++++++++++++++++- 8 files changed, 326 insertions(+), 45 deletions(-) diff --git a/internal/kongstate/route.go b/internal/kongstate/route.go index 47b444148b..42b3529c84 100644 --- a/internal/kongstate/route.go +++ b/internal/kongstate/route.go @@ -304,7 +304,7 @@ func (r *Route) overrideByKongIngress(log logrus.FieldLogger, kongIngress *confi SNIs = append(SNIs, kong.String(SNI)) } else { // SNI is not a valid hostname - log.WithField("kongroute", ir.Name).Errorf("invalid SNI: %v", unsanitizedSNI) + log.WithField("kongroute", r.Name).Errorf("invalid SNI: %v", unsanitizedSNI) return } } diff --git a/internal/kongstate/route_test.go b/internal/kongstate/route_test.go index ec4cda4b27..4ad715721c 100644 --- a/internal/kongstate/route_test.go +++ b/internal/kongstate/route_test.go @@ -40,7 +40,7 @@ func TestOverrideRoute(t *testing.T) { }, }, configurationv1.KongIngress{ - Route: &kong.Route{ + Route: &configurationv1.KongIngressRoute{ Methods: kong.StringSlice("GET", "POST"), }, }, @@ -58,7 +58,7 @@ func TestOverrideRoute(t *testing.T) { }, }, configurationv1.KongIngress{ - Route: &kong.Route{ + Route: &configurationv1.KongIngressRoute{ Methods: kong.StringSlice("GET ", "post"), }, }, @@ -76,7 +76,7 @@ func TestOverrideRoute(t *testing.T) { }, }, configurationv1.KongIngress{ - Route: &kong.Route{ + Route: &configurationv1.KongIngressRoute{ Methods: kong.StringSlice("GET", "-1"), }, }, @@ -93,7 +93,7 @@ func TestOverrideRoute(t *testing.T) { }, }, configurationv1.KongIngress{ - Route: &kong.Route{ + Route: &configurationv1.KongIngressRoute{ HTTPSRedirectStatusCode: kong.Int(302), }, }, @@ -113,7 +113,7 @@ func TestOverrideRoute(t *testing.T) { }, }, configurationv1.KongIngress{ - Route: &kong.Route{ + Route: &configurationv1.KongIngressRoute{ Protocols: kong.StringSlice("http"), PreserveHost: kong.Bool(false), StripPath: kong.Bool(false), @@ -138,7 +138,7 @@ func TestOverrideRoute(t *testing.T) { }, }, configurationv1.KongIngress{ - Route: &kong.Route{ + Route: &configurationv1.KongIngressRoute{ Headers: map[string][]string{ "foo-header": {"bar-value"}, }, @@ -161,7 +161,7 @@ func TestOverrideRoute(t *testing.T) { }, }, configurationv1.KongIngress{ - Route: &kong.Route{ + Route: &configurationv1.KongIngressRoute{ Protocols: kong.StringSlice("grpc", "grpcs"), }, }, @@ -180,7 +180,7 @@ func TestOverrideRoute(t *testing.T) { }, }, configurationv1.KongIngress{ - Route: &kong.Route{ + Route: &configurationv1.KongIngressRoute{ PathHandling: kong.String("v1"), }, }, @@ -198,7 +198,7 @@ func TestOverrideRoute(t *testing.T) { }, }, configurationv1.KongIngress{ - Route: &kong.Route{ + Route: &configurationv1.KongIngressRoute{ RequestBuffering: kong.Bool(true), ResponseBuffering: kong.Bool(true), }, @@ -233,8 +233,8 @@ func TestOverrideRoutePriority(t *testing.T) { }, } kongIngress := configurationv1.KongIngress{ - Route: &kong.Route{ - Hosts: kong.StringSlice("foo.com", "bar.com"), + Route: &configurationv1.KongIngressRoute{ + Protocols: kong.StringSlice("http"), }, } @@ -263,13 +263,13 @@ func TestOverrideRouteByKongIngress(t *testing.T) { }, } kongIngress := configurationv1.KongIngress{ - Route: &kong.Route{ - Hosts: kong.StringSlice("foo.com", "bar.com"), + Route: &configurationv1.KongIngressRoute{ + Protocols: kong.StringSlice("http"), }, } route.overrideByKongIngress(logrus.New(), &kongIngress) - assert.Equal(route.Hosts, kong.StringSlice("foo.com", "bar.com")) + assert.Equal(route.Protocols, kong.StringSlice("http")) assert.NotPanics(func() { var nilRoute *Route nilRoute.override(logrus.New(), nil) diff --git a/internal/kongstate/service_test.go b/internal/kongstate/service_test.go index 6a17b41bcc..d4db2feb4d 100644 --- a/internal/kongstate/service_test.go +++ b/internal/kongstate/service_test.go @@ -30,7 +30,7 @@ func TestOverrideService(t *testing.T) { }, }, configurationv1.KongIngress{ - Proxy: &kong.Service{}, + Proxy: &configurationv1.KongIngressService{}, }, Service{ Service: kong.Service{ @@ -54,7 +54,7 @@ func TestOverrideService(t *testing.T) { }, }, configurationv1.KongIngress{ - Proxy: &kong.Service{ + Proxy: &configurationv1.KongIngressService{ Protocol: kong.String("https"), }, }, @@ -80,7 +80,7 @@ func TestOverrideService(t *testing.T) { }, }, configurationv1.KongIngress{ - Proxy: &kong.Service{ + Proxy: &configurationv1.KongIngressService{ Retries: kong.Int(0), }, }, @@ -107,7 +107,7 @@ func TestOverrideService(t *testing.T) { }, }, configurationv1.KongIngress{ - Proxy: &kong.Service{ + Proxy: &configurationv1.KongIngressService{ Path: kong.String("/new-path"), }, }, @@ -133,7 +133,7 @@ func TestOverrideService(t *testing.T) { }, }, configurationv1.KongIngress{ - Proxy: &kong.Service{ + Proxy: &configurationv1.KongIngressService{ Retries: kong.Int(1), }, }, @@ -160,7 +160,7 @@ func TestOverrideService(t *testing.T) { }, }, configurationv1.KongIngress{ - Proxy: &kong.Service{ + Proxy: &configurationv1.KongIngressService{ ConnectTimeout: kong.Int(100), ReadTimeout: kong.Int(100), WriteTimeout: kong.Int(100), @@ -191,7 +191,7 @@ func TestOverrideService(t *testing.T) { }, }, configurationv1.KongIngress{ - Proxy: &kong.Service{ + Proxy: &configurationv1.KongIngressService{ Protocol: kong.String("grpc"), }, }, @@ -217,7 +217,7 @@ func TestOverrideService(t *testing.T) { }, }, configurationv1.KongIngress{ - Proxy: &kong.Service{ + Proxy: &configurationv1.KongIngressService{ Protocol: kong.String("grpcs"), }, }, @@ -243,7 +243,7 @@ func TestOverrideService(t *testing.T) { }, }, configurationv1.KongIngress{ - Proxy: &kong.Service{ + Proxy: &configurationv1.KongIngressService{ Protocol: kong.String("grpcs"), }, }, @@ -269,7 +269,7 @@ func TestOverrideService(t *testing.T) { }, }, configurationv1.KongIngress{ - Proxy: &kong.Service{ + Proxy: &configurationv1.KongIngressService{ Protocol: kong.String("grpcs"), }, }, @@ -295,7 +295,7 @@ func TestOverrideService(t *testing.T) { }, }, configurationv1.KongIngress{ - Proxy: &kong.Service{}, + Proxy: &configurationv1.KongIngressService{}, }, Service{ Service: kong.Service{ @@ -319,7 +319,7 @@ func TestOverrideService(t *testing.T) { }, }, configurationv1.KongIngress{ - Proxy: &kong.Service{ + Proxy: &configurationv1.KongIngressService{ Protocol: kong.String("grpcs"), }, }, @@ -345,7 +345,7 @@ func TestOverrideService(t *testing.T) { }, }, configurationv1.KongIngress{ - Proxy: &kong.Service{}, + Proxy: &configurationv1.KongIngressService{}, }, Service{ Service: kong.Service{ diff --git a/internal/kongstate/upstream.go b/internal/kongstate/upstream.go index d0a89f7112..c0fa1ad62c 100644 --- a/internal/kongstate/upstream.go +++ b/internal/kongstate/upstream.go @@ -45,13 +45,38 @@ func (u *Upstream) overrideByKongIngress(kongIngress *configurationv1.KongIngres if kongIngress == nil || kongIngress.Upstream == nil { return } - - // The upstream within the KongIngress has no name. - // As this overwrites the entire upstream object, we must restore the - // original name after. - name := *u.Upstream.Name - u.Upstream = *kongIngress.Upstream.DeepCopy() - u.Name = &name + k := kongIngress.Upstream + if k.HostHeader != nil { + u.HostHeader = kong.String(*k.HostHeader) + } + if k.Algorithm != nil { + u.Algorithm = kong.String(*k.Algorithm) + } + if k.Slots != nil { + u.Slots = kong.Int(*k.Slots) + } + if k.Healthchecks != nil { + u.Healthchecks = k.Healthchecks + } + if k.HashOn != nil { + u.HashOn = kong.String(*k.HashOn) + } + if k.HashFallback != nil { + u.HashFallback = kong.String(*k.HashFallback) + } + if k.HashOnHeader != nil { + u.HashOnHeader = kong.String(*k.HashOnHeader) + } + if k.HashFallbackHeader != nil { + u.HashFallbackHeader = kong.String(*k.HashFallbackHeader) + } + if k.HashOnCookie != nil { + u.HashOnCookie = kong.String(*k.HashOnCookie) + } + if k.HashOnCookiePath != nil { + u.HashOnCookiePath = kong.String(*k.HashOnCookiePath) + } + // TODO client certificate handling } // override sets Upstream fields by KongIngress first, then by annotation diff --git a/internal/kongstate/upstream_test.go b/internal/kongstate/upstream_test.go index edf1b45814..e6c90b6176 100644 --- a/internal/kongstate/upstream_test.go +++ b/internal/kongstate/upstream_test.go @@ -38,8 +38,7 @@ func TestOverrideUpstream(t *testing.T) { }, }, inKongIngresss: &configurationv1.KongIngress{ - Upstream: &kong.Upstream{ - Name: kong.String("wrong.com"), + Upstream: &configurationv1.KongIngressUpstream{ HashOn: kong.String("HashOn"), HashOnCookie: kong.String("HashOnCookie"), HashOnCookiePath: kong.String("HashOnCookiePath"), diff --git a/internal/parser/parser_test.go b/internal/parser/parser_test.go index 8b176003bf..f6cfbb7fcf 100644 --- a/internal/parser/parser_test.go +++ b/internal/parser/parser_test.go @@ -2099,7 +2099,7 @@ func TestKnativeIngressAndPlugins(t *testing.T) { Name: "https-only", Namespace: "foo-ns", }, - Route: &kong.Route{ + Route: &configurationv1.KongIngressRoute{ Protocols: kong.StringSlice("https"), HTTPSRedirectStatusCode: kong.Int(308), }, @@ -2177,7 +2177,7 @@ func TestKnativeIngressAndPlugins(t *testing.T) { Name: "https-only", Namespace: "foo-ns", }, - Route: &kong.Route{ + Route: &configurationv1.KongIngressRoute{ Protocols: kong.StringSlice("https"), HTTPSRedirectStatusCode: kong.Int(308), }, diff --git a/pkg/apis/configuration/v1/kongingress_types.go b/pkg/apis/configuration/v1/kongingress_types.go index f61030b186..87139ba0b5 100644 --- a/pkg/apis/configuration/v1/kongingress_types.go +++ b/pkg/apis/configuration/v1/kongingress_types.go @@ -34,9 +34,9 @@ type KongIngress struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Upstream *kong.Upstream `json:"upstream,omitempty"` - Proxy *kong.Service `json:"proxy,omitempty"` - Route *kong.Route `json:"route,omitempty"` + Upstream *KongIngressUpstream `json:"upstream,omitempty"` + Proxy *KongIngressService `json:"proxy,omitempty"` + Route *KongIngressRoute `json:"route,omitempty"` } //+kubebuilder:object:root=true @@ -48,6 +48,55 @@ type KongIngressList struct { Items []KongIngress `json:"items"` } +// KongIngressService contains KongIngress service configuration +// It contains the subset of go-kong.kong.Service fields supported by kongstate.Service.overrideByKongIngress +type KongIngressService struct { + Protocol *string `json:"protocol,omitempty" yaml:"protocol,omitempty"` + Path *string `json:"path,omitempty" yaml:"path,omitempty"` + Retries *int `json:"retries,omitempty" yaml:"retries,omitempty"` + ConnectTimeout *int `json:"connect_timeout,omitempty" yaml:"connect_timeout,omitempty"` + ReadTimeout *int `json:"read_timeout,omitempty" yaml:"read_timeout,omitempty"` + WriteTimeout *int `json:"write_timeout,omitempty" yaml:"write_timeout,omitempty"` +} + +// KongIngressRoute contains KongIngress route configuration +// It contains the subset of go-kong.kong.Route fields supported by kongstate.Route.overrideByKongIngress +type KongIngressRoute struct { + Methods []*string `json:"methods,omitempty" yaml:"methods,omitempty"` + Headers map[string][]string `json:"headers,omitempty" yaml:"headers,omitempty"` + Protocols []*string `json:"protocols,omitempty" yaml:"protocols,omitempty"` + RegexPriority *int `json:"regex_priority,omitempty" yaml:"regex_priority,omitempty"` + StripPath *bool `json:"strip_path,omitempty" yaml:"strip_path,omitempty"` + PreserveHost *bool `json:"preserve_host,omitempty" yaml:"preserve_host,omitempty"` + HTTPSRedirectStatusCode *int `json:"https_redirect_status_code,omitempty" yaml:"https_redirect_status_code,omitempty"` + PathHandling *string `json:"path_handling,omitempty" yaml:"path_handling,omitempty"` + SNIs []*string `json:"snis,omitempty" yaml:"snis,omitempty"` + RequestBuffering *bool `json:"request_buffering,omitempty" yaml:"request_buffering,omitempty"` + ResponseBuffering *bool `json:"response_buffering,omitempty" yaml:"response_buffering,omitempty"` +} + +// KongIngressUpstream contains KongIngress upstream configuration +// It contains the subset of go-kong.kong.Upstream fields supported by kongstate.Upstream.overrideByKongIngress +type KongIngressUpstream struct { + HostHeader *string `json:"host_header,omitempty" yaml:"host_header,omitempty"` + Algorithm *string `json:"algorithm,omitempty" yaml:"algorithm,omitempty"` + Slots *int `json:"slots,omitempty" yaml:"slots,omitempty"` + Healthchecks *kong.Healthcheck `json:"healthchecks,omitempty" yaml:"healthchecks,omitempty"` + HashOn *string `json:"hash_on,omitempty" yaml:"hash_on,omitempty"` + HashFallback *string `json:"hash_fallback,omitempty" yaml:"hash_fallback,omitempty"` + HashOnHeader *string `json:"hash_on_header,omitempty" yaml:"hash_on_header,omitempty"` + HashFallbackHeader *string `json:"hash_fallback_header,omitempty" yaml:"hash_fallback_header,omitempty"` + HashOnCookie *string `json:"hash_on_cookie,omitempty" yaml:"hash_on_cookie,omitempty"` + HashOnCookiePath *string `json:"hash_on_cookie_path,omitempty" yaml:"hash_on_cookie_path,omitempty"` + // TODO status of this in existing code is unclear. While we supported a raw dump from KongIngress.upstream + // into the generated upstream, the Kong upstream type only has a certificate ID field here, not a complete + // certificate/key pair (aka go-kong Certificate). Unclear if db-less or deck have some logic to automagically + // create the certificate and insert the correct ID into the upstream. + // We _DID NOT_ show any client cert example at https://docs.konghq.com/kubernetes-ingress-controller/1.3.x/references/custom-resources/#kongingress + // nor did we have tests for it + //ClientCertificate *Certificate `json:"client_certificate,omitempty" yaml:"client_certificate,omitempty"` +} + func init() { SchemeBuilder.Register(&KongIngress{}, &KongIngressList{}) } diff --git a/pkg/apis/configuration/v1/zz_generated.deepcopy.go b/pkg/apis/configuration/v1/zz_generated.deepcopy.go index 8fd587d08f..1e3b105efa 100644 --- a/pkg/apis/configuration/v1/zz_generated.deepcopy.go +++ b/pkg/apis/configuration/v1/zz_generated.deepcopy.go @@ -188,17 +188,17 @@ func (in *KongIngress) DeepCopyInto(out *KongIngress) { in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) if in.Upstream != nil { in, out := &in.Upstream, &out.Upstream - *out = new(kong.Upstream) + *out = new(KongIngressUpstream) (*in).DeepCopyInto(*out) } if in.Proxy != nil { in, out := &in.Proxy, &out.Proxy - *out = new(kong.Service) + *out = new(KongIngressService) (*in).DeepCopyInto(*out) } if in.Route != nil { in, out := &in.Route, &out.Route - *out = new(kong.Route) + *out = new(KongIngressRoute) (*in).DeepCopyInto(*out) } } @@ -253,6 +253,214 @@ func (in *KongIngressList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KongIngressRoute) DeepCopyInto(out *KongIngressRoute) { + *out = *in + if in.Methods != nil { + in, out := &in.Methods, &out.Methods + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.Headers != nil { + in, out := &in.Headers, &out.Headers + *out = make(map[string][]string, len(*in)) + for key, val := range *in { + var outVal []string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = make([]string, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal + } + } + if in.Protocols != nil { + in, out := &in.Protocols, &out.Protocols + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.RegexPriority != nil { + in, out := &in.RegexPriority, &out.RegexPriority + *out = new(int) + **out = **in + } + if in.StripPath != nil { + in, out := &in.StripPath, &out.StripPath + *out = new(bool) + **out = **in + } + if in.PreserveHost != nil { + in, out := &in.PreserveHost, &out.PreserveHost + *out = new(bool) + **out = **in + } + if in.HTTPSRedirectStatusCode != nil { + in, out := &in.HTTPSRedirectStatusCode, &out.HTTPSRedirectStatusCode + *out = new(int) + **out = **in + } + if in.PathHandling != nil { + in, out := &in.PathHandling, &out.PathHandling + *out = new(string) + **out = **in + } + if in.SNIs != nil { + in, out := &in.SNIs, &out.SNIs + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.RequestBuffering != nil { + in, out := &in.RequestBuffering, &out.RequestBuffering + *out = new(bool) + **out = **in + } + if in.ResponseBuffering != nil { + in, out := &in.ResponseBuffering, &out.ResponseBuffering + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KongIngressRoute. +func (in *KongIngressRoute) DeepCopy() *KongIngressRoute { + if in == nil { + return nil + } + out := new(KongIngressRoute) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KongIngressService) DeepCopyInto(out *KongIngressService) { + *out = *in + if in.Protocol != nil { + in, out := &in.Protocol, &out.Protocol + *out = new(string) + **out = **in + } + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } + if in.Retries != nil { + in, out := &in.Retries, &out.Retries + *out = new(int) + **out = **in + } + if in.ConnectTimeout != nil { + in, out := &in.ConnectTimeout, &out.ConnectTimeout + *out = new(int) + **out = **in + } + if in.ReadTimeout != nil { + in, out := &in.ReadTimeout, &out.ReadTimeout + *out = new(int) + **out = **in + } + if in.WriteTimeout != nil { + in, out := &in.WriteTimeout, &out.WriteTimeout + *out = new(int) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KongIngressService. +func (in *KongIngressService) DeepCopy() *KongIngressService { + if in == nil { + return nil + } + out := new(KongIngressService) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KongIngressUpstream) DeepCopyInto(out *KongIngressUpstream) { + *out = *in + if in.HostHeader != nil { + in, out := &in.HostHeader, &out.HostHeader + *out = new(string) + **out = **in + } + if in.Algorithm != nil { + in, out := &in.Algorithm, &out.Algorithm + *out = new(string) + **out = **in + } + if in.Slots != nil { + in, out := &in.Slots, &out.Slots + *out = new(int) + **out = **in + } + if in.Healthchecks != nil { + in, out := &in.Healthchecks, &out.Healthchecks + *out = new(kong.Healthcheck) + (*in).DeepCopyInto(*out) + } + if in.HashOn != nil { + in, out := &in.HashOn, &out.HashOn + *out = new(string) + **out = **in + } + if in.HashFallback != nil { + in, out := &in.HashFallback, &out.HashFallback + *out = new(string) + **out = **in + } + if in.HashOnHeader != nil { + in, out := &in.HashOnHeader, &out.HashOnHeader + *out = new(string) + **out = **in + } + if in.HashFallbackHeader != nil { + in, out := &in.HashFallbackHeader, &out.HashFallbackHeader + *out = new(string) + **out = **in + } + if in.HashOnCookie != nil { + in, out := &in.HashOnCookie, &out.HashOnCookie + *out = new(string) + **out = **in + } + if in.HashOnCookiePath != nil { + in, out := &in.HashOnCookiePath, &out.HashOnCookiePath + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KongIngressUpstream. +func (in *KongIngressUpstream) DeepCopy() *KongIngressUpstream { + if in == nil { + return nil + } + out := new(KongIngressUpstream) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KongPlugin) DeepCopyInto(out *KongPlugin) { *out = *in From c77cc8ba1c9be361bb05797b449a15c8568d3f7d Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Mon, 25 Oct 2021 13:26:45 -0700 Subject: [PATCH 02/21] feat(crd) add kubebuilder validation Add kubebuilder validation annotations. Exclude some comments from description generation. --- .../v1/kongclusterplugin_types.go | 2 +- .../configuration/v1/kongingress_types.go | 55 +++++++++++-------- pkg/apis/configuration/v1/kongplugin_types.go | 2 +- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/pkg/apis/configuration/v1/kongclusterplugin_types.go b/pkg/apis/configuration/v1/kongclusterplugin_types.go index 689738841a..7cce2d6fa9 100644 --- a/pkg/apis/configuration/v1/kongclusterplugin_types.go +++ b/pkg/apis/configuration/v1/kongclusterplugin_types.go @@ -63,7 +63,7 @@ type KongClusterPlugin struct { // Protocols configures plugin to run on requests received on specific // protocols. - //+kubebuilder:validation:Enum=http;https;grpc;grpcs;tcp;tls;udp + //+ TODO Protocols needs to be a slice of an alias type to deal with https://github.com/kubernetes-sigs/controller-tools/issues/342 Protocols []string `json:"protocols,omitempty"` } diff --git a/pkg/apis/configuration/v1/kongingress_types.go b/pkg/apis/configuration/v1/kongingress_types.go index 87139ba0b5..47d031b3a9 100644 --- a/pkg/apis/configuration/v1/kongingress_types.go +++ b/pkg/apis/configuration/v1/kongingress_types.go @@ -49,37 +49,48 @@ type KongIngressList struct { } // KongIngressService contains KongIngress service configuration -// It contains the subset of go-kong.kong.Service fields supported by kongstate.Service.overrideByKongIngress +//+ It contains the subset of go-kong.kong.Service fields supported by kongstate.Service.overrideByKongIngress type KongIngressService struct { - Protocol *string `json:"protocol,omitempty" yaml:"protocol,omitempty"` - Path *string `json:"path,omitempty" yaml:"path,omitempty"` - Retries *int `json:"retries,omitempty" yaml:"retries,omitempty"` - ConnectTimeout *int `json:"connect_timeout,omitempty" yaml:"connect_timeout,omitempty"` - ReadTimeout *int `json:"read_timeout,omitempty" yaml:"read_timeout,omitempty"` - WriteTimeout *int `json:"write_timeout,omitempty" yaml:"write_timeout,omitempty"` + //+kubebuilder:validation:Enum=http;https;grpc;grpcs;tcp;tls;udp + Protocol *string `json:"protocol,omitempty" yaml:"protocol,omitempty"` + //+kubebuilder:validation:Pattern=^/.*$ + Path *string `json:"path,omitempty" yaml:"path,omitempty"` + //+kubebuilder:validation:Minimum=0 + Retries *int `json:"retries,omitempty" yaml:"retries,omitempty"` + //+kubebuilder:validation:Minimum=0 + ConnectTimeout *int `json:"connect_timeout,omitempty" yaml:"connect_timeout,omitempty"` + //+kubebuilder:validation:Minimum=0 + ReadTimeout *int `json:"read_timeout,omitempty" yaml:"read_timeout,omitempty"` + //+kubebuilder:validation:Minimum=0 + WriteTimeout *int `json:"write_timeout,omitempty" yaml:"write_timeout,omitempty"` } // KongIngressRoute contains KongIngress route configuration -// It contains the subset of go-kong.kong.Route fields supported by kongstate.Route.overrideByKongIngress +//+ It contains the subset of go-kong.kong.Route fields supported by kongstate.Route.overrideByKongIngress type KongIngressRoute struct { - Methods []*string `json:"methods,omitempty" yaml:"methods,omitempty"` - Headers map[string][]string `json:"headers,omitempty" yaml:"headers,omitempty"` - Protocols []*string `json:"protocols,omitempty" yaml:"protocols,omitempty"` - RegexPriority *int `json:"regex_priority,omitempty" yaml:"regex_priority,omitempty"` - StripPath *bool `json:"strip_path,omitempty" yaml:"strip_path,omitempty"` - PreserveHost *bool `json:"preserve_host,omitempty" yaml:"preserve_host,omitempty"` - HTTPSRedirectStatusCode *int `json:"https_redirect_status_code,omitempty" yaml:"https_redirect_status_code,omitempty"` - PathHandling *string `json:"path_handling,omitempty" yaml:"path_handling,omitempty"` - SNIs []*string `json:"snis,omitempty" yaml:"snis,omitempty"` - RequestBuffering *bool `json:"request_buffering,omitempty" yaml:"request_buffering,omitempty"` - ResponseBuffering *bool `json:"response_buffering,omitempty" yaml:"response_buffering,omitempty"` + Methods []*string `json:"methods,omitempty" yaml:"methods,omitempty"` + Headers map[string][]string `json:"headers,omitempty" yaml:"headers,omitempty"` + //+ TODO Protocols needs to be a slice of an alias type to deal with https://github.com/kubernetes-sigs/controller-tools/issues/342 + //+ For some reason trying to do this breaks deepcopy generation + Protocols []*string `json:"protocols,omitempty" yaml:"protocols,omitempty"` + RegexPriority *int `json:"regex_priority,omitempty" yaml:"regex_priority,omitempty"` + StripPath *bool `json:"strip_path,omitempty" yaml:"strip_path,omitempty"` + PreserveHost *bool `json:"preserve_host,omitempty" yaml:"preserve_host,omitempty"` + HTTPSRedirectStatusCode *int `json:"https_redirect_status_code,omitempty" yaml:"https_redirect_status_code,omitempty"` + //+kubebuilder:validation:Enum=v0;v1 + PathHandling *string `json:"path_handling,omitempty" yaml:"path_handling,omitempty"` + SNIs []*string `json:"snis,omitempty" yaml:"snis,omitempty"` + RequestBuffering *bool `json:"request_buffering,omitempty" yaml:"request_buffering,omitempty"` + ResponseBuffering *bool `json:"response_buffering,omitempty" yaml:"response_buffering,omitempty"` } // KongIngressUpstream contains KongIngress upstream configuration -// It contains the subset of go-kong.kong.Upstream fields supported by kongstate.Upstream.overrideByKongIngress +//+ It contains the subset of go-kong.kong.Upstream fields supported by kongstate.Upstream.overrideByKongIngress type KongIngressUpstream struct { - HostHeader *string `json:"host_header,omitempty" yaml:"host_header,omitempty"` - Algorithm *string `json:"algorithm,omitempty" yaml:"algorithm,omitempty"` + HostHeader *string `json:"host_header,omitempty" yaml:"host_header,omitempty"` + //+kubebuilder:validation:Enum=round-robin;consistent-hashing;least-connections + Algorithm *string `json:"algorithm,omitempty" yaml:"algorithm,omitempty"` + //+kubebuilder:validation:Minimum=10 Slots *int `json:"slots,omitempty" yaml:"slots,omitempty"` Healthchecks *kong.Healthcheck `json:"healthchecks,omitempty" yaml:"healthchecks,omitempty"` HashOn *string `json:"hash_on,omitempty" yaml:"hash_on,omitempty"` diff --git a/pkg/apis/configuration/v1/kongplugin_types.go b/pkg/apis/configuration/v1/kongplugin_types.go index 096ef2e461..bfe85aa106 100644 --- a/pkg/apis/configuration/v1/kongplugin_types.go +++ b/pkg/apis/configuration/v1/kongplugin_types.go @@ -62,7 +62,7 @@ type KongPlugin struct { // Protocols configures plugin to run on requests received on specific // protocols. - //+kubebuilder:validation:Enum=http;https;grpc;grpcs;tcp;tls;udp + //+ TODO Protocols needs to be a slice of an alias type to deal with https://github.com/kubernetes-sigs/controller-tools/issues/342 Protocols []string `json:"protocols,omitempty"` } From 3e5d5d7b6d91057576a33f3732f29198a237400d Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Mon, 25 Oct 2021 13:27:52 -0700 Subject: [PATCH 03/21] feat(crd) enable CRD generation Use kubebuilder-generated CRDs for all CRDs. Remove the hack to exclude some CRDs from generation. Rebuild manifests. --- Makefile | 3 +- ...uration.konghq.com_kongclusterplugins.yaml | 49 ++++- ...onfiguration.konghq.com_kongconsumers.yaml | 18 +- ...onfiguration.konghq.com_kongingresses.yaml | 70 ++++--- .../configuration.konghq.com_kongplugins.yaml | 52 ++++- ...configuration.konghq.com_tcpingresses.yaml | 1 - ...configuration.konghq.com_udpingresses.yaml | 1 - .../all-in-one-dbless-k4k8s-enterprise.yaml | 177 ++++++++++++------ deploy/single/all-in-one-dbless.yaml | 177 ++++++++++++------ .../all-in-one-postgres-enterprise.yaml | 177 ++++++++++++------ deploy/single/all-in-one-postgres.yaml | 177 ++++++++++++------ hack/generators/manifests/main.go | 168 ----------------- 12 files changed, 617 insertions(+), 453 deletions(-) delete mode 100644 hack/generators/manifests/main.go diff --git a/Makefile b/Makefile index 5ed4e7dcdc..e036e435e8 100644 --- a/Makefile +++ b/Makefile @@ -119,8 +119,7 @@ manifests: manifests.crds manifests.single .PHONY: manifests.crds manifests.crds: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. - $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=kong-ingress webhook paths="./..." output:crd:artifacts:config=build/config/crd/bases - go run hack/generators/manifests/main.go --input-directory build/config/crd/bases/ --output-directory config/crd/bases + $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=kong-ingress webhook paths="./..." output:crd:artifacts:config=config/crd/bases .PHONY: manifests.single manifests.single: kustomize ## Compose single-file deployment manifests from building blocks diff --git a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml index f197b5bcc5..fb07564b7e 100644 --- a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml @@ -1,6 +1,11 @@ + +--- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongclusterplugins.configuration.konghq.com spec: group: configuration.konghq.com @@ -11,7 +16,6 @@ spec: shortNames: - kcp singular: kongclusterplugin - preserveUnknownFields: false scope: Cluster versions: - additionalPrinterColumns: @@ -38,6 +42,11 @@ spec: openAPIV3Schema: description: KongClusterPlugin is the Schema for the kongclusterplugins API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string config: description: Config contains the plugin configuration. type: object @@ -45,13 +54,36 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string secretKeyRef: description: NamespacedSecretValueFromSource represents the source of a secret value specifying the secret namespace properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string key: description: the key containing the value type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string name: description: the secret containing the key type: string @@ -70,6 +102,13 @@ spec: disabled: description: Disabled set if the plugin is disabled or not type: boolean + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object plugin: description: PluginName is the name of the plugin to which to apply the config @@ -78,14 +117,6 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: - enum: - - http - - https - - grpc - - grpcs - - tcp - - tls - - udp type: string type: array run_on: diff --git a/config/crd/bases/configuration.konghq.com_kongconsumers.yaml b/config/crd/bases/configuration.konghq.com_kongconsumers.yaml index 1626375374..e20cb6ce66 100644 --- a/config/crd/bases/configuration.konghq.com_kongconsumers.yaml +++ b/config/crd/bases/configuration.konghq.com_kongconsumers.yaml @@ -1,6 +1,11 @@ + +--- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongconsumers.configuration.konghq.com spec: group: configuration.konghq.com @@ -11,7 +16,6 @@ spec: shortNames: - kc singular: kongconsumer - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: @@ -28,6 +32,11 @@ spec: openAPIV3Schema: description: KongConsumer is the Schema for the kongconsumers API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string credentials: description: Credentials are references to secrets containing a credential to be provisioned in Kong. @@ -38,6 +47,13 @@ spec: description: CustomID existing unique ID for the consumer - useful for mapping Kong with users in your existing database type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object username: description: Username unique username of the consumer. type: string diff --git a/config/crd/bases/configuration.konghq.com_kongingresses.yaml b/config/crd/bases/configuration.konghq.com_kongingresses.yaml index e4914b95a8..3c37fa0323 100644 --- a/config/crd/bases/configuration.konghq.com_kongingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_kongingresses.yaml @@ -1,6 +1,11 @@ + +--- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongingresses.configuration.konghq.com spec: group: configuration.konghq.com @@ -11,7 +16,6 @@ spec: shortNames: - ki singular: kongingress - preserveUnknownFields: false scope: Namespaced versions: - name: v1 @@ -19,14 +23,27 @@ spec: openAPIV3Schema: description: KongIngress is the Schema for the kongingresses API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object proxy: + description: KongIngressService contains KongIngress service configuration properties: - path: - type: string - pattern: ^/.*$ connect_timeout: minimum: 0 type: integer + path: + pattern: ^/.*$ + type: string protocol: enum: - http @@ -48,7 +65,7 @@ spec: type: integer type: object route: - description: Route represents a Route in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Route-object + description: KongIngressRoute contains KongIngress route configuration properties: headers: additionalProperties: @@ -71,25 +88,11 @@ spec: type: boolean protocols: items: - enum: - - http - - https - - grpc - - grpcs - - tcp - - tls - - udp type: string type: array regex_priority: type: integer request_buffering: - description: "Kong buffers requests and responses by default. Buffering - is not always desired, for instance if large payloads are being - proxied using HTTP 1.1 chunked encoding. \n The request and response - route buffering options are enabled by default and allow the user - to disable buffering if desired for their use case. \n SEE ALSO: - - https://github.com/Kong/kong/pull/6057 - https://docs.konghq.com/2.2.x/admin-api/#route-object" type: boolean response_buffering: type: boolean @@ -101,7 +104,7 @@ spec: type: boolean type: object upstream: - description: Upstream represents an Upstream in Kong. + description: KongIngressUpstream contains KongIngress upstream configuration properties: algorithm: enum: @@ -130,7 +133,6 @@ spec: probing. properties: concurrency: - minimum: 1 type: integer healthy: description: Healthy configures thresholds and HTTP status @@ -141,17 +143,17 @@ spec: type: integer type: array interval: - minimum: 0 type: integer successes: - minimum: 0 type: integer type: object http_path: - pattern: ^/.*$ type: string + https_sni: + type: string + https_verify_certificate: + type: boolean timeout: - minimum: 0 type: integer type: type: string @@ -160,20 +162,16 @@ spec: codes to mark targets unhealthy. properties: http_failures: - minimum: 0 type: integer http_statuses: items: type: integer type: array interval: - minimum: 0 type: integer tcp_failures: - minimum: 0 type: integer - timeout: - minimum: 0 + timeouts: type: integer type: object type: object @@ -190,36 +188,32 @@ spec: type: integer type: array interval: - minimum: 0 type: integer successes: - minimum: 0 type: integer type: object + type: + type: string unhealthy: description: Unhealthy configures thresholds and HTTP status codes to mark targets unhealthy. properties: http_failures: - minimum: 0 type: integer http_statuses: items: type: integer type: array interval: - minimum: 0 type: integer tcp_failures: - minimum: 0 type: integer - timeout: - minimum: 0 + timeouts: type: integer type: object type: object threshold: - type: integer + type: number type: object host_header: type: string diff --git a/config/crd/bases/configuration.konghq.com_kongplugins.yaml b/config/crd/bases/configuration.konghq.com_kongplugins.yaml index d4aac76035..b0de084443 100644 --- a/config/crd/bases/configuration.konghq.com_kongplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongplugins.yaml @@ -1,6 +1,11 @@ + +--- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongplugins.configuration.konghq.com spec: group: configuration.konghq.com @@ -11,7 +16,6 @@ spec: shortNames: - kp singular: kongplugin - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: @@ -38,6 +42,11 @@ spec: openAPIV3Schema: description: KongPlugin is the Schema for the kongplugins API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string config: description: Config contains the plugin configuration. type: object @@ -45,13 +54,36 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string secretKeyRef: description: SecretValueFromSource represents the source of a secret value properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string key: description: the key containing the value type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string name: description: the secret containing the key type: string @@ -60,9 +92,19 @@ spec: - name type: object type: object + consumerRef: + description: ConsumerRef is a reference to a particular consumer + type: string disabled: description: Disabled set if the plugin is disabled or not type: boolean + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object plugin: description: PluginName is the name of the plugin to which to apply the config @@ -71,14 +113,6 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: - enum: - - http - - https - - grpc - - grpcs - - tcp - - tls - - udp type: string type: array run_on: diff --git a/config/crd/bases/configuration.konghq.com_tcpingresses.yaml b/config/crd/bases/configuration.konghq.com_tcpingresses.yaml index 357c098b95..b6f6192bab 100644 --- a/config/crd/bases/configuration.konghq.com_tcpingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_tcpingresses.yaml @@ -14,7 +14,6 @@ spec: listKind: TCPIngressList plural: tcpingresses singular: tcpingress - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: diff --git a/config/crd/bases/configuration.konghq.com_udpingresses.yaml b/config/crd/bases/configuration.konghq.com_udpingresses.yaml index 33a41d73e2..e18e0b3e79 100644 --- a/config/crd/bases/configuration.konghq.com_udpingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_udpingresses.yaml @@ -14,7 +14,6 @@ spec: listKind: UDPIngressList plural: udpingresses singular: udpingress - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: diff --git a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml index d000133791..cb785da788 100644 --- a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml +++ b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml @@ -6,6 +6,9 @@ metadata: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongclusterplugins.configuration.konghq.com spec: group: configuration.konghq.com @@ -16,7 +19,6 @@ spec: shortNames: - kcp singular: kongclusterplugin - preserveUnknownFields: false scope: Cluster versions: - additionalPrinterColumns: @@ -43,6 +45,11 @@ spec: openAPIV3Schema: description: KongClusterPlugin is the Schema for the kongclusterplugins API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string config: description: Config contains the plugin configuration. type: object @@ -50,13 +57,36 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string secretKeyRef: description: NamespacedSecretValueFromSource represents the source of a secret value specifying the secret namespace properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string key: description: the key containing the value type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string name: description: the secret containing the key type: string @@ -75,6 +105,13 @@ spec: disabled: description: Disabled set if the plugin is disabled or not type: boolean + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object plugin: description: PluginName is the name of the plugin to which to apply the config @@ -83,14 +120,6 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: - enum: - - http - - https - - grpc - - grpcs - - tcp - - tls - - udp type: string type: array run_on: @@ -118,6 +147,9 @@ status: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongconsumers.configuration.konghq.com spec: group: configuration.konghq.com @@ -128,7 +160,6 @@ spec: shortNames: - kc singular: kongconsumer - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: @@ -145,6 +176,11 @@ spec: openAPIV3Schema: description: KongConsumer is the Schema for the kongconsumers API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string credentials: description: Credentials are references to secrets containing a credential to be provisioned in Kong. @@ -155,6 +191,13 @@ spec: description: CustomID existing unique ID for the consumer - useful for mapping Kong with users in your existing database type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object username: description: Username unique username of the consumer. type: string @@ -173,6 +216,9 @@ status: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongingresses.configuration.konghq.com spec: group: configuration.konghq.com @@ -183,7 +229,6 @@ spec: shortNames: - ki singular: kongingress - preserveUnknownFields: false scope: Namespaced versions: - name: v1 @@ -191,7 +236,20 @@ spec: openAPIV3Schema: description: KongIngress is the Schema for the kongingresses API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object proxy: + description: KongIngressService contains KongIngress service configuration properties: connect_timeout: minimum: 0 @@ -220,7 +278,7 @@ spec: type: integer type: object route: - description: Route represents a Route in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Route-object + description: KongIngressRoute contains KongIngress route configuration properties: headers: additionalProperties: @@ -243,25 +301,11 @@ spec: type: boolean protocols: items: - enum: - - http - - https - - grpc - - grpcs - - tcp - - tls - - udp type: string type: array regex_priority: type: integer request_buffering: - description: "Kong buffers requests and responses by default. Buffering - is not always desired, for instance if large payloads are being - proxied using HTTP 1.1 chunked encoding. \n The request and response - route buffering options are enabled by default and allow the user - to disable buffering if desired for their use case. \n SEE ALSO: - - https://github.com/Kong/kong/pull/6057 - https://docs.konghq.com/2.2.x/admin-api/#route-object" type: boolean response_buffering: type: boolean @@ -273,7 +317,7 @@ spec: type: boolean type: object upstream: - description: Upstream represents an Upstream in Kong. + description: KongIngressUpstream contains KongIngress upstream configuration properties: algorithm: enum: @@ -302,7 +346,6 @@ spec: probing. properties: concurrency: - minimum: 1 type: integer healthy: description: Healthy configures thresholds and HTTP status @@ -313,17 +356,17 @@ spec: type: integer type: array interval: - minimum: 0 type: integer successes: - minimum: 0 type: integer type: object http_path: - pattern: ^/.*$ type: string + https_sni: + type: string + https_verify_certificate: + type: boolean timeout: - minimum: 0 type: integer type: type: string @@ -332,20 +375,16 @@ spec: codes to mark targets unhealthy. properties: http_failures: - minimum: 0 type: integer http_statuses: items: type: integer type: array interval: - minimum: 0 type: integer tcp_failures: - minimum: 0 type: integer - timeout: - minimum: 0 + timeouts: type: integer type: object type: object @@ -362,36 +401,32 @@ spec: type: integer type: array interval: - minimum: 0 type: integer successes: - minimum: 0 type: integer type: object + type: + type: string unhealthy: description: Unhealthy configures thresholds and HTTP status codes to mark targets unhealthy. properties: http_failures: - minimum: 0 type: integer http_statuses: items: type: integer type: array interval: - minimum: 0 type: integer tcp_failures: - minimum: 0 type: integer - timeout: - minimum: 0 + timeouts: type: integer type: object type: object threshold: - type: integer + type: number type: object host_header: type: string @@ -414,6 +449,9 @@ status: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongplugins.configuration.konghq.com spec: group: configuration.konghq.com @@ -424,7 +462,6 @@ spec: shortNames: - kp singular: kongplugin - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: @@ -451,6 +488,11 @@ spec: openAPIV3Schema: description: KongPlugin is the Schema for the kongplugins API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string config: description: Config contains the plugin configuration. type: object @@ -458,13 +500,36 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string secretKeyRef: description: SecretValueFromSource represents the source of a secret value properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string key: description: the key containing the value type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string name: description: the secret containing the key type: string @@ -473,9 +538,19 @@ spec: - name type: object type: object + consumerRef: + description: ConsumerRef is a reference to a particular consumer + type: string disabled: description: Disabled set if the plugin is disabled or not type: boolean + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object plugin: description: PluginName is the name of the plugin to which to apply the config @@ -484,14 +559,6 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: - enum: - - http - - https - - grpc - - grpcs - - tcp - - tls - - udp type: string type: array run_on: @@ -530,7 +597,6 @@ spec: listKind: TCPIngressList plural: tcpingresses singular: tcpingress - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: @@ -717,7 +783,6 @@ spec: listKind: UDPIngressList plural: udpingresses singular: udpingress - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: diff --git a/deploy/single/all-in-one-dbless.yaml b/deploy/single/all-in-one-dbless.yaml index 81c7044500..5231e5e4ad 100644 --- a/deploy/single/all-in-one-dbless.yaml +++ b/deploy/single/all-in-one-dbless.yaml @@ -6,6 +6,9 @@ metadata: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongclusterplugins.configuration.konghq.com spec: group: configuration.konghq.com @@ -16,7 +19,6 @@ spec: shortNames: - kcp singular: kongclusterplugin - preserveUnknownFields: false scope: Cluster versions: - additionalPrinterColumns: @@ -43,6 +45,11 @@ spec: openAPIV3Schema: description: KongClusterPlugin is the Schema for the kongclusterplugins API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string config: description: Config contains the plugin configuration. type: object @@ -50,13 +57,36 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string secretKeyRef: description: NamespacedSecretValueFromSource represents the source of a secret value specifying the secret namespace properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string key: description: the key containing the value type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string name: description: the secret containing the key type: string @@ -75,6 +105,13 @@ spec: disabled: description: Disabled set if the plugin is disabled or not type: boolean + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object plugin: description: PluginName is the name of the plugin to which to apply the config @@ -83,14 +120,6 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: - enum: - - http - - https - - grpc - - grpcs - - tcp - - tls - - udp type: string type: array run_on: @@ -118,6 +147,9 @@ status: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongconsumers.configuration.konghq.com spec: group: configuration.konghq.com @@ -128,7 +160,6 @@ spec: shortNames: - kc singular: kongconsumer - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: @@ -145,6 +176,11 @@ spec: openAPIV3Schema: description: KongConsumer is the Schema for the kongconsumers API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string credentials: description: Credentials are references to secrets containing a credential to be provisioned in Kong. @@ -155,6 +191,13 @@ spec: description: CustomID existing unique ID for the consumer - useful for mapping Kong with users in your existing database type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object username: description: Username unique username of the consumer. type: string @@ -173,6 +216,9 @@ status: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongingresses.configuration.konghq.com spec: group: configuration.konghq.com @@ -183,7 +229,6 @@ spec: shortNames: - ki singular: kongingress - preserveUnknownFields: false scope: Namespaced versions: - name: v1 @@ -191,7 +236,20 @@ spec: openAPIV3Schema: description: KongIngress is the Schema for the kongingresses API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object proxy: + description: KongIngressService contains KongIngress service configuration properties: connect_timeout: minimum: 0 @@ -220,7 +278,7 @@ spec: type: integer type: object route: - description: Route represents a Route in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Route-object + description: KongIngressRoute contains KongIngress route configuration properties: headers: additionalProperties: @@ -243,25 +301,11 @@ spec: type: boolean protocols: items: - enum: - - http - - https - - grpc - - grpcs - - tcp - - tls - - udp type: string type: array regex_priority: type: integer request_buffering: - description: "Kong buffers requests and responses by default. Buffering - is not always desired, for instance if large payloads are being - proxied using HTTP 1.1 chunked encoding. \n The request and response - route buffering options are enabled by default and allow the user - to disable buffering if desired for their use case. \n SEE ALSO: - - https://github.com/Kong/kong/pull/6057 - https://docs.konghq.com/2.2.x/admin-api/#route-object" type: boolean response_buffering: type: boolean @@ -273,7 +317,7 @@ spec: type: boolean type: object upstream: - description: Upstream represents an Upstream in Kong. + description: KongIngressUpstream contains KongIngress upstream configuration properties: algorithm: enum: @@ -302,7 +346,6 @@ spec: probing. properties: concurrency: - minimum: 1 type: integer healthy: description: Healthy configures thresholds and HTTP status @@ -313,17 +356,17 @@ spec: type: integer type: array interval: - minimum: 0 type: integer successes: - minimum: 0 type: integer type: object http_path: - pattern: ^/.*$ type: string + https_sni: + type: string + https_verify_certificate: + type: boolean timeout: - minimum: 0 type: integer type: type: string @@ -332,20 +375,16 @@ spec: codes to mark targets unhealthy. properties: http_failures: - minimum: 0 type: integer http_statuses: items: type: integer type: array interval: - minimum: 0 type: integer tcp_failures: - minimum: 0 type: integer - timeout: - minimum: 0 + timeouts: type: integer type: object type: object @@ -362,36 +401,32 @@ spec: type: integer type: array interval: - minimum: 0 type: integer successes: - minimum: 0 type: integer type: object + type: + type: string unhealthy: description: Unhealthy configures thresholds and HTTP status codes to mark targets unhealthy. properties: http_failures: - minimum: 0 type: integer http_statuses: items: type: integer type: array interval: - minimum: 0 type: integer tcp_failures: - minimum: 0 type: integer - timeout: - minimum: 0 + timeouts: type: integer type: object type: object threshold: - type: integer + type: number type: object host_header: type: string @@ -414,6 +449,9 @@ status: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongplugins.configuration.konghq.com spec: group: configuration.konghq.com @@ -424,7 +462,6 @@ spec: shortNames: - kp singular: kongplugin - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: @@ -451,6 +488,11 @@ spec: openAPIV3Schema: description: KongPlugin is the Schema for the kongplugins API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string config: description: Config contains the plugin configuration. type: object @@ -458,13 +500,36 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string secretKeyRef: description: SecretValueFromSource represents the source of a secret value properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string key: description: the key containing the value type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string name: description: the secret containing the key type: string @@ -473,9 +538,19 @@ spec: - name type: object type: object + consumerRef: + description: ConsumerRef is a reference to a particular consumer + type: string disabled: description: Disabled set if the plugin is disabled or not type: boolean + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object plugin: description: PluginName is the name of the plugin to which to apply the config @@ -484,14 +559,6 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: - enum: - - http - - https - - grpc - - grpcs - - tcp - - tls - - udp type: string type: array run_on: @@ -530,7 +597,6 @@ spec: listKind: TCPIngressList plural: tcpingresses singular: tcpingress - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: @@ -717,7 +783,6 @@ spec: listKind: UDPIngressList plural: udpingresses singular: udpingress - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: diff --git a/deploy/single/all-in-one-postgres-enterprise.yaml b/deploy/single/all-in-one-postgres-enterprise.yaml index 008b7c7958..8207f2d8db 100644 --- a/deploy/single/all-in-one-postgres-enterprise.yaml +++ b/deploy/single/all-in-one-postgres-enterprise.yaml @@ -6,6 +6,9 @@ metadata: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongclusterplugins.configuration.konghq.com spec: group: configuration.konghq.com @@ -16,7 +19,6 @@ spec: shortNames: - kcp singular: kongclusterplugin - preserveUnknownFields: false scope: Cluster versions: - additionalPrinterColumns: @@ -43,6 +45,11 @@ spec: openAPIV3Schema: description: KongClusterPlugin is the Schema for the kongclusterplugins API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string config: description: Config contains the plugin configuration. type: object @@ -50,13 +57,36 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string secretKeyRef: description: NamespacedSecretValueFromSource represents the source of a secret value specifying the secret namespace properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string key: description: the key containing the value type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string name: description: the secret containing the key type: string @@ -75,6 +105,13 @@ spec: disabled: description: Disabled set if the plugin is disabled or not type: boolean + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object plugin: description: PluginName is the name of the plugin to which to apply the config @@ -83,14 +120,6 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: - enum: - - http - - https - - grpc - - grpcs - - tcp - - tls - - udp type: string type: array run_on: @@ -118,6 +147,9 @@ status: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongconsumers.configuration.konghq.com spec: group: configuration.konghq.com @@ -128,7 +160,6 @@ spec: shortNames: - kc singular: kongconsumer - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: @@ -145,6 +176,11 @@ spec: openAPIV3Schema: description: KongConsumer is the Schema for the kongconsumers API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string credentials: description: Credentials are references to secrets containing a credential to be provisioned in Kong. @@ -155,6 +191,13 @@ spec: description: CustomID existing unique ID for the consumer - useful for mapping Kong with users in your existing database type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object username: description: Username unique username of the consumer. type: string @@ -173,6 +216,9 @@ status: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongingresses.configuration.konghq.com spec: group: configuration.konghq.com @@ -183,7 +229,6 @@ spec: shortNames: - ki singular: kongingress - preserveUnknownFields: false scope: Namespaced versions: - name: v1 @@ -191,7 +236,20 @@ spec: openAPIV3Schema: description: KongIngress is the Schema for the kongingresses API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object proxy: + description: KongIngressService contains KongIngress service configuration properties: connect_timeout: minimum: 0 @@ -220,7 +278,7 @@ spec: type: integer type: object route: - description: Route represents a Route in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Route-object + description: KongIngressRoute contains KongIngress route configuration properties: headers: additionalProperties: @@ -243,25 +301,11 @@ spec: type: boolean protocols: items: - enum: - - http - - https - - grpc - - grpcs - - tcp - - tls - - udp type: string type: array regex_priority: type: integer request_buffering: - description: "Kong buffers requests and responses by default. Buffering - is not always desired, for instance if large payloads are being - proxied using HTTP 1.1 chunked encoding. \n The request and response - route buffering options are enabled by default and allow the user - to disable buffering if desired for their use case. \n SEE ALSO: - - https://github.com/Kong/kong/pull/6057 - https://docs.konghq.com/2.2.x/admin-api/#route-object" type: boolean response_buffering: type: boolean @@ -273,7 +317,7 @@ spec: type: boolean type: object upstream: - description: Upstream represents an Upstream in Kong. + description: KongIngressUpstream contains KongIngress upstream configuration properties: algorithm: enum: @@ -302,7 +346,6 @@ spec: probing. properties: concurrency: - minimum: 1 type: integer healthy: description: Healthy configures thresholds and HTTP status @@ -313,17 +356,17 @@ spec: type: integer type: array interval: - minimum: 0 type: integer successes: - minimum: 0 type: integer type: object http_path: - pattern: ^/.*$ type: string + https_sni: + type: string + https_verify_certificate: + type: boolean timeout: - minimum: 0 type: integer type: type: string @@ -332,20 +375,16 @@ spec: codes to mark targets unhealthy. properties: http_failures: - minimum: 0 type: integer http_statuses: items: type: integer type: array interval: - minimum: 0 type: integer tcp_failures: - minimum: 0 type: integer - timeout: - minimum: 0 + timeouts: type: integer type: object type: object @@ -362,36 +401,32 @@ spec: type: integer type: array interval: - minimum: 0 type: integer successes: - minimum: 0 type: integer type: object + type: + type: string unhealthy: description: Unhealthy configures thresholds and HTTP status codes to mark targets unhealthy. properties: http_failures: - minimum: 0 type: integer http_statuses: items: type: integer type: array interval: - minimum: 0 type: integer tcp_failures: - minimum: 0 type: integer - timeout: - minimum: 0 + timeouts: type: integer type: object type: object threshold: - type: integer + type: number type: object host_header: type: string @@ -414,6 +449,9 @@ status: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongplugins.configuration.konghq.com spec: group: configuration.konghq.com @@ -424,7 +462,6 @@ spec: shortNames: - kp singular: kongplugin - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: @@ -451,6 +488,11 @@ spec: openAPIV3Schema: description: KongPlugin is the Schema for the kongplugins API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string config: description: Config contains the plugin configuration. type: object @@ -458,13 +500,36 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string secretKeyRef: description: SecretValueFromSource represents the source of a secret value properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string key: description: the key containing the value type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string name: description: the secret containing the key type: string @@ -473,9 +538,19 @@ spec: - name type: object type: object + consumerRef: + description: ConsumerRef is a reference to a particular consumer + type: string disabled: description: Disabled set if the plugin is disabled or not type: boolean + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object plugin: description: PluginName is the name of the plugin to which to apply the config @@ -484,14 +559,6 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: - enum: - - http - - https - - grpc - - grpcs - - tcp - - tls - - udp type: string type: array run_on: @@ -530,7 +597,6 @@ spec: listKind: TCPIngressList plural: tcpingresses singular: tcpingress - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: @@ -717,7 +783,6 @@ spec: listKind: UDPIngressList plural: udpingresses singular: udpingress - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: diff --git a/deploy/single/all-in-one-postgres.yaml b/deploy/single/all-in-one-postgres.yaml index ffd1116a9f..b7425dce9c 100644 --- a/deploy/single/all-in-one-postgres.yaml +++ b/deploy/single/all-in-one-postgres.yaml @@ -6,6 +6,9 @@ metadata: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongclusterplugins.configuration.konghq.com spec: group: configuration.konghq.com @@ -16,7 +19,6 @@ spec: shortNames: - kcp singular: kongclusterplugin - preserveUnknownFields: false scope: Cluster versions: - additionalPrinterColumns: @@ -43,6 +45,11 @@ spec: openAPIV3Schema: description: KongClusterPlugin is the Schema for the kongclusterplugins API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string config: description: Config contains the plugin configuration. type: object @@ -50,13 +57,36 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string secretKeyRef: description: NamespacedSecretValueFromSource represents the source of a secret value specifying the secret namespace properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string key: description: the key containing the value type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string name: description: the secret containing the key type: string @@ -75,6 +105,13 @@ spec: disabled: description: Disabled set if the plugin is disabled or not type: boolean + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object plugin: description: PluginName is the name of the plugin to which to apply the config @@ -83,14 +120,6 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: - enum: - - http - - https - - grpc - - grpcs - - tcp - - tls - - udp type: string type: array run_on: @@ -118,6 +147,9 @@ status: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongconsumers.configuration.konghq.com spec: group: configuration.konghq.com @@ -128,7 +160,6 @@ spec: shortNames: - kc singular: kongconsumer - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: @@ -145,6 +176,11 @@ spec: openAPIV3Schema: description: KongConsumer is the Schema for the kongconsumers API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string credentials: description: Credentials are references to secrets containing a credential to be provisioned in Kong. @@ -155,6 +191,13 @@ spec: description: CustomID existing unique ID for the consumer - useful for mapping Kong with users in your existing database type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object username: description: Username unique username of the consumer. type: string @@ -173,6 +216,9 @@ status: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongingresses.configuration.konghq.com spec: group: configuration.konghq.com @@ -183,7 +229,6 @@ spec: shortNames: - ki singular: kongingress - preserveUnknownFields: false scope: Namespaced versions: - name: v1 @@ -191,7 +236,20 @@ spec: openAPIV3Schema: description: KongIngress is the Schema for the kongingresses API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object proxy: + description: KongIngressService contains KongIngress service configuration properties: connect_timeout: minimum: 0 @@ -220,7 +278,7 @@ spec: type: integer type: object route: - description: Route represents a Route in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Route-object + description: KongIngressRoute contains KongIngress route configuration properties: headers: additionalProperties: @@ -243,25 +301,11 @@ spec: type: boolean protocols: items: - enum: - - http - - https - - grpc - - grpcs - - tcp - - tls - - udp type: string type: array regex_priority: type: integer request_buffering: - description: "Kong buffers requests and responses by default. Buffering - is not always desired, for instance if large payloads are being - proxied using HTTP 1.1 chunked encoding. \n The request and response - route buffering options are enabled by default and allow the user - to disable buffering if desired for their use case. \n SEE ALSO: - - https://github.com/Kong/kong/pull/6057 - https://docs.konghq.com/2.2.x/admin-api/#route-object" type: boolean response_buffering: type: boolean @@ -273,7 +317,7 @@ spec: type: boolean type: object upstream: - description: Upstream represents an Upstream in Kong. + description: KongIngressUpstream contains KongIngress upstream configuration properties: algorithm: enum: @@ -302,7 +346,6 @@ spec: probing. properties: concurrency: - minimum: 1 type: integer healthy: description: Healthy configures thresholds and HTTP status @@ -313,17 +356,17 @@ spec: type: integer type: array interval: - minimum: 0 type: integer successes: - minimum: 0 type: integer type: object http_path: - pattern: ^/.*$ type: string + https_sni: + type: string + https_verify_certificate: + type: boolean timeout: - minimum: 0 type: integer type: type: string @@ -332,20 +375,16 @@ spec: codes to mark targets unhealthy. properties: http_failures: - minimum: 0 type: integer http_statuses: items: type: integer type: array interval: - minimum: 0 type: integer tcp_failures: - minimum: 0 type: integer - timeout: - minimum: 0 + timeouts: type: integer type: object type: object @@ -362,36 +401,32 @@ spec: type: integer type: array interval: - minimum: 0 type: integer successes: - minimum: 0 type: integer type: object + type: + type: string unhealthy: description: Unhealthy configures thresholds and HTTP status codes to mark targets unhealthy. properties: http_failures: - minimum: 0 type: integer http_statuses: items: type: integer type: array interval: - minimum: 0 type: integer tcp_failures: - minimum: 0 type: integer - timeout: - minimum: 0 + timeouts: type: integer type: object type: object threshold: - type: integer + type: number type: object host_header: type: string @@ -414,6 +449,9 @@ status: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null name: kongplugins.configuration.konghq.com spec: group: configuration.konghq.com @@ -424,7 +462,6 @@ spec: shortNames: - kp singular: kongplugin - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: @@ -451,6 +488,11 @@ spec: openAPIV3Schema: description: KongPlugin is the Schema for the kongplugins API properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string config: description: Config contains the plugin configuration. type: object @@ -458,13 +500,36 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string secretKeyRef: description: SecretValueFromSource represents the source of a secret value properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string key: description: the key containing the value type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string name: description: the secret containing the key type: string @@ -473,9 +538,19 @@ spec: - name type: object type: object + consumerRef: + description: ConsumerRef is a reference to a particular consumer + type: string disabled: description: Disabled set if the plugin is disabled or not type: boolean + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object plugin: description: PluginName is the name of the plugin to which to apply the config @@ -484,14 +559,6 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: - enum: - - http - - https - - grpc - - grpcs - - tcp - - tls - - udp type: string type: array run_on: @@ -530,7 +597,6 @@ spec: listKind: TCPIngressList plural: tcpingresses singular: tcpingress - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: @@ -717,7 +783,6 @@ spec: listKind: UDPIngressList plural: udpingresses singular: udpingress - preserveUnknownFields: false scope: Namespaced versions: - additionalPrinterColumns: diff --git a/hack/generators/manifests/main.go b/hack/generators/manifests/main.go deleted file mode 100644 index 06ab3b5111..0000000000 --- a/hack/generators/manifests/main.go +++ /dev/null @@ -1,168 +0,0 @@ -package main - -import ( - "bytes" - "flag" - "fmt" - "os" - "os/exec" - "path/filepath" - "strings" - - v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - "sigs.k8s.io/yaml" -) - -// ----------------------------------------------------------------------------- -// This script exists as a workaround for some problems which came up between -// v1 and v2 of the KIC regarding upgrading and generating CRDs: -// -// 1. upgrades from v1beta1 CRD to v1 needed a fix for a backwards incompatible -// change made in upstream that makes "preserveUnknownFields" no longer usable -// in the same form that it previously was -// 2. controller-gen automatic generation of CRDs did not work out of the box for -// some of our complex "Kong" resources, and so this script has a list -// of types to filter out as we're still manually managing those CRDs -// -// ----------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------- -// Details on CRD v1's "PreserveUnknownFields" -// -// In the v1beta1 version of the API a field called "preserveUnknownFields" was -// used to trigger pruning for API fields that are sent in the request payload -// but not a valid part of the API. In v1 this field is effectively deprecated -// and MUST be set to false: -// -// https://github.com/kubernetes/kubernetes/pull/93078 -// -// Problematically: even though validation enforces the "false" setting of this -// deprecated attribute for v1 CRDs, the previous default was "true" in v1beta1 -// and if you try to apply a v1 CRD that does NOT have this field set where a -// v1beta1 version of the CRD already exists on the cluster this can result in -// and error and fail to upgrade the CRD. -// -// This program accounts for this by applying "preserveUnknownFields: false" to -// any v1 CustomResourceDefinition to work around the upstream backwards -// incompatibility issue automatically. -// -// NOTE: When this was first written using controller-gen configuration options -// and kubebuilder flags on the API types was attempted but none of these -// things could produce the right result. -// -// The controller-gen CLI can't really do it (easily) because the default -// behavior of the marshaller in sigs.k8s.io/yaml is to not emit optional -// boolean fields to YAML if they're set to false. 😑 -// -// It's quite possible there's a better way to do this and if you find one -// we encourage you to put in a PR and replace this. -// -// ----------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------- -// Vars -// ----------------------------------------------------------------------------- - -var ( - // inputDir that will be used for walking the filesystem to find CRDs. - inputDir string - - // outputDir is where this script will emit completed CRDs - outputDir string - - // patchfile is the patch that will be used for each CRD file - patchfile = "config/crd/patches/upgrade_compat.yaml" - - // excludedTypes is the list of API types which we DON'T want to automatically - // generate CRDs for, as those CRDs are currently manually maintained. - excludedTypes = [4]string{ - "KongClusterPlugin", - "KongPlugin", - "KongConsumer", - "KongIngress", - } -) - -// ----------------------------------------------------------------------------- -// Main -// ----------------------------------------------------------------------------- - -func main() { - // handle arguments - flag.StringVar(&inputDir, "input-directory", ".", "which directory to find CRDs in") - flag.StringVar(&outputDir, "output-directory", ".", "which directory to emit completed CRDs to") - flag.Parse() - - // find all the YAML CRDs in the provided directory and patch them - if err := filepath.Walk(inputDir, processFile); err != nil { - fmt.Fprintf(os.Stderr, "Error processing files in %s: %s\n", inputDir, err) - os.Exit(1) - } -} - -func processFile(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - - if info.IsDir() { - return nil - } - - // filter out any files that don't identify themselves as YAML files via file extensions - if !strings.HasSuffix(info.Name(), ".yaml") && !strings.HasSuffix(info.Name(), ".yml") { - return nil - } - - // read in the file contents - b, err := os.ReadFile(path) - if err != nil { - return err - } - - // filter out any YAML files that don't contain a v1.CustomResourceDefinition - if !bytes.Contains(b, []byte(`kind: CustomResourceDefinition`)) || !bytes.Contains(b, []byte(`apiVersion: apiextensions.k8s.io/v1`)) { - return nil - } - - // don't allow files that contain multiple objects (controller-gen wont be configured to emit these anyway) - yamlCRDs := bytes.Split(b, []byte(`\n---\n`)) - if len(yamlCRDs) > 1 { - return fmt.Errorf("file %s contained multiple objects (%d) which this script doesn't yet support", path, len(yamlCRDs)) - } - - // filter out YAML files for CRDs we specifically want to exclude from automatic generation - for _, excludedType := range excludedTypes { - // check whether the excluded type is even present - if bytes.Contains(b, []byte(excludedType)) { - // the excluded type is present in this file, marshal it into YAML - crd := v1.CustomResourceDefinition{} - if err := yaml.Unmarshal(b, &crd); err != nil { - return err - } - if crd.Spec.Names.Kind == excludedType { - return nil - } - } - } - - // generate a patch command to ensure "preserveUnknownFields" is set to false - stdout, stderr := new(bytes.Buffer), new(bytes.Buffer) - patchCMD := exec.Command("kubectl", "patch", "--type", "merge", "--local", "-o", "yaml", "-f", path, "--patch-file", patchfile) - patchCMD.Stdout = stdout - patchCMD.Stderr = stderr - - // run the patcher and make sure there are no errors - if err := patchCMD.Run(); err != nil { - return fmt.Errorf("failed to patch crd in %s: %w; STDOUT=(%s) STDERR=(%s)", - path, err, strings.TrimSpace(stdout.String()), strings.TrimSpace(stderr.String()), - ) - } - - // controller-gen will add a YAML delimiter in the header, so we match that for consistency - patchedCRD := append([]byte("\n---\n"), stdout.Bytes()...) - - // write the patched CRD back to the original file - outputPath := fmt.Sprintf("%s/%s", outputDir, info.Name()) - return os.WriteFile(outputPath, patchedCRD, info.Mode().Perm()) -} From 6767815fa423cf2fc6830432fedfdeb75eb3a0a0 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Mon, 25 Oct 2021 15:15:52 -0700 Subject: [PATCH 04/21] feat(parser) set route buffering defaults Set route request and response buffering settings to their default values on the base route. This avoids spurious diff detection when comparing desired routes against admin API objects. --- internal/parser/parser_test.go | 285 +++++++++++++++++------------- internal/parser/translate.go | 70 ++++---- internal/parser/translate_test.go | 32 ++-- 3 files changed, 219 insertions(+), 168 deletions(-) diff --git a/internal/parser/parser_test.go b/internal/parser/parser_test.go index f6cfbb7fcf..a99746bf8b 100644 --- a/internal/parser/parser_test.go +++ b/internal/parser/parser_test.go @@ -1174,13 +1174,15 @@ func TestKongRouteAnnotations(t *testing.T) { assert.Equal(1, len(state.Services[0].Routes), "expected one route to be rendered") assert.Equal(kong.Route{ - Name: kong.String("default.bar.00"), - StripPath: kong.Bool(true), - Hosts: kong.StringSlice("example.com"), - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), - RegexPriority: kong.Int(0), + Name: kong.String("default.bar.00"), + StripPath: kong.Bool(true), + Hosts: kong.StringSlice("example.com"), + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), }, state.Services[0].Routes[0].Route) }) t.Run("strip-path annotation is correctly processed (false)", func(t *testing.T) { @@ -1251,13 +1253,15 @@ func TestKongRouteAnnotations(t *testing.T) { assert.Equal(1, len(state.Services[0].Routes), "expected one route to be rendered") assert.Equal(kong.Route{ - Name: kong.String("default.bar.00"), - StripPath: kong.Bool(false), - Hosts: kong.StringSlice("example.com"), - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), - RegexPriority: kong.Int(0), + Name: kong.String("default.bar.00"), + StripPath: kong.Bool(false), + Hosts: kong.StringSlice("example.com"), + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), }, state.Services[0].Routes[0].Route) }) t.Run("https-redirect-status-code annotation is correctly processed", @@ -1337,6 +1341,8 @@ func TestKongRouteAnnotations(t *testing.T) { Paths: kong.StringSlice("/"), Protocols: kong.StringSlice("http", "https"), RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), }, state.Services[0].Routes[0].Route) }) t.Run("bad https-redirect-status-code annotation is ignored", @@ -1408,13 +1414,15 @@ func TestKongRouteAnnotations(t *testing.T) { assert.Equal(1, len(state.Services[0].Routes), "expected one route to be rendered") assert.Equal(kong.Route{ - Name: kong.String("default.bar.00"), - StripPath: kong.Bool(false), - Hosts: kong.StringSlice("example.com"), - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), - RegexPriority: kong.Int(0), + Name: kong.String("default.bar.00"), + StripPath: kong.Bool(false), + Hosts: kong.StringSlice("example.com"), + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), }, state.Services[0].Routes[0].Route) }) t.Run("preserve-host annotation is correctly processed", @@ -1486,13 +1494,15 @@ func TestKongRouteAnnotations(t *testing.T) { assert.Equal(1, len(state.Services[0].Routes), "expected one route to be rendered") assert.Equal(kong.Route{ - Name: kong.String("default.bar.00"), - StripPath: kong.Bool(false), - Hosts: kong.StringSlice("example.com"), - PreserveHost: kong.Bool(false), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), - RegexPriority: kong.Int(0), + Name: kong.String("default.bar.00"), + StripPath: kong.Bool(false), + Hosts: kong.StringSlice("example.com"), + PreserveHost: kong.Bool(false), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), }, state.Services[0].Routes[0].Route) }) t.Run("preserve-host annotation with random string is correctly processed", @@ -1564,13 +1574,15 @@ func TestKongRouteAnnotations(t *testing.T) { assert.Equal(1, len(state.Services[0].Routes), "expected one route to be rendered") assert.Equal(kong.Route{ - Name: kong.String("default.bar.00"), - StripPath: kong.Bool(false), - Hosts: kong.StringSlice("example.com"), - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), - RegexPriority: kong.Int(0), + Name: kong.String("default.bar.00"), + StripPath: kong.Bool(false), + Hosts: kong.StringSlice("example.com"), + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), }, state.Services[0].Routes[0].Route) }) t.Run("regex-priority annotation is correctly processed", @@ -1642,13 +1654,15 @@ func TestKongRouteAnnotations(t *testing.T) { assert.Equal(1, len(state.Services[0].Routes), "expected one route to be rendered") assert.Equal(kong.Route{ - Name: kong.String("default.bar.00"), - StripPath: kong.Bool(false), - RegexPriority: kong.Int(10), - Hosts: kong.StringSlice("example.com"), - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), + Name: kong.String("default.bar.00"), + StripPath: kong.Bool(false), + RegexPriority: kong.Int(10), + Hosts: kong.StringSlice("example.com"), + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), }, state.Services[0].Routes[0].Route) }) t.Run("non-integer regex-priority annotation is ignored", @@ -1720,13 +1734,15 @@ func TestKongRouteAnnotations(t *testing.T) { assert.Equal(1, len(state.Services[0].Routes), "expected one route to be rendered") assert.Equal(kong.Route{ - Name: kong.String("default.bar.00"), - StripPath: kong.Bool(false), - RegexPriority: kong.Int(0), - Hosts: kong.StringSlice("example.com"), - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), + Name: kong.String("default.bar.00"), + StripPath: kong.Bool(false), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), + Hosts: kong.StringSlice("example.com"), + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), }, state.Services[0].Routes[0].Route) }) t.Run("route buffering options are processed (true)", func(t *testing.T) { @@ -1937,10 +1953,11 @@ func TestKongRouteAnnotations(t *testing.T) { assert.Nil(err) assert.NotNil(state) + kongTrue := kong.Bool(true) assert.Equal(1, len(state.Services), "expected one service to be rendered") assert.Equal(1, len(state.Services[0].Routes), "expected one route to be rendered") - assert.Empty(state.Services[0].Routes[0].Route.RequestBuffering) - assert.Empty(state.Services[0].Routes[0].Route.ResponseBuffering) + assert.Equal(kongTrue, state.Services[0].Routes[0].Route.RequestBuffering) + assert.Equal(kongTrue, state.Services[0].Routes[0].Route.ResponseBuffering) }) } @@ -2384,13 +2401,15 @@ func TestKnativeIngressAndPlugins(t *testing.T) { assert.Equal(1, len(svc.Routes), "expected one route to be rendered") assert.Equal(kong.Route{ - Name: kong.String("foo-ns.knative-ingress.00"), - StripPath: kong.Bool(false), - Hosts: kong.StringSlice("my-func.example.com"), - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), - RegexPriority: kong.Int(0), + Name: kong.String("foo-ns.knative-ingress.00"), + StripPath: kong.Bool(false), + Hosts: kong.StringSlice("my-func.example.com"), + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), }, svc.Routes[0].Route) assert.Equal(1, len(state.Plugins), "expected one key-auth plugin") @@ -2480,13 +2499,15 @@ func TestKongServiceAnnotations(t *testing.T) { assert.Equal(1, len(state.Services[0].Routes), "expected one route to be rendered") assert.Equal(kong.Route{ - Name: kong.String("default.bar.00"), - StripPath: kong.Bool(false), - Hosts: kong.StringSlice("example.com"), - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), - RegexPriority: kong.Int(0), + Name: kong.String("default.bar.00"), + StripPath: kong.Bool(false), + Hosts: kong.StringSlice("example.com"), + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), }, state.Services[0].Routes[0].Route) }) @@ -2567,13 +2588,15 @@ func TestKongServiceAnnotations(t *testing.T) { assert.Equal(1, len(state.Services[0].Routes), "expected one route to be rendered") assert.Equal(kong.Route{ - Name: kong.String("default.bar.00"), - StripPath: kong.Bool(false), - Hosts: kong.StringSlice("example.com"), - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), - RegexPriority: kong.Int(0), + Name: kong.String("default.bar.00"), + StripPath: kong.Bool(false), + Hosts: kong.StringSlice("example.com"), + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), }, state.Services[0].Routes[0].Route) }) @@ -2646,14 +2669,16 @@ func TestKongServiceAnnotations(t *testing.T) { assert.Equal(1, len(state.Services[0].Routes), "expected one route to be rendered") assert.Equal(kong.Route{ - Name: kong.String("default.bar.00"), - StripPath: kong.Bool(false), - RegexPriority: kong.Int(0), - Hosts: kong.StringSlice("example.com"), - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), - Methods: kong.StringSlice("POST", "GET"), + Name: kong.String("default.bar.00"), + StripPath: kong.Bool(false), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), + Hosts: kong.StringSlice("example.com"), + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), + Methods: kong.StringSlice("POST", "GET"), }, state.Services[0].Routes[0].Route) }) } @@ -3073,23 +3098,27 @@ func TestParserSNI(t *testing.T) { assert.Nil(err) assert.NotNil(state) assert.Equal(kong.Route{ - Name: kong.String("default.foo.00"), - StripPath: kong.Bool(false), - RegexPriority: kong.Int(0), - Hosts: kong.StringSlice("example.com"), - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), + Name: kong.String("default.foo.00"), + StripPath: kong.Bool(false), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), + Hosts: kong.StringSlice("example.com"), + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), }, state.Services[0].Routes[0].Route) assert.Equal(kong.Route{ - Name: kong.String("default.foo.10"), - StripPath: kong.Bool(false), - RegexPriority: kong.Int(0), - Hosts: kong.StringSlice("*.example.com"), - SNIs: nil, - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), + Name: kong.String("default.foo.10"), + StripPath: kong.Bool(false), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), + Hosts: kong.StringSlice("*.example.com"), + SNIs: nil, + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), }, state.Services[0].Routes[1].Route) }) t.Run("route does not include SNI when TLS info absent", func(t *testing.T) { @@ -3133,14 +3162,16 @@ func TestParserSNI(t *testing.T) { assert.Nil(err) assert.NotNil(state) assert.Equal(kong.Route{ - Name: kong.String("default.foo.00"), - StripPath: kong.Bool(false), - RegexPriority: kong.Int(0), - Hosts: kong.StringSlice("example.com"), - SNIs: nil, - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), + Name: kong.String("default.foo.00"), + StripPath: kong.Bool(false), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), + Hosts: kong.StringSlice("example.com"), + SNIs: nil, + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), }, state.Services[0].Routes[0].Route) }) } @@ -3190,13 +3221,15 @@ func TestParserHostAliases(t *testing.T) { assert.Nil(err) assert.NotNil(state) assert.Equal(kong.Route{ - Name: kong.String("default.foo.00"), - StripPath: kong.Bool(false), - RegexPriority: kong.Int(0), - Hosts: kong.StringSlice("example.com", "*.example.com", "*.sample.com", "*.illustration.com"), - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), + Name: kong.String("default.foo.00"), + StripPath: kong.Bool(false), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), + Hosts: kong.StringSlice("example.com", "*.example.com", "*.sample.com", "*.illustration.com"), + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), }, state.Services[0].Routes[0].Route) }) t.Run("route Hosts remain unmodified when Host-Aliases are not present", func(t *testing.T) { @@ -3240,13 +3273,15 @@ func TestParserHostAliases(t *testing.T) { assert.Nil(err) assert.NotNil(state) assert.Equal(kong.Route{ - Name: kong.String("default.foo.00"), - StripPath: kong.Bool(false), - RegexPriority: kong.Int(0), - Hosts: kong.StringSlice("example.com"), - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), + Name: kong.String("default.foo.00"), + StripPath: kong.Bool(false), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), + Hosts: kong.StringSlice("example.com"), + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), }, state.Services[0].Routes[0].Route) }) t.Run("route Hosts will not contain duplicates when Host-Aliases duplicates the host", func(t *testing.T) { @@ -3291,13 +3326,15 @@ func TestParserHostAliases(t *testing.T) { assert.Nil(err) assert.NotNil(state) assert.Equal(kong.Route{ - Name: kong.String("default.foo.00"), - StripPath: kong.Bool(false), - RegexPriority: kong.Int(0), - Hosts: kong.StringSlice("example.com", "*.example.com"), - PreserveHost: kong.Bool(true), - Paths: kong.StringSlice("/"), - Protocols: kong.StringSlice("http", "https"), + Name: kong.String("default.foo.00"), + StripPath: kong.Bool(false), + RegexPriority: kong.Int(0), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), + Hosts: kong.StringSlice("example.com", "*.example.com"), + PreserveHost: kong.Bool(true), + Paths: kong.StringSlice("/"), + Protocols: kong.StringSlice("http", "https"), }, state.Services[0].Routes[0].Route) }) } diff --git a/internal/parser/translate.go b/internal/parser/translate.go index 03d8993ecc..4791256f5f 100644 --- a/internal/parser/translate.go +++ b/internal/parser/translate.go @@ -73,12 +73,14 @@ func fromIngressV1beta1(log logrus.FieldLogger, ingressList []*networkingv1beta1 // 2. Is it guaranteed that the order is stable? // Meaning, the routes will always appear in the same // order? - Name: kong.String(fmt.Sprintf("%s.%s.%d%d", ingress.Namespace, ingress.Name, i, j)), - Paths: kong.StringSlice(path), - StripPath: kong.Bool(false), - PreserveHost: kong.Bool(true), - Protocols: kong.StringSlice("http", "https"), - RegexPriority: kong.Int(0), + Name: kong.String(fmt.Sprintf("%s.%s.%d%d", ingress.Namespace, ingress.Name, i, j)), + Paths: kong.StringSlice(path), + StripPath: kong.Bool(false), + PreserveHost: kong.Bool(true), + Protocols: kong.StringSlice("http", "https"), + RegexPriority: kong.Int(0), + RequestBuffering: kong.Bool(true), + ResponseBuffering: kong.Bool(true), }, } if host != "" { @@ -154,12 +156,14 @@ func fromIngressV1beta1(log logrus.FieldLogger, ingressList []*networkingv1beta1 r := kongstate.Route{ Ingress: util.FromK8sObject(&ingress), Route: kong.Route{ - Name: kong.String(ingress.Namespace + "." + ingress.Name), - Paths: kong.StringSlice("/"), - StripPath: kong.Bool(false), - PreserveHost: kong.Bool(true), - Protocols: kong.StringSlice("http", "https"), - RegexPriority: kong.Int(0), + Name: kong.String(ingress.Namespace + "." + ingress.Name), + Paths: kong.StringSlice("/"), + StripPath: kong.Bool(false), + PreserveHost: kong.Bool(true), + Protocols: kong.StringSlice("http", "https"), + RegexPriority: kong.Int(0), + RequestBuffering: kong.Bool(true), + ResponseBuffering: kong.Bool(true), }, } service.Routes = append(service.Routes, r) @@ -223,12 +227,14 @@ func fromIngressV1(log logrus.FieldLogger, ingressList []*networkingv1.Ingress) // 2. Is it guaranteed that the order is stable? // Meaning, the routes will always appear in the same // order? - Name: kong.String(fmt.Sprintf("%s.%s.%d%d", ingress.Namespace, ingress.Name, i, j)), - Paths: paths, - StripPath: kong.Bool(false), - PreserveHost: kong.Bool(true), - Protocols: kong.StringSlice("http", "https"), - RegexPriority: kong.Int(priorityForPath[pathType]), + Name: kong.String(fmt.Sprintf("%s.%s.%d%d", ingress.Namespace, ingress.Name, i, j)), + Paths: paths, + StripPath: kong.Bool(false), + PreserveHost: kong.Bool(true), + Protocols: kong.StringSlice("http", "https"), + RegexPriority: kong.Int(priorityForPath[pathType]), + RequestBuffering: kong.Bool(true), + ResponseBuffering: kong.Bool(true), }, } if rule.Host != "" { @@ -301,12 +307,14 @@ func fromIngressV1(log logrus.FieldLogger, ingressList []*networkingv1.Ingress) r := kongstate.Route{ Ingress: util.FromK8sObject(&ingress), Route: kong.Route{ - Name: kong.String(ingress.Namespace + "." + ingress.Name), - Paths: kong.StringSlice("/"), - StripPath: kong.Bool(false), - PreserveHost: kong.Bool(true), - Protocols: kong.StringSlice("http", "https"), - RegexPriority: kong.Int(0), + Name: kong.String(ingress.Namespace + "." + ingress.Name), + Paths: kong.StringSlice("/"), + StripPath: kong.Bool(false), + PreserveHost: kong.Bool(true), + Protocols: kong.StringSlice("http", "https"), + RegexPriority: kong.Int(0), + RequestBuffering: kong.Bool(true), + ResponseBuffering: kong.Bool(true), }, } service.Routes = append(service.Routes, r) @@ -511,12 +519,14 @@ func fromKnativeIngress(log logrus.FieldLogger, ingressList []*knative.Ingress) // 2. Is it guaranteed that the order is stable? // Meaning, the routes will always appear in the same // order? - Name: kong.String(fmt.Sprintf("%s.%s.%d%d", ingress.Namespace, ingress.Name, i, j)), - Paths: kong.StringSlice(path), - StripPath: kong.Bool(false), - PreserveHost: kong.Bool(true), - Protocols: kong.StringSlice("http", "https"), - RegexPriority: kong.Int(0), + Name: kong.String(fmt.Sprintf("%s.%s.%d%d", ingress.Namespace, ingress.Name, i, j)), + Paths: kong.StringSlice(path), + StripPath: kong.Bool(false), + PreserveHost: kong.Bool(true), + Protocols: kong.StringSlice("http", "https"), + RegexPriority: kong.Int(0), + RequestBuffering: kong.Bool(true), + ResponseBuffering: kong.Bool(true), }, } r.Hosts = kong.StringSlice(hosts...) diff --git a/internal/parser/translate_test.go b/internal/parser/translate_test.go index 24a2b90ffd..3fa55c2d95 100644 --- a/internal/parser/translate_test.go +++ b/internal/parser/translate_test.go @@ -1022,13 +1022,15 @@ func TestFromKnativeIngress(t *testing.T) { Retries: kong.Int(5), }, svc.Service) assert.Equal(kong.Route{ - Name: kong.String("foo-namespace.foo.00"), - RegexPriority: kong.Int(0), - StripPath: kong.Bool(false), - Paths: kong.StringSlice("/"), - PreserveHost: kong.Bool(true), - Protocols: kong.StringSlice("http", "https"), - Hosts: kong.StringSlice("my-func.example.com"), + Name: kong.String("foo-namespace.foo.00"), + RegexPriority: kong.Int(0), + StripPath: kong.Bool(false), + Paths: kong.StringSlice("/"), + PreserveHost: kong.Bool(true), + Protocols: kong.StringSlice("http", "https"), + Hosts: kong.StringSlice("my-func.example.com"), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), }, svc.Routes[0].Route) assert.Equal(kong.Plugin{ Name: kong.String("request-transformer"), @@ -1065,13 +1067,15 @@ func TestFromKnativeIngress(t *testing.T) { Retries: kong.Int(5), }, svc.Service) assert.Equal(kong.Route{ - Name: kong.String("foo-namespace.foo.00"), - RegexPriority: kong.Int(0), - StripPath: kong.Bool(false), - Paths: kong.StringSlice("/"), - PreserveHost: kong.Bool(true), - Protocols: kong.StringSlice("http", "https"), - Hosts: kong.StringSlice("my-func.example.com"), + Name: kong.String("foo-namespace.foo.00"), + RegexPriority: kong.Int(0), + StripPath: kong.Bool(false), + Paths: kong.StringSlice("/"), + PreserveHost: kong.Bool(true), + Protocols: kong.StringSlice("http", "https"), + Hosts: kong.StringSlice("my-func.example.com"), + ResponseBuffering: kong.Bool(true), + RequestBuffering: kong.Bool(true), }, svc.Routes[0].Route) assert.Equal(kong.Plugin{ Name: kong.String("request-transformer"), From 6f2b022c50b76fcb9912311c796b7358c2f2846c Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Mon, 25 Oct 2021 15:17:34 -0700 Subject: [PATCH 05/21] test(knative) remove log line Remove log line that prints status information each test run. The status can be roughly inferred from the test's success or failure. --- test/integration/knative_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/test/integration/knative_test.go b/test/integration/knative_test.go index ab121c4057..456db50fd9 100644 --- a/test/integration/knative_test.go +++ b/test/integration/knative_test.go @@ -166,7 +166,6 @@ func accessKnativeSrv(ctx context.Context, proxy, nsn string, t *testing.T) bool return assert.Eventually(t, func() bool { resp, err := client.Do(req) - t.Logf("resp <%v> ", resp.StatusCode) if err != nil { return false } From 680c03aefa20801cd4caaead83493c0abcd85996 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Mon, 25 Oct 2021 15:29:43 -0700 Subject: [PATCH 06/21] feat(crd) add protocol type Add a string alias KongProtocol type to allow enumerating allowed protocols within lists. Regenerate manifests. --- ...uration.konghq.com_kongclusterplugins.yaml | 8 +++++ ...onfiguration.konghq.com_kongingresses.yaml | 8 +++++ .../configuration.konghq.com_kongplugins.yaml | 8 +++++ .../all-in-one-dbless-k4k8s-enterprise.yaml | 24 +++++++++++++ deploy/single/all-in-one-dbless.yaml | 24 +++++++++++++ .../all-in-one-postgres-enterprise.yaml | 24 +++++++++++++ deploy/single/all-in-one-postgres.yaml | 24 +++++++++++++ internal/admission/validator.go | 2 +- internal/kongstate/route.go | 2 +- internal/kongstate/route_test.go | 8 ++--- internal/kongstate/util.go | 17 +++++++--- internal/kongstate/util_test.go | 20 +++++------ internal/parser/parser_test.go | 34 +++++++++---------- .../v1/kongclusterplugin_types.go | 3 +- .../configuration/v1/kongingress_types.go | 16 ++++----- pkg/apis/configuration/v1/kongplugin_types.go | 3 +- .../configuration/v1/kongprotocol_types.go | 31 +++++++++++++++++ .../configuration/v1/zz_generated.deepcopy.go | 8 ++--- test/integration/kongingress_test.go | 2 +- 19 files changed, 211 insertions(+), 55 deletions(-) create mode 100644 pkg/apis/configuration/v1/kongprotocol_types.go diff --git a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml index fb07564b7e..13cb4e7f53 100644 --- a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml @@ -117,6 +117,14 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + - udp type: string type: array run_on: diff --git a/config/crd/bases/configuration.konghq.com_kongingresses.yaml b/config/crd/bases/configuration.konghq.com_kongingresses.yaml index 3c37fa0323..a6ea7070f2 100644 --- a/config/crd/bases/configuration.konghq.com_kongingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_kongingresses.yaml @@ -88,6 +88,14 @@ spec: type: boolean protocols: items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + - udp type: string type: array regex_priority: diff --git a/config/crd/bases/configuration.konghq.com_kongplugins.yaml b/config/crd/bases/configuration.konghq.com_kongplugins.yaml index b0de084443..9f947cf7c8 100644 --- a/config/crd/bases/configuration.konghq.com_kongplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongplugins.yaml @@ -113,6 +113,14 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + - udp type: string type: array run_on: diff --git a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml index cb785da788..43714a557d 100644 --- a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml +++ b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml @@ -120,6 +120,14 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + - udp type: string type: array run_on: @@ -301,6 +309,14 @@ spec: type: boolean protocols: items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + - udp type: string type: array regex_priority: @@ -559,6 +575,14 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + - udp type: string type: array run_on: diff --git a/deploy/single/all-in-one-dbless.yaml b/deploy/single/all-in-one-dbless.yaml index 5231e5e4ad..f4e13460c8 100644 --- a/deploy/single/all-in-one-dbless.yaml +++ b/deploy/single/all-in-one-dbless.yaml @@ -120,6 +120,14 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + - udp type: string type: array run_on: @@ -301,6 +309,14 @@ spec: type: boolean protocols: items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + - udp type: string type: array regex_priority: @@ -559,6 +575,14 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + - udp type: string type: array run_on: diff --git a/deploy/single/all-in-one-postgres-enterprise.yaml b/deploy/single/all-in-one-postgres-enterprise.yaml index 8207f2d8db..4422578e63 100644 --- a/deploy/single/all-in-one-postgres-enterprise.yaml +++ b/deploy/single/all-in-one-postgres-enterprise.yaml @@ -120,6 +120,14 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + - udp type: string type: array run_on: @@ -301,6 +309,14 @@ spec: type: boolean protocols: items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + - udp type: string type: array regex_priority: @@ -559,6 +575,14 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + - udp type: string type: array run_on: diff --git a/deploy/single/all-in-one-postgres.yaml b/deploy/single/all-in-one-postgres.yaml index b7425dce9c..7ea8456478 100644 --- a/deploy/single/all-in-one-postgres.yaml +++ b/deploy/single/all-in-one-postgres.yaml @@ -120,6 +120,14 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + - udp type: string type: array run_on: @@ -301,6 +309,14 @@ spec: type: boolean protocols: items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + - udp type: string type: array regex_priority: @@ -559,6 +575,14 @@ spec: description: Protocols configures plugin to run on requests received on specific protocols. items: + enum: + - http + - https + - grpc + - grpcs + - tcp + - tls + - udp type: string type: array run_on: diff --git a/internal/admission/validator.go b/internal/admission/validator.go index 7f536d30df..c1c71ac4e3 100644 --- a/internal/admission/validator.go +++ b/internal/admission/validator.go @@ -229,7 +229,7 @@ func (validator KongHTTPValidator) ValidatePlugin( plugin.RunOn = kong.String(k8sPlugin.RunOn) } if len(k8sPlugin.Protocols) > 0 { - plugin.Protocols = kong.StringSlice(k8sPlugin.Protocols...) + plugin.Protocols = kong.StringSlice(configurationv1.KongProtocolsToStrings(k8sPlugin.Protocols)...) } isValid, msg, err := validator.PluginSvc.Validate(ctx, &plugin) if err != nil { diff --git a/internal/kongstate/route.go b/internal/kongstate/route.go index 42b3529c84..9f470f655a 100644 --- a/internal/kongstate/route.go +++ b/internal/kongstate/route.go @@ -279,7 +279,7 @@ func (r *Route) overrideByKongIngress(log logrus.FieldLogger, kongIngress *confi r.Headers = ir.Headers } if len(ir.Protocols) != 0 { - r.Protocols = cloneStringPointerSlice(ir.Protocols...) + r.Protocols = protocolPointersToStringPointers(ir.Protocols) } if ir.RegexPriority != nil { r.RegexPriority = kong.Int(*ir.RegexPriority) diff --git a/internal/kongstate/route_test.go b/internal/kongstate/route_test.go index 4ad715721c..6ac09d14d0 100644 --- a/internal/kongstate/route_test.go +++ b/internal/kongstate/route_test.go @@ -114,7 +114,7 @@ func TestOverrideRoute(t *testing.T) { }, configurationv1.KongIngress{ Route: &configurationv1.KongIngressRoute{ - Protocols: kong.StringSlice("http"), + Protocols: configurationv1.ProtocolSlice("http"), PreserveHost: kong.Bool(false), StripPath: kong.Bool(false), RegexPriority: kong.Int(10), @@ -162,7 +162,7 @@ func TestOverrideRoute(t *testing.T) { }, configurationv1.KongIngress{ Route: &configurationv1.KongIngressRoute{ - Protocols: kong.StringSlice("grpc", "grpcs"), + Protocols: configurationv1.ProtocolSlice("grpc", "grpcs"), }, }, Route{ @@ -234,7 +234,7 @@ func TestOverrideRoutePriority(t *testing.T) { } kongIngress := configurationv1.KongIngress{ Route: &configurationv1.KongIngressRoute{ - Protocols: kong.StringSlice("http"), + Protocols: configurationv1.ProtocolSlice("http"), }, } @@ -264,7 +264,7 @@ func TestOverrideRouteByKongIngress(t *testing.T) { } kongIngress := configurationv1.KongIngress{ Route: &configurationv1.KongIngressRoute{ - Protocols: kong.StringSlice("http"), + Protocols: configurationv1.ProtocolSlice("http"), }, } diff --git a/internal/kongstate/util.go b/internal/kongstate/util.go index e1a5eb9f47..4e2994c4b0 100644 --- a/internal/kongstate/util.go +++ b/internal/kongstate/util.go @@ -112,13 +112,22 @@ func kongPluginFromK8SClusterPlugin( RunOn: k8sPlugin.RunOn, Disabled: k8sPlugin.Disabled, - Protocols: k8sPlugin.Protocols, + Protocols: protocolsToStrings(k8sPlugin.Protocols), }.toKongPlugin() return kongPlugin, nil } -func cloneStringPointerSlice(array ...*string) (res []*string) { - res = append(res, array...) +func protocolPointersToStringPointers(protocols []*configurationv1.KongProtocol) (res []*string) { + for _, protocol := range protocols { + res = append(res, kong.String(string(*protocol))) + } + return +} + +func protocolsToStrings(protocols []configurationv1.KongProtocol) (res []string) { + for _, protocol := range protocols { + res = append(res, string(protocol)) + } return } @@ -153,7 +162,7 @@ func kongPluginFromK8SPlugin( RunOn: k8sPlugin.RunOn, Disabled: k8sPlugin.Disabled, - Protocols: k8sPlugin.Protocols, + Protocols: protocolsToStrings(k8sPlugin.Protocols), }.toKongPlugin() return kongPlugin, nil } diff --git a/internal/kongstate/util_test.go b/internal/kongstate/util_test.go index 30642fcea3..55b067ec82 100644 --- a/internal/kongstate/util_test.go +++ b/internal/kongstate/util_test.go @@ -41,7 +41,7 @@ func TestKongPluginFromK8SClusterPlugin(t *testing.T) { name: "basic configuration", args: args{ plugin: configurationv1.KongClusterPlugin{ - Protocols: []string{"http"}, + Protocols: []configurationv1.KongProtocol{"http"}, PluginName: "correlation-id", Config: apiextensionsv1.JSON{ Raw: []byte(`{"header_name": "foo"}`), @@ -61,7 +61,7 @@ func TestKongPluginFromK8SClusterPlugin(t *testing.T) { name: "secret configuration", args: args{ plugin: configurationv1.KongClusterPlugin{ - Protocols: []string{"http"}, + Protocols: []configurationv1.KongProtocol{"http"}, PluginName: "correlation-id", ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ @@ -85,7 +85,7 @@ func TestKongPluginFromK8SClusterPlugin(t *testing.T) { name: "missing secret configuration", args: args{ plugin: configurationv1.KongClusterPlugin{ - Protocols: []string{"http"}, + Protocols: []configurationv1.KongProtocol{"http"}, PluginName: "correlation-id", ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ @@ -103,7 +103,7 @@ func TestKongPluginFromK8SClusterPlugin(t *testing.T) { name: "non-JSON configuration", args: args{ plugin: configurationv1.KongClusterPlugin{ - Protocols: []string{"http"}, + Protocols: []configurationv1.KongProtocol{"http"}, PluginName: "correlation-id", Config: apiextensionsv1.JSON{ Raw: []byte(`{{}`), @@ -117,7 +117,7 @@ func TestKongPluginFromK8SClusterPlugin(t *testing.T) { name: "both Config and ConfigFrom set", args: args{ plugin: configurationv1.KongClusterPlugin{ - Protocols: []string{"http"}, + Protocols: []configurationv1.KongProtocol{"http"}, PluginName: "correlation-id", Config: apiextensionsv1.JSON{ Raw: []byte(`{"header_name": "foo"}`), @@ -175,7 +175,7 @@ func TestKongPluginFromK8SPlugin(t *testing.T) { name: "basic configuration", args: args{ plugin: configurationv1.KongPlugin{ - Protocols: []string{"http"}, + Protocols: []configurationv1.KongProtocol{"http"}, PluginName: "correlation-id", Config: apiextensionsv1.JSON{ Raw: []byte(`{"header_name": "foo"}`), @@ -199,7 +199,7 @@ func TestKongPluginFromK8SPlugin(t *testing.T) { Name: "foo", Namespace: "default", }, - Protocols: []string{"http"}, + Protocols: []configurationv1.KongProtocol{"http"}, PluginName: "correlation-id", ConfigFrom: &configurationv1.ConfigSource{ SecretValue: configurationv1.SecretValueFromSource{ @@ -226,7 +226,7 @@ func TestKongPluginFromK8SPlugin(t *testing.T) { Name: "foo", Namespace: "default", }, - Protocols: []string{"http"}, + Protocols: []configurationv1.KongProtocol{"http"}, PluginName: "correlation-id", ConfigFrom: &configurationv1.ConfigSource{ SecretValue: configurationv1.SecretValueFromSource{ @@ -243,7 +243,7 @@ func TestKongPluginFromK8SPlugin(t *testing.T) { name: "non-JSON configuration", args: args{ plugin: configurationv1.KongPlugin{ - Protocols: []string{"http"}, + Protocols: []configurationv1.KongProtocol{"http"}, PluginName: "correlation-id", Config: apiextensionsv1.JSON{ Raw: []byte(`{{}`), @@ -257,7 +257,7 @@ func TestKongPluginFromK8SPlugin(t *testing.T) { name: "both Config and ConfigFrom set", args: args{ plugin: configurationv1.KongPlugin{ - Protocols: []string{"http"}, + Protocols: []configurationv1.KongProtocol{"http"}, PluginName: "correlation-id", Config: apiextensionsv1.JSON{ Raw: []byte(`{"header_name": "foo"}`), diff --git a/internal/parser/parser_test.go b/internal/parser/parser_test.go index a99746bf8b..5fde1adbd6 100644 --- a/internal/parser/parser_test.go +++ b/internal/parser/parser_test.go @@ -254,7 +254,7 @@ func TestGlobalPlugin(t *testing.T) { annotations.IngressClassKey: annotations.DefaultIngressClass, }, }, - Protocols: []string{"http"}, + Protocols: configurationv1.StringsToKongProtocols([]string{"http"}), PluginName: "basic-auth", Config: apiextensionsv1.JSON{ Raw: []byte(`{"foo1": "bar1"}`), @@ -383,7 +383,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { annotations.IngressClassKey: annotations.DefaultIngressClass, }, }, - Protocols: []string{"http"}, + Protocols: configurationv1.StringsToKongProtocols([]string{"http"}), PluginName: "basic-auth", ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ @@ -403,7 +403,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { // explicitly none, this should not get rendered }, }, - Protocols: []string{"http"}, + Protocols: configurationv1.StringsToKongProtocols([]string{"http"}), PluginName: "basic-auth", ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ @@ -417,7 +417,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "bar-plugin", }, - Protocols: []string{"http"}, + Protocols: configurationv1.StringsToKongProtocols([]string{"http"}), PluginName: "basic-auth", ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ @@ -507,7 +507,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { "global": "true", }, }, - Protocols: []string{"http"}, + Protocols: configurationv1.StringsToKongProtocols([]string{"http"}), PluginName: "basic-auth", ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ @@ -521,7 +521,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "bar-plugin", }, - Protocols: []string{"http"}, + Protocols: configurationv1.StringsToKongProtocols([]string{"http"}), PluginName: "basic-auth", ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ @@ -602,7 +602,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { "global": "true", }, }, - Protocols: []string{"http"}, + Protocols: configurationv1.StringsToKongProtocols([]string{"http"}), PluginName: "basic-auth", Config: apiextensionsv1.JSON{ Raw: []byte(`{"fake": true}`), @@ -619,7 +619,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "bar-plugin", }, - Protocols: []string{"http"}, + Protocols: configurationv1.StringsToKongProtocols([]string{"http"}), PluginName: "basic-auth", Config: apiextensionsv1.JSON{ Raw: []byte(`{"fake": true}`), @@ -757,7 +757,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { "global": "true", }, }, - Protocols: []string{"http"}, + Protocols: configurationv1.StringsToKongProtocols([]string{"http"}), PluginName: "basic-auth", ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ @@ -771,7 +771,7 @@ func TestSecretConfigurationPlugin(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "bar-plugin", }, - Protocols: []string{"http"}, + Protocols: configurationv1.StringsToKongProtocols([]string{"http"}), PluginName: "basic-auth", ConfigFrom: &configurationv1.NamespacedConfigSource{ SecretValue: configurationv1.NamespacedSecretValueFromSource{ @@ -2117,7 +2117,7 @@ func TestKnativeIngressAndPlugins(t *testing.T) { Namespace: "foo-ns", }, Route: &configurationv1.KongIngressRoute{ - Protocols: kong.StringSlice("https"), + Protocols: configurationv1.ProtocolSlice("https"), HTTPSRedirectStatusCode: kong.Int(308), }, }, @@ -2195,7 +2195,7 @@ func TestKnativeIngressAndPlugins(t *testing.T) { Namespace: "foo-ns", }, Route: &configurationv1.KongIngressRoute{ - Protocols: kong.StringSlice("https"), + Protocols: configurationv1.ProtocolSlice("https"), HTTPSRedirectStatusCode: kong.Int(308), }, }, @@ -2356,7 +2356,7 @@ func TestKnativeIngressAndPlugins(t *testing.T) { Namespace: "foo-ns", }, PluginName: "key-auth", - Protocols: []string{"http"}, + Protocols: configurationv1.StringsToKongProtocols([]string{"http"}), Config: apiextensionsv1.JSON{ Raw: []byte(`{"foo": "bar", "knative": "yo"}`), }, @@ -3390,7 +3390,7 @@ func TestPluginAnnotations(t *testing.T) { Namespace: "default", }, PluginName: "key-auth", - Protocols: []string{"grpc"}, + Protocols: []configurationv1.KongProtocol{"grpc"}, Config: apiextensionsv1.JSON{ Raw: []byte(`{ "foo": "bar", @@ -3481,7 +3481,7 @@ func TestPluginAnnotations(t *testing.T) { Namespace: "default", }, PluginName: "basic-auth", - Protocols: []string{"grpc"}, + Protocols: []configurationv1.KongProtocol{"grpc"}, Config: apiextensionsv1.JSON{ Raw: []byte(`{"foo": "bar"}`), }, @@ -3494,7 +3494,7 @@ func TestPluginAnnotations(t *testing.T) { Namespace: "default", }, PluginName: "key-auth", - Protocols: []string{"grpc"}, + Protocols: []configurationv1.KongProtocol{"grpc"}, Config: apiextensionsv1.JSON{ Raw: []byte(`{"foo": "bar"}`), }, @@ -3565,7 +3565,7 @@ func TestPluginAnnotations(t *testing.T) { Namespace: "default", }, PluginName: "basic-auth", - Protocols: []string{"grpc"}, + Protocols: []configurationv1.KongProtocol{"grpc"}, Config: apiextensionsv1.JSON{ Raw: []byte(`{"foo": "bar"}`), }, diff --git a/pkg/apis/configuration/v1/kongclusterplugin_types.go b/pkg/apis/configuration/v1/kongclusterplugin_types.go index 7cce2d6fa9..1609ca1d86 100644 --- a/pkg/apis/configuration/v1/kongclusterplugin_types.go +++ b/pkg/apis/configuration/v1/kongclusterplugin_types.go @@ -63,8 +63,7 @@ type KongClusterPlugin struct { // Protocols configures plugin to run on requests received on specific // protocols. - //+ TODO Protocols needs to be a slice of an alias type to deal with https://github.com/kubernetes-sigs/controller-tools/issues/342 - Protocols []string `json:"protocols,omitempty"` + Protocols []KongProtocol `json:"protocols,omitempty"` } //+kubebuilder:object:root=true diff --git a/pkg/apis/configuration/v1/kongingress_types.go b/pkg/apis/configuration/v1/kongingress_types.go index 47d031b3a9..75725b667b 100644 --- a/pkg/apis/configuration/v1/kongingress_types.go +++ b/pkg/apis/configuration/v1/kongingress_types.go @@ -68,15 +68,13 @@ type KongIngressService struct { // KongIngressRoute contains KongIngress route configuration //+ It contains the subset of go-kong.kong.Route fields supported by kongstate.Route.overrideByKongIngress type KongIngressRoute struct { - Methods []*string `json:"methods,omitempty" yaml:"methods,omitempty"` - Headers map[string][]string `json:"headers,omitempty" yaml:"headers,omitempty"` - //+ TODO Protocols needs to be a slice of an alias type to deal with https://github.com/kubernetes-sigs/controller-tools/issues/342 - //+ For some reason trying to do this breaks deepcopy generation - Protocols []*string `json:"protocols,omitempty" yaml:"protocols,omitempty"` - RegexPriority *int `json:"regex_priority,omitempty" yaml:"regex_priority,omitempty"` - StripPath *bool `json:"strip_path,omitempty" yaml:"strip_path,omitempty"` - PreserveHost *bool `json:"preserve_host,omitempty" yaml:"preserve_host,omitempty"` - HTTPSRedirectStatusCode *int `json:"https_redirect_status_code,omitempty" yaml:"https_redirect_status_code,omitempty"` + Methods []*string `json:"methods,omitempty" yaml:"methods,omitempty"` + Headers map[string][]string `json:"headers,omitempty" yaml:"headers,omitempty"` + Protocols []*KongProtocol `json:"protocols,omitempty" yaml:"protocols,omitempty"` + RegexPriority *int `json:"regex_priority,omitempty" yaml:"regex_priority,omitempty"` + StripPath *bool `json:"strip_path,omitempty" yaml:"strip_path,omitempty"` + PreserveHost *bool `json:"preserve_host,omitempty" yaml:"preserve_host,omitempty"` + HTTPSRedirectStatusCode *int `json:"https_redirect_status_code,omitempty" yaml:"https_redirect_status_code,omitempty"` //+kubebuilder:validation:Enum=v0;v1 PathHandling *string `json:"path_handling,omitempty" yaml:"path_handling,omitempty"` SNIs []*string `json:"snis,omitempty" yaml:"snis,omitempty"` diff --git a/pkg/apis/configuration/v1/kongplugin_types.go b/pkg/apis/configuration/v1/kongplugin_types.go index bfe85aa106..1ab9547f28 100644 --- a/pkg/apis/configuration/v1/kongplugin_types.go +++ b/pkg/apis/configuration/v1/kongplugin_types.go @@ -62,8 +62,7 @@ type KongPlugin struct { // Protocols configures plugin to run on requests received on specific // protocols. - //+ TODO Protocols needs to be a slice of an alias type to deal with https://github.com/kubernetes-sigs/controller-tools/issues/342 - Protocols []string `json:"protocols,omitempty"` + Protocols []KongProtocol `json:"protocols,omitempty"` } //+kubebuilder:object:root=true diff --git a/pkg/apis/configuration/v1/kongprotocol_types.go b/pkg/apis/configuration/v1/kongprotocol_types.go new file mode 100644 index 0000000000..2970fd6d3b --- /dev/null +++ b/pkg/apis/configuration/v1/kongprotocol_types.go @@ -0,0 +1,31 @@ +package v1 + +//+ KongProtocol is a valid Kong protocol +//+ This alias is necessary to deal with https://github.com/kubernetes-sigs/controller-tools/issues/342 +//+kubebuilder:validation:Enum=http;https;grpc;grpcs;tcp;tls;udp +//+kubebuilder:object:generate=true +type KongProtocol string + +func KongProtocolsToStrings(protocols []KongProtocol) (res []string) { + for _, protocol := range protocols { + res = append(res, string(protocol)) + } + return +} + +func StringsToKongProtocols(strings []string) (res []KongProtocol) { + for _, protocol := range strings { + res = append(res, KongProtocol(protocol)) + } + return +} + +// ProtocolSlice converts a slice of string to a slice of *KongProtocol +func ProtocolSlice(elements ...string) []*KongProtocol { + var res []*KongProtocol + for _, element := range elements { + e := KongProtocol(element) + res = append(res, &e) + } + return res +} diff --git a/pkg/apis/configuration/v1/zz_generated.deepcopy.go b/pkg/apis/configuration/v1/zz_generated.deepcopy.go index 1e3b105efa..4993336a34 100644 --- a/pkg/apis/configuration/v1/zz_generated.deepcopy.go +++ b/pkg/apis/configuration/v1/zz_generated.deepcopy.go @@ -64,7 +64,7 @@ func (in *KongClusterPlugin) DeepCopyInto(out *KongClusterPlugin) { } if in.Protocols != nil { in, out := &in.Protocols, &out.Protocols - *out = make([]string, len(*in)) + *out = make([]KongProtocol, len(*in)) copy(*out, *in) } } @@ -284,11 +284,11 @@ func (in *KongIngressRoute) DeepCopyInto(out *KongIngressRoute) { } if in.Protocols != nil { in, out := &in.Protocols, &out.Protocols - *out = make([]*string, len(*in)) + *out = make([]*KongProtocol, len(*in)) for i := range *in { if (*in)[i] != nil { in, out := &(*in)[i], &(*out)[i] - *out = new(string) + *out = new(KongProtocol) **out = **in } } @@ -474,7 +474,7 @@ func (in *KongPlugin) DeepCopyInto(out *KongPlugin) { } if in.Protocols != nil { in, out := &in.Protocols, &out.Protocols - *out = make([]string, len(*in)) + *out = make([]KongProtocol, len(*in)) copy(*out, *in) } } diff --git a/test/integration/kongingress_test.go b/test/integration/kongingress_test.go index a996c1c337..8ceb4c1f21 100644 --- a/test/integration/kongingress_test.go +++ b/test/integration/kongingress_test.go @@ -75,7 +75,7 @@ func TestKongIngressEssentials(t *testing.T) { annotations.IngressClassKey: ingressClass, }, }, - Proxy: &kong.Service{ + Proxy: &kongv1.KongIngressService{ ReadTimeout: kong.Int(1000), }, } From e14392043cf765816a553e7ff5f81282440aca9f Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Thu, 28 Oct 2021 09:02:03 -0700 Subject: [PATCH 07/21] chore(deps) bump controller-gen to 0.7.0 Bump controll-gen to the latest version. Remove several options that were specific to v1beta1 CRDs and are no longer supported in 0.7.0. --- Makefile | 4 ++-- .../configuration.konghq.com_kongclusterplugins.yaml | 2 +- .../configuration.konghq.com_kongconsumers.yaml | 2 +- .../configuration.konghq.com_kongingresses.yaml | 2 +- .../bases/configuration.konghq.com_kongplugins.yaml | 2 +- .../bases/configuration.konghq.com_tcpingresses.yaml | 2 +- .../bases/configuration.konghq.com_udpingresses.yaml | 2 +- .../single/all-in-one-dbless-k4k8s-enterprise.yaml | 12 ++++++------ deploy/single/all-in-one-dbless.yaml | 12 ++++++------ deploy/single/all-in-one-postgres-enterprise.yaml | 12 ++++++------ deploy/single/all-in-one-postgres.yaml | 12 ++++++------ 11 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index e036e435e8..9a5617b32e 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ export GO111MODULE=on CONTROLLER_GEN = $(shell pwd)/bin/controller-gen controller-gen: ## Download controller-gen locally if necessary. - $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2) + $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0) KUSTOMIZE = $(shell pwd)/bin/kustomize kustomize: ## Download kustomize locally if necessary. @@ -52,7 +52,7 @@ endef # Build # ------------------------------------------------------------------------------ -CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false,allowDangerousTypes=true" +CRD_OPTIONS ?= "+crd:allowDangerousTypes=true" # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) GOBIN=$(shell go env GOPATH)/bin diff --git a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml index 13cb4e7f53..7b02e0b940 100644 --- a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongclusterplugins.configuration.konghq.com spec: diff --git a/config/crd/bases/configuration.konghq.com_kongconsumers.yaml b/config/crd/bases/configuration.konghq.com_kongconsumers.yaml index e20cb6ce66..cc516ffeb4 100644 --- a/config/crd/bases/configuration.konghq.com_kongconsumers.yaml +++ b/config/crd/bases/configuration.konghq.com_kongconsumers.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongconsumers.configuration.konghq.com spec: diff --git a/config/crd/bases/configuration.konghq.com_kongingresses.yaml b/config/crd/bases/configuration.konghq.com_kongingresses.yaml index a6ea7070f2..3c565354b4 100644 --- a/config/crd/bases/configuration.konghq.com_kongingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_kongingresses.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongingresses.configuration.konghq.com spec: diff --git a/config/crd/bases/configuration.konghq.com_kongplugins.yaml b/config/crd/bases/configuration.konghq.com_kongplugins.yaml index 9f947cf7c8..fc237bb02c 100644 --- a/config/crd/bases/configuration.konghq.com_kongplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongplugins.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongplugins.configuration.konghq.com spec: diff --git a/config/crd/bases/configuration.konghq.com_tcpingresses.yaml b/config/crd/bases/configuration.konghq.com_tcpingresses.yaml index b6f6192bab..9e275b5c79 100644 --- a/config/crd/bases/configuration.konghq.com_tcpingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_tcpingresses.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: tcpingresses.configuration.konghq.com spec: diff --git a/config/crd/bases/configuration.konghq.com_udpingresses.yaml b/config/crd/bases/configuration.konghq.com_udpingresses.yaml index e18e0b3e79..10f7006bd9 100644 --- a/config/crd/bases/configuration.konghq.com_udpingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_udpingresses.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: udpingresses.configuration.konghq.com spec: diff --git a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml index 43714a557d..fa27fcbf6d 100644 --- a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml +++ b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml @@ -7,7 +7,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongclusterplugins.configuration.konghq.com spec: @@ -156,7 +156,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongconsumers.configuration.konghq.com spec: @@ -225,7 +225,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongingresses.configuration.konghq.com spec: @@ -466,7 +466,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongplugins.configuration.konghq.com spec: @@ -611,7 +611,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: tcpingresses.configuration.konghq.com spec: @@ -797,7 +797,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: udpingresses.configuration.konghq.com spec: diff --git a/deploy/single/all-in-one-dbless.yaml b/deploy/single/all-in-one-dbless.yaml index f4e13460c8..32b315accc 100644 --- a/deploy/single/all-in-one-dbless.yaml +++ b/deploy/single/all-in-one-dbless.yaml @@ -7,7 +7,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongclusterplugins.configuration.konghq.com spec: @@ -156,7 +156,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongconsumers.configuration.konghq.com spec: @@ -225,7 +225,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongingresses.configuration.konghq.com spec: @@ -466,7 +466,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongplugins.configuration.konghq.com spec: @@ -611,7 +611,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: tcpingresses.configuration.konghq.com spec: @@ -797,7 +797,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: udpingresses.configuration.konghq.com spec: diff --git a/deploy/single/all-in-one-postgres-enterprise.yaml b/deploy/single/all-in-one-postgres-enterprise.yaml index 4422578e63..2a64b91447 100644 --- a/deploy/single/all-in-one-postgres-enterprise.yaml +++ b/deploy/single/all-in-one-postgres-enterprise.yaml @@ -7,7 +7,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongclusterplugins.configuration.konghq.com spec: @@ -156,7 +156,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongconsumers.configuration.konghq.com spec: @@ -225,7 +225,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongingresses.configuration.konghq.com spec: @@ -466,7 +466,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongplugins.configuration.konghq.com spec: @@ -611,7 +611,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: tcpingresses.configuration.konghq.com spec: @@ -797,7 +797,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: udpingresses.configuration.konghq.com spec: diff --git a/deploy/single/all-in-one-postgres.yaml b/deploy/single/all-in-one-postgres.yaml index 7ea8456478..f9fed83899 100644 --- a/deploy/single/all-in-one-postgres.yaml +++ b/deploy/single/all-in-one-postgres.yaml @@ -7,7 +7,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongclusterplugins.configuration.konghq.com spec: @@ -156,7 +156,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongconsumers.configuration.konghq.com spec: @@ -225,7 +225,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongingresses.configuration.konghq.com spec: @@ -466,7 +466,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: kongplugins.configuration.konghq.com spec: @@ -611,7 +611,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: tcpingresses.configuration.konghq.com spec: @@ -797,7 +797,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 + controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: udpingresses.configuration.konghq.com spec: From 4885e542ac1e808856332455c2c46c2c8bbfb81e Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Thu, 28 Oct 2021 09:57:12 -0700 Subject: [PATCH 08/21] fix(types) strip TypeMeta from non-object types The types used for plugin CRD ConfigFrom fields were originally written as Kubernetes objects with TypeMeta, with validation rules set to ignore the absence of TypeMeta fields. As best I recall, I originally added TypeMeta to meet the "// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object" requirements. That deepcopy generator only works for Kubernetes objects, so it fails if TypeMeta is absent. We have other deepcopy generators available that generate the non-object deepcopy functions, which are all we need. Remove validation annotations from ConfigFrom types. With the removal of TypeMeta, only the required fields are left, so we can remove the optional annotation on the type and required annotation from individual required fields. Removes a case in the store for handling ConfigSource GVKs. These types would never be deployed as standalone resources and this case was unnecessary. --- ...uration.konghq.com_kongclusterplugins.yaml | 27 ------------ .../configuration.konghq.com_kongplugins.yaml | 15 ------- .../all-in-one-dbless-k4k8s-enterprise.yaml | 42 ------------------- deploy/single/all-in-one-dbless.yaml | 42 ------------------- .../all-in-one-postgres-enterprise.yaml | 42 ------------------- deploy/single/all-in-one-postgres.yaml | 42 ------------------- internal/store/store.go | 2 - pkg/apis/configuration/v1/configsource.go | 24 +++-------- .../configuration/v1/zz_generated.deepcopy.go | 35 ---------------- 9 files changed, 5 insertions(+), 266 deletions(-) diff --git a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml index 7b02e0b940..50588eef56 100644 --- a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml @@ -54,46 +54,19 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string secretKeyRef: description: NamespacedSecretValueFromSource represents the source of a secret value specifying the secret namespace properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this - representation of an object. Servers should convert recognized - schemas to the latest internal value, and may reject unrecognized - values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string key: description: the key containing the value type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string name: description: the secret containing the key type: string namespace: description: The namespace containing the secret type: string - required: - - key - - name - - namespace type: object type: object consumerRef: diff --git a/config/crd/bases/configuration.konghq.com_kongplugins.yaml b/config/crd/bases/configuration.konghq.com_kongplugins.yaml index fc237bb02c..bfe836347c 100644 --- a/config/crd/bases/configuration.konghq.com_kongplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongplugins.yaml @@ -69,27 +69,12 @@ spec: description: SecretValueFromSource represents the source of a secret value properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this - representation of an object. Servers should convert recognized - schemas to the latest internal value, and may reject unrecognized - values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string key: description: the key containing the value type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string name: description: the secret containing the key type: string - required: - - key - - name type: object type: object consumerRef: diff --git a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml index fa27fcbf6d..9e6027cb69 100644 --- a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml +++ b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml @@ -57,46 +57,19 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string secretKeyRef: description: NamespacedSecretValueFromSource represents the source of a secret value specifying the secret namespace properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this - representation of an object. Servers should convert recognized - schemas to the latest internal value, and may reject unrecognized - values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string key: description: the key containing the value type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string name: description: the secret containing the key type: string namespace: description: The namespace containing the secret type: string - required: - - key - - name - - namespace type: object type: object consumerRef: @@ -531,27 +504,12 @@ spec: description: SecretValueFromSource represents the source of a secret value properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this - representation of an object. Servers should convert recognized - schemas to the latest internal value, and may reject unrecognized - values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string key: description: the key containing the value type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string name: description: the secret containing the key type: string - required: - - key - - name type: object type: object consumerRef: diff --git a/deploy/single/all-in-one-dbless.yaml b/deploy/single/all-in-one-dbless.yaml index 32b315accc..170bd1bb1a 100644 --- a/deploy/single/all-in-one-dbless.yaml +++ b/deploy/single/all-in-one-dbless.yaml @@ -57,46 +57,19 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string secretKeyRef: description: NamespacedSecretValueFromSource represents the source of a secret value specifying the secret namespace properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this - representation of an object. Servers should convert recognized - schemas to the latest internal value, and may reject unrecognized - values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string key: description: the key containing the value type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string name: description: the secret containing the key type: string namespace: description: The namespace containing the secret type: string - required: - - key - - name - - namespace type: object type: object consumerRef: @@ -531,27 +504,12 @@ spec: description: SecretValueFromSource represents the source of a secret value properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this - representation of an object. Servers should convert recognized - schemas to the latest internal value, and may reject unrecognized - values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string key: description: the key containing the value type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string name: description: the secret containing the key type: string - required: - - key - - name type: object type: object consumerRef: diff --git a/deploy/single/all-in-one-postgres-enterprise.yaml b/deploy/single/all-in-one-postgres-enterprise.yaml index 2a64b91447..b72b2d1d85 100644 --- a/deploy/single/all-in-one-postgres-enterprise.yaml +++ b/deploy/single/all-in-one-postgres-enterprise.yaml @@ -57,46 +57,19 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string secretKeyRef: description: NamespacedSecretValueFromSource represents the source of a secret value specifying the secret namespace properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this - representation of an object. Servers should convert recognized - schemas to the latest internal value, and may reject unrecognized - values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string key: description: the key containing the value type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string name: description: the secret containing the key type: string namespace: description: The namespace containing the secret type: string - required: - - key - - name - - namespace type: object type: object consumerRef: @@ -531,27 +504,12 @@ spec: description: SecretValueFromSource represents the source of a secret value properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this - representation of an object. Servers should convert recognized - schemas to the latest internal value, and may reject unrecognized - values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string key: description: the key containing the value type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string name: description: the secret containing the key type: string - required: - - key - - name type: object type: object consumerRef: diff --git a/deploy/single/all-in-one-postgres.yaml b/deploy/single/all-in-one-postgres.yaml index f9fed83899..c34b94752e 100644 --- a/deploy/single/all-in-one-postgres.yaml +++ b/deploy/single/all-in-one-postgres.yaml @@ -57,46 +57,19 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string secretKeyRef: description: NamespacedSecretValueFromSource represents the source of a secret value specifying the secret namespace properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this - representation of an object. Servers should convert recognized - schemas to the latest internal value, and may reject unrecognized - values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string key: description: the key containing the value type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string name: description: the secret containing the key type: string namespace: description: The namespace containing the secret type: string - required: - - key - - name - - namespace type: object type: object consumerRef: @@ -531,27 +504,12 @@ spec: description: SecretValueFromSource represents the source of a secret value properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this - representation of an object. Servers should convert recognized - schemas to the latest internal value, and may reject unrecognized - values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string key: description: the key containing the value type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string name: description: the secret containing the key type: string - required: - - key - - name type: object type: object consumerRef: diff --git a/internal/store/store.go b/internal/store/store.go index a876d2de5c..e021f9d2a0 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -741,8 +741,6 @@ func mkObjFromGVK(gvk schema.GroupVersionKind) (runtime.Object, error) { return &kongv1.KongClusterPlugin{}, nil case kongv1.SchemeGroupVersion.WithKind("KongConsumer"): return &kongv1.KongConsumer{}, nil - case kongv1.SchemeGroupVersion.WithKind("ConfigSource"): - return &kongv1.ConfigSource{}, nil case knative.SchemeGroupVersion.WithKind("Ingress"): return &knative.Ingress{}, nil default: diff --git a/pkg/apis/configuration/v1/configsource.go b/pkg/apis/configuration/v1/configsource.go index aafc5c9f1f..2ec845cbc1 100644 --- a/pkg/apis/configuration/v1/configsource.go +++ b/pkg/apis/configuration/v1/configsource.go @@ -2,49 +2,35 @@ package v1 import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - // ConfigSource is a wrapper around SecretValueFromSource +//+kubebuilder:object:generate=true type ConfigSource struct { metav1.TypeMeta `json:",inline"` SecretValue SecretValueFromSource `json:"secretKeyRef,omitempty"` } -//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - // NamespacedConfigSource is a wrapper around NamespacedSecretValueFromSource +//+kubebuilder:object:generate=true type NamespacedConfigSource struct { - metav1.TypeMeta `json:",inline"` - SecretValue NamespacedSecretValueFromSource `json:"secretKeyRef,omitempty"` + SecretValue NamespacedSecretValueFromSource `json:"secretKeyRef,omitempty"` } -//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -//+kubebuilder:validation:Optional - // SecretValueFromSource represents the source of a secret value +//+kubebuilder:object:generate=true type SecretValueFromSource struct { - metav1.TypeMeta `json:",inline"` // the secret containing the key - //+kubebuilder:validation:Required Secret string `json:"name,omitempty"` // the key containing the value - //+kubebuilder:validation:Required Key string `json:"key,omitempty"` } -//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -//+kubebuilder:validation:Optional - // NamespacedSecretValueFromSource represents the source of a secret value specifying the secret namespace +//+kubebuilder:object:generate=true type NamespacedSecretValueFromSource struct { - metav1.TypeMeta `json:",inline"` // The namespace containing the secret - //+kubebuilder:validation:Required Namespace string `json:"namespace,omitempty"` // the secret containing the key - //+kubebuilder:validation:Required Secret string `json:"name,omitempty"` // the key containing the value - //+kubebuilder:validation:Required Key string `json:"key,omitempty"` } diff --git a/pkg/apis/configuration/v1/zz_generated.deepcopy.go b/pkg/apis/configuration/v1/zz_generated.deepcopy.go index 4993336a34..b8a59f4517 100644 --- a/pkg/apis/configuration/v1/zz_generated.deepcopy.go +++ b/pkg/apis/configuration/v1/zz_generated.deepcopy.go @@ -43,14 +43,6 @@ func (in *ConfigSource) DeepCopy() *ConfigSource { return out } -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ConfigSource) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KongClusterPlugin) DeepCopyInto(out *KongClusterPlugin) { *out = *in @@ -532,7 +524,6 @@ func (in *KongPluginList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NamespacedConfigSource) DeepCopyInto(out *NamespacedConfigSource) { *out = *in - out.TypeMeta = in.TypeMeta out.SecretValue = in.SecretValue } @@ -546,18 +537,9 @@ func (in *NamespacedConfigSource) DeepCopy() *NamespacedConfigSource { return out } -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NamespacedConfigSource) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NamespacedSecretValueFromSource) DeepCopyInto(out *NamespacedSecretValueFromSource) { *out = *in - out.TypeMeta = in.TypeMeta } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespacedSecretValueFromSource. @@ -570,18 +552,9 @@ func (in *NamespacedSecretValueFromSource) DeepCopy() *NamespacedSecretValueFrom return out } -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NamespacedSecretValueFromSource) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SecretValueFromSource) DeepCopyInto(out *SecretValueFromSource) { *out = *in - out.TypeMeta = in.TypeMeta } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretValueFromSource. @@ -593,11 +566,3 @@ func (in *SecretValueFromSource) DeepCopy() *SecretValueFromSource { in.DeepCopyInto(out) return out } - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *SecretValueFromSource) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} From dabb230833cd02eb870023c6a21f7bc52cdc9e79 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Tue, 2 Nov 2021 10:15:59 -0700 Subject: [PATCH 09/21] fix(crds) restore explicit preserveUnknownFields --- .../bases/configuration.konghq.com_kongclusterplugins.yaml | 1 + .../crd/bases/configuration.konghq.com_kongconsumers.yaml | 1 + .../crd/bases/configuration.konghq.com_kongingresses.yaml | 1 + config/crd/bases/configuration.konghq.com_kongplugins.yaml | 1 + config/crd/bases/configuration.konghq.com_tcpingresses.yaml | 1 + config/crd/bases/configuration.konghq.com_udpingresses.yaml | 1 + deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml | 6 ++++++ deploy/single/all-in-one-dbless.yaml | 6 ++++++ deploy/single/all-in-one-postgres-enterprise.yaml | 6 ++++++ deploy/single/all-in-one-postgres.yaml | 6 ++++++ pkg/apis/configuration/v1/kongclusterplugin_types.go | 1 + pkg/apis/configuration/v1/kongconsumer_types.go | 1 + pkg/apis/configuration/v1/kongingress_types.go | 1 + pkg/apis/configuration/v1/kongplugin_types.go | 1 + pkg/apis/configuration/v1beta1/tcpingress_types.go | 1 + pkg/apis/configuration/v1beta1/udpingress_types.go | 1 + 16 files changed, 36 insertions(+) diff --git a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml index 50588eef56..5581acc4f6 100644 --- a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml @@ -111,6 +111,7 @@ spec: required: - plugin type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/config/crd/bases/configuration.konghq.com_kongconsumers.yaml b/config/crd/bases/configuration.konghq.com_kongconsumers.yaml index cc516ffeb4..4687ebd91c 100644 --- a/config/crd/bases/configuration.konghq.com_kongconsumers.yaml +++ b/config/crd/bases/configuration.konghq.com_kongconsumers.yaml @@ -58,6 +58,7 @@ spec: description: Username unique username of the consumer. type: string type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/config/crd/bases/configuration.konghq.com_kongingresses.yaml b/config/crd/bases/configuration.konghq.com_kongingresses.yaml index 3c565354b4..2e6bad68eb 100644 --- a/config/crd/bases/configuration.konghq.com_kongingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_kongingresses.yaml @@ -230,6 +230,7 @@ spec: type: integer type: object type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/config/crd/bases/configuration.konghq.com_kongplugins.yaml b/config/crd/bases/configuration.konghq.com_kongplugins.yaml index bfe836347c..59291af05e 100644 --- a/config/crd/bases/configuration.konghq.com_kongplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongplugins.yaml @@ -119,6 +119,7 @@ spec: required: - plugin type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/config/crd/bases/configuration.konghq.com_tcpingresses.yaml b/config/crd/bases/configuration.konghq.com_tcpingresses.yaml index 9e275b5c79..6eb98fedb3 100644 --- a/config/crd/bases/configuration.konghq.com_tcpingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_tcpingresses.yaml @@ -175,6 +175,7 @@ spec: type: object type: object type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/config/crd/bases/configuration.konghq.com_udpingresses.yaml b/config/crd/bases/configuration.konghq.com_udpingresses.yaml index 10f7006bd9..c8fc28df62 100644 --- a/config/crd/bases/configuration.konghq.com_udpingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_udpingresses.yaml @@ -143,6 +143,7 @@ spec: type: object type: object type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml index 9e6027cb69..d42c14aad3 100644 --- a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml +++ b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml @@ -114,6 +114,7 @@ spec: required: - plugin type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -183,6 +184,7 @@ spec: description: Username unique username of the consumer. type: string type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -424,6 +426,7 @@ spec: type: integer type: object type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -554,6 +557,7 @@ spec: required: - plugin type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -740,6 +744,7 @@ spec: type: object type: object type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -894,6 +899,7 @@ spec: type: object type: object type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/deploy/single/all-in-one-dbless.yaml b/deploy/single/all-in-one-dbless.yaml index 170bd1bb1a..70c8879984 100644 --- a/deploy/single/all-in-one-dbless.yaml +++ b/deploy/single/all-in-one-dbless.yaml @@ -114,6 +114,7 @@ spec: required: - plugin type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -183,6 +184,7 @@ spec: description: Username unique username of the consumer. type: string type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -424,6 +426,7 @@ spec: type: integer type: object type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -554,6 +557,7 @@ spec: required: - plugin type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -740,6 +744,7 @@ spec: type: object type: object type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -894,6 +899,7 @@ spec: type: object type: object type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/deploy/single/all-in-one-postgres-enterprise.yaml b/deploy/single/all-in-one-postgres-enterprise.yaml index b72b2d1d85..1d9456002a 100644 --- a/deploy/single/all-in-one-postgres-enterprise.yaml +++ b/deploy/single/all-in-one-postgres-enterprise.yaml @@ -114,6 +114,7 @@ spec: required: - plugin type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -183,6 +184,7 @@ spec: description: Username unique username of the consumer. type: string type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -424,6 +426,7 @@ spec: type: integer type: object type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -554,6 +557,7 @@ spec: required: - plugin type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -740,6 +744,7 @@ spec: type: object type: object type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -894,6 +899,7 @@ spec: type: object type: object type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/deploy/single/all-in-one-postgres.yaml b/deploy/single/all-in-one-postgres.yaml index c34b94752e..d055a60b84 100644 --- a/deploy/single/all-in-one-postgres.yaml +++ b/deploy/single/all-in-one-postgres.yaml @@ -114,6 +114,7 @@ spec: required: - plugin type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -183,6 +184,7 @@ spec: description: Username unique username of the consumer. type: string type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -424,6 +426,7 @@ spec: type: integer type: object type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -554,6 +557,7 @@ spec: required: - plugin type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -740,6 +744,7 @@ spec: type: object type: object type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -894,6 +899,7 @@ spec: type: object type: object type: object + x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/pkg/apis/configuration/v1/kongclusterplugin_types.go b/pkg/apis/configuration/v1/kongclusterplugin_types.go index 1609ca1d86..39fcf69166 100644 --- a/pkg/apis/configuration/v1/kongclusterplugin_types.go +++ b/pkg/apis/configuration/v1/kongclusterplugin_types.go @@ -33,6 +33,7 @@ import ( //+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" //+kubebuilder:printcolumn:name="Disabled",type=boolean,JSONPath=`.disabled`,description="Indicates if the plugin is disabled",priority=1 //+kubebuilder:printcolumn:name="Config",type=string,JSONPath=`.config`,description="Configuration of the plugin",priority=1 +//+kubebuilder:pruning:PreserveUnknownFields // KongClusterPlugin is the Schema for the kongclusterplugins API type KongClusterPlugin struct { diff --git a/pkg/apis/configuration/v1/kongconsumer_types.go b/pkg/apis/configuration/v1/kongconsumer_types.go index 73149a5557..c73d01ba56 100644 --- a/pkg/apis/configuration/v1/kongconsumer_types.go +++ b/pkg/apis/configuration/v1/kongconsumer_types.go @@ -29,6 +29,7 @@ import ( //+kubebuilder:validation:Optional //+kubebuilder:printcolumn:name="Username",type=string,JSONPath=`.username`,description="Username of a Kong Consumer" //+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" +//+kubebuilder:pruning:PreserveUnknownFields // KongConsumer is the Schema for the kongconsumers API type KongConsumer struct { diff --git a/pkg/apis/configuration/v1/kongingress_types.go b/pkg/apis/configuration/v1/kongingress_types.go index 75725b667b..d5bc98651a 100644 --- a/pkg/apis/configuration/v1/kongingress_types.go +++ b/pkg/apis/configuration/v1/kongingress_types.go @@ -28,6 +28,7 @@ import ( //+kubebuilder:storageversion //+kubebuilder:resource:shortName=ki //+kubebuilder:validation:Optional +//+kubebuilder:pruning:PreserveUnknownFields // KongIngress is the Schema for the kongingresses API type KongIngress struct { diff --git a/pkg/apis/configuration/v1/kongplugin_types.go b/pkg/apis/configuration/v1/kongplugin_types.go index 1ab9547f28..31d415eeb9 100644 --- a/pkg/apis/configuration/v1/kongplugin_types.go +++ b/pkg/apis/configuration/v1/kongplugin_types.go @@ -32,6 +32,7 @@ import ( //+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" //+kubebuilder:printcolumn:name="Disabled",type=boolean,JSONPath=`.disabled`,description="Indicates if the plugin is disabled",priority=1 //+kubebuilder:printcolumn:name="Config",type=string,JSONPath=`.config`,description="Configuration of the plugin",priority=1 +//+kubebuilder:pruning:PreserveUnknownFields // KongPlugin is the Schema for the kongplugins API type KongPlugin struct { diff --git a/pkg/apis/configuration/v1beta1/tcpingress_types.go b/pkg/apis/configuration/v1beta1/tcpingress_types.go index 2f2ab577f7..7d7b837bf3 100644 --- a/pkg/apis/configuration/v1beta1/tcpingress_types.go +++ b/pkg/apis/configuration/v1beta1/tcpingress_types.go @@ -29,6 +29,7 @@ import ( //+kubebuilder:validation:Optional //+kubebuilder:printcolumn:name="Address",type=string,JSONPath=`.status.loadBalancer.ingress[*].ip`,description="Address of the load balancer" //+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" +//+kubebuilder:pruning:PreserveUnknownFields // TCPIngress is the Schema for the tcpingresses API type TCPIngress struct { diff --git a/pkg/apis/configuration/v1beta1/udpingress_types.go b/pkg/apis/configuration/v1beta1/udpingress_types.go index 6bd31d2b60..08a2434250 100644 --- a/pkg/apis/configuration/v1beta1/udpingress_types.go +++ b/pkg/apis/configuration/v1beta1/udpingress_types.go @@ -42,6 +42,7 @@ type UDPIngressList struct { //+kubebuilder:validation:Optional //+kubebuilder:printcolumn:name="Address",type=string,JSONPath=`.status.loadBalancer.ingress[*].ip`,description="Address of the load balancer" //+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" +//+kubebuilder:pruning:PreserveUnknownFields // UDPIngress is the Schema for the udpingresses API type UDPIngress struct { From f291b1a6efdaee1ed57e51929b1808a643649cbe Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Mon, 15 Nov 2021 10:09:14 -0800 Subject: [PATCH 10/21] test(e2e) add test for upgrades Add a new test to deploy the previous version of KIC manifests and then the current version of KIC manifests to confirm that upgrades are viable. Split verifyIngress() into deployIngress() and verifyIngress(). deployIngress() creates the test Ingress and associated resources. verifyIngress() confirms the resulting route is available on the proxy. Add a KongIngress to the deployIngress() and verifyIngress() functions to perform a basic test of our CRDs. Add helper functions to retrieve the current and previous Git tag per the local repo. --- test/e2e/all_in_one_test.go | 153 +++++++++++++++++++++++++++++++++--- 1 file changed, 140 insertions(+), 13 deletions(-) diff --git a/test/e2e/all_in_one_test.go b/test/e2e/all_in_one_test.go index 4c00496850..80fdf2e492 100644 --- a/test/e2e/all_in_one_test.go +++ b/test/e2e/all_in_one_test.go @@ -15,6 +15,7 @@ import ( "os" "os/exec" "path/filepath" + "sort" "strings" "testing" "time" @@ -24,6 +25,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" + kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "sigs.k8s.io/kustomize/api/krusty" @@ -37,6 +39,8 @@ import ( "github.com/kong/kubernetes-testing-framework/pkg/utils/kubernetes/generators" "github.com/kong/kubernetes-ingress-controller/v2/internal/annotations" + kongv1 "github.com/kong/kubernetes-ingress-controller/v2/pkg/apis/configuration/v1" + "github.com/kong/kubernetes-ingress-controller/v2/pkg/clientset" ) // ----------------------------------------------------------------------------- @@ -71,7 +75,10 @@ var imageOverride = os.Getenv("TEST_KONG_CONTROLLER_IMAGE_OVERRIDE") // ensure that things are up and running. // ----------------------------------------------------------------------------- -const dblessPath = "../../deploy/single/all-in-one-dbless.yaml" +const ( + dblessPath = "../../deploy/single/all-in-one-dbless.yaml" + dblessURL = "https://raw.githubusercontent.com/Kong/kubernetes-ingress-controller/%v.%v.x/deploy/single/all-in-one-dbless.yaml" +) func TestDeployAllInOneDBLESS(t *testing.T) { t.Log("configuring all-in-one-dbless.yaml manifest test") @@ -103,6 +110,57 @@ func TestDeployAllInOneDBLESS(t *testing.T) { deployKong(ctx, t, env, manifest) t.Log("running ingress tests to verify all-in-one deployed ingress controller and proxy are functional") + deployIngress(ctx, t, env) + verifyIngress(ctx, t, env) +} + +func TestDeployAndUpgradeAllInOneDBLESS(t *testing.T) { + curTag, err := getCurrentGitTag("") + require.NoError(t, err) + preTag, err := getPreviousGitTag("", curTag) + require.NoError(t, err) + if curTag.Patch != 0 || len(curTag.Pre) > 0 { + t.Skipf("%v not a new minor version, skipping upgrade test", curTag) + } + oldManifest, err := http.Get(fmt.Sprintf(dblessURL, preTag.Major, preTag.Minor)) + require.NoError(t, err) + defer oldManifest.Body.Close() + + t.Log("configuring all-in-one-dbless.yaml manifest test") + t.Parallel() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + t.Log("building test cluster and environment") + addons := []clusters.Addon{} + addons = append(addons, metallb.New()) + if b, err := loadimage.NewBuilder().WithImage(imageOverride); err == nil { + addons = append(addons, b.Build()) + } + builder := environments.NewBuilder().WithAddons(addons...) + if clusterVersionStr != "" { + clusterVersion, err := semver.Parse(clusterVersionStr) + require.NoError(t, err) + builder.WithKubernetesVersion(clusterVersion) + } + env, err := builder.Build(ctx) + require.NoError(t, err) + defer func() { + assert.NoError(t, env.Cleanup(ctx)) + }() + + t.Log("deploying previous minor version kong manifest") + deployKong(ctx, t, env, oldManifest.Body) + + t.Log("running ingress tests to verify all-in-one deployed ingress controller and proxy are functional") + deployIngress(ctx, t, env) + verifyIngress(ctx, t, env) + + t.Log("deploying current kong manifest") + + manifest, err := getTestManifest(t, dblessPath) + require.NoError(t, err) + deployKong(ctx, t, env, manifest) verifyIngress(ctx, t, env) } @@ -137,6 +195,7 @@ func TestDeployAllInOneDBLESSNoLoadBalancer(t *testing.T) { deployKong(ctx, t, env, manifest) t.Log("running ingress tests to verify all-in-one deployed ingress controller and proxy are functional") + deployIngress(ctx, t, env) verifyIngress(ctx, t, env) } @@ -186,6 +245,7 @@ func TestDeployAllInOneEnterpriseDBLESS(t *testing.T) { exposeAdminAPI(ctx, t, env) t.Log("running ingress tests to verify all-in-one deployed ingress controller and proxy are functional") + deployIngress(ctx, t, env) verifyIngress(ctx, t, env) t.Log("verifying enterprise mode was enabled properly") @@ -227,6 +287,7 @@ func TestDeployAllInOnePostgres(t *testing.T) { verifyPostgres(ctx, t, env) t.Log("running ingress tests to verify all-in-one deployed ingress controller and proxy are functional") + deployIngress(ctx, t, env) verifyIngress(ctx, t, env) } @@ -276,6 +337,7 @@ func TestDeployAllInOneEnterprisePostgres(t *testing.T) { verifyPostgres(ctx, t, env) t.Log("running ingress tests to verify ingress controller and proxy are functional") + deployIngress(ctx, t, env) verifyIngress(ctx, t, env) t.Log("this deployment used enterprise kong, verifying that enterprise functionality was set up properly") @@ -307,27 +369,29 @@ func deployKong(ctx context.Context, t *testing.T, env environments.Environment, written, err := kubeconfigFile.Write(kubeconfig) require.NoError(t, err) require.Equal(t, len(kubeconfig), written) + kubeconfigFilename := kubeconfigFile.Name() t.Log("waiting for testing environment to be ready") require.NoError(t, <-env.WaitForReady(ctx)) t.Log("creating the kong namespace") - kubeconfigFilename := kubeconfigFile.Name() - stdout, stderr := new(bytes.Buffer), new(bytes.Buffer) - cmd := exec.CommandContext(ctx, "kubectl", "--kubeconfig", kubeconfigFilename, "create", "namespace", namespace) - cmd.Stdout = stdout - cmd.Stderr = stderr - require.NoError(t, cmd.Run(), fmt.Sprintf("STDOUT=(%s), STDERR=(%s)", stdout.String(), stderr.String())) + ns := &corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "kong"}} + _, err = env.Cluster().Client().CoreV1().Namespaces().Create(ctx, ns, metav1.CreateOptions{}) + if !kerrors.IsAlreadyExists(err) { + require.NoError(t, err) + } t.Logf("deploying any supplemental secrets (found: %d)", len(additionalSecrets)) for _, secret := range additionalSecrets { _, err := env.Cluster().Client().CoreV1().Secrets("kong").Create(ctx, secret, metav1.CreateOptions{}) - require.NoError(t, err) + if !kerrors.IsAlreadyExists(err) { + require.NoError(t, err) + } } t.Log("deploying the manifest to the cluster") - stdout, stderr = new(bytes.Buffer), new(bytes.Buffer) - cmd = exec.CommandContext(ctx, "kubectl", "--kubeconfig", kubeconfigFilename, "apply", "-f", "-") + stdout, stderr := new(bytes.Buffer), new(bytes.Buffer) + cmd := exec.CommandContext(ctx, "kubectl", "--kubeconfig", kubeconfigFilename, "apply", "-f", "-") cmd.Stdout = stdout cmd.Stderr = stderr cmd.Stdin = manifest @@ -341,11 +405,13 @@ func deployKong(ctx context.Context, t *testing.T, env environments.Environment, }, kongComponentWait, time.Second) } -func verifyIngress(ctx context.Context, t *testing.T, env environments.Environment) { +func deployIngress(ctx context.Context, t *testing.T, env environments.Environment) { + c, err := clientset.NewForConfig(env.Cluster().Config()) + assert.NoError(t, err) t.Log("deploying an HTTP service to test the ingress controller and proxy") container := generators.NewContainer("httpbin", httpBinImage, 80) deployment := generators.NewDeploymentForContainer(container) - deployment, err := env.Cluster().Client().AppsV1().Deployments(corev1.NamespaceDefault).Create(ctx, deployment, metav1.CreateOptions{}) + deployment, err = env.Cluster().Client().AppsV1().Deployments(corev1.NamespaceDefault).Create(ctx, deployment, metav1.CreateOptions{}) require.NoError(t, err) t.Logf("exposing deployment %s via service", deployment.Name) @@ -353,15 +419,33 @@ func verifyIngress(ctx context.Context, t *testing.T, env environments.Environme _, err = env.Cluster().Client().CoreV1().Services(corev1.NamespaceDefault).Create(ctx, service, metav1.CreateOptions{}) require.NoError(t, err) + getString := "GET" + king := &kongv1.KongIngress{ + ObjectMeta: metav1.ObjectMeta{ + Name: "testki", + Namespace: corev1.NamespaceDefault, + Annotations: map[string]string{ + annotations.IngressClassKey: ingressClass, + }, + }, + Route: &kongv1.KongIngressRoute{ + Methods: []*string{&getString}, + }, + } + king, err = c.ConfigurationV1().KongIngresses(corev1.NamespaceDefault).Create(ctx, king, + metav1.CreateOptions{}) t.Logf("creating an ingress for service %s with ingress.class %s", service.Name, ingressClass) kubernetesVersion, err := env.Cluster().Version() require.NoError(t, err) ingress := generators.NewIngressForServiceWithClusterVersion(kubernetesVersion, "/httpbin", map[string]string{ annotations.IngressClassKey: ingressClass, "konghq.com/strip-path": "true", + "konghq.com/override": "testki", }, service) require.NoError(t, clusters.DeployIngress(ctx, env.Cluster(), corev1.NamespaceDefault, ingress)) +} +func verifyIngress(ctx context.Context, t *testing.T, env environments.Environment) { t.Log("finding the kong proxy service ip") svc, err := env.Cluster().Client().CoreV1().Services(namespace).Get(ctx, "kong-proxy", metav1.GetOptions{}) require.NoError(t, err) @@ -419,7 +503,19 @@ func verifyIngress(ctx context.Context, t *testing.T, env environments.Environme n, err := b.ReadFrom(resp.Body) require.NoError(t, err) require.True(t, n > 0) - return strings.Contains(b.String(), "httpbin.org") + if !strings.Contains(b.String(), "httpbin.org") { + return false + } + } + // verify the KongIngress method restriction + fakeData := url.Values{} + fakeData.Set("foo", "bar") + resp, err = httpc.PostForm(fmt.Sprintf("http://%s/httpbin", proxyIP), fakeData) + if err != nil { + return false + } + if resp.StatusCode == http.StatusNotFound { + return true } return false }, ingressWait, time.Second) @@ -652,3 +748,34 @@ func kustomizeManifest(path string) ([]byte, error) { } return m.AsYaml() } + +func getCurrentGitTag(path string) (semver.Version, error) { + cmd := exec.Command("git", "describe", "--tags") + cmd.Dir = path + tagBytes, _ := cmd.Output() + tag, err := semver.ParseTolerant(string(tagBytes)) + if err != nil { + return semver.Version{}, err + } + return tag, nil +} + +func getPreviousGitTag(path string, cur semver.Version) (semver.Version, error) { + var tags []semver.Version + cmd := exec.Command("git", "tag") + cmd.Dir = path + tagsBytes, _ := cmd.Output() + foo := strings.Split(string(tagsBytes), "\n") + for _, tag := range foo { + ver, err := semver.ParseTolerant(tag) + if err == nil { + tags = append(tags, ver) + } + } + sort.Slice(tags, func(i, j int) bool { return tags[i].LT(tags[j]) }) + curIndex := sort.Search(len(tags), func(i int) bool { return tags[i].EQ(cur) }) + if curIndex == 0 { + return tags[curIndex], nil + } + return tags[curIndex-1], nil +} From 82022394917c4211f6a13346fe245b96fab1b3df Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Wed, 1 Dec 2021 13:29:35 -0800 Subject: [PATCH 11/21] chore(admission) update package name --- internal/admission/validator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/admission/validator.go b/internal/admission/validator.go index c1c71ac4e3..957545be10 100644 --- a/internal/admission/validator.go +++ b/internal/admission/validator.go @@ -229,7 +229,7 @@ func (validator KongHTTPValidator) ValidatePlugin( plugin.RunOn = kong.String(k8sPlugin.RunOn) } if len(k8sPlugin.Protocols) > 0 { - plugin.Protocols = kong.StringSlice(configurationv1.KongProtocolsToStrings(k8sPlugin.Protocols)...) + plugin.Protocols = kong.StringSlice(kongv1.KongProtocolsToStrings(k8sPlugin.Protocols)...) } isValid, msg, err := validator.PluginSvc.Validate(ctx, &plugin) if err != nil { From 19bb83a2ddb103c1bc7d4b3abf3ff36521ca9637 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Thu, 2 Dec 2021 14:11:08 -0800 Subject: [PATCH 12/21] fix(types) strip TypeMeta from ConfigSource also The initial pass for this stripped TypeMeta from NamespacedConfigSource, but not ConfigSource. Neither should include TypeMeta. This strips TypeMeta from ConfigSource. --- .../bases/configuration.konghq.com_kongplugins.yaml | 11 ----------- deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml | 11 ----------- deploy/single/all-in-one-dbless.yaml | 11 ----------- deploy/single/all-in-one-postgres-enterprise.yaml | 11 ----------- deploy/single/all-in-one-postgres.yaml | 11 ----------- pkg/apis/configuration/v1/configsource.go | 5 +---- pkg/apis/configuration/v1/zz_generated.deepcopy.go | 1 - 7 files changed, 1 insertion(+), 60 deletions(-) diff --git a/config/crd/bases/configuration.konghq.com_kongplugins.yaml b/config/crd/bases/configuration.konghq.com_kongplugins.yaml index 59291af05e..87d4f17fba 100644 --- a/config/crd/bases/configuration.konghq.com_kongplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongplugins.yaml @@ -54,17 +54,6 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string secretKeyRef: description: SecretValueFromSource represents the source of a secret value diff --git a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml index d42c14aad3..ea8f31b2e3 100644 --- a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml +++ b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml @@ -492,17 +492,6 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string secretKeyRef: description: SecretValueFromSource represents the source of a secret value diff --git a/deploy/single/all-in-one-dbless.yaml b/deploy/single/all-in-one-dbless.yaml index 70c8879984..b54888295d 100644 --- a/deploy/single/all-in-one-dbless.yaml +++ b/deploy/single/all-in-one-dbless.yaml @@ -492,17 +492,6 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string secretKeyRef: description: SecretValueFromSource represents the source of a secret value diff --git a/deploy/single/all-in-one-postgres-enterprise.yaml b/deploy/single/all-in-one-postgres-enterprise.yaml index 1d9456002a..37c8158a5a 100644 --- a/deploy/single/all-in-one-postgres-enterprise.yaml +++ b/deploy/single/all-in-one-postgres-enterprise.yaml @@ -492,17 +492,6 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string secretKeyRef: description: SecretValueFromSource represents the source of a secret value diff --git a/deploy/single/all-in-one-postgres.yaml b/deploy/single/all-in-one-postgres.yaml index d055a60b84..705ab99a69 100644 --- a/deploy/single/all-in-one-postgres.yaml +++ b/deploy/single/all-in-one-postgres.yaml @@ -492,17 +492,6 @@ spec: configFrom: description: ConfigFrom references a secret containing the plugin configuration. properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string secretKeyRef: description: SecretValueFromSource represents the source of a secret value diff --git a/pkg/apis/configuration/v1/configsource.go b/pkg/apis/configuration/v1/configsource.go index 2ec845cbc1..3add2a2181 100644 --- a/pkg/apis/configuration/v1/configsource.go +++ b/pkg/apis/configuration/v1/configsource.go @@ -1,12 +1,9 @@ package v1 -import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - // ConfigSource is a wrapper around SecretValueFromSource //+kubebuilder:object:generate=true type ConfigSource struct { - metav1.TypeMeta `json:",inline"` - SecretValue SecretValueFromSource `json:"secretKeyRef,omitempty"` + SecretValue SecretValueFromSource `json:"secretKeyRef,omitempty"` } // NamespacedConfigSource is a wrapper around NamespacedSecretValueFromSource diff --git a/pkg/apis/configuration/v1/zz_generated.deepcopy.go b/pkg/apis/configuration/v1/zz_generated.deepcopy.go index b8a59f4517..2c0554ab35 100644 --- a/pkg/apis/configuration/v1/zz_generated.deepcopy.go +++ b/pkg/apis/configuration/v1/zz_generated.deepcopy.go @@ -29,7 +29,6 @@ import ( // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ConfigSource) DeepCopyInto(out *ConfigSource) { *out = *in - out.TypeMeta = in.TypeMeta out.SecretValue = in.SecretValue } From b01c3b75be377e0f92840362d6970d362cdb7ac4 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Thu, 2 Dec 2021 14:26:05 -0800 Subject: [PATCH 13/21] Revert "fix(crds) restore explicit preserveUnknownFields" This reverts commit 817c28d34af3756b129ec74125b9ca9338f2455e. --- .../bases/configuration.konghq.com_kongclusterplugins.yaml | 1 - .../crd/bases/configuration.konghq.com_kongconsumers.yaml | 1 - .../crd/bases/configuration.konghq.com_kongingresses.yaml | 1 - config/crd/bases/configuration.konghq.com_kongplugins.yaml | 1 - config/crd/bases/configuration.konghq.com_tcpingresses.yaml | 1 - config/crd/bases/configuration.konghq.com_udpingresses.yaml | 1 - deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml | 6 ------ deploy/single/all-in-one-dbless.yaml | 6 ------ deploy/single/all-in-one-postgres-enterprise.yaml | 6 ------ deploy/single/all-in-one-postgres.yaml | 6 ------ pkg/apis/configuration/v1/kongclusterplugin_types.go | 1 - pkg/apis/configuration/v1/kongconsumer_types.go | 1 - pkg/apis/configuration/v1/kongingress_types.go | 1 - pkg/apis/configuration/v1/kongplugin_types.go | 1 - pkg/apis/configuration/v1beta1/tcpingress_types.go | 1 - pkg/apis/configuration/v1beta1/udpingress_types.go | 1 - 16 files changed, 36 deletions(-) diff --git a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml index 5581acc4f6..50588eef56 100644 --- a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml @@ -111,7 +111,6 @@ spec: required: - plugin type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/config/crd/bases/configuration.konghq.com_kongconsumers.yaml b/config/crd/bases/configuration.konghq.com_kongconsumers.yaml index 4687ebd91c..cc516ffeb4 100644 --- a/config/crd/bases/configuration.konghq.com_kongconsumers.yaml +++ b/config/crd/bases/configuration.konghq.com_kongconsumers.yaml @@ -58,7 +58,6 @@ spec: description: Username unique username of the consumer. type: string type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/config/crd/bases/configuration.konghq.com_kongingresses.yaml b/config/crd/bases/configuration.konghq.com_kongingresses.yaml index 2e6bad68eb..3c565354b4 100644 --- a/config/crd/bases/configuration.konghq.com_kongingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_kongingresses.yaml @@ -230,7 +230,6 @@ spec: type: integer type: object type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/config/crd/bases/configuration.konghq.com_kongplugins.yaml b/config/crd/bases/configuration.konghq.com_kongplugins.yaml index 87d4f17fba..7b4b7fac39 100644 --- a/config/crd/bases/configuration.konghq.com_kongplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongplugins.yaml @@ -108,7 +108,6 @@ spec: required: - plugin type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/config/crd/bases/configuration.konghq.com_tcpingresses.yaml b/config/crd/bases/configuration.konghq.com_tcpingresses.yaml index 6eb98fedb3..9e275b5c79 100644 --- a/config/crd/bases/configuration.konghq.com_tcpingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_tcpingresses.yaml @@ -175,7 +175,6 @@ spec: type: object type: object type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/config/crd/bases/configuration.konghq.com_udpingresses.yaml b/config/crd/bases/configuration.konghq.com_udpingresses.yaml index c8fc28df62..10f7006bd9 100644 --- a/config/crd/bases/configuration.konghq.com_udpingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_udpingresses.yaml @@ -143,7 +143,6 @@ spec: type: object type: object type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml index ea8f31b2e3..81adc3272a 100644 --- a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml +++ b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml @@ -114,7 +114,6 @@ spec: required: - plugin type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -184,7 +183,6 @@ spec: description: Username unique username of the consumer. type: string type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -426,7 +424,6 @@ spec: type: integer type: object type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -546,7 +543,6 @@ spec: required: - plugin type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -733,7 +729,6 @@ spec: type: object type: object type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -888,7 +883,6 @@ spec: type: object type: object type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/deploy/single/all-in-one-dbless.yaml b/deploy/single/all-in-one-dbless.yaml index b54888295d..975e9556c2 100644 --- a/deploy/single/all-in-one-dbless.yaml +++ b/deploy/single/all-in-one-dbless.yaml @@ -114,7 +114,6 @@ spec: required: - plugin type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -184,7 +183,6 @@ spec: description: Username unique username of the consumer. type: string type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -426,7 +424,6 @@ spec: type: integer type: object type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -546,7 +543,6 @@ spec: required: - plugin type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -733,7 +729,6 @@ spec: type: object type: object type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -888,7 +883,6 @@ spec: type: object type: object type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/deploy/single/all-in-one-postgres-enterprise.yaml b/deploy/single/all-in-one-postgres-enterprise.yaml index 37c8158a5a..48884beee1 100644 --- a/deploy/single/all-in-one-postgres-enterprise.yaml +++ b/deploy/single/all-in-one-postgres-enterprise.yaml @@ -114,7 +114,6 @@ spec: required: - plugin type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -184,7 +183,6 @@ spec: description: Username unique username of the consumer. type: string type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -426,7 +424,6 @@ spec: type: integer type: object type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -546,7 +543,6 @@ spec: required: - plugin type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -733,7 +729,6 @@ spec: type: object type: object type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -888,7 +883,6 @@ spec: type: object type: object type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/deploy/single/all-in-one-postgres.yaml b/deploy/single/all-in-one-postgres.yaml index 705ab99a69..1e1cad6a83 100644 --- a/deploy/single/all-in-one-postgres.yaml +++ b/deploy/single/all-in-one-postgres.yaml @@ -114,7 +114,6 @@ spec: required: - plugin type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -184,7 +183,6 @@ spec: description: Username unique username of the consumer. type: string type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -426,7 +424,6 @@ spec: type: integer type: object type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -546,7 +543,6 @@ spec: required: - plugin type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -733,7 +729,6 @@ spec: type: object type: object type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: @@ -888,7 +883,6 @@ spec: type: object type: object type: object - x-kubernetes-preserve-unknown-fields: true served: true storage: true subresources: diff --git a/pkg/apis/configuration/v1/kongclusterplugin_types.go b/pkg/apis/configuration/v1/kongclusterplugin_types.go index 39fcf69166..1609ca1d86 100644 --- a/pkg/apis/configuration/v1/kongclusterplugin_types.go +++ b/pkg/apis/configuration/v1/kongclusterplugin_types.go @@ -33,7 +33,6 @@ import ( //+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" //+kubebuilder:printcolumn:name="Disabled",type=boolean,JSONPath=`.disabled`,description="Indicates if the plugin is disabled",priority=1 //+kubebuilder:printcolumn:name="Config",type=string,JSONPath=`.config`,description="Configuration of the plugin",priority=1 -//+kubebuilder:pruning:PreserveUnknownFields // KongClusterPlugin is the Schema for the kongclusterplugins API type KongClusterPlugin struct { diff --git a/pkg/apis/configuration/v1/kongconsumer_types.go b/pkg/apis/configuration/v1/kongconsumer_types.go index c73d01ba56..73149a5557 100644 --- a/pkg/apis/configuration/v1/kongconsumer_types.go +++ b/pkg/apis/configuration/v1/kongconsumer_types.go @@ -29,7 +29,6 @@ import ( //+kubebuilder:validation:Optional //+kubebuilder:printcolumn:name="Username",type=string,JSONPath=`.username`,description="Username of a Kong Consumer" //+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" -//+kubebuilder:pruning:PreserveUnknownFields // KongConsumer is the Schema for the kongconsumers API type KongConsumer struct { diff --git a/pkg/apis/configuration/v1/kongingress_types.go b/pkg/apis/configuration/v1/kongingress_types.go index d5bc98651a..75725b667b 100644 --- a/pkg/apis/configuration/v1/kongingress_types.go +++ b/pkg/apis/configuration/v1/kongingress_types.go @@ -28,7 +28,6 @@ import ( //+kubebuilder:storageversion //+kubebuilder:resource:shortName=ki //+kubebuilder:validation:Optional -//+kubebuilder:pruning:PreserveUnknownFields // KongIngress is the Schema for the kongingresses API type KongIngress struct { diff --git a/pkg/apis/configuration/v1/kongplugin_types.go b/pkg/apis/configuration/v1/kongplugin_types.go index 31d415eeb9..1ab9547f28 100644 --- a/pkg/apis/configuration/v1/kongplugin_types.go +++ b/pkg/apis/configuration/v1/kongplugin_types.go @@ -32,7 +32,6 @@ import ( //+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" //+kubebuilder:printcolumn:name="Disabled",type=boolean,JSONPath=`.disabled`,description="Indicates if the plugin is disabled",priority=1 //+kubebuilder:printcolumn:name="Config",type=string,JSONPath=`.config`,description="Configuration of the plugin",priority=1 -//+kubebuilder:pruning:PreserveUnknownFields // KongPlugin is the Schema for the kongplugins API type KongPlugin struct { diff --git a/pkg/apis/configuration/v1beta1/tcpingress_types.go b/pkg/apis/configuration/v1beta1/tcpingress_types.go index 7d7b837bf3..2f2ab577f7 100644 --- a/pkg/apis/configuration/v1beta1/tcpingress_types.go +++ b/pkg/apis/configuration/v1beta1/tcpingress_types.go @@ -29,7 +29,6 @@ import ( //+kubebuilder:validation:Optional //+kubebuilder:printcolumn:name="Address",type=string,JSONPath=`.status.loadBalancer.ingress[*].ip`,description="Address of the load balancer" //+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" -//+kubebuilder:pruning:PreserveUnknownFields // TCPIngress is the Schema for the tcpingresses API type TCPIngress struct { diff --git a/pkg/apis/configuration/v1beta1/udpingress_types.go b/pkg/apis/configuration/v1beta1/udpingress_types.go index 08a2434250..6bd31d2b60 100644 --- a/pkg/apis/configuration/v1beta1/udpingress_types.go +++ b/pkg/apis/configuration/v1beta1/udpingress_types.go @@ -42,7 +42,6 @@ type UDPIngressList struct { //+kubebuilder:validation:Optional //+kubebuilder:printcolumn:name="Address",type=string,JSONPath=`.status.loadBalancer.ingress[*].ip`,description="Address of the load balancer" //+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age" -//+kubebuilder:pruning:PreserveUnknownFields // UDPIngress is the Schema for the udpingresses API type UDPIngress struct { From 9ad632ee9937850cca23493c591609df137bfd4e Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Thu, 2 Dec 2021 16:01:58 -0800 Subject: [PATCH 14/21] test(e2e) log versions for upgrade test --- test/e2e/all_in_one_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/all_in_one_test.go b/test/e2e/all_in_one_test.go index 80fdf2e492..7115ddb257 100644 --- a/test/e2e/all_in_one_test.go +++ b/test/e2e/all_in_one_test.go @@ -149,14 +149,14 @@ func TestDeployAndUpgradeAllInOneDBLESS(t *testing.T) { assert.NoError(t, env.Cleanup(ctx)) }() - t.Log("deploying previous minor version kong manifest") + t.Logf("deploying previous version %s kong manifest", preTag) deployKong(ctx, t, env, oldManifest.Body) t.Log("running ingress tests to verify all-in-one deployed ingress controller and proxy are functional") deployIngress(ctx, t, env) verifyIngress(ctx, t, env) - t.Log("deploying current kong manifest") + t.Logf("deploying current version %s kong manifest", curTag) manifest, err := getTestManifest(t, dblessPath) require.NoError(t, err) From 95aa83e7fbccf46f1c12f6a9c67adc67d5c22460 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Tue, 7 Dec 2021 15:18:29 -0800 Subject: [PATCH 15/21] fix(crd) enforce required configFrom fields --- .../bases/configuration.konghq.com_kongclusterplugins.yaml | 4 ++++ config/crd/bases/configuration.konghq.com_kongplugins.yaml | 3 +++ deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml | 7 +++++++ deploy/single/all-in-one-dbless.yaml | 7 +++++++ deploy/single/all-in-one-postgres-enterprise.yaml | 7 +++++++ deploy/single/all-in-one-postgres.yaml | 7 +++++++ pkg/apis/configuration/v1/configsource.go | 5 +++++ 7 files changed, 40 insertions(+) diff --git a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml index 50588eef56..ff88a536f3 100644 --- a/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml @@ -67,6 +67,10 @@ spec: namespace: description: The namespace containing the secret type: string + required: + - key + - name + - namespace type: object type: object consumerRef: diff --git a/config/crd/bases/configuration.konghq.com_kongplugins.yaml b/config/crd/bases/configuration.konghq.com_kongplugins.yaml index 7b4b7fac39..763f39b12b 100644 --- a/config/crd/bases/configuration.konghq.com_kongplugins.yaml +++ b/config/crd/bases/configuration.konghq.com_kongplugins.yaml @@ -64,6 +64,9 @@ spec: name: description: the secret containing the key type: string + required: + - key + - name type: object type: object consumerRef: diff --git a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml index 81adc3272a..2bfe1c27f3 100644 --- a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml +++ b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml @@ -70,6 +70,10 @@ spec: namespace: description: The namespace containing the secret type: string + required: + - key + - name + - namespace type: object type: object consumerRef: @@ -499,6 +503,9 @@ spec: name: description: the secret containing the key type: string + required: + - key + - name type: object type: object consumerRef: diff --git a/deploy/single/all-in-one-dbless.yaml b/deploy/single/all-in-one-dbless.yaml index 975e9556c2..67ac56a612 100644 --- a/deploy/single/all-in-one-dbless.yaml +++ b/deploy/single/all-in-one-dbless.yaml @@ -70,6 +70,10 @@ spec: namespace: description: The namespace containing the secret type: string + required: + - key + - name + - namespace type: object type: object consumerRef: @@ -499,6 +503,9 @@ spec: name: description: the secret containing the key type: string + required: + - key + - name type: object type: object consumerRef: diff --git a/deploy/single/all-in-one-postgres-enterprise.yaml b/deploy/single/all-in-one-postgres-enterprise.yaml index 48884beee1..b2c49b9647 100644 --- a/deploy/single/all-in-one-postgres-enterprise.yaml +++ b/deploy/single/all-in-one-postgres-enterprise.yaml @@ -70,6 +70,10 @@ spec: namespace: description: The namespace containing the secret type: string + required: + - key + - name + - namespace type: object type: object consumerRef: @@ -499,6 +503,9 @@ spec: name: description: the secret containing the key type: string + required: + - key + - name type: object type: object consumerRef: diff --git a/deploy/single/all-in-one-postgres.yaml b/deploy/single/all-in-one-postgres.yaml index 1e1cad6a83..13bf8dd1e0 100644 --- a/deploy/single/all-in-one-postgres.yaml +++ b/deploy/single/all-in-one-postgres.yaml @@ -70,6 +70,10 @@ spec: namespace: description: The namespace containing the secret type: string + required: + - key + - name + - namespace type: object type: object consumerRef: @@ -499,6 +503,9 @@ spec: name: description: the secret containing the key type: string + required: + - key + - name type: object type: object consumerRef: diff --git a/pkg/apis/configuration/v1/configsource.go b/pkg/apis/configuration/v1/configsource.go index 3add2a2181..4680b09469 100644 --- a/pkg/apis/configuration/v1/configsource.go +++ b/pkg/apis/configuration/v1/configsource.go @@ -16,8 +16,10 @@ type NamespacedConfigSource struct { //+kubebuilder:object:generate=true type SecretValueFromSource struct { // the secret containing the key + //+kubebuilder:validation:Required Secret string `json:"name,omitempty"` // the key containing the value + //+kubebuilder:validation:Required Key string `json:"key,omitempty"` } @@ -25,9 +27,12 @@ type SecretValueFromSource struct { //+kubebuilder:object:generate=true type NamespacedSecretValueFromSource struct { // The namespace containing the secret + //+kubebuilder:validation:Required Namespace string `json:"namespace,omitempty"` // the secret containing the key + //+kubebuilder:validation:Required Secret string `json:"name,omitempty"` // the key containing the value + //+kubebuilder:validation:Required Key string `json:"key,omitempty"` } From 7b2af456534bd7ac32391c2dca28364f81fec427 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Wed, 8 Dec 2021 09:31:24 -0800 Subject: [PATCH 16/21] doc(changelog) add CRD update entry --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60da863d00..2edd000574 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,20 @@ you should edit it (`kubectl edit validatingwebhookconfiguration kong-validations`) and add `kongclusterplugins` under the `resources` block for the `configuration.konghq.com` API group. +#### Breaking changes + +- You must upgrade to 2.0.x before upgrading to 2.1.x to properly handle the + transition from apiextensions.k8s.io/v1beta1 CRDs to apiextensions.k8s.io/v1 + CRDSs. CRDs are now generated from their underlying Go structures to avoid + accidental mismatches between implementation and Kubernetes configuration. + KongIngresses previously included `healthchecks.passive.unhealthy.timeout` + and `healthchecks.active.unhealthy.timeout` fields that did not match the + corresponding Kong configuration and had no effect. These are now + `healthchecks.passive.unhealthy.timeouts` and + `healthchecks.active.unhealthy.timeouts`, respectively. If you use these + fields, you must rename them in your KongIngresses before upgrading. + [#1971](https://github.com/Kong/kubernetes-ingress-controller/pull/1971) + #### Added - Added validation for `Gateway` objects in the admission webhook From 3684d193d95d910f23b1b2ce64e71b0de24576ae Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Wed, 8 Dec 2021 10:33:18 -0800 Subject: [PATCH 17/21] chore(*) use go-kong v0.25.0 and build manifests --- ...onfiguration.konghq.com_kongingresses.yaml | 15 +++++++++++ .../all-in-one-dbless-k4k8s-enterprise.yaml | 15 +++++++++++ deploy/single/all-in-one-dbless.yaml | 15 +++++++++++ .../all-in-one-postgres-enterprise.yaml | 15 +++++++++++ deploy/single/all-in-one-postgres.yaml | 15 +++++++++++ go.mod | 12 ++++----- go.sum | 25 ++++++++++++++----- 7 files changed, 100 insertions(+), 12 deletions(-) diff --git a/config/crd/bases/configuration.konghq.com_kongingresses.yaml b/config/crd/bases/configuration.konghq.com_kongingresses.yaml index 3c565354b4..72d1d56805 100644 --- a/config/crd/bases/configuration.konghq.com_kongingresses.yaml +++ b/config/crd/bases/configuration.konghq.com_kongingresses.yaml @@ -141,6 +141,7 @@ spec: probing. properties: concurrency: + minimum: 1 type: integer healthy: description: Healthy configures thresholds and HTTP status @@ -151,17 +152,21 @@ spec: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object http_path: + pattern: ^/.*$ type: string https_sni: type: string https_verify_certificate: type: boolean timeout: + minimum: 0 type: integer type: type: string @@ -170,16 +175,20 @@ spec: codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer timeouts: + minimum: 0 type: integer type: object type: object @@ -196,8 +205,10 @@ spec: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object type: @@ -207,16 +218,20 @@ spec: codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer timeouts: + minimum: 0 type: integer type: object type: object diff --git a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml index 2bfe1c27f3..10557d84b3 100644 --- a/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml +++ b/deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml @@ -339,6 +339,7 @@ spec: probing. properties: concurrency: + minimum: 1 type: integer healthy: description: Healthy configures thresholds and HTTP status @@ -349,17 +350,21 @@ spec: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object http_path: + pattern: ^/.*$ type: string https_sni: type: string https_verify_certificate: type: boolean timeout: + minimum: 0 type: integer type: type: string @@ -368,16 +373,20 @@ spec: codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer timeouts: + minimum: 0 type: integer type: object type: object @@ -394,8 +403,10 @@ spec: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object type: @@ -405,16 +416,20 @@ spec: codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer timeouts: + minimum: 0 type: integer type: object type: object diff --git a/deploy/single/all-in-one-dbless.yaml b/deploy/single/all-in-one-dbless.yaml index 67ac56a612..0bd9b98af6 100644 --- a/deploy/single/all-in-one-dbless.yaml +++ b/deploy/single/all-in-one-dbless.yaml @@ -339,6 +339,7 @@ spec: probing. properties: concurrency: + minimum: 1 type: integer healthy: description: Healthy configures thresholds and HTTP status @@ -349,17 +350,21 @@ spec: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object http_path: + pattern: ^/.*$ type: string https_sni: type: string https_verify_certificate: type: boolean timeout: + minimum: 0 type: integer type: type: string @@ -368,16 +373,20 @@ spec: codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer timeouts: + minimum: 0 type: integer type: object type: object @@ -394,8 +403,10 @@ spec: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object type: @@ -405,16 +416,20 @@ spec: codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer timeouts: + minimum: 0 type: integer type: object type: object diff --git a/deploy/single/all-in-one-postgres-enterprise.yaml b/deploy/single/all-in-one-postgres-enterprise.yaml index b2c49b9647..0e9fca1490 100644 --- a/deploy/single/all-in-one-postgres-enterprise.yaml +++ b/deploy/single/all-in-one-postgres-enterprise.yaml @@ -339,6 +339,7 @@ spec: probing. properties: concurrency: + minimum: 1 type: integer healthy: description: Healthy configures thresholds and HTTP status @@ -349,17 +350,21 @@ spec: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object http_path: + pattern: ^/.*$ type: string https_sni: type: string https_verify_certificate: type: boolean timeout: + minimum: 0 type: integer type: type: string @@ -368,16 +373,20 @@ spec: codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer timeouts: + minimum: 0 type: integer type: object type: object @@ -394,8 +403,10 @@ spec: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object type: @@ -405,16 +416,20 @@ spec: codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer timeouts: + minimum: 0 type: integer type: object type: object diff --git a/deploy/single/all-in-one-postgres.yaml b/deploy/single/all-in-one-postgres.yaml index 13bf8dd1e0..2b8c0dadf0 100644 --- a/deploy/single/all-in-one-postgres.yaml +++ b/deploy/single/all-in-one-postgres.yaml @@ -339,6 +339,7 @@ spec: probing. properties: concurrency: + minimum: 1 type: integer healthy: description: Healthy configures thresholds and HTTP status @@ -349,17 +350,21 @@ spec: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object http_path: + pattern: ^/.*$ type: string https_sni: type: string https_verify_certificate: type: boolean timeout: + minimum: 0 type: integer type: type: string @@ -368,16 +373,20 @@ spec: codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer timeouts: + minimum: 0 type: integer type: object type: object @@ -394,8 +403,10 @@ spec: type: integer type: array interval: + minimum: 0 type: integer successes: + minimum: 0 type: integer type: object type: @@ -405,16 +416,20 @@ spec: codes to mark targets unhealthy. properties: http_failures: + minimum: 0 type: integer http_statuses: items: type: integer type: array interval: + minimum: 0 type: integer tcp_failures: + minimum: 0 type: integer timeouts: + minimum: 0 type: integer type: object type: object diff --git a/go.mod b/go.mod index e3fbb3462c..b34c26149d 100644 --- a/go.mod +++ b/go.mod @@ -8,10 +8,10 @@ require ( github.com/blang/semver/v4 v4.0.0 github.com/bombsimon/logrusr v1.1.0 github.com/ghodss/yaml v1.0.0 - github.com/go-logr/logr v0.4.0 + github.com/go-logr/logr v1.2.0 github.com/google/uuid v1.3.0 github.com/kong/deck v1.7.0 - github.com/kong/go-kong v0.24.0 + github.com/kong/go-kong v0.25.0 github.com/kong/kubernetes-testing-framework v0.10.0 github.com/lithammer/dedent v1.1.0 github.com/miekg/dns v1.1.43 @@ -91,7 +91,7 @@ require ( github.com/imdario/mergo v0.3.12 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/josharian/intern v1.0.0 // indirect - github.com/json-iterator/go v1.1.11 // indirect + github.com/json-iterator/go v1.1.12 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.8 // indirect github.com/mattn/go-isatty v0.0.12 // indirect @@ -99,7 +99,7 @@ require ( github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.2 // indirect @@ -139,8 +139,8 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect - k8s.io/klog/v2 v2.10.0 // indirect - k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c // indirect + k8s.io/klog/v2 v2.30.0 // indirect + k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect k8s.io/utils v0.0.0-20210820185131-d34e5cb4466e // indirect sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect ) diff --git a/go.sum b/go.sum index 6fb762d61f..8e5c8bafe4 100644 --- a/go.sum +++ b/go.sum @@ -405,6 +405,7 @@ github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWp github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= +github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= @@ -425,8 +426,9 @@ github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-logr/logr v0.4.0 h1:K7/B1jt6fIBQVd4Owv2MqGQClcgf0R266+7C/QjRcLc= github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v1.2.0 h1:QK40JKJyMdUDz+h+xvCsru/bJhvG0UxvePV0ufL/AcE= +github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/zapr v0.4.0 h1:uc1uML3hRYL9/ZZPdgHS/n8Nzo+eaYL/Efxkkamf7OM= github.com/go-logr/zapr v0.4.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= @@ -677,8 +679,9 @@ github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= @@ -697,8 +700,9 @@ github.com/klauspost/compress v1.13.0/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8 github.com/kong/deck v1.7.0 h1:uo4NdcChHoM9sb2Z8YPAuFyobv8bxaQuayA00tzN5js= github.com/kong/deck v1.7.0/go.mod h1:o2letQaSpXVnDNoXehEibOF6q7v46qtbsKOCC+1owAw= github.com/kong/go-kong v0.19.0/go.mod h1:HyNtOxzh/tzmOV//ccO5NAdmrCnq8b86YUPjmdy5aog= -github.com/kong/go-kong v0.24.0 h1:uX3oq3lYq6t/+ZtlmSM1R/ookjpe/B390I7h7GS/mPs= github.com/kong/go-kong v0.24.0/go.mod h1:LEv2jsUFcGHpN3Ocmcya81yJOZSsMydXo4aLfiGYmbQ= +github.com/kong/go-kong v0.25.0 h1:Q3cn06zWDGKvgDUasmf88ReTx5WV0Ge8XVjWxBrtDuQ= +github.com/kong/go-kong v0.25.0/go.mod h1:vUXOoOeGeg1moe5v66lPeMkSEIZFJReAAcoptEtc7tY= github.com/kong/kubernetes-testing-framework v0.10.0 h1:yS9wDZFqd9akbX0qJ0W260PQxaWGf8i5nK8DfRKZMoY= github.com/kong/kubernetes-testing-framework v0.10.0/go.mod h1:q9x9PPdQbBzD68st/Pm75/4Oi4qR1+dD+U9uormYhyI= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -784,8 +788,9 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/2gBQ3RWajuToeY6ZtZTIKv2v7ThUy5KKusIT0yc0= github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= @@ -1231,6 +1236,7 @@ golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -1370,6 +1376,7 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1463,6 +1470,7 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.6-0.20210820212750-d4cc65f0b2ff/go.mod h1:YD9qOF0M9xpSpdWTBbzEl5e/RnCefISl8E5Noe10jFM= golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1751,6 +1759,7 @@ k8s.io/code-generator v0.22.0/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpx k8s.io/code-generator v0.22.2/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpxa+o= k8s.io/code-generator v0.22.3/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpxa+o= k8s.io/code-generator v0.22.4/go.mod h1:qjYl54pQ/emhkT0UxbufbREYJMWsHNNV/jSVwhYZQGw= +k8s.io/code-generator v0.23.0/go.mod h1:vQvOhDXhuzqiVfM/YHp+dmg10WDZCchJVObc9MvowsE= k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI= k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= @@ -1769,6 +1778,7 @@ k8s.io/csi-translation-lib v0.21.0/go.mod h1:edq+UMpgqEx3roTuGF/03uIuSOsI986jtu6 k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20201203183100-97869a43a9d9/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/gengo v0.0.0-20210915205010-39e73c8a59cd/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog v0.2.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= @@ -1778,19 +1788,22 @@ k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= -k8s.io/klog/v2 v2.10.0 h1:R2HDMDJsHVTHA2n4RjwbeYXdOcBymXdX/JRb1v0VGhE= k8s.io/klog/v2 v2.10.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= +k8s.io/klog/v2 v2.30.0 h1:bUO6drIvCIsvZ/XFgfxoGFQU/a4Qkh0iAlvUR7vlHJw= +k8s.io/klog/v2 v2.30.0/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE= k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw= -k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c h1:jvamsI1tn9V0S8jicyX82qaFC0H/NKxv2e5mbqsgR80= k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw= +k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 h1:E3J9oCLlaobFUqsjG9DfKbP2BmgwBL2p7pn0A3dG9W4= +k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65/go.mod h1:sX9MT8g7NVZM5lVL/j8QyCCJe8YSMW30QvGZWaCIDIk= k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= k8s.io/legacy-cloud-providers v0.21.0/go.mod h1:bNxo7gDg+PGkBmT/MFZswLTWdSWK9kAlS1s8DJca5q4= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20210111153108-fddb29f9d009/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20210707171843-4b05e18ac7d9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20210722164352-7f3ee0f31471/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20210820185131-d34e5cb4466e h1:ldQh+neBabomh7+89dTpiFAB8tGdfVmuIzAHbvtl+9I= k8s.io/utils v0.0.0-20210820185131-d34e5cb4466e/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= From d101970db2ac59f536daf26cffdc4a9e9e675c57 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Wed, 8 Dec 2021 14:23:26 -0800 Subject: [PATCH 18/21] chore(deps) bump go-kong to 0.25.1 --- go.mod | 6 +++--- go.sum | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b34c26149d..0cbb21db9b 100644 --- a/go.mod +++ b/go.mod @@ -8,10 +8,10 @@ require ( github.com/blang/semver/v4 v4.0.0 github.com/bombsimon/logrusr v1.1.0 github.com/ghodss/yaml v1.0.0 - github.com/go-logr/logr v1.2.0 + github.com/go-logr/logr v0.4.0 github.com/google/uuid v1.3.0 github.com/kong/deck v1.7.0 - github.com/kong/go-kong v0.25.0 + github.com/kong/go-kong v0.25.1 github.com/kong/kubernetes-testing-framework v0.10.0 github.com/lithammer/dedent v1.1.0 github.com/miekg/dns v1.1.43 @@ -139,7 +139,7 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect - k8s.io/klog/v2 v2.30.0 // indirect + k8s.io/klog/v2 v2.10.0 // indirect k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect k8s.io/utils v0.0.0-20210820185131-d34e5cb4466e // indirect sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect diff --git a/go.sum b/go.sum index 8e5c8bafe4..264f21ba13 100644 --- a/go.sum +++ b/go.sum @@ -426,6 +426,7 @@ github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v0.4.0 h1:K7/B1jt6fIBQVd4Owv2MqGQClcgf0R266+7C/QjRcLc= github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v1.2.0 h1:QK40JKJyMdUDz+h+xvCsru/bJhvG0UxvePV0ufL/AcE= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -703,6 +704,8 @@ github.com/kong/go-kong v0.19.0/go.mod h1:HyNtOxzh/tzmOV//ccO5NAdmrCnq8b86YUPjmd github.com/kong/go-kong v0.24.0/go.mod h1:LEv2jsUFcGHpN3Ocmcya81yJOZSsMydXo4aLfiGYmbQ= github.com/kong/go-kong v0.25.0 h1:Q3cn06zWDGKvgDUasmf88ReTx5WV0Ge8XVjWxBrtDuQ= github.com/kong/go-kong v0.25.0/go.mod h1:vUXOoOeGeg1moe5v66lPeMkSEIZFJReAAcoptEtc7tY= +github.com/kong/go-kong v0.25.1 h1:T3a4JvwQO//FVtj8F8xrOo689bb/ZmcvoLtBvrPaaj0= +github.com/kong/go-kong v0.25.1/go.mod h1:8Dl/eA8SVH3aJNOkS91J8CPf5oUHZ2+XSYvacrF5PBc= github.com/kong/kubernetes-testing-framework v0.10.0 h1:yS9wDZFqd9akbX0qJ0W260PQxaWGf8i5nK8DfRKZMoY= github.com/kong/kubernetes-testing-framework v0.10.0/go.mod h1:q9x9PPdQbBzD68st/Pm75/4Oi4qR1+dD+U9uormYhyI= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -1788,6 +1791,7 @@ k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= +k8s.io/klog/v2 v2.10.0 h1:R2HDMDJsHVTHA2n4RjwbeYXdOcBymXdX/JRb1v0VGhE= k8s.io/klog/v2 v2.10.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= k8s.io/klog/v2 v2.30.0 h1:bUO6drIvCIsvZ/XFgfxoGFQU/a4Qkh0iAlvUR7vlHJw= k8s.io/klog/v2 v2.30.0/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= From 22eae4a6e8ce9a7571e39256ef670f94a939e9e9 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Wed, 8 Dec 2021 14:43:48 -0800 Subject: [PATCH 19/21] chore(deps) tidy mod --- go.sum | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/go.sum b/go.sum index 264f21ba13..cb879d8f2c 100644 --- a/go.sum +++ b/go.sum @@ -428,8 +428,6 @@ github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7 github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v0.4.0 h1:K7/B1jt6fIBQVd4Owv2MqGQClcgf0R266+7C/QjRcLc= github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-logr/logr v1.2.0 h1:QK40JKJyMdUDz+h+xvCsru/bJhvG0UxvePV0ufL/AcE= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/zapr v0.4.0 h1:uc1uML3hRYL9/ZZPdgHS/n8Nzo+eaYL/Efxkkamf7OM= github.com/go-logr/zapr v0.4.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= @@ -702,8 +700,6 @@ github.com/kong/deck v1.7.0 h1:uo4NdcChHoM9sb2Z8YPAuFyobv8bxaQuayA00tzN5js= github.com/kong/deck v1.7.0/go.mod h1:o2letQaSpXVnDNoXehEibOF6q7v46qtbsKOCC+1owAw= github.com/kong/go-kong v0.19.0/go.mod h1:HyNtOxzh/tzmOV//ccO5NAdmrCnq8b86YUPjmdy5aog= github.com/kong/go-kong v0.24.0/go.mod h1:LEv2jsUFcGHpN3Ocmcya81yJOZSsMydXo4aLfiGYmbQ= -github.com/kong/go-kong v0.25.0 h1:Q3cn06zWDGKvgDUasmf88ReTx5WV0Ge8XVjWxBrtDuQ= -github.com/kong/go-kong v0.25.0/go.mod h1:vUXOoOeGeg1moe5v66lPeMkSEIZFJReAAcoptEtc7tY= github.com/kong/go-kong v0.25.1 h1:T3a4JvwQO//FVtj8F8xrOo689bb/ZmcvoLtBvrPaaj0= github.com/kong/go-kong v0.25.1/go.mod h1:8Dl/eA8SVH3aJNOkS91J8CPf5oUHZ2+XSYvacrF5PBc= github.com/kong/kubernetes-testing-framework v0.10.0 h1:yS9wDZFqd9akbX0qJ0W260PQxaWGf8i5nK8DfRKZMoY= @@ -1239,7 +1235,6 @@ golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -1379,7 +1374,6 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1473,7 +1467,6 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.6-0.20210820212750-d4cc65f0b2ff/go.mod h1:YD9qOF0M9xpSpdWTBbzEl5e/RnCefISl8E5Noe10jFM= golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1762,7 +1755,6 @@ k8s.io/code-generator v0.22.0/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpx k8s.io/code-generator v0.22.2/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpxa+o= k8s.io/code-generator v0.22.3/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpxa+o= k8s.io/code-generator v0.22.4/go.mod h1:qjYl54pQ/emhkT0UxbufbREYJMWsHNNV/jSVwhYZQGw= -k8s.io/code-generator v0.23.0/go.mod h1:vQvOhDXhuzqiVfM/YHp+dmg10WDZCchJVObc9MvowsE= k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI= k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= @@ -1793,8 +1785,6 @@ k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= k8s.io/klog/v2 v2.10.0 h1:R2HDMDJsHVTHA2n4RjwbeYXdOcBymXdX/JRb1v0VGhE= k8s.io/klog/v2 v2.10.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= -k8s.io/klog/v2 v2.30.0 h1:bUO6drIvCIsvZ/XFgfxoGFQU/a4Qkh0iAlvUR7vlHJw= -k8s.io/klog/v2 v2.30.0/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE= k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw= From 07d8f6a3f9484399cad3de500e449f680605c723 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Thu, 9 Dec 2021 10:58:48 -0800 Subject: [PATCH 20/21] pr: add docstrings --- pkg/apis/configuration/v1/kongprotocol_types.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/apis/configuration/v1/kongprotocol_types.go b/pkg/apis/configuration/v1/kongprotocol_types.go index 2970fd6d3b..14c0312883 100644 --- a/pkg/apis/configuration/v1/kongprotocol_types.go +++ b/pkg/apis/configuration/v1/kongprotocol_types.go @@ -6,6 +6,7 @@ package v1 //+kubebuilder:object:generate=true type KongProtocol string +// KongProtocolsToStrings converts a slice of KongProtocol to plain strings func KongProtocolsToStrings(protocols []KongProtocol) (res []string) { for _, protocol := range protocols { res = append(res, string(protocol)) @@ -13,6 +14,7 @@ func KongProtocolsToStrings(protocols []KongProtocol) (res []string) { return } +// StringsToKongProtocols converts a slice of strings to KongProtocols func StringsToKongProtocols(strings []string) (res []KongProtocol) { for _, protocol := range strings { res = append(res, KongProtocol(protocol)) From d543d6790a1c336f0baef36ecd2556165b535a77 Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Thu, 9 Dec 2021 11:21:35 -0800 Subject: [PATCH 21/21] pr: convert TODO to issue --- internal/kongstate/upstream.go | 2 +- pkg/apis/configuration/v1/kongingress_types.go | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/internal/kongstate/upstream.go b/internal/kongstate/upstream.go index c0fa1ad62c..e4eea5945c 100644 --- a/internal/kongstate/upstream.go +++ b/internal/kongstate/upstream.go @@ -76,7 +76,7 @@ func (u *Upstream) overrideByKongIngress(kongIngress *configurationv1.KongIngres if k.HashOnCookiePath != nil { u.HashOnCookiePath = kong.String(*k.HashOnCookiePath) } - // TODO client certificate handling + // TODO https://github.com/Kong/kubernetes-ingress-controller/issues/2075 } // override sets Upstream fields by KongIngress first, then by annotation diff --git a/pkg/apis/configuration/v1/kongingress_types.go b/pkg/apis/configuration/v1/kongingress_types.go index 75725b667b..3ab8b78789 100644 --- a/pkg/apis/configuration/v1/kongingress_types.go +++ b/pkg/apis/configuration/v1/kongingress_types.go @@ -97,13 +97,8 @@ type KongIngressUpstream struct { HashFallbackHeader *string `json:"hash_fallback_header,omitempty" yaml:"hash_fallback_header,omitempty"` HashOnCookie *string `json:"hash_on_cookie,omitempty" yaml:"hash_on_cookie,omitempty"` HashOnCookiePath *string `json:"hash_on_cookie_path,omitempty" yaml:"hash_on_cookie_path,omitempty"` - // TODO status of this in existing code is unclear. While we supported a raw dump from KongIngress.upstream - // into the generated upstream, the Kong upstream type only has a certificate ID field here, not a complete - // certificate/key pair (aka go-kong Certificate). Unclear if db-less or deck have some logic to automagically - // create the certificate and insert the correct ID into the upstream. - // We _DID NOT_ show any client cert example at https://docs.konghq.com/kubernetes-ingress-controller/1.3.x/references/custom-resources/#kongingress - // nor did we have tests for it - //ClientCertificate *Certificate `json:"client_certificate,omitempty" yaml:"client_certificate,omitempty"` + // TODO https://github.com/Kong/kubernetes-ingress-controller/issues/2075 + //ClientCertificate *CertificateSecretRef `json:"client_certificate,omitempty" yaml:"client_certificate,omitempty"` } func init() {