diff --git a/enroute-dp/apis/enroute/v1/doc.go b/enroute-dp/apis/enroute/v1/doc.go new file mode 100644 index 0000000..cda8a8c --- /dev/null +++ b/enroute-dp/apis/enroute/v1/doc.go @@ -0,0 +1,5 @@ +// +k8s:deepcopy-gen=package + +// Package v1 is the v1 version of the API. +// +groupName=enroute.saaras.io +package v1 diff --git a/enroute-dp/apis/enroute/v1/gatewayhost.go b/enroute-dp/apis/enroute/v1/gatewayhost.go new file mode 100644 index 0000000..2f1ea51 --- /dev/null +++ b/enroute-dp/apis/enroute/v1/gatewayhost.go @@ -0,0 +1,295 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// GatewayHostSpec defines the spec of the CRD +type GatewayHostSpec struct { + // Virtualhost appears at most once. If it is present, the object is considered + // to be a "root". + VirtualHost *VirtualHost `json:"virtualhost,omitempty"` + // Routes are the ingress routes. If TCPProxy is present, Routes is ignored. + Routes []Route `json:"routes"` + // TCPProxy holds TCP proxy information. + TCPProxy *TCPProxy `json:"tcpproxy,omitempty"` +} + +type RouteAttachedFilter struct { + // Name of the filter attached to this route + Name string `json:"name,omitempty"` + // Type of the filter attached to this route + Type string `json:"type,omitempty"` +} + +type HostAttachedFilter struct { + // Name of the filter attached to this VirtualHost + Name string `json:"name,omitempty"` + // Type of the filter attached to this VirtualHost + Type string `json:"type,omitempty"` +} + +// VirtualHost appears at most once. If it is present, the object is considered +// to be a "root". +type VirtualHost struct { + // The fully qualified domain name of the root of the ingress tree + // all leaves of the DAG rooted at this object relate to the fqdn + Fqdn string `json:"fqdn"` + // If present describes tls properties. The CNI names that will be matched on + // are described in fqdn, the tls.secretName secret must contain a + // matching certificate + TLS *TLS `json:"tls,omitempty"` + + // Filters attached to this VirtualHost + Filters []HostAttachedFilter `json:"filters,omitempty"` +} + +// TLS describes tls properties. The CNI names that will be matched on +// are described in fqdn, the tls.secretName secret must contain a +// matching certificate unless tls.passthrough is set to true. +type TLS struct { + // required, the name of a secret in the current namespace + SecretName string `json:"secretName,omitempty"` + // Minimum TLS version this vhost should negotiate + MinimumProtocolVersion string `json:"minimumProtocolVersion,omitempty"` + // If Passthrough is set to true, the SecretName will be ignored + // and the encrypted handshake will be passed through to the + // backing cluster. + Passthrough bool `json:"passthrough,omitempty"` +} + +// HeaderCondition specifies the header condition to match. +// Name is required. Only one of Present or Contains must +// be provided. +type HeaderCondition struct { + + // Name is the name of the header to match on. Name is required. + // Header names are case insensitive. + Name string `json:"name"` + + // Present is true if the Header is present in the request. + // +optional + Present bool `json:"present,omitempty"` + + // Contains is true if the Header containing this string is present + // in the request. + // +optional + Contains string `json:"contains,omitempty"` + + // NotContains is true if the Header containing this string is not present + // in the request. + // +optional + NotContains string `json:"notcontains,omitempty"` + + // Exact is true if the Header containing this string matches exactly + // in the request. + // +optional + Exact string `json:"exact,omitempty"` + + // NotExact is true if the Header containing this string doesn't match exactly + // in the request. + // +optional + NotExact string `json:"notexact,omitempty"` +} + +// Condition are policies that are applied on top of GatewayHost. +// One of Prefix or Header must be provided. +type Condition struct { + // Prefix defines a prefix match for a request. + // +optional + Prefix string `json:"prefix,omitempty"` + + // Header specifies the header condition to match. + // +optional + Header *HeaderCondition `json:"header,omitempty"` +} + +// Route contains the set of routes for a virtual host +type Route struct { + // Conditions are a set of routing properties that is applied to an GatewayHost in a namespace. + // +optional + Conditions []Condition `json:"conditions,omitempty"` + // Services are the services to proxy traffic + Services []Service `json:"services,omitempty"` + // Delegate specifies that this route should be delegated to another GatewayHost + Delegate *Delegate `json:"delegate,omitempty"` + // Enables websocket support for the route + EnableWebsockets bool `json:"enableWebsockets,omitempty"` + // Allow this path to respond to insecure requests over HTTP which are normally + // not permitted when a `virtualhost.tls` block is present. + PermitInsecure bool `json:"permitInsecure,omitempty"` + // Indicates that during forwarding, the matched prefix (or path) should be swapped with this value + PrefixRewrite string `json:"prefixRewrite,omitempty"` + // The timeout policy for this route + TimeoutPolicy *TimeoutPolicy `json:"timeoutPolicy,omitempty"` + // // The retry policy for this route + RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` + // The policy for rewriting the path of the request URL + // after the request has been routed to a Service. + // + // +kubebuilder:validation:Optional + PathRewrite *PathRewritePolicy `json:"pathRewritePolicy,omitempty"` + + // Filters attached to this route + Filters []RouteAttachedFilter `json:"filters,omitempty"` +} + +// PathRewritePolicy specifies how a request URL path should be +// rewritten. This rewriting takes place after a request is routed +// and has no subsequent effects on the proxy's routing decision. +// No HTTP headers or body content is rewritten. +// +// Exactly one field in this struct may be specified. +type PathRewritePolicy struct { + // ReplacePrefix describes how the path prefix should be replaced. + // +kubebuilder:validation:Optional + ReplacePrefix []ReplacePrefix `json:"replacePrefix,omitempty"` +} + +// ReplacePrefix describes a path prefix replacement. +type ReplacePrefix struct { + // Prefix specifies the URL path prefix to be replaced. + // + // If Prefix is specified, it must exactly match the Condition + // prefix that is rendered by the chain of including HTTPProxies + // and only that path prefix will be replaced by Replacement. + // This allows HTTPProxies that are included through multiple + // roots to only replace specific path prefixes, leaving others + // unmodified. + // + // If Prefix is not specified, all routing prefixes rendered + // by the include chain will be replaced. + // + // +kubebuilder:validation:Optional + // +kubebuilder:validation:MinLength=1 + Prefix string `json:"prefix,omitempty"` + + // Replacement is the string that the routing path prefix + // will be replaced with. This must not be empty. + // + // +kubebuilder:validation:Required + // +kubebuilder:validation:MinLength=1 + Replacement string `json:"replacement"` +} + +// TCPProxy contains the set of services to proxy TCP connections. +type TCPProxy struct { + // Services are the services to proxy traffic + Services []Service `json:"services,omitempty"` + // Delegate specifies that this tcpproxy should be delegated to another GatewayHost + Delegate *Delegate `json:"delegate,omitempty"` +} + +// Service defines an upstream to proxy traffic to +type Service struct { + // Name is the name of Kubernetes service to proxy traffic. + // Names defined here will be used to look up corresponding endpoints which contain the ips to route. + Name string `json:"name"` + // Port (defined as Integer) to proxy traffic to since a service can have multiple defined + // + // +required + // +kubebuilder:validation:Minimum=1 + // +kubebuilder:validation:Maximum=65536 + // +kubebuilder:validation:ExclusiveMinimum=false + // +kubebuilder:validation:ExclusiveMaximum=true + Port int `json:"port"` + // Protocol may be used to specify (or override) the protocol used to reach this Service. + // Values may be tls, h2, h2c. If omitted, protocol-selection falls back on Service annotations. + // +kubebuilder:validation:Enum=h2;h2c;tls + // +optional + Protocol string `json:"protocol,omitempty"` + // Weight defines percentage of traffic to balance traffic + // +optional + Weight uint32 `json:"weight,omitempty"` + // HealthCheck defines optional healthchecks on the upstream service + // +optional + HealthCheck *HealthCheck `json:"healthCheck,omitempty"` + // LB Algorithm to apply (see https://github.com/saarasio/enroute/enroute-dp/blob/master/design/gatewayhost-design.md#load-balancing) + // +optional + Strategy string `json:"strategy,omitempty"` + // UpstreamValidation defines how to verify the backend service's certificate + // +optional + UpstreamValidation *UpstreamValidation `json:"validation,omitempty"` + // ClientValidation defines a way to provide client's identity encoded in SAN in a certificate. + // The certificate to send to backend service that it'll verify + // +optional + ClientValidation *UpstreamValidation `json:"clientvalidation,omitempty"` +} + +// Delegate allows for delegating VHosts to other GatewayHosts +type Delegate struct { + // Name of the GatewayHost + Name string `json:"name"` + // Namespace of the GatewayHost + Namespace string `json:"namespace,omitempty"` +} + +// HealthCheck defines optional healthchecks on the upstream service +type HealthCheck struct { + // HTTP endpoint used to perform health checks on upstream service + Path string `json:"path"` + // The value of the host header in the HTTP health check request. + // If left empty (default value), the name "contour-envoy-healthcheck" + // will be used. + Host string `json:"host,omitempty"` + // The interval (seconds) between health checks + IntervalSeconds int64 `json:"intervalSeconds"` + // The time to wait (seconds) for a health check response + TimeoutSeconds int64 `json:"timeoutSeconds"` + // The number of unhealthy health checks required before a host is marked unhealthy + UnhealthyThresholdCount uint32 `json:"unhealthyThresholdCount"` + // The number of healthy health checks required before a host is marked healthy + HealthyThresholdCount uint32 `json:"healthyThresholdCount"` +} + +// TimeoutPolicy define the attributes associated with timeout +type TimeoutPolicy struct { + // Timeout for receiving a response from the server after processing a request from client. + // If not supplied the timeout duration is undefined. + Request string `json:"request"` +} + +// RetryPolicy define the attributes associated with retrying policy +type RetryPolicy struct { + // NumRetries is maximum allowed number of retries. + // If not supplied, the number of retries is zero. + NumRetries uint32 `json:"count"` + // PerTryTimeout specifies the timeout per retry attempt. + // Ignored if NumRetries is not supplied. + PerTryTimeout string `json:"perTryTimeout,omitempty"` +} + +// UpstreamValidation defines how to verify the backend service's certificate +type UpstreamValidation struct { + // Name of the Kubernetes secret be used to validate the certificate presented by the backend + CACertificate string `json:"caSecret"` + // Key which is expected to be present in the 'subjectAltName' of the presented certificate + SubjectName string `json:"subjectName"` +} + +// Status reports the current state of the GatewayHost +type Status struct { + CurrentStatus string `json:"currentStatus"` + Description string `json:"description"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// GatewayHost is an Ingress CRD specificiation +type GatewayHost struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec GatewayHostSpec `json:"spec"` + Status `json:"status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// GatewayHostList is a list of GatewayHosts +type GatewayHostList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []GatewayHost `json:"items"` +} diff --git a/enroute-dp/apis/enroute/v1/globalconfig.go b/enroute-dp/apis/enroute/v1/globalconfig.go new file mode 100644 index 0000000..d45963e --- /dev/null +++ b/enroute-dp/apis/enroute/v1/globalconfig.go @@ -0,0 +1,33 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// GlobalConfigSpec defines the spec of the CRD +type GlobalConfigSpec struct { + Name string `json:"name,omitempty"` + Type string `json:"type,omitempty"` + Config string `json:"config,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// GlobalConfig is an Ingress CRD specificiation +type GlobalConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec GlobalConfigSpec `json:"spec"` + Status `json:"status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// GlobalConfigList is a list of GlobalConfig +type GlobalConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []GlobalConfig `json:"items"` +} diff --git a/enroute-dp/apis/enroute/v1/httpfilter.go b/enroute-dp/apis/enroute/v1/httpfilter.go new file mode 100644 index 0000000..a31e114 --- /dev/null +++ b/enroute-dp/apis/enroute/v1/httpfilter.go @@ -0,0 +1,40 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type GenericHttpFilterConfig struct { + Config string `json:"config,omitempty"` +} + +// HttpFilterSpec defines the spec of the CRD +type HttpFilterSpec struct { + Name string `json:"name,omitempty"` + Type string `json:"type,omitempty"` + HttpFilterConfig GenericHttpFilterConfig `json:"httpFilterConfig,omitempty"` + // Service that the filter communicates with to provide the filter functionality + // Eg: jwt server that hosts external JWKS + Service Service `json:"services,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// HttpFilter is an Ingress CRD specificiation +type HttpFilter struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec HttpFilterSpec `json:"spec"` + Status `json:"status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// HttpFilterList is a list of HttpFilter +type HttpFilterList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []HttpFilter `json:"items"` +} diff --git a/enroute-dp/apis/enroute/v1/register.go b/enroute-dp/apis/enroute/v1/register.go new file mode 100644 index 0000000..c6d5b17 --- /dev/null +++ b/enroute-dp/apis/enroute/v1/register.go @@ -0,0 +1,45 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + // GroupName is the group name for the Contour API + GroupName = "enroute.saaras.io" +) + +var ( + // SchemeBuilder collects the scheme builder functions for the Enroute API + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + + // AddToScheme applies the SchemeBuilder functions to a specified scheme + AddToScheme = SchemeBuilder.AddToScheme +) + +// SchemeGroupVersion is the GroupVersion for the Contour API +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} + +// Resource gets an Contour GroupResource for a specified resource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &GatewayHost{}, + &GatewayHostList{}, + &GlobalConfig{}, + &GlobalConfigList{}, + &HttpFilter{}, + &HttpFilterList{}, + &RouteFilter{}, + &RouteFilterList{}, + &TLSCertificateDelegation{}, + &TLSCertificateDelegationList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/enroute-dp/apis/enroute/v1/routefilter.go b/enroute-dp/apis/enroute/v1/routefilter.go new file mode 100644 index 0000000..0fba59b --- /dev/null +++ b/enroute-dp/apis/enroute/v1/routefilter.go @@ -0,0 +1,40 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type GenericRouteFilterConfig struct { + Config string `json:"config,omitempty"` +} + +// RouteFilterSpec defines the spec of the CRD +type RouteFilterSpec struct { + Name string `json:"name,omitempty"` + Type string `json:"type,omitempty"` + RouteFilterConfig GenericRouteFilterConfig `json:"routeFilterConfig,omitempty"` + // Service that the filter may need to communicate with to provide the filter functionality + // Eg: jwt server that hosts external JWKS + Service Service `json:"services,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// RouteFilter is an Ingress CRD specificiation +type RouteFilter struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec RouteFilterSpec `json:"spec"` + Status `json:"status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// RouteFilterList is a list of RouteFilter +type RouteFilterList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []RouteFilter `json:"items"` +} diff --git a/enroute-dp/apis/enroute/v1/tlscertificatedelegation.go b/enroute-dp/apis/enroute/v1/tlscertificatedelegation.go new file mode 100644 index 0000000..a347ecc --- /dev/null +++ b/enroute-dp/apis/enroute/v1/tlscertificatedelegation.go @@ -0,0 +1,46 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// TLSCertificateDelegationSpec defines the spec of the CRD +type TLSCertificateDelegationSpec struct { + Delegations []CertificateDelegation `json:"delegations"` +} + +// CertificateDelegation maps the authority to reference a secret +// in the current namespace to a set of namespaces. +type CertificateDelegation struct { + + // required, the name of a secret in the current namespace. + SecretName string `json:"secretName"` + + // required, the namespaces the authority to reference the + // the secret will be delegated to. + // If TargetNamespaces is nil or empty, the CertificateDelegation' + // is ignored. If the TargetNamespace list contains the character, "*" + // the secret will be delegated to all namespaces. + TargetNamespaces []string `json:"targetNamespaces"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TLSCertificateDelegation is an TLS Certificate Delegation CRD specificiation. +// See design/tls-certificate-delegation.md for details. +type TLSCertificateDelegation struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec TLSCertificateDelegationSpec `json:"spec"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TLSCertificateDelegationList is a list of TLSCertificateDelegations. +type TLSCertificateDelegationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []TLSCertificateDelegation `json:"items"` +} diff --git a/enroute-dp/apis/enroute/v1/zz_generated.deepcopy.go b/enroute-dp/apis/enroute/v1/zz_generated.deepcopy.go new file mode 100644 index 0000000..661b1c9 --- /dev/null +++ b/enroute-dp/apis/enroute/v1/zz_generated.deepcopy.go @@ -0,0 +1,835 @@ +// +build !ignore_autogenerated + +// SPDX-License-Identifier: Apache-2.0 +// Copyright(c) 2018-2021 Saaras Inc. + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CertificateDelegation) DeepCopyInto(out *CertificateDelegation) { + *out = *in + if in.TargetNamespaces != nil { + in, out := &in.TargetNamespaces, &out.TargetNamespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertificateDelegation. +func (in *CertificateDelegation) DeepCopy() *CertificateDelegation { + if in == nil { + return nil + } + out := new(CertificateDelegation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition) DeepCopyInto(out *Condition) { + *out = *in + if in.Header != nil { + in, out := &in.Header, &out.Header + *out = new(HeaderCondition) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition. +func (in *Condition) DeepCopy() *Condition { + if in == nil { + return nil + } + out := new(Condition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Delegate) DeepCopyInto(out *Delegate) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Delegate. +func (in *Delegate) DeepCopy() *Delegate { + if in == nil { + return nil + } + out := new(Delegate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GatewayHost) DeepCopyInto(out *GatewayHost) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayHost. +func (in *GatewayHost) DeepCopy() *GatewayHost { + if in == nil { + return nil + } + out := new(GatewayHost) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GatewayHost) 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 *GatewayHostList) DeepCopyInto(out *GatewayHostList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GatewayHost, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayHostList. +func (in *GatewayHostList) DeepCopy() *GatewayHostList { + if in == nil { + return nil + } + out := new(GatewayHostList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GatewayHostList) 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 *GatewayHostSpec) DeepCopyInto(out *GatewayHostSpec) { + *out = *in + if in.VirtualHost != nil { + in, out := &in.VirtualHost, &out.VirtualHost + *out = new(VirtualHost) + (*in).DeepCopyInto(*out) + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]Route, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.TCPProxy != nil { + in, out := &in.TCPProxy, &out.TCPProxy + *out = new(TCPProxy) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayHostSpec. +func (in *GatewayHostSpec) DeepCopy() *GatewayHostSpec { + if in == nil { + return nil + } + out := new(GatewayHostSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GenericHttpFilterConfig) DeepCopyInto(out *GenericHttpFilterConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericHttpFilterConfig. +func (in *GenericHttpFilterConfig) DeepCopy() *GenericHttpFilterConfig { + if in == nil { + return nil + } + out := new(GenericHttpFilterConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GenericRouteFilterConfig) DeepCopyInto(out *GenericRouteFilterConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericRouteFilterConfig. +func (in *GenericRouteFilterConfig) DeepCopy() *GenericRouteFilterConfig { + if in == nil { + return nil + } + out := new(GenericRouteFilterConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GlobalConfig) DeepCopyInto(out *GlobalConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalConfig. +func (in *GlobalConfig) DeepCopy() *GlobalConfig { + if in == nil { + return nil + } + out := new(GlobalConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GlobalConfig) 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 *GlobalConfigList) DeepCopyInto(out *GlobalConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GlobalConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalConfigList. +func (in *GlobalConfigList) DeepCopy() *GlobalConfigList { + if in == nil { + return nil + } + out := new(GlobalConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GlobalConfigList) 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 *GlobalConfigSpec) DeepCopyInto(out *GlobalConfigSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalConfigSpec. +func (in *GlobalConfigSpec) DeepCopy() *GlobalConfigSpec { + if in == nil { + return nil + } + out := new(GlobalConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HeaderCondition) DeepCopyInto(out *HeaderCondition) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HeaderCondition. +func (in *HeaderCondition) DeepCopy() *HeaderCondition { + if in == nil { + return nil + } + out := new(HeaderCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HealthCheck) DeepCopyInto(out *HealthCheck) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheck. +func (in *HealthCheck) DeepCopy() *HealthCheck { + if in == nil { + return nil + } + out := new(HealthCheck) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HostAttachedFilter) DeepCopyInto(out *HostAttachedFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostAttachedFilter. +func (in *HostAttachedFilter) DeepCopy() *HostAttachedFilter { + if in == nil { + return nil + } + out := new(HostAttachedFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HttpFilter) DeepCopyInto(out *HttpFilter) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HttpFilter. +func (in *HttpFilter) DeepCopy() *HttpFilter { + if in == nil { + return nil + } + out := new(HttpFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HttpFilter) 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 *HttpFilterList) DeepCopyInto(out *HttpFilterList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]HttpFilter, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HttpFilterList. +func (in *HttpFilterList) DeepCopy() *HttpFilterList { + if in == nil { + return nil + } + out := new(HttpFilterList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HttpFilterList) 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 *HttpFilterSpec) DeepCopyInto(out *HttpFilterSpec) { + *out = *in + out.HttpFilterConfig = in.HttpFilterConfig + in.Service.DeepCopyInto(&out.Service) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HttpFilterSpec. +func (in *HttpFilterSpec) DeepCopy() *HttpFilterSpec { + if in == nil { + return nil + } + out := new(HttpFilterSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PathRewritePolicy) DeepCopyInto(out *PathRewritePolicy) { + *out = *in + if in.ReplacePrefix != nil { + in, out := &in.ReplacePrefix, &out.ReplacePrefix + *out = make([]ReplacePrefix, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PathRewritePolicy. +func (in *PathRewritePolicy) DeepCopy() *PathRewritePolicy { + if in == nil { + return nil + } + out := new(PathRewritePolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReplacePrefix) DeepCopyInto(out *ReplacePrefix) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplacePrefix. +func (in *ReplacePrefix) DeepCopy() *ReplacePrefix { + if in == nil { + return nil + } + out := new(ReplacePrefix) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RetryPolicy) DeepCopyInto(out *RetryPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetryPolicy. +func (in *RetryPolicy) DeepCopy() *RetryPolicy { + if in == nil { + return nil + } + out := new(RetryPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Route) DeepCopyInto(out *Route) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Services != nil { + in, out := &in.Services, &out.Services + *out = make([]Service, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Delegate != nil { + in, out := &in.Delegate, &out.Delegate + *out = new(Delegate) + **out = **in + } + if in.TimeoutPolicy != nil { + in, out := &in.TimeoutPolicy, &out.TimeoutPolicy + *out = new(TimeoutPolicy) + **out = **in + } + if in.RetryPolicy != nil { + in, out := &in.RetryPolicy, &out.RetryPolicy + *out = new(RetryPolicy) + **out = **in + } + if in.PathRewrite != nil { + in, out := &in.PathRewrite, &out.PathRewrite + *out = new(PathRewritePolicy) + (*in).DeepCopyInto(*out) + } + if in.Filters != nil { + in, out := &in.Filters, &out.Filters + *out = make([]RouteAttachedFilter, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route. +func (in *Route) DeepCopy() *Route { + if in == nil { + return nil + } + out := new(Route) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteAttachedFilter) DeepCopyInto(out *RouteAttachedFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteAttachedFilter. +func (in *RouteAttachedFilter) DeepCopy() *RouteAttachedFilter { + if in == nil { + return nil + } + out := new(RouteAttachedFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteFilter) DeepCopyInto(out *RouteFilter) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteFilter. +func (in *RouteFilter) DeepCopy() *RouteFilter { + if in == nil { + return nil + } + out := new(RouteFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RouteFilter) 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 *RouteFilterList) DeepCopyInto(out *RouteFilterList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]RouteFilter, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteFilterList. +func (in *RouteFilterList) DeepCopy() *RouteFilterList { + if in == nil { + return nil + } + out := new(RouteFilterList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RouteFilterList) 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 *RouteFilterSpec) DeepCopyInto(out *RouteFilterSpec) { + *out = *in + out.RouteFilterConfig = in.RouteFilterConfig + in.Service.DeepCopyInto(&out.Service) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteFilterSpec. +func (in *RouteFilterSpec) DeepCopy() *RouteFilterSpec { + if in == nil { + return nil + } + out := new(RouteFilterSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Service) DeepCopyInto(out *Service) { + *out = *in + if in.HealthCheck != nil { + in, out := &in.HealthCheck, &out.HealthCheck + *out = new(HealthCheck) + **out = **in + } + if in.UpstreamValidation != nil { + in, out := &in.UpstreamValidation, &out.UpstreamValidation + *out = new(UpstreamValidation) + **out = **in + } + if in.ClientValidation != nil { + in, out := &in.ClientValidation, &out.ClientValidation + *out = new(UpstreamValidation) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service. +func (in *Service) DeepCopy() *Service { + if in == nil { + return nil + } + out := new(Service) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Status) DeepCopyInto(out *Status) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Status. +func (in *Status) DeepCopy() *Status { + if in == nil { + return nil + } + out := new(Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TCPProxy) DeepCopyInto(out *TCPProxy) { + *out = *in + if in.Services != nil { + in, out := &in.Services, &out.Services + *out = make([]Service, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Delegate != nil { + in, out := &in.Delegate, &out.Delegate + *out = new(Delegate) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPProxy. +func (in *TCPProxy) DeepCopy() *TCPProxy { + if in == nil { + return nil + } + out := new(TCPProxy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TLS) DeepCopyInto(out *TLS) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLS. +func (in *TLS) DeepCopy() *TLS { + if in == nil { + return nil + } + out := new(TLS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TLSCertificateDelegation) DeepCopyInto(out *TLSCertificateDelegation) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSCertificateDelegation. +func (in *TLSCertificateDelegation) DeepCopy() *TLSCertificateDelegation { + if in == nil { + return nil + } + out := new(TLSCertificateDelegation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TLSCertificateDelegation) 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 *TLSCertificateDelegationList) DeepCopyInto(out *TLSCertificateDelegationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]TLSCertificateDelegation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSCertificateDelegationList. +func (in *TLSCertificateDelegationList) DeepCopy() *TLSCertificateDelegationList { + if in == nil { + return nil + } + out := new(TLSCertificateDelegationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TLSCertificateDelegationList) 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 *TLSCertificateDelegationSpec) DeepCopyInto(out *TLSCertificateDelegationSpec) { + *out = *in + if in.Delegations != nil { + in, out := &in.Delegations, &out.Delegations + *out = make([]CertificateDelegation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSCertificateDelegationSpec. +func (in *TLSCertificateDelegationSpec) DeepCopy() *TLSCertificateDelegationSpec { + if in == nil { + return nil + } + out := new(TLSCertificateDelegationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TimeoutPolicy) DeepCopyInto(out *TimeoutPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeoutPolicy. +func (in *TimeoutPolicy) DeepCopy() *TimeoutPolicy { + if in == nil { + return nil + } + out := new(TimeoutPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UpstreamValidation) DeepCopyInto(out *UpstreamValidation) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpstreamValidation. +func (in *UpstreamValidation) DeepCopy() *UpstreamValidation { + if in == nil { + return nil + } + out := new(UpstreamValidation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualHost) DeepCopyInto(out *VirtualHost) { + *out = *in + if in.TLS != nil { + in, out := &in.TLS, &out.TLS + *out = new(TLS) + **out = **in + } + if in.Filters != nil { + in, out := &in.Filters, &out.Filters + *out = make([]HostAttachedFilter, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualHost. +func (in *VirtualHost) DeepCopy() *VirtualHost { + if in == nil { + return nil + } + out := new(VirtualHost) + in.DeepCopyInto(out) + return out +} diff --git a/enroute-dp/apis/generated/clientset/versioned/clientset.go b/enroute-dp/apis/generated/clientset/versioned/clientset.go index 0cd000d..530e7c2 100644 --- a/enroute-dp/apis/generated/clientset/versioned/clientset.go +++ b/enroute-dp/apis/generated/clientset/versioned/clientset.go @@ -1,22 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. package versioned @@ -24,7 +8,7 @@ package versioned import ( "fmt" - enroutev1beta1 "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1" + enroutev1 "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -32,19 +16,19 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - EnrouteV1beta1() enroutev1beta1.EnrouteV1beta1Interface + EnrouteV1() enroutev1.EnrouteV1Interface } // Clientset contains the clients for groups. Each group has exactly one // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - enrouteV1beta1 *enroutev1beta1.EnrouteV1beta1Client + enrouteV1 *enroutev1.EnrouteV1Client } -// EnrouteV1beta1 retrieves the EnrouteV1beta1Client -func (c *Clientset) EnrouteV1beta1() enroutev1beta1.EnrouteV1beta1Interface { - return c.enrouteV1beta1 +// EnrouteV1 retrieves the EnrouteV1Client +func (c *Clientset) EnrouteV1() enroutev1.EnrouteV1Interface { + return c.enrouteV1 } // Discovery retrieves the DiscoveryClient @@ -68,7 +52,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { } var cs Clientset var err error - cs.enrouteV1beta1, err = enroutev1beta1.NewForConfig(&configShallowCopy) + cs.enrouteV1, err = enroutev1.NewForConfig(&configShallowCopy) if err != nil { return nil, err } @@ -84,7 +68,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset - cs.enrouteV1beta1 = enroutev1beta1.NewForConfigOrDie(c) + cs.enrouteV1 = enroutev1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -93,7 +77,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.enrouteV1beta1 = enroutev1beta1.New(c) + cs.enrouteV1 = enroutev1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/enroute-dp/apis/generated/clientset/versioned/doc.go b/enroute-dp/apis/generated/clientset/versioned/doc.go index 7559b61..f7b3dec 100644 --- a/enroute-dp/apis/generated/clientset/versioned/doc.go +++ b/enroute-dp/apis/generated/clientset/versioned/doc.go @@ -1,22 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated clientset. diff --git a/enroute-dp/apis/generated/clientset/versioned/fake/clientset_generated.go b/enroute-dp/apis/generated/clientset/versioned/fake/clientset_generated.go index e665659..c7578b2 100644 --- a/enroute-dp/apis/generated/clientset/versioned/fake/clientset_generated.go +++ b/enroute-dp/apis/generated/clientset/versioned/fake/clientset_generated.go @@ -1,30 +1,14 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. package fake import ( clientset "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned" - enroutev1beta1 "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1" - fakeenroutev1beta1 "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake" + enroutev1 "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1" + fakeenroutev1 "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -79,7 +63,7 @@ func (c *Clientset) Tracker() testing.ObjectTracker { var _ clientset.Interface = &Clientset{} -// EnrouteV1beta1 retrieves the EnrouteV1beta1Client -func (c *Clientset) EnrouteV1beta1() enroutev1beta1.EnrouteV1beta1Interface { - return &fakeenroutev1beta1.FakeEnrouteV1beta1{Fake: &c.Fake} +// EnrouteV1 retrieves the EnrouteV1Client +func (c *Clientset) EnrouteV1() enroutev1.EnrouteV1Interface { + return &fakeenroutev1.FakeEnrouteV1{Fake: &c.Fake} } diff --git a/enroute-dp/apis/generated/clientset/versioned/fake/doc.go b/enroute-dp/apis/generated/clientset/versioned/fake/doc.go index 9cacd63..69dd756 100644 --- a/enroute-dp/apis/generated/clientset/versioned/fake/doc.go +++ b/enroute-dp/apis/generated/clientset/versioned/fake/doc.go @@ -1,22 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated fake clientset. diff --git a/enroute-dp/apis/generated/clientset/versioned/fake/register.go b/enroute-dp/apis/generated/clientset/versioned/fake/register.go index 934a4e3..087aef9 100644 --- a/enroute-dp/apis/generated/clientset/versioned/fake/register.go +++ b/enroute-dp/apis/generated/clientset/versioned/fake/register.go @@ -1,28 +1,12 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. package fake import ( - enroutev1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + enroutev1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -34,7 +18,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var parameterCodec = runtime.NewParameterCodec(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - enroutev1beta1.AddToScheme, + enroutev1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/enroute-dp/apis/generated/clientset/versioned/scheme/doc.go b/enroute-dp/apis/generated/clientset/versioned/scheme/doc.go index 9cc9e88..4e87fdb 100644 --- a/enroute-dp/apis/generated/clientset/versioned/scheme/doc.go +++ b/enroute-dp/apis/generated/clientset/versioned/scheme/doc.go @@ -1,22 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. // This package contains the scheme of the automatically generated clientset. diff --git a/enroute-dp/apis/generated/clientset/versioned/scheme/register.go b/enroute-dp/apis/generated/clientset/versioned/scheme/register.go index 4306ac8..96973d5 100644 --- a/enroute-dp/apis/generated/clientset/versioned/scheme/register.go +++ b/enroute-dp/apis/generated/clientset/versioned/scheme/register.go @@ -1,28 +1,12 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. package scheme import ( - enroutev1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + enroutev1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -34,7 +18,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - enroutev1beta1.AddToScheme, + enroutev1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/doc.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/doc.go new file mode 100644 index 0000000..8482a80 --- /dev/null +++ b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright(c) 2018-2021 Saaras Inc. + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/enroute_client.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/enroute_client.go new file mode 100644 index 0000000..3dd6ffc --- /dev/null +++ b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/enroute_client.go @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright(c) 2018-2021 Saaras Inc. + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" + "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type EnrouteV1Interface interface { + RESTClient() rest.Interface + GatewayHostsGetter + GlobalConfigsGetter + HttpFiltersGetter + RouteFiltersGetter + TLSCertificateDelegationsGetter +} + +// EnrouteV1Client is used to interact with features provided by the enroute.saaras.io group. +type EnrouteV1Client struct { + restClient rest.Interface +} + +func (c *EnrouteV1Client) GatewayHosts(namespace string) GatewayHostInterface { + return newGatewayHosts(c, namespace) +} + +func (c *EnrouteV1Client) GlobalConfigs(namespace string) GlobalConfigInterface { + return newGlobalConfigs(c, namespace) +} + +func (c *EnrouteV1Client) HttpFilters(namespace string) HttpFilterInterface { + return newHttpFilters(c, namespace) +} + +func (c *EnrouteV1Client) RouteFilters(namespace string) RouteFilterInterface { + return newRouteFilters(c, namespace) +} + +func (c *EnrouteV1Client) TLSCertificateDelegations(namespace string) TLSCertificateDelegationInterface { + return newTLSCertificateDelegations(c, namespace) +} + +// NewForConfig creates a new EnrouteV1Client for the given config. +func NewForConfig(c *rest.Config) (*EnrouteV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &EnrouteV1Client{client}, nil +} + +// NewForConfigOrDie creates a new EnrouteV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *EnrouteV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new EnrouteV1Client for the given RESTClient. +func New(c rest.Interface) *EnrouteV1Client { + return &EnrouteV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *EnrouteV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/doc.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/doc.go new file mode 100644 index 0000000..8c96468 --- /dev/null +++ b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright(c) 2018-2021 Saaras Inc. + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_enroute_client.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_enroute_client.go new file mode 100644 index 0000000..d9ab08d --- /dev/null +++ b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_enroute_client.go @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright(c) 2018-2021 Saaras Inc. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeEnrouteV1 struct { + *testing.Fake +} + +func (c *FakeEnrouteV1) GatewayHosts(namespace string) v1.GatewayHostInterface { + return &FakeGatewayHosts{c, namespace} +} + +func (c *FakeEnrouteV1) GlobalConfigs(namespace string) v1.GlobalConfigInterface { + return &FakeGlobalConfigs{c, namespace} +} + +func (c *FakeEnrouteV1) HttpFilters(namespace string) v1.HttpFilterInterface { + return &FakeHttpFilters{c, namespace} +} + +func (c *FakeEnrouteV1) RouteFilters(namespace string) v1.RouteFilterInterface { + return &FakeRouteFilters{c, namespace} +} + +func (c *FakeEnrouteV1) TLSCertificateDelegations(namespace string) v1.TLSCertificateDelegationInterface { + return &FakeTLSCertificateDelegations{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeEnrouteV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_gatewayhost.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_gatewayhost.go similarity index 65% rename from enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_gatewayhost.go rename to enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_gatewayhost.go index 0c8f472..eaf09f5 100644 --- a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_gatewayhost.go +++ b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_gatewayhost.go @@ -1,22 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. package fake @@ -24,7 +8,7 @@ package fake import ( "context" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + enroutev1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -35,29 +19,29 @@ import ( // FakeGatewayHosts implements GatewayHostInterface type FakeGatewayHosts struct { - Fake *FakeEnrouteV1beta1 + Fake *FakeEnrouteV1 ns string } -var gatewayhostsResource = schema.GroupVersionResource{Group: "enroute.saaras.io", Version: "v1beta1", Resource: "gatewayhosts"} +var gatewayhostsResource = schema.GroupVersionResource{Group: "enroute.saaras.io", Version: "v1", Resource: "gatewayhosts"} -var gatewayhostsKind = schema.GroupVersionKind{Group: "enroute.saaras.io", Version: "v1beta1", Kind: "GatewayHost"} +var gatewayhostsKind = schema.GroupVersionKind{Group: "enroute.saaras.io", Version: "v1", Kind: "GatewayHost"} // Get takes name of the gatewayHost, and returns the corresponding gatewayHost object, and an error if there is any. -func (c *FakeGatewayHosts) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.GatewayHost, err error) { +func (c *FakeGatewayHosts) Get(ctx context.Context, name string, options v1.GetOptions) (result *enroutev1.GatewayHost, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(gatewayhostsResource, c.ns, name), &v1beta1.GatewayHost{}) + Invokes(testing.NewGetAction(gatewayhostsResource, c.ns, name), &enroutev1.GatewayHost{}) if obj == nil { return nil, err } - return obj.(*v1beta1.GatewayHost), err + return obj.(*enroutev1.GatewayHost), err } // List takes label and field selectors, and returns the list of GatewayHosts that match those selectors. -func (c *FakeGatewayHosts) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.GatewayHostList, err error) { +func (c *FakeGatewayHosts) List(ctx context.Context, opts v1.ListOptions) (result *enroutev1.GatewayHostList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(gatewayhostsResource, gatewayhostsKind, c.ns, opts), &v1beta1.GatewayHostList{}) + Invokes(testing.NewListAction(gatewayhostsResource, gatewayhostsKind, c.ns, opts), &enroutev1.GatewayHostList{}) if obj == nil { return nil, err @@ -67,8 +51,8 @@ func (c *FakeGatewayHosts) List(ctx context.Context, opts v1.ListOptions) (resul if label == nil { label = labels.Everything() } - list := &v1beta1.GatewayHostList{ListMeta: obj.(*v1beta1.GatewayHostList).ListMeta} - for _, item := range obj.(*v1beta1.GatewayHostList).Items { + list := &enroutev1.GatewayHostList{ListMeta: obj.(*enroutev1.GatewayHostList).ListMeta} + for _, item := range obj.(*enroutev1.GatewayHostList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -84,43 +68,43 @@ func (c *FakeGatewayHosts) Watch(ctx context.Context, opts v1.ListOptions) (watc } // Create takes the representation of a gatewayHost and creates it. Returns the server's representation of the gatewayHost, and an error, if there is any. -func (c *FakeGatewayHosts) Create(ctx context.Context, gatewayHost *v1beta1.GatewayHost, opts v1.CreateOptions) (result *v1beta1.GatewayHost, err error) { +func (c *FakeGatewayHosts) Create(ctx context.Context, gatewayHost *enroutev1.GatewayHost, opts v1.CreateOptions) (result *enroutev1.GatewayHost, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(gatewayhostsResource, c.ns, gatewayHost), &v1beta1.GatewayHost{}) + Invokes(testing.NewCreateAction(gatewayhostsResource, c.ns, gatewayHost), &enroutev1.GatewayHost{}) if obj == nil { return nil, err } - return obj.(*v1beta1.GatewayHost), err + return obj.(*enroutev1.GatewayHost), err } // Update takes the representation of a gatewayHost and updates it. Returns the server's representation of the gatewayHost, and an error, if there is any. -func (c *FakeGatewayHosts) Update(ctx context.Context, gatewayHost *v1beta1.GatewayHost, opts v1.UpdateOptions) (result *v1beta1.GatewayHost, err error) { +func (c *FakeGatewayHosts) Update(ctx context.Context, gatewayHost *enroutev1.GatewayHost, opts v1.UpdateOptions) (result *enroutev1.GatewayHost, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(gatewayhostsResource, c.ns, gatewayHost), &v1beta1.GatewayHost{}) + Invokes(testing.NewUpdateAction(gatewayhostsResource, c.ns, gatewayHost), &enroutev1.GatewayHost{}) if obj == nil { return nil, err } - return obj.(*v1beta1.GatewayHost), err + return obj.(*enroutev1.GatewayHost), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeGatewayHosts) UpdateStatus(ctx context.Context, gatewayHost *v1beta1.GatewayHost, opts v1.UpdateOptions) (*v1beta1.GatewayHost, error) { +func (c *FakeGatewayHosts) UpdateStatus(ctx context.Context, gatewayHost *enroutev1.GatewayHost, opts v1.UpdateOptions) (*enroutev1.GatewayHost, error) { obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(gatewayhostsResource, "status", c.ns, gatewayHost), &v1beta1.GatewayHost{}) + Invokes(testing.NewUpdateSubresourceAction(gatewayhostsResource, "status", c.ns, gatewayHost), &enroutev1.GatewayHost{}) if obj == nil { return nil, err } - return obj.(*v1beta1.GatewayHost), err + return obj.(*enroutev1.GatewayHost), err } // Delete takes name of the gatewayHost and deletes it. Returns an error if one occurs. func (c *FakeGatewayHosts) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(gatewayhostsResource, c.ns, name), &v1beta1.GatewayHost{}) + Invokes(testing.NewDeleteAction(gatewayhostsResource, c.ns, name), &enroutev1.GatewayHost{}) return err } @@ -129,17 +113,17 @@ func (c *FakeGatewayHosts) Delete(ctx context.Context, name string, opts v1.Dele func (c *FakeGatewayHosts) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewDeleteCollectionAction(gatewayhostsResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &v1beta1.GatewayHostList{}) + _, err := c.Fake.Invokes(action, &enroutev1.GatewayHostList{}) return err } // Patch applies the patch and returns the patched gatewayHost. -func (c *FakeGatewayHosts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.GatewayHost, err error) { +func (c *FakeGatewayHosts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *enroutev1.GatewayHost, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(gatewayhostsResource, c.ns, name, pt, data, subresources...), &v1beta1.GatewayHost{}) + Invokes(testing.NewPatchSubresourceAction(gatewayhostsResource, c.ns, name, pt, data, subresources...), &enroutev1.GatewayHost{}) if obj == nil { return nil, err } - return obj.(*v1beta1.GatewayHost), err + return obj.(*enroutev1.GatewayHost), err } diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_globalconfig.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_globalconfig.go similarity index 65% rename from enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_globalconfig.go rename to enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_globalconfig.go index d3dacc3..4d0914e 100644 --- a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_globalconfig.go +++ b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_globalconfig.go @@ -1,22 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. package fake @@ -24,7 +8,7 @@ package fake import ( "context" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + enroutev1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -35,29 +19,29 @@ import ( // FakeGlobalConfigs implements GlobalConfigInterface type FakeGlobalConfigs struct { - Fake *FakeEnrouteV1beta1 + Fake *FakeEnrouteV1 ns string } -var globalconfigsResource = schema.GroupVersionResource{Group: "enroute.saaras.io", Version: "v1beta1", Resource: "globalconfigs"} +var globalconfigsResource = schema.GroupVersionResource{Group: "enroute.saaras.io", Version: "v1", Resource: "globalconfigs"} -var globalconfigsKind = schema.GroupVersionKind{Group: "enroute.saaras.io", Version: "v1beta1", Kind: "GlobalConfig"} +var globalconfigsKind = schema.GroupVersionKind{Group: "enroute.saaras.io", Version: "v1", Kind: "GlobalConfig"} // Get takes name of the globalConfig, and returns the corresponding globalConfig object, and an error if there is any. -func (c *FakeGlobalConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.GlobalConfig, err error) { +func (c *FakeGlobalConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *enroutev1.GlobalConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(globalconfigsResource, c.ns, name), &v1beta1.GlobalConfig{}) + Invokes(testing.NewGetAction(globalconfigsResource, c.ns, name), &enroutev1.GlobalConfig{}) if obj == nil { return nil, err } - return obj.(*v1beta1.GlobalConfig), err + return obj.(*enroutev1.GlobalConfig), err } // List takes label and field selectors, and returns the list of GlobalConfigs that match those selectors. -func (c *FakeGlobalConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.GlobalConfigList, err error) { +func (c *FakeGlobalConfigs) List(ctx context.Context, opts v1.ListOptions) (result *enroutev1.GlobalConfigList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(globalconfigsResource, globalconfigsKind, c.ns, opts), &v1beta1.GlobalConfigList{}) + Invokes(testing.NewListAction(globalconfigsResource, globalconfigsKind, c.ns, opts), &enroutev1.GlobalConfigList{}) if obj == nil { return nil, err @@ -67,8 +51,8 @@ func (c *FakeGlobalConfigs) List(ctx context.Context, opts v1.ListOptions) (resu if label == nil { label = labels.Everything() } - list := &v1beta1.GlobalConfigList{ListMeta: obj.(*v1beta1.GlobalConfigList).ListMeta} - for _, item := range obj.(*v1beta1.GlobalConfigList).Items { + list := &enroutev1.GlobalConfigList{ListMeta: obj.(*enroutev1.GlobalConfigList).ListMeta} + for _, item := range obj.(*enroutev1.GlobalConfigList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -84,43 +68,43 @@ func (c *FakeGlobalConfigs) Watch(ctx context.Context, opts v1.ListOptions) (wat } // Create takes the representation of a globalConfig and creates it. Returns the server's representation of the globalConfig, and an error, if there is any. -func (c *FakeGlobalConfigs) Create(ctx context.Context, globalConfig *v1beta1.GlobalConfig, opts v1.CreateOptions) (result *v1beta1.GlobalConfig, err error) { +func (c *FakeGlobalConfigs) Create(ctx context.Context, globalConfig *enroutev1.GlobalConfig, opts v1.CreateOptions) (result *enroutev1.GlobalConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(globalconfigsResource, c.ns, globalConfig), &v1beta1.GlobalConfig{}) + Invokes(testing.NewCreateAction(globalconfigsResource, c.ns, globalConfig), &enroutev1.GlobalConfig{}) if obj == nil { return nil, err } - return obj.(*v1beta1.GlobalConfig), err + return obj.(*enroutev1.GlobalConfig), err } // Update takes the representation of a globalConfig and updates it. Returns the server's representation of the globalConfig, and an error, if there is any. -func (c *FakeGlobalConfigs) Update(ctx context.Context, globalConfig *v1beta1.GlobalConfig, opts v1.UpdateOptions) (result *v1beta1.GlobalConfig, err error) { +func (c *FakeGlobalConfigs) Update(ctx context.Context, globalConfig *enroutev1.GlobalConfig, opts v1.UpdateOptions) (result *enroutev1.GlobalConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(globalconfigsResource, c.ns, globalConfig), &v1beta1.GlobalConfig{}) + Invokes(testing.NewUpdateAction(globalconfigsResource, c.ns, globalConfig), &enroutev1.GlobalConfig{}) if obj == nil { return nil, err } - return obj.(*v1beta1.GlobalConfig), err + return obj.(*enroutev1.GlobalConfig), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeGlobalConfigs) UpdateStatus(ctx context.Context, globalConfig *v1beta1.GlobalConfig, opts v1.UpdateOptions) (*v1beta1.GlobalConfig, error) { +func (c *FakeGlobalConfigs) UpdateStatus(ctx context.Context, globalConfig *enroutev1.GlobalConfig, opts v1.UpdateOptions) (*enroutev1.GlobalConfig, error) { obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(globalconfigsResource, "status", c.ns, globalConfig), &v1beta1.GlobalConfig{}) + Invokes(testing.NewUpdateSubresourceAction(globalconfigsResource, "status", c.ns, globalConfig), &enroutev1.GlobalConfig{}) if obj == nil { return nil, err } - return obj.(*v1beta1.GlobalConfig), err + return obj.(*enroutev1.GlobalConfig), err } // Delete takes name of the globalConfig and deletes it. Returns an error if one occurs. func (c *FakeGlobalConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(globalconfigsResource, c.ns, name), &v1beta1.GlobalConfig{}) + Invokes(testing.NewDeleteAction(globalconfigsResource, c.ns, name), &enroutev1.GlobalConfig{}) return err } @@ -129,17 +113,17 @@ func (c *FakeGlobalConfigs) Delete(ctx context.Context, name string, opts v1.Del func (c *FakeGlobalConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewDeleteCollectionAction(globalconfigsResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &v1beta1.GlobalConfigList{}) + _, err := c.Fake.Invokes(action, &enroutev1.GlobalConfigList{}) return err } // Patch applies the patch and returns the patched globalConfig. -func (c *FakeGlobalConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.GlobalConfig, err error) { +func (c *FakeGlobalConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *enroutev1.GlobalConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(globalconfigsResource, c.ns, name, pt, data, subresources...), &v1beta1.GlobalConfig{}) + Invokes(testing.NewPatchSubresourceAction(globalconfigsResource, c.ns, name, pt, data, subresources...), &enroutev1.GlobalConfig{}) if obj == nil { return nil, err } - return obj.(*v1beta1.GlobalConfig), err + return obj.(*enroutev1.GlobalConfig), err } diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_httpfilter.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_httpfilter.go similarity index 65% rename from enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_httpfilter.go rename to enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_httpfilter.go index 4452bea..c70582c 100644 --- a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_httpfilter.go +++ b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_httpfilter.go @@ -1,22 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. package fake @@ -24,7 +8,7 @@ package fake import ( "context" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + enroutev1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -35,29 +19,29 @@ import ( // FakeHttpFilters implements HttpFilterInterface type FakeHttpFilters struct { - Fake *FakeEnrouteV1beta1 + Fake *FakeEnrouteV1 ns string } -var httpfiltersResource = schema.GroupVersionResource{Group: "enroute.saaras.io", Version: "v1beta1", Resource: "httpfilters"} +var httpfiltersResource = schema.GroupVersionResource{Group: "enroute.saaras.io", Version: "v1", Resource: "httpfilters"} -var httpfiltersKind = schema.GroupVersionKind{Group: "enroute.saaras.io", Version: "v1beta1", Kind: "HttpFilter"} +var httpfiltersKind = schema.GroupVersionKind{Group: "enroute.saaras.io", Version: "v1", Kind: "HttpFilter"} // Get takes name of the httpFilter, and returns the corresponding httpFilter object, and an error if there is any. -func (c *FakeHttpFilters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.HttpFilter, err error) { +func (c *FakeHttpFilters) Get(ctx context.Context, name string, options v1.GetOptions) (result *enroutev1.HttpFilter, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(httpfiltersResource, c.ns, name), &v1beta1.HttpFilter{}) + Invokes(testing.NewGetAction(httpfiltersResource, c.ns, name), &enroutev1.HttpFilter{}) if obj == nil { return nil, err } - return obj.(*v1beta1.HttpFilter), err + return obj.(*enroutev1.HttpFilter), err } // List takes label and field selectors, and returns the list of HttpFilters that match those selectors. -func (c *FakeHttpFilters) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.HttpFilterList, err error) { +func (c *FakeHttpFilters) List(ctx context.Context, opts v1.ListOptions) (result *enroutev1.HttpFilterList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(httpfiltersResource, httpfiltersKind, c.ns, opts), &v1beta1.HttpFilterList{}) + Invokes(testing.NewListAction(httpfiltersResource, httpfiltersKind, c.ns, opts), &enroutev1.HttpFilterList{}) if obj == nil { return nil, err @@ -67,8 +51,8 @@ func (c *FakeHttpFilters) List(ctx context.Context, opts v1.ListOptions) (result if label == nil { label = labels.Everything() } - list := &v1beta1.HttpFilterList{ListMeta: obj.(*v1beta1.HttpFilterList).ListMeta} - for _, item := range obj.(*v1beta1.HttpFilterList).Items { + list := &enroutev1.HttpFilterList{ListMeta: obj.(*enroutev1.HttpFilterList).ListMeta} + for _, item := range obj.(*enroutev1.HttpFilterList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -84,43 +68,43 @@ func (c *FakeHttpFilters) Watch(ctx context.Context, opts v1.ListOptions) (watch } // Create takes the representation of a httpFilter and creates it. Returns the server's representation of the httpFilter, and an error, if there is any. -func (c *FakeHttpFilters) Create(ctx context.Context, httpFilter *v1beta1.HttpFilter, opts v1.CreateOptions) (result *v1beta1.HttpFilter, err error) { +func (c *FakeHttpFilters) Create(ctx context.Context, httpFilter *enroutev1.HttpFilter, opts v1.CreateOptions) (result *enroutev1.HttpFilter, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(httpfiltersResource, c.ns, httpFilter), &v1beta1.HttpFilter{}) + Invokes(testing.NewCreateAction(httpfiltersResource, c.ns, httpFilter), &enroutev1.HttpFilter{}) if obj == nil { return nil, err } - return obj.(*v1beta1.HttpFilter), err + return obj.(*enroutev1.HttpFilter), err } // Update takes the representation of a httpFilter and updates it. Returns the server's representation of the httpFilter, and an error, if there is any. -func (c *FakeHttpFilters) Update(ctx context.Context, httpFilter *v1beta1.HttpFilter, opts v1.UpdateOptions) (result *v1beta1.HttpFilter, err error) { +func (c *FakeHttpFilters) Update(ctx context.Context, httpFilter *enroutev1.HttpFilter, opts v1.UpdateOptions) (result *enroutev1.HttpFilter, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(httpfiltersResource, c.ns, httpFilter), &v1beta1.HttpFilter{}) + Invokes(testing.NewUpdateAction(httpfiltersResource, c.ns, httpFilter), &enroutev1.HttpFilter{}) if obj == nil { return nil, err } - return obj.(*v1beta1.HttpFilter), err + return obj.(*enroutev1.HttpFilter), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeHttpFilters) UpdateStatus(ctx context.Context, httpFilter *v1beta1.HttpFilter, opts v1.UpdateOptions) (*v1beta1.HttpFilter, error) { +func (c *FakeHttpFilters) UpdateStatus(ctx context.Context, httpFilter *enroutev1.HttpFilter, opts v1.UpdateOptions) (*enroutev1.HttpFilter, error) { obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(httpfiltersResource, "status", c.ns, httpFilter), &v1beta1.HttpFilter{}) + Invokes(testing.NewUpdateSubresourceAction(httpfiltersResource, "status", c.ns, httpFilter), &enroutev1.HttpFilter{}) if obj == nil { return nil, err } - return obj.(*v1beta1.HttpFilter), err + return obj.(*enroutev1.HttpFilter), err } // Delete takes name of the httpFilter and deletes it. Returns an error if one occurs. func (c *FakeHttpFilters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(httpfiltersResource, c.ns, name), &v1beta1.HttpFilter{}) + Invokes(testing.NewDeleteAction(httpfiltersResource, c.ns, name), &enroutev1.HttpFilter{}) return err } @@ -129,17 +113,17 @@ func (c *FakeHttpFilters) Delete(ctx context.Context, name string, opts v1.Delet func (c *FakeHttpFilters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewDeleteCollectionAction(httpfiltersResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &v1beta1.HttpFilterList{}) + _, err := c.Fake.Invokes(action, &enroutev1.HttpFilterList{}) return err } // Patch applies the patch and returns the patched httpFilter. -func (c *FakeHttpFilters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.HttpFilter, err error) { +func (c *FakeHttpFilters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *enroutev1.HttpFilter, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(httpfiltersResource, c.ns, name, pt, data, subresources...), &v1beta1.HttpFilter{}) + Invokes(testing.NewPatchSubresourceAction(httpfiltersResource, c.ns, name, pt, data, subresources...), &enroutev1.HttpFilter{}) if obj == nil { return nil, err } - return obj.(*v1beta1.HttpFilter), err + return obj.(*enroutev1.HttpFilter), err } diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_routefilter.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_routefilter.go similarity index 65% rename from enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_routefilter.go rename to enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_routefilter.go index 47d43c7..ed42b1f 100644 --- a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_routefilter.go +++ b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_routefilter.go @@ -1,22 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. package fake @@ -24,7 +8,7 @@ package fake import ( "context" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + enroutev1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -35,29 +19,29 @@ import ( // FakeRouteFilters implements RouteFilterInterface type FakeRouteFilters struct { - Fake *FakeEnrouteV1beta1 + Fake *FakeEnrouteV1 ns string } -var routefiltersResource = schema.GroupVersionResource{Group: "enroute.saaras.io", Version: "v1beta1", Resource: "routefilters"} +var routefiltersResource = schema.GroupVersionResource{Group: "enroute.saaras.io", Version: "v1", Resource: "routefilters"} -var routefiltersKind = schema.GroupVersionKind{Group: "enroute.saaras.io", Version: "v1beta1", Kind: "RouteFilter"} +var routefiltersKind = schema.GroupVersionKind{Group: "enroute.saaras.io", Version: "v1", Kind: "RouteFilter"} // Get takes name of the routeFilter, and returns the corresponding routeFilter object, and an error if there is any. -func (c *FakeRouteFilters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.RouteFilter, err error) { +func (c *FakeRouteFilters) Get(ctx context.Context, name string, options v1.GetOptions) (result *enroutev1.RouteFilter, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(routefiltersResource, c.ns, name), &v1beta1.RouteFilter{}) + Invokes(testing.NewGetAction(routefiltersResource, c.ns, name), &enroutev1.RouteFilter{}) if obj == nil { return nil, err } - return obj.(*v1beta1.RouteFilter), err + return obj.(*enroutev1.RouteFilter), err } // List takes label and field selectors, and returns the list of RouteFilters that match those selectors. -func (c *FakeRouteFilters) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.RouteFilterList, err error) { +func (c *FakeRouteFilters) List(ctx context.Context, opts v1.ListOptions) (result *enroutev1.RouteFilterList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(routefiltersResource, routefiltersKind, c.ns, opts), &v1beta1.RouteFilterList{}) + Invokes(testing.NewListAction(routefiltersResource, routefiltersKind, c.ns, opts), &enroutev1.RouteFilterList{}) if obj == nil { return nil, err @@ -67,8 +51,8 @@ func (c *FakeRouteFilters) List(ctx context.Context, opts v1.ListOptions) (resul if label == nil { label = labels.Everything() } - list := &v1beta1.RouteFilterList{ListMeta: obj.(*v1beta1.RouteFilterList).ListMeta} - for _, item := range obj.(*v1beta1.RouteFilterList).Items { + list := &enroutev1.RouteFilterList{ListMeta: obj.(*enroutev1.RouteFilterList).ListMeta} + for _, item := range obj.(*enroutev1.RouteFilterList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -84,43 +68,43 @@ func (c *FakeRouteFilters) Watch(ctx context.Context, opts v1.ListOptions) (watc } // Create takes the representation of a routeFilter and creates it. Returns the server's representation of the routeFilter, and an error, if there is any. -func (c *FakeRouteFilters) Create(ctx context.Context, routeFilter *v1beta1.RouteFilter, opts v1.CreateOptions) (result *v1beta1.RouteFilter, err error) { +func (c *FakeRouteFilters) Create(ctx context.Context, routeFilter *enroutev1.RouteFilter, opts v1.CreateOptions) (result *enroutev1.RouteFilter, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(routefiltersResource, c.ns, routeFilter), &v1beta1.RouteFilter{}) + Invokes(testing.NewCreateAction(routefiltersResource, c.ns, routeFilter), &enroutev1.RouteFilter{}) if obj == nil { return nil, err } - return obj.(*v1beta1.RouteFilter), err + return obj.(*enroutev1.RouteFilter), err } // Update takes the representation of a routeFilter and updates it. Returns the server's representation of the routeFilter, and an error, if there is any. -func (c *FakeRouteFilters) Update(ctx context.Context, routeFilter *v1beta1.RouteFilter, opts v1.UpdateOptions) (result *v1beta1.RouteFilter, err error) { +func (c *FakeRouteFilters) Update(ctx context.Context, routeFilter *enroutev1.RouteFilter, opts v1.UpdateOptions) (result *enroutev1.RouteFilter, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(routefiltersResource, c.ns, routeFilter), &v1beta1.RouteFilter{}) + Invokes(testing.NewUpdateAction(routefiltersResource, c.ns, routeFilter), &enroutev1.RouteFilter{}) if obj == nil { return nil, err } - return obj.(*v1beta1.RouteFilter), err + return obj.(*enroutev1.RouteFilter), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeRouteFilters) UpdateStatus(ctx context.Context, routeFilter *v1beta1.RouteFilter, opts v1.UpdateOptions) (*v1beta1.RouteFilter, error) { +func (c *FakeRouteFilters) UpdateStatus(ctx context.Context, routeFilter *enroutev1.RouteFilter, opts v1.UpdateOptions) (*enroutev1.RouteFilter, error) { obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(routefiltersResource, "status", c.ns, routeFilter), &v1beta1.RouteFilter{}) + Invokes(testing.NewUpdateSubresourceAction(routefiltersResource, "status", c.ns, routeFilter), &enroutev1.RouteFilter{}) if obj == nil { return nil, err } - return obj.(*v1beta1.RouteFilter), err + return obj.(*enroutev1.RouteFilter), err } // Delete takes name of the routeFilter and deletes it. Returns an error if one occurs. func (c *FakeRouteFilters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(routefiltersResource, c.ns, name), &v1beta1.RouteFilter{}) + Invokes(testing.NewDeleteAction(routefiltersResource, c.ns, name), &enroutev1.RouteFilter{}) return err } @@ -129,17 +113,17 @@ func (c *FakeRouteFilters) Delete(ctx context.Context, name string, opts v1.Dele func (c *FakeRouteFilters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewDeleteCollectionAction(routefiltersResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &v1beta1.RouteFilterList{}) + _, err := c.Fake.Invokes(action, &enroutev1.RouteFilterList{}) return err } // Patch applies the patch and returns the patched routeFilter. -func (c *FakeRouteFilters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.RouteFilter, err error) { +func (c *FakeRouteFilters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *enroutev1.RouteFilter, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(routefiltersResource, c.ns, name, pt, data, subresources...), &v1beta1.RouteFilter{}) + Invokes(testing.NewPatchSubresourceAction(routefiltersResource, c.ns, name, pt, data, subresources...), &enroutev1.RouteFilter{}) if obj == nil { return nil, err } - return obj.(*v1beta1.RouteFilter), err + return obj.(*enroutev1.RouteFilter), err } diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_tlscertificatedelegation.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_tlscertificatedelegation.go similarity index 60% rename from enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_tlscertificatedelegation.go rename to enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_tlscertificatedelegation.go index d3b4c54..869b1d5 100644 --- a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_tlscertificatedelegation.go +++ b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/fake/fake_tlscertificatedelegation.go @@ -1,22 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. package fake @@ -24,7 +8,7 @@ package fake import ( "context" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + enroutev1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -35,29 +19,29 @@ import ( // FakeTLSCertificateDelegations implements TLSCertificateDelegationInterface type FakeTLSCertificateDelegations struct { - Fake *FakeEnrouteV1beta1 + Fake *FakeEnrouteV1 ns string } -var tlscertificatedelegationsResource = schema.GroupVersionResource{Group: "enroute.saaras.io", Version: "v1beta1", Resource: "tlscertificatedelegations"} +var tlscertificatedelegationsResource = schema.GroupVersionResource{Group: "enroute.saaras.io", Version: "v1", Resource: "tlscertificatedelegations"} -var tlscertificatedelegationsKind = schema.GroupVersionKind{Group: "enroute.saaras.io", Version: "v1beta1", Kind: "TLSCertificateDelegation"} +var tlscertificatedelegationsKind = schema.GroupVersionKind{Group: "enroute.saaras.io", Version: "v1", Kind: "TLSCertificateDelegation"} // Get takes name of the tLSCertificateDelegation, and returns the corresponding tLSCertificateDelegation object, and an error if there is any. -func (c *FakeTLSCertificateDelegations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.TLSCertificateDelegation, err error) { +func (c *FakeTLSCertificateDelegations) Get(ctx context.Context, name string, options v1.GetOptions) (result *enroutev1.TLSCertificateDelegation, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(tlscertificatedelegationsResource, c.ns, name), &v1beta1.TLSCertificateDelegation{}) + Invokes(testing.NewGetAction(tlscertificatedelegationsResource, c.ns, name), &enroutev1.TLSCertificateDelegation{}) if obj == nil { return nil, err } - return obj.(*v1beta1.TLSCertificateDelegation), err + return obj.(*enroutev1.TLSCertificateDelegation), err } // List takes label and field selectors, and returns the list of TLSCertificateDelegations that match those selectors. -func (c *FakeTLSCertificateDelegations) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.TLSCertificateDelegationList, err error) { +func (c *FakeTLSCertificateDelegations) List(ctx context.Context, opts v1.ListOptions) (result *enroutev1.TLSCertificateDelegationList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(tlscertificatedelegationsResource, tlscertificatedelegationsKind, c.ns, opts), &v1beta1.TLSCertificateDelegationList{}) + Invokes(testing.NewListAction(tlscertificatedelegationsResource, tlscertificatedelegationsKind, c.ns, opts), &enroutev1.TLSCertificateDelegationList{}) if obj == nil { return nil, err @@ -67,8 +51,8 @@ func (c *FakeTLSCertificateDelegations) List(ctx context.Context, opts v1.ListOp if label == nil { label = labels.Everything() } - list := &v1beta1.TLSCertificateDelegationList{ListMeta: obj.(*v1beta1.TLSCertificateDelegationList).ListMeta} - for _, item := range obj.(*v1beta1.TLSCertificateDelegationList).Items { + list := &enroutev1.TLSCertificateDelegationList{ListMeta: obj.(*enroutev1.TLSCertificateDelegationList).ListMeta} + for _, item := range obj.(*enroutev1.TLSCertificateDelegationList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -84,31 +68,31 @@ func (c *FakeTLSCertificateDelegations) Watch(ctx context.Context, opts v1.ListO } // Create takes the representation of a tLSCertificateDelegation and creates it. Returns the server's representation of the tLSCertificateDelegation, and an error, if there is any. -func (c *FakeTLSCertificateDelegations) Create(ctx context.Context, tLSCertificateDelegation *v1beta1.TLSCertificateDelegation, opts v1.CreateOptions) (result *v1beta1.TLSCertificateDelegation, err error) { +func (c *FakeTLSCertificateDelegations) Create(ctx context.Context, tLSCertificateDelegation *enroutev1.TLSCertificateDelegation, opts v1.CreateOptions) (result *enroutev1.TLSCertificateDelegation, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(tlscertificatedelegationsResource, c.ns, tLSCertificateDelegation), &v1beta1.TLSCertificateDelegation{}) + Invokes(testing.NewCreateAction(tlscertificatedelegationsResource, c.ns, tLSCertificateDelegation), &enroutev1.TLSCertificateDelegation{}) if obj == nil { return nil, err } - return obj.(*v1beta1.TLSCertificateDelegation), err + return obj.(*enroutev1.TLSCertificateDelegation), err } // Update takes the representation of a tLSCertificateDelegation and updates it. Returns the server's representation of the tLSCertificateDelegation, and an error, if there is any. -func (c *FakeTLSCertificateDelegations) Update(ctx context.Context, tLSCertificateDelegation *v1beta1.TLSCertificateDelegation, opts v1.UpdateOptions) (result *v1beta1.TLSCertificateDelegation, err error) { +func (c *FakeTLSCertificateDelegations) Update(ctx context.Context, tLSCertificateDelegation *enroutev1.TLSCertificateDelegation, opts v1.UpdateOptions) (result *enroutev1.TLSCertificateDelegation, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(tlscertificatedelegationsResource, c.ns, tLSCertificateDelegation), &v1beta1.TLSCertificateDelegation{}) + Invokes(testing.NewUpdateAction(tlscertificatedelegationsResource, c.ns, tLSCertificateDelegation), &enroutev1.TLSCertificateDelegation{}) if obj == nil { return nil, err } - return obj.(*v1beta1.TLSCertificateDelegation), err + return obj.(*enroutev1.TLSCertificateDelegation), err } // Delete takes name of the tLSCertificateDelegation and deletes it. Returns an error if one occurs. func (c *FakeTLSCertificateDelegations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(tlscertificatedelegationsResource, c.ns, name), &v1beta1.TLSCertificateDelegation{}) + Invokes(testing.NewDeleteAction(tlscertificatedelegationsResource, c.ns, name), &enroutev1.TLSCertificateDelegation{}) return err } @@ -117,17 +101,17 @@ func (c *FakeTLSCertificateDelegations) Delete(ctx context.Context, name string, func (c *FakeTLSCertificateDelegations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewDeleteCollectionAction(tlscertificatedelegationsResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &v1beta1.TLSCertificateDelegationList{}) + _, err := c.Fake.Invokes(action, &enroutev1.TLSCertificateDelegationList{}) return err } // Patch applies the patch and returns the patched tLSCertificateDelegation. -func (c *FakeTLSCertificateDelegations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.TLSCertificateDelegation, err error) { +func (c *FakeTLSCertificateDelegations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *enroutev1.TLSCertificateDelegation, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(tlscertificatedelegationsResource, c.ns, name, pt, data, subresources...), &v1beta1.TLSCertificateDelegation{}) + Invokes(testing.NewPatchSubresourceAction(tlscertificatedelegationsResource, c.ns, name, pt, data, subresources...), &enroutev1.TLSCertificateDelegation{}) if obj == nil { return nil, err } - return obj.(*v1beta1.TLSCertificateDelegation), err + return obj.(*enroutev1.TLSCertificateDelegation), err } diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/gatewayhost.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/gatewayhost.go similarity index 63% rename from enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/gatewayhost.go rename to enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/gatewayhost.go index 4b0656f..52836e5 100644 --- a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/gatewayhost.go +++ b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/gatewayhost.go @@ -1,33 +1,17 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" "time" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" scheme "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" @@ -41,15 +25,15 @@ type GatewayHostsGetter interface { // GatewayHostInterface has methods to work with GatewayHost resources. type GatewayHostInterface interface { - Create(ctx context.Context, gatewayHost *v1beta1.GatewayHost, opts v1.CreateOptions) (*v1beta1.GatewayHost, error) - Update(ctx context.Context, gatewayHost *v1beta1.GatewayHost, opts v1.UpdateOptions) (*v1beta1.GatewayHost, error) - UpdateStatus(ctx context.Context, gatewayHost *v1beta1.GatewayHost, opts v1.UpdateOptions) (*v1beta1.GatewayHost, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.GatewayHost, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.GatewayHostList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.GatewayHost, err error) + Create(ctx context.Context, gatewayHost *v1.GatewayHost, opts metav1.CreateOptions) (*v1.GatewayHost, error) + Update(ctx context.Context, gatewayHost *v1.GatewayHost, opts metav1.UpdateOptions) (*v1.GatewayHost, error) + UpdateStatus(ctx context.Context, gatewayHost *v1.GatewayHost, opts metav1.UpdateOptions) (*v1.GatewayHost, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.GatewayHost, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.GatewayHostList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.GatewayHost, err error) GatewayHostExpansion } @@ -60,7 +44,7 @@ type gatewayHosts struct { } // newGatewayHosts returns a GatewayHosts -func newGatewayHosts(c *EnrouteV1beta1Client, namespace string) *gatewayHosts { +func newGatewayHosts(c *EnrouteV1Client, namespace string) *gatewayHosts { return &gatewayHosts{ client: c.RESTClient(), ns: namespace, @@ -68,8 +52,8 @@ func newGatewayHosts(c *EnrouteV1beta1Client, namespace string) *gatewayHosts { } // Get takes name of the gatewayHost, and returns the corresponding gatewayHost object, and an error if there is any. -func (c *gatewayHosts) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.GatewayHost, err error) { - result = &v1beta1.GatewayHost{} +func (c *gatewayHosts) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.GatewayHost, err error) { + result = &v1.GatewayHost{} err = c.client.Get(). Namespace(c.ns). Resource("gatewayhosts"). @@ -81,12 +65,12 @@ func (c *gatewayHosts) Get(ctx context.Context, name string, options v1.GetOptio } // List takes label and field selectors, and returns the list of GatewayHosts that match those selectors. -func (c *gatewayHosts) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.GatewayHostList, err error) { +func (c *gatewayHosts) List(ctx context.Context, opts metav1.ListOptions) (result *v1.GatewayHostList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1beta1.GatewayHostList{} + result = &v1.GatewayHostList{} err = c.client.Get(). Namespace(c.ns). Resource("gatewayhosts"). @@ -98,7 +82,7 @@ func (c *gatewayHosts) List(ctx context.Context, opts v1.ListOptions) (result *v } // Watch returns a watch.Interface that watches the requested gatewayHosts. -func (c *gatewayHosts) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *gatewayHosts) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -113,8 +97,8 @@ func (c *gatewayHosts) Watch(ctx context.Context, opts v1.ListOptions) (watch.In } // Create takes the representation of a gatewayHost and creates it. Returns the server's representation of the gatewayHost, and an error, if there is any. -func (c *gatewayHosts) Create(ctx context.Context, gatewayHost *v1beta1.GatewayHost, opts v1.CreateOptions) (result *v1beta1.GatewayHost, err error) { - result = &v1beta1.GatewayHost{} +func (c *gatewayHosts) Create(ctx context.Context, gatewayHost *v1.GatewayHost, opts metav1.CreateOptions) (result *v1.GatewayHost, err error) { + result = &v1.GatewayHost{} err = c.client.Post(). Namespace(c.ns). Resource("gatewayhosts"). @@ -126,8 +110,8 @@ func (c *gatewayHosts) Create(ctx context.Context, gatewayHost *v1beta1.GatewayH } // Update takes the representation of a gatewayHost and updates it. Returns the server's representation of the gatewayHost, and an error, if there is any. -func (c *gatewayHosts) Update(ctx context.Context, gatewayHost *v1beta1.GatewayHost, opts v1.UpdateOptions) (result *v1beta1.GatewayHost, err error) { - result = &v1beta1.GatewayHost{} +func (c *gatewayHosts) Update(ctx context.Context, gatewayHost *v1.GatewayHost, opts metav1.UpdateOptions) (result *v1.GatewayHost, err error) { + result = &v1.GatewayHost{} err = c.client.Put(). Namespace(c.ns). Resource("gatewayhosts"). @@ -141,8 +125,8 @@ func (c *gatewayHosts) Update(ctx context.Context, gatewayHost *v1beta1.GatewayH // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *gatewayHosts) UpdateStatus(ctx context.Context, gatewayHost *v1beta1.GatewayHost, opts v1.UpdateOptions) (result *v1beta1.GatewayHost, err error) { - result = &v1beta1.GatewayHost{} +func (c *gatewayHosts) UpdateStatus(ctx context.Context, gatewayHost *v1.GatewayHost, opts metav1.UpdateOptions) (result *v1.GatewayHost, err error) { + result = &v1.GatewayHost{} err = c.client.Put(). Namespace(c.ns). Resource("gatewayhosts"). @@ -156,7 +140,7 @@ func (c *gatewayHosts) UpdateStatus(ctx context.Context, gatewayHost *v1beta1.Ga } // Delete takes name of the gatewayHost and deletes it. Returns an error if one occurs. -func (c *gatewayHosts) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *gatewayHosts) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("gatewayhosts"). @@ -167,7 +151,7 @@ func (c *gatewayHosts) Delete(ctx context.Context, name string, opts v1.DeleteOp } // DeleteCollection deletes a collection of objects. -func (c *gatewayHosts) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *gatewayHosts) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { var timeout time.Duration if listOpts.TimeoutSeconds != nil { timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second @@ -183,8 +167,8 @@ func (c *gatewayHosts) DeleteCollection(ctx context.Context, opts v1.DeleteOptio } // Patch applies the patch and returns the patched gatewayHost. -func (c *gatewayHosts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.GatewayHost, err error) { - result = &v1beta1.GatewayHost{} +func (c *gatewayHosts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.GatewayHost, err error) { + result = &v1.GatewayHost{} err = c.client.Patch(pt). Namespace(c.ns). Resource("gatewayhosts"). diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/generated_expansion.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/generated_expansion.go new file mode 100644 index 0000000..cf33ca2 --- /dev/null +++ b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/generated_expansion.go @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright(c) 2018-2021 Saaras Inc. + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +type GatewayHostExpansion interface{} + +type GlobalConfigExpansion interface{} + +type HttpFilterExpansion interface{} + +type RouteFilterExpansion interface{} + +type TLSCertificateDelegationExpansion interface{} diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/globalconfig.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/globalconfig.go similarity index 63% rename from enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/globalconfig.go rename to enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/globalconfig.go index 27e5aa5..41306f8 100644 --- a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/globalconfig.go +++ b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/globalconfig.go @@ -1,33 +1,17 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" "time" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" scheme "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" @@ -41,15 +25,15 @@ type GlobalConfigsGetter interface { // GlobalConfigInterface has methods to work with GlobalConfig resources. type GlobalConfigInterface interface { - Create(ctx context.Context, globalConfig *v1beta1.GlobalConfig, opts v1.CreateOptions) (*v1beta1.GlobalConfig, error) - Update(ctx context.Context, globalConfig *v1beta1.GlobalConfig, opts v1.UpdateOptions) (*v1beta1.GlobalConfig, error) - UpdateStatus(ctx context.Context, globalConfig *v1beta1.GlobalConfig, opts v1.UpdateOptions) (*v1beta1.GlobalConfig, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.GlobalConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.GlobalConfigList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.GlobalConfig, err error) + Create(ctx context.Context, globalConfig *v1.GlobalConfig, opts metav1.CreateOptions) (*v1.GlobalConfig, error) + Update(ctx context.Context, globalConfig *v1.GlobalConfig, opts metav1.UpdateOptions) (*v1.GlobalConfig, error) + UpdateStatus(ctx context.Context, globalConfig *v1.GlobalConfig, opts metav1.UpdateOptions) (*v1.GlobalConfig, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.GlobalConfig, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.GlobalConfigList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.GlobalConfig, err error) GlobalConfigExpansion } @@ -60,7 +44,7 @@ type globalConfigs struct { } // newGlobalConfigs returns a GlobalConfigs -func newGlobalConfigs(c *EnrouteV1beta1Client, namespace string) *globalConfigs { +func newGlobalConfigs(c *EnrouteV1Client, namespace string) *globalConfigs { return &globalConfigs{ client: c.RESTClient(), ns: namespace, @@ -68,8 +52,8 @@ func newGlobalConfigs(c *EnrouteV1beta1Client, namespace string) *globalConfigs } // Get takes name of the globalConfig, and returns the corresponding globalConfig object, and an error if there is any. -func (c *globalConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.GlobalConfig, err error) { - result = &v1beta1.GlobalConfig{} +func (c *globalConfigs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.GlobalConfig, err error) { + result = &v1.GlobalConfig{} err = c.client.Get(). Namespace(c.ns). Resource("globalconfigs"). @@ -81,12 +65,12 @@ func (c *globalConfigs) Get(ctx context.Context, name string, options v1.GetOpti } // List takes label and field selectors, and returns the list of GlobalConfigs that match those selectors. -func (c *globalConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.GlobalConfigList, err error) { +func (c *globalConfigs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.GlobalConfigList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1beta1.GlobalConfigList{} + result = &v1.GlobalConfigList{} err = c.client.Get(). Namespace(c.ns). Resource("globalconfigs"). @@ -98,7 +82,7 @@ func (c *globalConfigs) List(ctx context.Context, opts v1.ListOptions) (result * } // Watch returns a watch.Interface that watches the requested globalConfigs. -func (c *globalConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *globalConfigs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -113,8 +97,8 @@ func (c *globalConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.I } // Create takes the representation of a globalConfig and creates it. Returns the server's representation of the globalConfig, and an error, if there is any. -func (c *globalConfigs) Create(ctx context.Context, globalConfig *v1beta1.GlobalConfig, opts v1.CreateOptions) (result *v1beta1.GlobalConfig, err error) { - result = &v1beta1.GlobalConfig{} +func (c *globalConfigs) Create(ctx context.Context, globalConfig *v1.GlobalConfig, opts metav1.CreateOptions) (result *v1.GlobalConfig, err error) { + result = &v1.GlobalConfig{} err = c.client.Post(). Namespace(c.ns). Resource("globalconfigs"). @@ -126,8 +110,8 @@ func (c *globalConfigs) Create(ctx context.Context, globalConfig *v1beta1.Global } // Update takes the representation of a globalConfig and updates it. Returns the server's representation of the globalConfig, and an error, if there is any. -func (c *globalConfigs) Update(ctx context.Context, globalConfig *v1beta1.GlobalConfig, opts v1.UpdateOptions) (result *v1beta1.GlobalConfig, err error) { - result = &v1beta1.GlobalConfig{} +func (c *globalConfigs) Update(ctx context.Context, globalConfig *v1.GlobalConfig, opts metav1.UpdateOptions) (result *v1.GlobalConfig, err error) { + result = &v1.GlobalConfig{} err = c.client.Put(). Namespace(c.ns). Resource("globalconfigs"). @@ -141,8 +125,8 @@ func (c *globalConfigs) Update(ctx context.Context, globalConfig *v1beta1.Global // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *globalConfigs) UpdateStatus(ctx context.Context, globalConfig *v1beta1.GlobalConfig, opts v1.UpdateOptions) (result *v1beta1.GlobalConfig, err error) { - result = &v1beta1.GlobalConfig{} +func (c *globalConfigs) UpdateStatus(ctx context.Context, globalConfig *v1.GlobalConfig, opts metav1.UpdateOptions) (result *v1.GlobalConfig, err error) { + result = &v1.GlobalConfig{} err = c.client.Put(). Namespace(c.ns). Resource("globalconfigs"). @@ -156,7 +140,7 @@ func (c *globalConfigs) UpdateStatus(ctx context.Context, globalConfig *v1beta1. } // Delete takes name of the globalConfig and deletes it. Returns an error if one occurs. -func (c *globalConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *globalConfigs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("globalconfigs"). @@ -167,7 +151,7 @@ func (c *globalConfigs) Delete(ctx context.Context, name string, opts v1.DeleteO } // DeleteCollection deletes a collection of objects. -func (c *globalConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *globalConfigs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { var timeout time.Duration if listOpts.TimeoutSeconds != nil { timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second @@ -183,8 +167,8 @@ func (c *globalConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOpti } // Patch applies the patch and returns the patched globalConfig. -func (c *globalConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.GlobalConfig, err error) { - result = &v1beta1.GlobalConfig{} +func (c *globalConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.GlobalConfig, err error) { + result = &v1.GlobalConfig{} err = c.client.Patch(pt). Namespace(c.ns). Resource("globalconfigs"). diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/httpfilter.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/httpfilter.go similarity index 63% rename from enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/httpfilter.go rename to enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/httpfilter.go index 9e42d77..aa3ae1d 100644 --- a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/httpfilter.go +++ b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/httpfilter.go @@ -1,33 +1,17 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" "time" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" scheme "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" @@ -41,15 +25,15 @@ type HttpFiltersGetter interface { // HttpFilterInterface has methods to work with HttpFilter resources. type HttpFilterInterface interface { - Create(ctx context.Context, httpFilter *v1beta1.HttpFilter, opts v1.CreateOptions) (*v1beta1.HttpFilter, error) - Update(ctx context.Context, httpFilter *v1beta1.HttpFilter, opts v1.UpdateOptions) (*v1beta1.HttpFilter, error) - UpdateStatus(ctx context.Context, httpFilter *v1beta1.HttpFilter, opts v1.UpdateOptions) (*v1beta1.HttpFilter, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.HttpFilter, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.HttpFilterList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.HttpFilter, err error) + Create(ctx context.Context, httpFilter *v1.HttpFilter, opts metav1.CreateOptions) (*v1.HttpFilter, error) + Update(ctx context.Context, httpFilter *v1.HttpFilter, opts metav1.UpdateOptions) (*v1.HttpFilter, error) + UpdateStatus(ctx context.Context, httpFilter *v1.HttpFilter, opts metav1.UpdateOptions) (*v1.HttpFilter, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.HttpFilter, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.HttpFilterList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HttpFilter, err error) HttpFilterExpansion } @@ -60,7 +44,7 @@ type httpFilters struct { } // newHttpFilters returns a HttpFilters -func newHttpFilters(c *EnrouteV1beta1Client, namespace string) *httpFilters { +func newHttpFilters(c *EnrouteV1Client, namespace string) *httpFilters { return &httpFilters{ client: c.RESTClient(), ns: namespace, @@ -68,8 +52,8 @@ func newHttpFilters(c *EnrouteV1beta1Client, namespace string) *httpFilters { } // Get takes name of the httpFilter, and returns the corresponding httpFilter object, and an error if there is any. -func (c *httpFilters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.HttpFilter, err error) { - result = &v1beta1.HttpFilter{} +func (c *httpFilters) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.HttpFilter, err error) { + result = &v1.HttpFilter{} err = c.client.Get(). Namespace(c.ns). Resource("httpfilters"). @@ -81,12 +65,12 @@ func (c *httpFilters) Get(ctx context.Context, name string, options v1.GetOption } // List takes label and field selectors, and returns the list of HttpFilters that match those selectors. -func (c *httpFilters) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.HttpFilterList, err error) { +func (c *httpFilters) List(ctx context.Context, opts metav1.ListOptions) (result *v1.HttpFilterList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1beta1.HttpFilterList{} + result = &v1.HttpFilterList{} err = c.client.Get(). Namespace(c.ns). Resource("httpfilters"). @@ -98,7 +82,7 @@ func (c *httpFilters) List(ctx context.Context, opts v1.ListOptions) (result *v1 } // Watch returns a watch.Interface that watches the requested httpFilters. -func (c *httpFilters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *httpFilters) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -113,8 +97,8 @@ func (c *httpFilters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Int } // Create takes the representation of a httpFilter and creates it. Returns the server's representation of the httpFilter, and an error, if there is any. -func (c *httpFilters) Create(ctx context.Context, httpFilter *v1beta1.HttpFilter, opts v1.CreateOptions) (result *v1beta1.HttpFilter, err error) { - result = &v1beta1.HttpFilter{} +func (c *httpFilters) Create(ctx context.Context, httpFilter *v1.HttpFilter, opts metav1.CreateOptions) (result *v1.HttpFilter, err error) { + result = &v1.HttpFilter{} err = c.client.Post(). Namespace(c.ns). Resource("httpfilters"). @@ -126,8 +110,8 @@ func (c *httpFilters) Create(ctx context.Context, httpFilter *v1beta1.HttpFilter } // Update takes the representation of a httpFilter and updates it. Returns the server's representation of the httpFilter, and an error, if there is any. -func (c *httpFilters) Update(ctx context.Context, httpFilter *v1beta1.HttpFilter, opts v1.UpdateOptions) (result *v1beta1.HttpFilter, err error) { - result = &v1beta1.HttpFilter{} +func (c *httpFilters) Update(ctx context.Context, httpFilter *v1.HttpFilter, opts metav1.UpdateOptions) (result *v1.HttpFilter, err error) { + result = &v1.HttpFilter{} err = c.client.Put(). Namespace(c.ns). Resource("httpfilters"). @@ -141,8 +125,8 @@ func (c *httpFilters) Update(ctx context.Context, httpFilter *v1beta1.HttpFilter // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *httpFilters) UpdateStatus(ctx context.Context, httpFilter *v1beta1.HttpFilter, opts v1.UpdateOptions) (result *v1beta1.HttpFilter, err error) { - result = &v1beta1.HttpFilter{} +func (c *httpFilters) UpdateStatus(ctx context.Context, httpFilter *v1.HttpFilter, opts metav1.UpdateOptions) (result *v1.HttpFilter, err error) { + result = &v1.HttpFilter{} err = c.client.Put(). Namespace(c.ns). Resource("httpfilters"). @@ -156,7 +140,7 @@ func (c *httpFilters) UpdateStatus(ctx context.Context, httpFilter *v1beta1.Http } // Delete takes name of the httpFilter and deletes it. Returns an error if one occurs. -func (c *httpFilters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *httpFilters) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("httpfilters"). @@ -167,7 +151,7 @@ func (c *httpFilters) Delete(ctx context.Context, name string, opts v1.DeleteOpt } // DeleteCollection deletes a collection of objects. -func (c *httpFilters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *httpFilters) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { var timeout time.Duration if listOpts.TimeoutSeconds != nil { timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second @@ -183,8 +167,8 @@ func (c *httpFilters) DeleteCollection(ctx context.Context, opts v1.DeleteOption } // Patch applies the patch and returns the patched httpFilter. -func (c *httpFilters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.HttpFilter, err error) { - result = &v1beta1.HttpFilter{} +func (c *httpFilters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HttpFilter, err error) { + result = &v1.HttpFilter{} err = c.client.Patch(pt). Namespace(c.ns). Resource("httpfilters"). diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/routefilter.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/routefilter.go similarity index 63% rename from enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/routefilter.go rename to enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/routefilter.go index 6237838..2d44ace 100644 --- a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/routefilter.go +++ b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/routefilter.go @@ -1,33 +1,17 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" "time" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" scheme "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" @@ -41,15 +25,15 @@ type RouteFiltersGetter interface { // RouteFilterInterface has methods to work with RouteFilter resources. type RouteFilterInterface interface { - Create(ctx context.Context, routeFilter *v1beta1.RouteFilter, opts v1.CreateOptions) (*v1beta1.RouteFilter, error) - Update(ctx context.Context, routeFilter *v1beta1.RouteFilter, opts v1.UpdateOptions) (*v1beta1.RouteFilter, error) - UpdateStatus(ctx context.Context, routeFilter *v1beta1.RouteFilter, opts v1.UpdateOptions) (*v1beta1.RouteFilter, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.RouteFilter, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.RouteFilterList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.RouteFilter, err error) + Create(ctx context.Context, routeFilter *v1.RouteFilter, opts metav1.CreateOptions) (*v1.RouteFilter, error) + Update(ctx context.Context, routeFilter *v1.RouteFilter, opts metav1.UpdateOptions) (*v1.RouteFilter, error) + UpdateStatus(ctx context.Context, routeFilter *v1.RouteFilter, opts metav1.UpdateOptions) (*v1.RouteFilter, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.RouteFilter, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.RouteFilterList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.RouteFilter, err error) RouteFilterExpansion } @@ -60,7 +44,7 @@ type routeFilters struct { } // newRouteFilters returns a RouteFilters -func newRouteFilters(c *EnrouteV1beta1Client, namespace string) *routeFilters { +func newRouteFilters(c *EnrouteV1Client, namespace string) *routeFilters { return &routeFilters{ client: c.RESTClient(), ns: namespace, @@ -68,8 +52,8 @@ func newRouteFilters(c *EnrouteV1beta1Client, namespace string) *routeFilters { } // Get takes name of the routeFilter, and returns the corresponding routeFilter object, and an error if there is any. -func (c *routeFilters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.RouteFilter, err error) { - result = &v1beta1.RouteFilter{} +func (c *routeFilters) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.RouteFilter, err error) { + result = &v1.RouteFilter{} err = c.client.Get(). Namespace(c.ns). Resource("routefilters"). @@ -81,12 +65,12 @@ func (c *routeFilters) Get(ctx context.Context, name string, options v1.GetOptio } // List takes label and field selectors, and returns the list of RouteFilters that match those selectors. -func (c *routeFilters) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.RouteFilterList, err error) { +func (c *routeFilters) List(ctx context.Context, opts metav1.ListOptions) (result *v1.RouteFilterList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1beta1.RouteFilterList{} + result = &v1.RouteFilterList{} err = c.client.Get(). Namespace(c.ns). Resource("routefilters"). @@ -98,7 +82,7 @@ func (c *routeFilters) List(ctx context.Context, opts v1.ListOptions) (result *v } // Watch returns a watch.Interface that watches the requested routeFilters. -func (c *routeFilters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *routeFilters) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -113,8 +97,8 @@ func (c *routeFilters) Watch(ctx context.Context, opts v1.ListOptions) (watch.In } // Create takes the representation of a routeFilter and creates it. Returns the server's representation of the routeFilter, and an error, if there is any. -func (c *routeFilters) Create(ctx context.Context, routeFilter *v1beta1.RouteFilter, opts v1.CreateOptions) (result *v1beta1.RouteFilter, err error) { - result = &v1beta1.RouteFilter{} +func (c *routeFilters) Create(ctx context.Context, routeFilter *v1.RouteFilter, opts metav1.CreateOptions) (result *v1.RouteFilter, err error) { + result = &v1.RouteFilter{} err = c.client.Post(). Namespace(c.ns). Resource("routefilters"). @@ -126,8 +110,8 @@ func (c *routeFilters) Create(ctx context.Context, routeFilter *v1beta1.RouteFil } // Update takes the representation of a routeFilter and updates it. Returns the server's representation of the routeFilter, and an error, if there is any. -func (c *routeFilters) Update(ctx context.Context, routeFilter *v1beta1.RouteFilter, opts v1.UpdateOptions) (result *v1beta1.RouteFilter, err error) { - result = &v1beta1.RouteFilter{} +func (c *routeFilters) Update(ctx context.Context, routeFilter *v1.RouteFilter, opts metav1.UpdateOptions) (result *v1.RouteFilter, err error) { + result = &v1.RouteFilter{} err = c.client.Put(). Namespace(c.ns). Resource("routefilters"). @@ -141,8 +125,8 @@ func (c *routeFilters) Update(ctx context.Context, routeFilter *v1beta1.RouteFil // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *routeFilters) UpdateStatus(ctx context.Context, routeFilter *v1beta1.RouteFilter, opts v1.UpdateOptions) (result *v1beta1.RouteFilter, err error) { - result = &v1beta1.RouteFilter{} +func (c *routeFilters) UpdateStatus(ctx context.Context, routeFilter *v1.RouteFilter, opts metav1.UpdateOptions) (result *v1.RouteFilter, err error) { + result = &v1.RouteFilter{} err = c.client.Put(). Namespace(c.ns). Resource("routefilters"). @@ -156,7 +140,7 @@ func (c *routeFilters) UpdateStatus(ctx context.Context, routeFilter *v1beta1.Ro } // Delete takes name of the routeFilter and deletes it. Returns an error if one occurs. -func (c *routeFilters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *routeFilters) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("routefilters"). @@ -167,7 +151,7 @@ func (c *routeFilters) Delete(ctx context.Context, name string, opts v1.DeleteOp } // DeleteCollection deletes a collection of objects. -func (c *routeFilters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *routeFilters) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { var timeout time.Duration if listOpts.TimeoutSeconds != nil { timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second @@ -183,8 +167,8 @@ func (c *routeFilters) DeleteCollection(ctx context.Context, opts v1.DeleteOptio } // Patch applies the patch and returns the patched routeFilter. -func (c *routeFilters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.RouteFilter, err error) { - result = &v1beta1.RouteFilter{} +func (c *routeFilters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.RouteFilter, err error) { + result = &v1.RouteFilter{} err = c.client.Patch(pt). Namespace(c.ns). Resource("routefilters"). diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/tlscertificatedelegation.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/tlscertificatedelegation.go similarity index 63% rename from enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/tlscertificatedelegation.go rename to enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/tlscertificatedelegation.go index 96c96ae..c409e20 100644 --- a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/tlscertificatedelegation.go +++ b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1/tlscertificatedelegation.go @@ -1,33 +1,17 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" "time" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" scheme "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" @@ -41,14 +25,14 @@ type TLSCertificateDelegationsGetter interface { // TLSCertificateDelegationInterface has methods to work with TLSCertificateDelegation resources. type TLSCertificateDelegationInterface interface { - Create(ctx context.Context, tLSCertificateDelegation *v1beta1.TLSCertificateDelegation, opts v1.CreateOptions) (*v1beta1.TLSCertificateDelegation, error) - Update(ctx context.Context, tLSCertificateDelegation *v1beta1.TLSCertificateDelegation, opts v1.UpdateOptions) (*v1beta1.TLSCertificateDelegation, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.TLSCertificateDelegation, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.TLSCertificateDelegationList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.TLSCertificateDelegation, err error) + Create(ctx context.Context, tLSCertificateDelegation *v1.TLSCertificateDelegation, opts metav1.CreateOptions) (*v1.TLSCertificateDelegation, error) + Update(ctx context.Context, tLSCertificateDelegation *v1.TLSCertificateDelegation, opts metav1.UpdateOptions) (*v1.TLSCertificateDelegation, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.TLSCertificateDelegation, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.TLSCertificateDelegationList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TLSCertificateDelegation, err error) TLSCertificateDelegationExpansion } @@ -59,7 +43,7 @@ type tLSCertificateDelegations struct { } // newTLSCertificateDelegations returns a TLSCertificateDelegations -func newTLSCertificateDelegations(c *EnrouteV1beta1Client, namespace string) *tLSCertificateDelegations { +func newTLSCertificateDelegations(c *EnrouteV1Client, namespace string) *tLSCertificateDelegations { return &tLSCertificateDelegations{ client: c.RESTClient(), ns: namespace, @@ -67,8 +51,8 @@ func newTLSCertificateDelegations(c *EnrouteV1beta1Client, namespace string) *tL } // Get takes name of the tLSCertificateDelegation, and returns the corresponding tLSCertificateDelegation object, and an error if there is any. -func (c *tLSCertificateDelegations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.TLSCertificateDelegation, err error) { - result = &v1beta1.TLSCertificateDelegation{} +func (c *tLSCertificateDelegations) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TLSCertificateDelegation, err error) { + result = &v1.TLSCertificateDelegation{} err = c.client.Get(). Namespace(c.ns). Resource("tlscertificatedelegations"). @@ -80,12 +64,12 @@ func (c *tLSCertificateDelegations) Get(ctx context.Context, name string, option } // List takes label and field selectors, and returns the list of TLSCertificateDelegations that match those selectors. -func (c *tLSCertificateDelegations) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.TLSCertificateDelegationList, err error) { +func (c *tLSCertificateDelegations) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TLSCertificateDelegationList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1beta1.TLSCertificateDelegationList{} + result = &v1.TLSCertificateDelegationList{} err = c.client.Get(). Namespace(c.ns). Resource("tlscertificatedelegations"). @@ -97,7 +81,7 @@ func (c *tLSCertificateDelegations) List(ctx context.Context, opts v1.ListOption } // Watch returns a watch.Interface that watches the requested tLSCertificateDelegations. -func (c *tLSCertificateDelegations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *tLSCertificateDelegations) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -112,8 +96,8 @@ func (c *tLSCertificateDelegations) Watch(ctx context.Context, opts v1.ListOptio } // Create takes the representation of a tLSCertificateDelegation and creates it. Returns the server's representation of the tLSCertificateDelegation, and an error, if there is any. -func (c *tLSCertificateDelegations) Create(ctx context.Context, tLSCertificateDelegation *v1beta1.TLSCertificateDelegation, opts v1.CreateOptions) (result *v1beta1.TLSCertificateDelegation, err error) { - result = &v1beta1.TLSCertificateDelegation{} +func (c *tLSCertificateDelegations) Create(ctx context.Context, tLSCertificateDelegation *v1.TLSCertificateDelegation, opts metav1.CreateOptions) (result *v1.TLSCertificateDelegation, err error) { + result = &v1.TLSCertificateDelegation{} err = c.client.Post(). Namespace(c.ns). Resource("tlscertificatedelegations"). @@ -125,8 +109,8 @@ func (c *tLSCertificateDelegations) Create(ctx context.Context, tLSCertificateDe } // Update takes the representation of a tLSCertificateDelegation and updates it. Returns the server's representation of the tLSCertificateDelegation, and an error, if there is any. -func (c *tLSCertificateDelegations) Update(ctx context.Context, tLSCertificateDelegation *v1beta1.TLSCertificateDelegation, opts v1.UpdateOptions) (result *v1beta1.TLSCertificateDelegation, err error) { - result = &v1beta1.TLSCertificateDelegation{} +func (c *tLSCertificateDelegations) Update(ctx context.Context, tLSCertificateDelegation *v1.TLSCertificateDelegation, opts metav1.UpdateOptions) (result *v1.TLSCertificateDelegation, err error) { + result = &v1.TLSCertificateDelegation{} err = c.client.Put(). Namespace(c.ns). Resource("tlscertificatedelegations"). @@ -139,7 +123,7 @@ func (c *tLSCertificateDelegations) Update(ctx context.Context, tLSCertificateDe } // Delete takes name of the tLSCertificateDelegation and deletes it. Returns an error if one occurs. -func (c *tLSCertificateDelegations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *tLSCertificateDelegations) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("tlscertificatedelegations"). @@ -150,7 +134,7 @@ func (c *tLSCertificateDelegations) Delete(ctx context.Context, name string, opt } // DeleteCollection deletes a collection of objects. -func (c *tLSCertificateDelegations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *tLSCertificateDelegations) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { var timeout time.Duration if listOpts.TimeoutSeconds != nil { timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second @@ -166,8 +150,8 @@ func (c *tLSCertificateDelegations) DeleteCollection(ctx context.Context, opts v } // Patch applies the patch and returns the patched tLSCertificateDelegation. -func (c *tLSCertificateDelegations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.TLSCertificateDelegation, err error) { - result = &v1beta1.TLSCertificateDelegation{} +func (c *tLSCertificateDelegations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TLSCertificateDelegation, err error) { + result = &v1.TLSCertificateDelegation{} err = c.client.Patch(pt). Namespace(c.ns). Resource("tlscertificatedelegations"). diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/doc.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/doc.go deleted file mode 100644 index 318e610..0000000 --- a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/doc.go +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright(c) 2018-2021 Saaras Inc. - -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1beta1 diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/enroute_client.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/enroute_client.go deleted file mode 100644 index 5587208..0000000 --- a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/enroute_client.go +++ /dev/null @@ -1,112 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright(c) 2018-2021 Saaras Inc. - -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" - "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type EnrouteV1beta1Interface interface { - RESTClient() rest.Interface - GatewayHostsGetter - GlobalConfigsGetter - HttpFiltersGetter - RouteFiltersGetter - TLSCertificateDelegationsGetter -} - -// EnrouteV1beta1Client is used to interact with features provided by the enroute.saaras.io group. -type EnrouteV1beta1Client struct { - restClient rest.Interface -} - -func (c *EnrouteV1beta1Client) GatewayHosts(namespace string) GatewayHostInterface { - return newGatewayHosts(c, namespace) -} - -func (c *EnrouteV1beta1Client) GlobalConfigs(namespace string) GlobalConfigInterface { - return newGlobalConfigs(c, namespace) -} - -func (c *EnrouteV1beta1Client) HttpFilters(namespace string) HttpFilterInterface { - return newHttpFilters(c, namespace) -} - -func (c *EnrouteV1beta1Client) RouteFilters(namespace string) RouteFilterInterface { - return newRouteFilters(c, namespace) -} - -func (c *EnrouteV1beta1Client) TLSCertificateDelegations(namespace string) TLSCertificateDelegationInterface { - return newTLSCertificateDelegations(c, namespace) -} - -// NewForConfig creates a new EnrouteV1beta1Client for the given config. -func NewForConfig(c *rest.Config) (*EnrouteV1beta1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &EnrouteV1beta1Client{client}, nil -} - -// NewForConfigOrDie creates a new EnrouteV1beta1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *EnrouteV1beta1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new EnrouteV1beta1Client for the given RESTClient. -func New(c rest.Interface) *EnrouteV1beta1Client { - return &EnrouteV1beta1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1beta1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *EnrouteV1beta1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/doc.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/doc.go deleted file mode 100644 index b49d554..0000000 --- a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/doc.go +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright(c) 2018-2021 Saaras Inc. - -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_enroute_client.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_enroute_client.go deleted file mode 100644 index 0c86cbc..0000000 --- a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/fake/fake_enroute_client.go +++ /dev/null @@ -1,59 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright(c) 2018-2021 Saaras Inc. - -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeEnrouteV1beta1 struct { - *testing.Fake -} - -func (c *FakeEnrouteV1beta1) GatewayHosts(namespace string) v1beta1.GatewayHostInterface { - return &FakeGatewayHosts{c, namespace} -} - -func (c *FakeEnrouteV1beta1) GlobalConfigs(namespace string) v1beta1.GlobalConfigInterface { - return &FakeGlobalConfigs{c, namespace} -} - -func (c *FakeEnrouteV1beta1) HttpFilters(namespace string) v1beta1.HttpFilterInterface { - return &FakeHttpFilters{c, namespace} -} - -func (c *FakeEnrouteV1beta1) RouteFilters(namespace string) v1beta1.RouteFilterInterface { - return &FakeRouteFilters{c, namespace} -} - -func (c *FakeEnrouteV1beta1) TLSCertificateDelegations(namespace string) v1beta1.TLSCertificateDelegationInterface { - return &FakeTLSCertificateDelegations{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeEnrouteV1beta1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/generated_expansion.go b/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/generated_expansion.go deleted file mode 100644 index 5b9f40a..0000000 --- a/enroute-dp/apis/generated/clientset/versioned/typed/enroute/v1beta1/generated_expansion.go +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright(c) 2018-2021 Saaras Inc. - -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -type GatewayHostExpansion interface{} - -type GlobalConfigExpansion interface{} - -type HttpFilterExpansion interface{} - -type RouteFilterExpansion interface{} - -type TLSCertificateDelegationExpansion interface{} diff --git a/enroute-dp/apis/generated/informers/externalversions/enroute/interface.go b/enroute-dp/apis/generated/informers/externalversions/enroute/interface.go index cb82141..ae59244 100644 --- a/enroute-dp/apis/generated/informers/externalversions/enroute/interface.go +++ b/enroute-dp/apis/generated/informers/externalversions/enroute/interface.go @@ -1,35 +1,19 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by informer-gen. DO NOT EDIT. package enroute import ( - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/generated/informers/externalversions/enroute/v1" internalinterfaces "github.com/saarasio/enroute/enroute-dp/apis/generated/informers/externalversions/internalinterfaces" ) // Interface provides access to each of this group's versions. type Interface interface { - // V1beta1 provides access to shared informers for resources in V1beta1. - V1beta1() v1beta1.Interface + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface } type group struct { @@ -43,7 +27,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// V1beta1 returns a new v1beta1.Interface. -func (g *group) V1beta1() v1beta1.Interface { - return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) } diff --git a/enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/gatewayhost.go b/enroute-dp/apis/generated/informers/externalversions/enroute/v1/gatewayhost.go similarity index 63% rename from enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/gatewayhost.go rename to enroute-dp/apis/generated/informers/externalversions/enroute/v1/gatewayhost.go index 5e73517..5720c3f 100644 --- a/enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/gatewayhost.go +++ b/enroute-dp/apis/generated/informers/externalversions/enroute/v1/gatewayhost.go @@ -1,35 +1,19 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by informer-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" time "time" - enroutev1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + enroutev1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" versioned "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned" internalinterfaces "github.com/saarasio/enroute/enroute-dp/apis/generated/informers/externalversions/internalinterfaces" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/generated/listers/enroute/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/generated/listers/enroute/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" @@ -39,7 +23,7 @@ import ( // GatewayHosts. type GatewayHostInformer interface { Informer() cache.SharedIndexInformer - Lister() v1beta1.GatewayHostLister + Lister() v1.GatewayHostLister } type gatewayHostInformer struct { @@ -61,20 +45,20 @@ func NewGatewayHostInformer(client versioned.Interface, namespace string, resync func NewFilteredGatewayHostInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.EnrouteV1beta1().GatewayHosts(namespace).List(context.TODO(), options) + return client.EnrouteV1().GatewayHosts(namespace).List(context.TODO(), options) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.EnrouteV1beta1().GatewayHosts(namespace).Watch(context.TODO(), options) + return client.EnrouteV1().GatewayHosts(namespace).Watch(context.TODO(), options) }, }, - &enroutev1beta1.GatewayHost{}, + &enroutev1.GatewayHost{}, resyncPeriod, indexers, ) @@ -85,9 +69,9 @@ func (f *gatewayHostInformer) defaultInformer(client versioned.Interface, resync } func (f *gatewayHostInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&enroutev1beta1.GatewayHost{}, f.defaultInformer) + return f.factory.InformerFor(&enroutev1.GatewayHost{}, f.defaultInformer) } -func (f *gatewayHostInformer) Lister() v1beta1.GatewayHostLister { - return v1beta1.NewGatewayHostLister(f.Informer().GetIndexer()) +func (f *gatewayHostInformer) Lister() v1.GatewayHostLister { + return v1.NewGatewayHostLister(f.Informer().GetIndexer()) } diff --git a/enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/globalconfig.go b/enroute-dp/apis/generated/informers/externalversions/enroute/v1/globalconfig.go similarity index 63% rename from enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/globalconfig.go rename to enroute-dp/apis/generated/informers/externalversions/enroute/v1/globalconfig.go index d99357e..fcca29d 100644 --- a/enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/globalconfig.go +++ b/enroute-dp/apis/generated/informers/externalversions/enroute/v1/globalconfig.go @@ -1,35 +1,19 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by informer-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" time "time" - enroutev1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + enroutev1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" versioned "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned" internalinterfaces "github.com/saarasio/enroute/enroute-dp/apis/generated/informers/externalversions/internalinterfaces" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/generated/listers/enroute/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/generated/listers/enroute/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" @@ -39,7 +23,7 @@ import ( // GlobalConfigs. type GlobalConfigInformer interface { Informer() cache.SharedIndexInformer - Lister() v1beta1.GlobalConfigLister + Lister() v1.GlobalConfigLister } type globalConfigInformer struct { @@ -61,20 +45,20 @@ func NewGlobalConfigInformer(client versioned.Interface, namespace string, resyn func NewFilteredGlobalConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.EnrouteV1beta1().GlobalConfigs(namespace).List(context.TODO(), options) + return client.EnrouteV1().GlobalConfigs(namespace).List(context.TODO(), options) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.EnrouteV1beta1().GlobalConfigs(namespace).Watch(context.TODO(), options) + return client.EnrouteV1().GlobalConfigs(namespace).Watch(context.TODO(), options) }, }, - &enroutev1beta1.GlobalConfig{}, + &enroutev1.GlobalConfig{}, resyncPeriod, indexers, ) @@ -85,9 +69,9 @@ func (f *globalConfigInformer) defaultInformer(client versioned.Interface, resyn } func (f *globalConfigInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&enroutev1beta1.GlobalConfig{}, f.defaultInformer) + return f.factory.InformerFor(&enroutev1.GlobalConfig{}, f.defaultInformer) } -func (f *globalConfigInformer) Lister() v1beta1.GlobalConfigLister { - return v1beta1.NewGlobalConfigLister(f.Informer().GetIndexer()) +func (f *globalConfigInformer) Lister() v1.GlobalConfigLister { + return v1.NewGlobalConfigLister(f.Informer().GetIndexer()) } diff --git a/enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/httpfilter.go b/enroute-dp/apis/generated/informers/externalversions/enroute/v1/httpfilter.go similarity index 63% rename from enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/httpfilter.go rename to enroute-dp/apis/generated/informers/externalversions/enroute/v1/httpfilter.go index 3e1faed..02745a2 100644 --- a/enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/httpfilter.go +++ b/enroute-dp/apis/generated/informers/externalversions/enroute/v1/httpfilter.go @@ -1,35 +1,19 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by informer-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" time "time" - enroutev1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + enroutev1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" versioned "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned" internalinterfaces "github.com/saarasio/enroute/enroute-dp/apis/generated/informers/externalversions/internalinterfaces" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/generated/listers/enroute/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/generated/listers/enroute/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" @@ -39,7 +23,7 @@ import ( // HttpFilters. type HttpFilterInformer interface { Informer() cache.SharedIndexInformer - Lister() v1beta1.HttpFilterLister + Lister() v1.HttpFilterLister } type httpFilterInformer struct { @@ -61,20 +45,20 @@ func NewHttpFilterInformer(client versioned.Interface, namespace string, resyncP func NewFilteredHttpFilterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.EnrouteV1beta1().HttpFilters(namespace).List(context.TODO(), options) + return client.EnrouteV1().HttpFilters(namespace).List(context.TODO(), options) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.EnrouteV1beta1().HttpFilters(namespace).Watch(context.TODO(), options) + return client.EnrouteV1().HttpFilters(namespace).Watch(context.TODO(), options) }, }, - &enroutev1beta1.HttpFilter{}, + &enroutev1.HttpFilter{}, resyncPeriod, indexers, ) @@ -85,9 +69,9 @@ func (f *httpFilterInformer) defaultInformer(client versioned.Interface, resyncP } func (f *httpFilterInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&enroutev1beta1.HttpFilter{}, f.defaultInformer) + return f.factory.InformerFor(&enroutev1.HttpFilter{}, f.defaultInformer) } -func (f *httpFilterInformer) Lister() v1beta1.HttpFilterLister { - return v1beta1.NewHttpFilterLister(f.Informer().GetIndexer()) +func (f *httpFilterInformer) Lister() v1.HttpFilterLister { + return v1.NewHttpFilterLister(f.Informer().GetIndexer()) } diff --git a/enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/interface.go b/enroute-dp/apis/generated/informers/externalversions/enroute/v1/interface.go similarity index 80% rename from enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/interface.go rename to enroute-dp/apis/generated/informers/externalversions/enroute/v1/interface.go index 4952f45..f479efb 100644 --- a/enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/interface.go +++ b/enroute-dp/apis/generated/informers/externalversions/enroute/v1/interface.go @@ -1,25 +1,9 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by informer-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( internalinterfaces "github.com/saarasio/enroute/enroute-dp/apis/generated/informers/externalversions/internalinterfaces" diff --git a/enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/routefilter.go b/enroute-dp/apis/generated/informers/externalversions/enroute/v1/routefilter.go similarity index 63% rename from enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/routefilter.go rename to enroute-dp/apis/generated/informers/externalversions/enroute/v1/routefilter.go index 7ad4ea3..d97cb08 100644 --- a/enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/routefilter.go +++ b/enroute-dp/apis/generated/informers/externalversions/enroute/v1/routefilter.go @@ -1,35 +1,19 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by informer-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" time "time" - enroutev1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + enroutev1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" versioned "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned" internalinterfaces "github.com/saarasio/enroute/enroute-dp/apis/generated/informers/externalversions/internalinterfaces" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/generated/listers/enroute/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/generated/listers/enroute/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" @@ -39,7 +23,7 @@ import ( // RouteFilters. type RouteFilterInformer interface { Informer() cache.SharedIndexInformer - Lister() v1beta1.RouteFilterLister + Lister() v1.RouteFilterLister } type routeFilterInformer struct { @@ -61,20 +45,20 @@ func NewRouteFilterInformer(client versioned.Interface, namespace string, resync func NewFilteredRouteFilterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.EnrouteV1beta1().RouteFilters(namespace).List(context.TODO(), options) + return client.EnrouteV1().RouteFilters(namespace).List(context.TODO(), options) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.EnrouteV1beta1().RouteFilters(namespace).Watch(context.TODO(), options) + return client.EnrouteV1().RouteFilters(namespace).Watch(context.TODO(), options) }, }, - &enroutev1beta1.RouteFilter{}, + &enroutev1.RouteFilter{}, resyncPeriod, indexers, ) @@ -85,9 +69,9 @@ func (f *routeFilterInformer) defaultInformer(client versioned.Interface, resync } func (f *routeFilterInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&enroutev1beta1.RouteFilter{}, f.defaultInformer) + return f.factory.InformerFor(&enroutev1.RouteFilter{}, f.defaultInformer) } -func (f *routeFilterInformer) Lister() v1beta1.RouteFilterLister { - return v1beta1.NewRouteFilterLister(f.Informer().GetIndexer()) +func (f *routeFilterInformer) Lister() v1.RouteFilterLister { + return v1.NewRouteFilterLister(f.Informer().GetIndexer()) } diff --git a/enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/tlscertificatedelegation.go b/enroute-dp/apis/generated/informers/externalversions/enroute/v1/tlscertificatedelegation.go similarity index 63% rename from enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/tlscertificatedelegation.go rename to enroute-dp/apis/generated/informers/externalversions/enroute/v1/tlscertificatedelegation.go index cf85fdf..e4f5e3d 100644 --- a/enroute-dp/apis/generated/informers/externalversions/enroute/v1beta1/tlscertificatedelegation.go +++ b/enroute-dp/apis/generated/informers/externalversions/enroute/v1/tlscertificatedelegation.go @@ -1,35 +1,19 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by informer-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" time "time" - enroutev1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + enroutev1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" versioned "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned" internalinterfaces "github.com/saarasio/enroute/enroute-dp/apis/generated/informers/externalversions/internalinterfaces" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/generated/listers/enroute/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/generated/listers/enroute/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" @@ -39,7 +23,7 @@ import ( // TLSCertificateDelegations. type TLSCertificateDelegationInformer interface { Informer() cache.SharedIndexInformer - Lister() v1beta1.TLSCertificateDelegationLister + Lister() v1.TLSCertificateDelegationLister } type tLSCertificateDelegationInformer struct { @@ -61,20 +45,20 @@ func NewTLSCertificateDelegationInformer(client versioned.Interface, namespace s func NewFilteredTLSCertificateDelegationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.EnrouteV1beta1().TLSCertificateDelegations(namespace).List(context.TODO(), options) + return client.EnrouteV1().TLSCertificateDelegations(namespace).List(context.TODO(), options) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.EnrouteV1beta1().TLSCertificateDelegations(namespace).Watch(context.TODO(), options) + return client.EnrouteV1().TLSCertificateDelegations(namespace).Watch(context.TODO(), options) }, }, - &enroutev1beta1.TLSCertificateDelegation{}, + &enroutev1.TLSCertificateDelegation{}, resyncPeriod, indexers, ) @@ -85,9 +69,9 @@ func (f *tLSCertificateDelegationInformer) defaultInformer(client versioned.Inte } func (f *tLSCertificateDelegationInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&enroutev1beta1.TLSCertificateDelegation{}, f.defaultInformer) + return f.factory.InformerFor(&enroutev1.TLSCertificateDelegation{}, f.defaultInformer) } -func (f *tLSCertificateDelegationInformer) Lister() v1beta1.TLSCertificateDelegationLister { - return v1beta1.NewTLSCertificateDelegationLister(f.Informer().GetIndexer()) +func (f *tLSCertificateDelegationInformer) Lister() v1.TLSCertificateDelegationLister { + return v1.NewTLSCertificateDelegationLister(f.Informer().GetIndexer()) } diff --git a/enroute-dp/apis/generated/informers/externalversions/factory.go b/enroute-dp/apis/generated/informers/externalversions/factory.go index 7d910ce..3c23590 100644 --- a/enroute-dp/apis/generated/informers/externalversions/factory.go +++ b/enroute-dp/apis/generated/informers/externalversions/factory.go @@ -1,22 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by informer-gen. DO NOT EDIT. package externalversions diff --git a/enroute-dp/apis/generated/informers/externalversions/generic.go b/enroute-dp/apis/generated/informers/externalversions/generic.go index 0b52ec8..d723b78 100644 --- a/enroute-dp/apis/generated/informers/externalversions/generic.go +++ b/enroute-dp/apis/generated/informers/externalversions/generic.go @@ -1,22 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by informer-gen. DO NOT EDIT. package externalversions @@ -24,7 +8,7 @@ package externalversions import ( "fmt" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -55,17 +39,17 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=enroute.saaras.io, Version=v1beta1 - case v1beta1.SchemeGroupVersion.WithResource("gatewayhosts"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Enroute().V1beta1().GatewayHosts().Informer()}, nil - case v1beta1.SchemeGroupVersion.WithResource("globalconfigs"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Enroute().V1beta1().GlobalConfigs().Informer()}, nil - case v1beta1.SchemeGroupVersion.WithResource("httpfilters"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Enroute().V1beta1().HttpFilters().Informer()}, nil - case v1beta1.SchemeGroupVersion.WithResource("routefilters"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Enroute().V1beta1().RouteFilters().Informer()}, nil - case v1beta1.SchemeGroupVersion.WithResource("tlscertificatedelegations"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Enroute().V1beta1().TLSCertificateDelegations().Informer()}, nil + // Group=enroute.saaras.io, Version=v1 + case v1.SchemeGroupVersion.WithResource("gatewayhosts"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Enroute().V1().GatewayHosts().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("globalconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Enroute().V1().GlobalConfigs().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("httpfilters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Enroute().V1().HttpFilters().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("routefilters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Enroute().V1().RouteFilters().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("tlscertificatedelegations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Enroute().V1().TLSCertificateDelegations().Informer()}, nil } diff --git a/enroute-dp/apis/generated/informers/externalversions/internalinterfaces/factory_interfaces.go b/enroute-dp/apis/generated/informers/externalversions/internalinterfaces/factory_interfaces.go index bed3bad..75fb68c 100644 --- a/enroute-dp/apis/generated/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/enroute-dp/apis/generated/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -1,22 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by informer-gen. DO NOT EDIT. package internalinterfaces diff --git a/enroute-dp/apis/generated/listers/enroute/v1beta1/expansion_generated.go b/enroute-dp/apis/generated/listers/enroute/v1/expansion_generated.go similarity index 74% rename from enroute-dp/apis/generated/listers/enroute/v1beta1/expansion_generated.go rename to enroute-dp/apis/generated/listers/enroute/v1/expansion_generated.go index 710bfff..9fcad88 100644 --- a/enroute-dp/apis/generated/listers/enroute/v1beta1/expansion_generated.go +++ b/enroute-dp/apis/generated/listers/enroute/v1/expansion_generated.go @@ -1,25 +1,9 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by lister-gen. DO NOT EDIT. -package v1beta1 +package v1 // GatewayHostListerExpansion allows custom methods to be added to // GatewayHostLister. diff --git a/enroute-dp/apis/generated/listers/enroute/v1beta1/gatewayhost.go b/enroute-dp/apis/generated/listers/enroute/v1/gatewayhost.go similarity index 64% rename from enroute-dp/apis/generated/listers/enroute/v1beta1/gatewayhost.go rename to enroute-dp/apis/generated/listers/enroute/v1/gatewayhost.go index 53328df..40a67ac 100644 --- a/enroute-dp/apis/generated/listers/enroute/v1beta1/gatewayhost.go +++ b/enroute-dp/apis/generated/listers/enroute/v1/gatewayhost.go @@ -1,28 +1,12 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by lister-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -31,7 +15,7 @@ import ( // GatewayHostLister helps list GatewayHosts. type GatewayHostLister interface { // List lists all GatewayHosts in the indexer. - List(selector labels.Selector) (ret []*v1beta1.GatewayHost, err error) + List(selector labels.Selector) (ret []*v1.GatewayHost, err error) // GatewayHosts returns an object that can list and get GatewayHosts. GatewayHosts(namespace string) GatewayHostNamespaceLister GatewayHostListerExpansion @@ -48,9 +32,9 @@ func NewGatewayHostLister(indexer cache.Indexer) GatewayHostLister { } // List lists all GatewayHosts in the indexer. -func (s *gatewayHostLister) List(selector labels.Selector) (ret []*v1beta1.GatewayHost, err error) { +func (s *gatewayHostLister) List(selector labels.Selector) (ret []*v1.GatewayHost, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.GatewayHost)) + ret = append(ret, m.(*v1.GatewayHost)) }) return ret, err } @@ -63,9 +47,9 @@ func (s *gatewayHostLister) GatewayHosts(namespace string) GatewayHostNamespaceL // GatewayHostNamespaceLister helps list and get GatewayHosts. type GatewayHostNamespaceLister interface { // List lists all GatewayHosts in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1beta1.GatewayHost, err error) + List(selector labels.Selector) (ret []*v1.GatewayHost, err error) // Get retrieves the GatewayHost from the indexer for a given namespace and name. - Get(name string) (*v1beta1.GatewayHost, error) + Get(name string) (*v1.GatewayHost, error) GatewayHostNamespaceListerExpansion } @@ -77,21 +61,21 @@ type gatewayHostNamespaceLister struct { } // List lists all GatewayHosts in the indexer for a given namespace. -func (s gatewayHostNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.GatewayHost, err error) { +func (s gatewayHostNamespaceLister) List(selector labels.Selector) (ret []*v1.GatewayHost, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.GatewayHost)) + ret = append(ret, m.(*v1.GatewayHost)) }) return ret, err } // Get retrieves the GatewayHost from the indexer for a given namespace and name. -func (s gatewayHostNamespaceLister) Get(name string) (*v1beta1.GatewayHost, error) { +func (s gatewayHostNamespaceLister) Get(name string) (*v1.GatewayHost, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("gatewayhost"), name) + return nil, errors.NewNotFound(v1.Resource("gatewayhost"), name) } - return obj.(*v1beta1.GatewayHost), nil + return obj.(*v1.GatewayHost), nil } diff --git a/enroute-dp/apis/generated/listers/enroute/v1beta1/globalconfig.go b/enroute-dp/apis/generated/listers/enroute/v1/globalconfig.go similarity index 64% rename from enroute-dp/apis/generated/listers/enroute/v1beta1/globalconfig.go rename to enroute-dp/apis/generated/listers/enroute/v1/globalconfig.go index 7caad29..b5bb7a7 100644 --- a/enroute-dp/apis/generated/listers/enroute/v1beta1/globalconfig.go +++ b/enroute-dp/apis/generated/listers/enroute/v1/globalconfig.go @@ -1,28 +1,12 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by lister-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -31,7 +15,7 @@ import ( // GlobalConfigLister helps list GlobalConfigs. type GlobalConfigLister interface { // List lists all GlobalConfigs in the indexer. - List(selector labels.Selector) (ret []*v1beta1.GlobalConfig, err error) + List(selector labels.Selector) (ret []*v1.GlobalConfig, err error) // GlobalConfigs returns an object that can list and get GlobalConfigs. GlobalConfigs(namespace string) GlobalConfigNamespaceLister GlobalConfigListerExpansion @@ -48,9 +32,9 @@ func NewGlobalConfigLister(indexer cache.Indexer) GlobalConfigLister { } // List lists all GlobalConfigs in the indexer. -func (s *globalConfigLister) List(selector labels.Selector) (ret []*v1beta1.GlobalConfig, err error) { +func (s *globalConfigLister) List(selector labels.Selector) (ret []*v1.GlobalConfig, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.GlobalConfig)) + ret = append(ret, m.(*v1.GlobalConfig)) }) return ret, err } @@ -63,9 +47,9 @@ func (s *globalConfigLister) GlobalConfigs(namespace string) GlobalConfigNamespa // GlobalConfigNamespaceLister helps list and get GlobalConfigs. type GlobalConfigNamespaceLister interface { // List lists all GlobalConfigs in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1beta1.GlobalConfig, err error) + List(selector labels.Selector) (ret []*v1.GlobalConfig, err error) // Get retrieves the GlobalConfig from the indexer for a given namespace and name. - Get(name string) (*v1beta1.GlobalConfig, error) + Get(name string) (*v1.GlobalConfig, error) GlobalConfigNamespaceListerExpansion } @@ -77,21 +61,21 @@ type globalConfigNamespaceLister struct { } // List lists all GlobalConfigs in the indexer for a given namespace. -func (s globalConfigNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.GlobalConfig, err error) { +func (s globalConfigNamespaceLister) List(selector labels.Selector) (ret []*v1.GlobalConfig, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.GlobalConfig)) + ret = append(ret, m.(*v1.GlobalConfig)) }) return ret, err } // Get retrieves the GlobalConfig from the indexer for a given namespace and name. -func (s globalConfigNamespaceLister) Get(name string) (*v1beta1.GlobalConfig, error) { +func (s globalConfigNamespaceLister) Get(name string) (*v1.GlobalConfig, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("globalconfig"), name) + return nil, errors.NewNotFound(v1.Resource("globalconfig"), name) } - return obj.(*v1beta1.GlobalConfig), nil + return obj.(*v1.GlobalConfig), nil } diff --git a/enroute-dp/apis/generated/listers/enroute/v1beta1/httpfilter.go b/enroute-dp/apis/generated/listers/enroute/v1/httpfilter.go similarity index 64% rename from enroute-dp/apis/generated/listers/enroute/v1beta1/httpfilter.go rename to enroute-dp/apis/generated/listers/enroute/v1/httpfilter.go index 50b43dd..2ab029a 100644 --- a/enroute-dp/apis/generated/listers/enroute/v1beta1/httpfilter.go +++ b/enroute-dp/apis/generated/listers/enroute/v1/httpfilter.go @@ -1,28 +1,12 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by lister-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -31,7 +15,7 @@ import ( // HttpFilterLister helps list HttpFilters. type HttpFilterLister interface { // List lists all HttpFilters in the indexer. - List(selector labels.Selector) (ret []*v1beta1.HttpFilter, err error) + List(selector labels.Selector) (ret []*v1.HttpFilter, err error) // HttpFilters returns an object that can list and get HttpFilters. HttpFilters(namespace string) HttpFilterNamespaceLister HttpFilterListerExpansion @@ -48,9 +32,9 @@ func NewHttpFilterLister(indexer cache.Indexer) HttpFilterLister { } // List lists all HttpFilters in the indexer. -func (s *httpFilterLister) List(selector labels.Selector) (ret []*v1beta1.HttpFilter, err error) { +func (s *httpFilterLister) List(selector labels.Selector) (ret []*v1.HttpFilter, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.HttpFilter)) + ret = append(ret, m.(*v1.HttpFilter)) }) return ret, err } @@ -63,9 +47,9 @@ func (s *httpFilterLister) HttpFilters(namespace string) HttpFilterNamespaceList // HttpFilterNamespaceLister helps list and get HttpFilters. type HttpFilterNamespaceLister interface { // List lists all HttpFilters in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1beta1.HttpFilter, err error) + List(selector labels.Selector) (ret []*v1.HttpFilter, err error) // Get retrieves the HttpFilter from the indexer for a given namespace and name. - Get(name string) (*v1beta1.HttpFilter, error) + Get(name string) (*v1.HttpFilter, error) HttpFilterNamespaceListerExpansion } @@ -77,21 +61,21 @@ type httpFilterNamespaceLister struct { } // List lists all HttpFilters in the indexer for a given namespace. -func (s httpFilterNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.HttpFilter, err error) { +func (s httpFilterNamespaceLister) List(selector labels.Selector) (ret []*v1.HttpFilter, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.HttpFilter)) + ret = append(ret, m.(*v1.HttpFilter)) }) return ret, err } // Get retrieves the HttpFilter from the indexer for a given namespace and name. -func (s httpFilterNamespaceLister) Get(name string) (*v1beta1.HttpFilter, error) { +func (s httpFilterNamespaceLister) Get(name string) (*v1.HttpFilter, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("httpfilter"), name) + return nil, errors.NewNotFound(v1.Resource("httpfilter"), name) } - return obj.(*v1beta1.HttpFilter), nil + return obj.(*v1.HttpFilter), nil } diff --git a/enroute-dp/apis/generated/listers/enroute/v1beta1/routefilter.go b/enroute-dp/apis/generated/listers/enroute/v1/routefilter.go similarity index 64% rename from enroute-dp/apis/generated/listers/enroute/v1beta1/routefilter.go rename to enroute-dp/apis/generated/listers/enroute/v1/routefilter.go index 89d8aef..70d45e5 100644 --- a/enroute-dp/apis/generated/listers/enroute/v1beta1/routefilter.go +++ b/enroute-dp/apis/generated/listers/enroute/v1/routefilter.go @@ -1,28 +1,12 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by lister-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -31,7 +15,7 @@ import ( // RouteFilterLister helps list RouteFilters. type RouteFilterLister interface { // List lists all RouteFilters in the indexer. - List(selector labels.Selector) (ret []*v1beta1.RouteFilter, err error) + List(selector labels.Selector) (ret []*v1.RouteFilter, err error) // RouteFilters returns an object that can list and get RouteFilters. RouteFilters(namespace string) RouteFilterNamespaceLister RouteFilterListerExpansion @@ -48,9 +32,9 @@ func NewRouteFilterLister(indexer cache.Indexer) RouteFilterLister { } // List lists all RouteFilters in the indexer. -func (s *routeFilterLister) List(selector labels.Selector) (ret []*v1beta1.RouteFilter, err error) { +func (s *routeFilterLister) List(selector labels.Selector) (ret []*v1.RouteFilter, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.RouteFilter)) + ret = append(ret, m.(*v1.RouteFilter)) }) return ret, err } @@ -63,9 +47,9 @@ func (s *routeFilterLister) RouteFilters(namespace string) RouteFilterNamespaceL // RouteFilterNamespaceLister helps list and get RouteFilters. type RouteFilterNamespaceLister interface { // List lists all RouteFilters in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1beta1.RouteFilter, err error) + List(selector labels.Selector) (ret []*v1.RouteFilter, err error) // Get retrieves the RouteFilter from the indexer for a given namespace and name. - Get(name string) (*v1beta1.RouteFilter, error) + Get(name string) (*v1.RouteFilter, error) RouteFilterNamespaceListerExpansion } @@ -77,21 +61,21 @@ type routeFilterNamespaceLister struct { } // List lists all RouteFilters in the indexer for a given namespace. -func (s routeFilterNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.RouteFilter, err error) { +func (s routeFilterNamespaceLister) List(selector labels.Selector) (ret []*v1.RouteFilter, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.RouteFilter)) + ret = append(ret, m.(*v1.RouteFilter)) }) return ret, err } // Get retrieves the RouteFilter from the indexer for a given namespace and name. -func (s routeFilterNamespaceLister) Get(name string) (*v1beta1.RouteFilter, error) { +func (s routeFilterNamespaceLister) Get(name string) (*v1.RouteFilter, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("routefilter"), name) + return nil, errors.NewNotFound(v1.Resource("routefilter"), name) } - return obj.(*v1beta1.RouteFilter), nil + return obj.(*v1.RouteFilter), nil } diff --git a/enroute-dp/apis/generated/listers/enroute/v1beta1/tlscertificatedelegation.go b/enroute-dp/apis/generated/listers/enroute/v1/tlscertificatedelegation.go similarity index 67% rename from enroute-dp/apis/generated/listers/enroute/v1beta1/tlscertificatedelegation.go rename to enroute-dp/apis/generated/listers/enroute/v1/tlscertificatedelegation.go index 083519f..36fe688 100644 --- a/enroute-dp/apis/generated/listers/enroute/v1beta1/tlscertificatedelegation.go +++ b/enroute-dp/apis/generated/listers/enroute/v1/tlscertificatedelegation.go @@ -1,28 +1,12 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by lister-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -31,7 +15,7 @@ import ( // TLSCertificateDelegationLister helps list TLSCertificateDelegations. type TLSCertificateDelegationLister interface { // List lists all TLSCertificateDelegations in the indexer. - List(selector labels.Selector) (ret []*v1beta1.TLSCertificateDelegation, err error) + List(selector labels.Selector) (ret []*v1.TLSCertificateDelegation, err error) // TLSCertificateDelegations returns an object that can list and get TLSCertificateDelegations. TLSCertificateDelegations(namespace string) TLSCertificateDelegationNamespaceLister TLSCertificateDelegationListerExpansion @@ -48,9 +32,9 @@ func NewTLSCertificateDelegationLister(indexer cache.Indexer) TLSCertificateDele } // List lists all TLSCertificateDelegations in the indexer. -func (s *tLSCertificateDelegationLister) List(selector labels.Selector) (ret []*v1beta1.TLSCertificateDelegation, err error) { +func (s *tLSCertificateDelegationLister) List(selector labels.Selector) (ret []*v1.TLSCertificateDelegation, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.TLSCertificateDelegation)) + ret = append(ret, m.(*v1.TLSCertificateDelegation)) }) return ret, err } @@ -63,9 +47,9 @@ func (s *tLSCertificateDelegationLister) TLSCertificateDelegations(namespace str // TLSCertificateDelegationNamespaceLister helps list and get TLSCertificateDelegations. type TLSCertificateDelegationNamespaceLister interface { // List lists all TLSCertificateDelegations in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1beta1.TLSCertificateDelegation, err error) + List(selector labels.Selector) (ret []*v1.TLSCertificateDelegation, err error) // Get retrieves the TLSCertificateDelegation from the indexer for a given namespace and name. - Get(name string) (*v1beta1.TLSCertificateDelegation, error) + Get(name string) (*v1.TLSCertificateDelegation, error) TLSCertificateDelegationNamespaceListerExpansion } @@ -77,21 +61,21 @@ type tLSCertificateDelegationNamespaceLister struct { } // List lists all TLSCertificateDelegations in the indexer for a given namespace. -func (s tLSCertificateDelegationNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.TLSCertificateDelegation, err error) { +func (s tLSCertificateDelegationNamespaceLister) List(selector labels.Selector) (ret []*v1.TLSCertificateDelegation, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.TLSCertificateDelegation)) + ret = append(ret, m.(*v1.TLSCertificateDelegation)) }) return ret, err } // Get retrieves the TLSCertificateDelegation from the indexer for a given namespace and name. -func (s tLSCertificateDelegationNamespaceLister) Get(name string) (*v1beta1.TLSCertificateDelegation, error) { +func (s tLSCertificateDelegationNamespaceLister) Get(name string) (*v1.TLSCertificateDelegation, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("tlscertificatedelegation"), name) + return nil, errors.NewNotFound(v1.Resource("tlscertificatedelegation"), name) } - return obj.(*v1beta1.TLSCertificateDelegation), nil + return obj.(*v1.TLSCertificateDelegation), nil } diff --git a/enroute-dp/cmd/enroute/serve.go b/enroute-dp/cmd/enroute/serve.go index 4309c36..955ca1d 100644 --- a/enroute-dp/cmd/enroute/serve.go +++ b/enroute-dp/cmd/enroute/serve.go @@ -294,8 +294,8 @@ func doServe(log logrus.FieldLogger, ctx *serveContext) error { if mode_ingress { coreInformers.Core().V1().Services().Informer().AddEventHandler(&reh) coreInformers.Core().V1().Secrets().Informer().AddEventHandler(&reh) - coreInformers.Networking().V1beta1().Ingresses().Informer().AddEventHandler(&reh) - contourInformers.Enroute().V1beta1().GatewayHosts().Informer().AddEventHandler(&reh) + coreInformers.Networking().V1().Ingresses().Informer().AddEventHandler(&reh) + contourInformers.Enroute().V1().GatewayHosts().Informer().AddEventHandler(&reh) // Add informers for each root-gatewayhost namespaces for _, inf := range namespacedInformers { @@ -309,9 +309,9 @@ func doServe(log logrus.FieldLogger, ctx *serveContext) error { // step 5.5 register resource event handler with k8s informers if mode_ingress { - contourInformers.Enroute().V1beta1().RouteFilters().Informer().AddEventHandler(&reh) - contourInformers.Enroute().V1beta1().HttpFilters().Informer().AddEventHandler(&reh) - contourInformers.Enroute().V1beta1().TLSCertificateDelegations().Informer().AddEventHandler(&reh) + contourInformers.Enroute().V1().RouteFilters().Informer().AddEventHandler(&reh) + contourInformers.Enroute().V1().HttpFilters().Informer().AddEventHandler(&reh) + contourInformers.Enroute().V1().TLSCertificateDelegations().Informer().AddEventHandler(&reh) } // step 6. endpoints updates are handled directly by the EndpointsTranslator @@ -332,7 +332,7 @@ func doServe(log logrus.FieldLogger, ctx *serveContext) error { // step 6.5 if mode_ingress { - contourInformers.Enroute().V1beta1().GlobalConfigs().Informer().AddEventHandler(pct) + contourInformers.Enroute().V1().GlobalConfigs().Informer().AddEventHandler(pct) } // step 7. setup workgroup runner and register informers. diff --git a/enroute-dp/hack/boilerplate.go.tmpl b/enroute-dp/hack/boilerplate.go.tmpl index 56bc6b3..e91842b 100644 --- a/enroute-dp/hack/boilerplate.go.tmpl +++ b/enroute-dp/hack/boilerplate.go.tmpl @@ -1,18 +1,3 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2018-2021 Saaras Inc. -/* -Copyright 2019 Heptio - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ diff --git a/enroute-dp/hack/update-generated-crd-code.sh b/enroute-dp/hack/update-generated-crd-code.sh index 33ce6d5..3157338 100755 --- a/enroute-dp/hack/update-generated-crd-code.sh +++ b/enroute-dp/hack/update-generated-crd-code.sh @@ -29,7 +29,7 @@ GOPATH=${HOME}/go code-generator/generate-groups.sh \ all \ github.com/saarasio/enroute/enroute-dp/apis/generated \ github.com/saarasio/enroute/enroute-dp/apis \ - "enroute:v1beta1 " \ + "enroute:v1" \ --output-base . \ --go-header-file hack/boilerplate.go.tmpl \ $@ @@ -39,5 +39,5 @@ rm -rf code-generator # Copy the generated.deepcopy to the api packages rm -rf apis/generated cp -R github.com/saarasio/enroute/enroute-dp/apis/generated apis/ -mv github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1/zz_generated.deepcopy.go apis/enroute/v1beta1 +mv github.com/saarasio/enroute/enroute-dp/apis/enroute/v1/zz_generated.deepcopy.go apis/enroute/v1 rm -rf github.com diff --git a/enroute-dp/internal/contour/annotations.go b/enroute-dp/internal/contour/annotations.go index 8ab6e09..72d5ade 100644 --- a/enroute-dp/internal/contour/annotations.go +++ b/enroute-dp/internal/contour/annotations.go @@ -20,7 +20,7 @@ import ( "strings" "github.com/gogo/protobuf/types" - "k8s.io/api/networking/v1beta1" + "k8s.io/api/networking/v1" ) const ( @@ -32,13 +32,13 @@ const ( // httpAllowed returns true unless the kubernetes.io/ingress.allow-http annotation is // present and set to false. -func httpAllowed(i *v1beta1.Ingress) bool { +func httpAllowed(i *v1.Ingress) bool { return !(i.Annotations["kubernetes.io/ingress.allow-http"] == "false") } // websocketRoutes returns a map of websocket routes. If the value is not present, or // malformed, then an empty map is returned. -func websocketRoutes(i *v1beta1.Ingress) map[string]*types.BoolValue { +func websocketRoutes(i *v1.Ingress) map[string]*types.BoolValue { routes := make(map[string]*types.BoolValue) for _, v := range strings.Split(i.Annotations[annotationWebsocketRoutes], ",") { route := strings.TrimSpace(v) diff --git a/enroute-dp/internal/contour/annotations_test.go b/enroute-dp/internal/contour/annotations_test.go index 98aa601..dd27b63 100644 --- a/enroute-dp/internal/contour/annotations_test.go +++ b/enroute-dp/internal/contour/annotations_test.go @@ -21,18 +21,17 @@ import ( "testing" "github.com/gogo/protobuf/types" - "k8s.io/api/networking/v1beta1" + "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" ) func TestWebsocketRoutes(t *testing.T) { tests := map[string]struct { - a *v1beta1.Ingress + a *v1.Ingress want map[string]*types.BoolValue }{ "empty": { - a: &v1beta1.Ingress{ + a: &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{annotationWebsocketRoutes: ""}, }, @@ -40,7 +39,7 @@ func TestWebsocketRoutes(t *testing.T) { want: map[string]*types.BoolValue{}, }, "empty with spaces": { - a: &v1beta1.Ingress{ + a: &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{annotationWebsocketRoutes: ", ,"}, }, @@ -48,7 +47,7 @@ func TestWebsocketRoutes(t *testing.T) { want: map[string]*types.BoolValue{}, }, "single value": { - a: &v1beta1.Ingress{ + a: &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{annotationWebsocketRoutes: "/ws1"}, }, @@ -58,7 +57,7 @@ func TestWebsocketRoutes(t *testing.T) { }, }, "multiple values": { - a: &v1beta1.Ingress{ + a: &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{annotationWebsocketRoutes: "/ws1,/ws2"}, }, @@ -69,7 +68,7 @@ func TestWebsocketRoutes(t *testing.T) { }, }, "multiple values with spaces and invalid entries": { - a: &v1beta1.Ingress{ + a: &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{annotationWebsocketRoutes: " /ws1, , /ws2 "}, }, @@ -93,27 +92,27 @@ func TestWebsocketRoutes(t *testing.T) { func TestHttpAllowed(t *testing.T) { tests := map[string]struct { - i *v1beta1.Ingress + i *v1.Ingress valid bool }{ "basic ingress": { - i: &v1beta1.Ingress{ + i: &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: v1.IngressSpec{ + TLS: []v1.IngressTLS{{ Hosts: []string{"whatever.example.com"}, SecretName: "secret", }}, - Backend: backend("backend", intstr.FromInt(80)), + DefaultBackend: backend("backend", 80), }, }, valid: true, }, "kubernetes.io/ingress.allow-http: \"false\"": { - i: &v1beta1.Ingress{ + i: &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", @@ -121,12 +120,12 @@ func TestHttpAllowed(t *testing.T) { "kubernetes.io/ingress.allow-http": "false", }, }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: v1.IngressSpec{ + TLS: []v1.IngressTLS{{ Hosts: []string{"whatever.example.com"}, SecretName: "secret", }}, - Backend: backend("backend", intstr.FromInt(80)), + DefaultBackend: backend("backend", 80), }, }, valid: false, @@ -144,9 +143,13 @@ func TestHttpAllowed(t *testing.T) { } } -func backend(name string, port intstr.IntOrString) *v1beta1.IngressBackend { - return &v1beta1.IngressBackend{ - ServiceName: name, - ServicePort: port, +func backend(name string, port int32) *v1.IngressBackend { + return &v1.IngressBackend{ + Service: &v1.IngressServiceBackend{ + Name: name, + Port: v1.ServiceBackendPort{ + Number: port, + }, + }, } } diff --git a/enroute-dp/internal/contour/cachehandler_test.go b/enroute-dp/internal/contour/cachehandler_test.go index a28d1c3..04f8351 100644 --- a/enroute-dp/internal/contour/cachehandler_test.go +++ b/enroute-dp/internal/contour/cachehandler_test.go @@ -20,7 +20,7 @@ import ( "reflect" "testing" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/internal/dag" "github.com/saarasio/enroute/enroute-dp/internal/metrics" v1 "k8s.io/api/core/v1" diff --git a/enroute-dp/internal/contour/cluster_test.go b/enroute-dp/internal/contour/cluster_test.go index 2d5d6a0..81bfb27 100644 --- a/enroute-dp/internal/contour/cluster_test.go +++ b/enroute-dp/internal/contour/cluster_test.go @@ -27,15 +27,15 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/duration" "github.com/prometheus/client_golang/prometheus" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/internal/assert" "github.com/saarasio/enroute/enroute-dp/internal/dag" "github.com/saarasio/enroute/enroute-dp/internal/envoy" //"github.com/saarasio/enroute/enroute-dp/internal/debug" "github.com/saarasio/enroute/enroute-dp/internal/metrics" "github.com/saarasio/enroute/enroute-dp/internal/protobuf" - v1 "k8s.io/api/core/v1" - "k8s.io/api/networking/v1beta1" + core_v1 "k8s.io/api/core/v1" + "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -196,20 +196,24 @@ func TestClusterVisit(t *testing.T) { }, "single unnamed service": { objs: []interface{}{ - &v1beta1.Ingress{ + &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(443), + Spec: v1.IngressSpec{ + DefaultBackend: &v1.IngressBackend{ + Service: &v1.IngressServiceBackend{ + Name: "kuard", + Port: v1.ServiceBackendPort{ + Number: 443, + }, + }, }, }, }, service("default", "kuard", - v1.ServicePort{ + core_v1.ServicePort{ Protocol: "TCP", Port: 443, TargetPort: intstr.FromInt(8443), @@ -233,20 +237,24 @@ func TestClusterVisit(t *testing.T) { }, "single named service": { objs: []interface{}{ - &v1beta1.Ingress{ + &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("https"), + Spec: v1.IngressSpec{ + DefaultBackend: &v1.IngressBackend{ + Service: &v1.IngressServiceBackend{ + Name: "kuard", + Port: v1.ServiceBackendPort{ + Name: "https", + }, + }, }, }, }, service("default", "kuard", - v1.ServicePort{ + core_v1.ServicePort{ Name: "https", Protocol: "TCP", Port: 443, @@ -271,15 +279,19 @@ func TestClusterVisit(t *testing.T) { }, "h2c upstream": { objs: []interface{}{ - &v1beta1.Ingress{ + &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("http"), + Spec: v1.IngressSpec{ + DefaultBackend: &v1.IngressBackend{ + Service: &v1.IngressServiceBackend{ + Name: "kuard", + Port: v1.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -289,7 +301,7 @@ func TestClusterVisit(t *testing.T) { map[string]string{ "enroute.saaras.io/upstream-protocol.h2c": "80,http", }, - v1.ServicePort{ + core_v1.ServicePort{ Protocol: "TCP", Name: "http", Port: 80, @@ -315,20 +327,24 @@ func TestClusterVisit(t *testing.T) { }, "long namespace and service name": { objs: []interface{}{ - &v1beta1.Ingress{ + &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "webserver-1-unimatrix-zero-one", Namespace: "beurocratic-company-test-domain-1", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "tiny-cog-department-test-instance", - ServicePort: intstr.FromInt(443), + Spec: v1.IngressSpec{ + DefaultBackend: &v1.IngressBackend{ + Service: &v1.IngressServiceBackend{ + Name: "tiny-cog-department-test-instance", + Port: v1.ServiceBackendPort{ + Number: 443, + }, + }, }, }, }, service("beurocratic-company-test-domain-1", "tiny-cog-department-test-instance", - v1.ServicePort{ + core_v1.ServicePort{ Name: "svc-0", Protocol: "TCP", Port: 443, @@ -376,12 +392,12 @@ func TestClusterVisit(t *testing.T) { }}, }, }, - service("default", "backend", v1.ServicePort{ + service("default", "backend", core_v1.ServicePort{ Name: "http", Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(6502), - }, v1.ServicePort{ + }, core_v1.ServicePort{ Name: "alt", Protocol: "TCP", Port: 8080, @@ -442,7 +458,7 @@ func TestClusterVisit(t *testing.T) { }}, }, }, - service("default", "backend", v1.ServicePort{ + service("default", "backend", core_v1.ServicePort{ Name: "http", Protocol: "TCP", Port: 80, @@ -508,7 +524,7 @@ func TestClusterVisit(t *testing.T) { }}, }, }, - service("default", "backend", v1.ServicePort{ + service("default", "backend", core_v1.ServicePort{ Name: "http", Protocol: "TCP", Port: 80, @@ -567,7 +583,7 @@ func TestClusterVisit(t *testing.T) { }}, }, }, - service("default", "backend", v1.ServicePort{ + service("default", "backend", core_v1.ServicePort{ Name: "http", Protocol: "TCP", Port: 80, @@ -613,7 +629,7 @@ func TestClusterVisit(t *testing.T) { }}, }, }, - service("default", "backend", v1.ServicePort{ + service("default", "backend", core_v1.ServicePort{ Name: "http", Protocol: "TCP", Port: 80, @@ -659,7 +675,7 @@ func TestClusterVisit(t *testing.T) { }}, }, }, - service("default", "backend", v1.ServicePort{ + service("default", "backend", core_v1.ServicePort{ Name: "http", Protocol: "TCP", Port: 80, @@ -714,7 +730,7 @@ func TestClusterVisit(t *testing.T) { }}, }, }, - service("default", "backend", v1.ServicePort{ + service("default", "backend", core_v1.ServicePort{ Name: "http", Protocol: "TCP", Port: 80, @@ -773,7 +789,7 @@ func TestClusterVisit(t *testing.T) { }}, }, }, - service("default", "backend", v1.ServicePort{ + service("default", "backend", core_v1.ServicePort{ Name: "http", Protocol: "TCP", Port: 80, @@ -798,15 +814,19 @@ func TestClusterVisit(t *testing.T) { }, "circuitbreaker annotations": { objs: []interface{}{ - &v1beta1.Ingress{ + &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("http"), + Spec: v1.IngressSpec{ + DefaultBackend: &v1.IngressBackend{ + Service: &v1.IngressServiceBackend{ + Name: "kuard", + Port: v1.ServiceBackendPort{ + Name: "http", + }, + }, }, }, }, @@ -819,7 +839,7 @@ func TestClusterVisit(t *testing.T) { "enroute.saaras.io/max-requests": "404", "enroute.saaras.io/max-retries": "7", }, - v1.ServicePort{ + core_v1.ServicePort{ Protocol: "TCP", Name: "http", Port: 80, @@ -852,7 +872,7 @@ func TestClusterVisit(t *testing.T) { }, "enroute.saaras.io/num-retries annotation": { objs: []interface{}{ - &v1beta1.Ingress{ + &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", @@ -861,15 +881,19 @@ func TestClusterVisit(t *testing.T) { "enroute.saaras.io/retry-on": "gateway-error", }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("https"), + Spec: v1.IngressSpec{ + DefaultBackend: &v1.IngressBackend{ + Service: &v1.IngressServiceBackend{ + Name: "kuard", + Port: v1.ServiceBackendPort{ + Name: "https", + }, + }, }, }, }, service("default", "kuard", - v1.ServicePort{ + core_v1.ServicePort{ Name: "https", Protocol: "TCP", Port: 443, @@ -917,18 +941,18 @@ func TestClusterVisit(t *testing.T) { } } -func service(ns, name string, ports ...v1.ServicePort) *v1.Service { +func service(ns, name string, ports ...core_v1.ServicePort) *core_v1.Service { return serviceWithAnnotations(ns, name, nil, ports...) } -func serviceWithAnnotations(ns, name string, annotations map[string]string, ports ...v1.ServicePort) *v1.Service { - return &v1.Service{ +func serviceWithAnnotations(ns, name string, annotations map[string]string, ports ...core_v1.ServicePort) *core_v1.Service { + return &core_v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: ns, Annotations: annotations, }, - Spec: v1.ServiceSpec{ + Spec: core_v1.ServiceSpec{ Ports: ports, }, } diff --git a/enroute-dp/internal/contour/globalconfigtranslator.go b/enroute-dp/internal/contour/globalconfigtranslator.go index 9c10925..192cb5f 100644 --- a/enroute-dp/internal/contour/globalconfigtranslator.go +++ b/enroute-dp/internal/contour/globalconfigtranslator.go @@ -9,7 +9,7 @@ import ( "github.com/sirupsen/logrus" // v1 "k8s.io/api/core/v1" // metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" _ "github.com/saarasio/enroute/enroute-dp/saarasconfig" k8scache "k8s.io/client-go/tools/cache" ) diff --git a/enroute-dp/internal/contour/k8s.go b/enroute-dp/internal/contour/k8s.go index 9866f94..d1bda0a 100644 --- a/enroute-dp/internal/contour/k8s.go +++ b/enroute-dp/internal/contour/k8s.go @@ -23,11 +23,11 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/prometheus/client_golang/prometheus" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/internal/dag" "github.com/saarasio/enroute/enroute-dp/internal/metrics" "github.com/sirupsen/logrus" - "k8s.io/api/networking/v1beta1" + "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -112,7 +112,7 @@ func (reh *ResourceEventHandler) update() { // validIngressClass returns true iff: // -// 1. obj is not of type *v1beta1.Ingress or gatewayhostv1.GatewayHost. +// 1. obj is not of type *v1.Ingress or gatewayhostv1.GatewayHost. // 2. obj has no ingress.class annotation. // 2. obj's ingress.class annotation matches d.IngressClass. func (reh *ResourceEventHandler) validIngressClass(obj interface{}) bool { @@ -120,7 +120,7 @@ func (reh *ResourceEventHandler) validIngressClass(obj interface{}) bool { case *gatewayhostv1.GatewayHost: class, ok := getIngressClassAnnotation(i.Annotations) return !ok || class == reh.ingressClass() - case *v1beta1.Ingress: + case *v1.Ingress: class, ok := getIngressClassAnnotation(i.Annotations) return !ok || class == reh.ingressClass() default: diff --git a/enroute-dp/internal/contour/listener_test.go b/enroute-dp/internal/contour/listener_test.go index 61cd632..1c2e9e1 100644 --- a/enroute-dp/internal/contour/listener_test.go +++ b/enroute-dp/internal/contour/listener_test.go @@ -25,16 +25,15 @@ import ( "github.com/golang/protobuf/proto" "github.com/google/go-cmp/cmp" "github.com/prometheus/client_golang/prometheus" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/internal/assert" "github.com/saarasio/enroute/enroute-dp/internal/dag" "github.com/saarasio/enroute/enroute-dp/internal/envoy" "github.com/saarasio/enroute/enroute-dp/internal/metrics" "google.golang.org/protobuf/testing/protocmp" - v1 "k8s.io/api/core/v1" - "k8s.io/api/networking/v1beta1" + corev1 "k8s.io/api/core/v1" + netv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" ) func TestListenerCacheContents(t *testing.T) { @@ -141,25 +140,29 @@ func TestListenerVisit(t *testing.T) { }, "one http only ingress": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -194,13 +197,13 @@ func TestListenerVisit(t *testing.T) { }}, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -216,23 +219,27 @@ func TestListenerVisit(t *testing.T) { }, "simple ingress with secret": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"whatever.example.com"}, SecretName: "secret", }}, - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Secret{ + &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", @@ -240,13 +247,13 @@ func TestListenerVisit(t *testing.T) { Type: "kubernetes.io/tls", Data: secretdata("certificate", "key"), }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -275,39 +282,47 @@ func TestListenerVisit(t *testing.T) { }, "multiple tls ingress with secrets should be sorted": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "sortedsecond", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"sortedsecond.example.com"}, SecretName: "secret", }}, - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "sortedfirst", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"sortedfirst.example.com"}, SecretName: "secret", }}, - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Secret{ + &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", @@ -315,13 +330,13 @@ func TestListenerVisit(t *testing.T) { Type: "kubernetes.io/tls", Data: secretdata("certificate", "key"), }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -359,23 +374,27 @@ func TestListenerVisit(t *testing.T) { }, "simple ingress with missing secret": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"whatever.example.com"}, SecretName: "missing", }}, - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Secret{ + &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", @@ -383,13 +402,13 @@ func TestListenerVisit(t *testing.T) { Type: "kubernetes.io/tls", Data: secretdata("certificate", "key"), }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -429,7 +448,7 @@ func TestListenerVisit(t *testing.T) { }, }, }, - &v1.Secret{ + &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", @@ -437,13 +456,13 @@ func TestListenerVisit(t *testing.T) { Type: "kubernetes.io/tls", Data: secretdata("certificate", "key"), }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -472,7 +491,7 @@ func TestListenerVisit(t *testing.T) { }, "ingress with allow-http: false": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", @@ -480,10 +499,14 @@ func TestListenerVisit(t *testing.T) { "kubernetes.io/ingress.allow-http": "false", }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, @@ -492,7 +515,7 @@ func TestListenerVisit(t *testing.T) { }, "simple tls ingress with allow-http:false": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", @@ -500,18 +523,22 @@ func TestListenerVisit(t *testing.T) { "kubernetes.io/ingress.allow-http": "false", }, }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"www.example.com"}, SecretName: "secret", }}, - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Secret{ + &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", @@ -543,23 +570,27 @@ func TestListenerVisit(t *testing.T) { HTTPSPort: 9200, }, objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"whatever.example.com"}, SecretName: "secret", }}, - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Secret{ + &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", @@ -567,13 +598,13 @@ func TestListenerVisit(t *testing.T) { Type: "kubernetes.io/tls", Data: secretdata("certificate", "key"), }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -605,23 +636,27 @@ func TestListenerVisit(t *testing.T) { UseProxyProto: true, }, objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"whatever.example.com"}, SecretName: "secret", }}, - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Secret{ + &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", @@ -629,13 +664,13 @@ func TestListenerVisit(t *testing.T) { Type: "kubernetes.io/tls", Data: secretdata("certificate", "key"), }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -672,23 +707,27 @@ func TestListenerVisit(t *testing.T) { HTTPSAccessLog: "/tmp/https_access.log", }, objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"whatever.example.com"}, SecretName: "secret", }}, - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Secret{ + &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", @@ -696,13 +735,13 @@ func TestListenerVisit(t *testing.T) { Type: "kubernetes.io/tls", Data: secretdata("certificate", "key"), }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -758,8 +797,8 @@ func transportSocket(tlsMinProtoVersion envoy_extensions_transport_sockets_tls_v func secretdata(cert, key string) map[string][]byte { return map[string][]byte{ - v1.TLSCertKey: []byte(cert), - v1.TLSPrivateKeyKey: []byte(key), + corev1.TLSCertKey: []byte(cert), + corev1.TLSPrivateKeyKey: []byte(key), } } diff --git a/enroute-dp/internal/contour/route_test.go b/enroute-dp/internal/contour/route_test.go index 358c6e3..65ee7bb 100644 --- a/enroute-dp/internal/contour/route_test.go +++ b/enroute-dp/internal/contour/route_test.go @@ -24,14 +24,14 @@ import ( "github.com/golang/protobuf/proto" "github.com/prometheus/client_golang/prometheus" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/internal/assert" "github.com/saarasio/enroute/enroute-dp/internal/dag" "github.com/saarasio/enroute/enroute-dp/internal/envoy" "github.com/saarasio/enroute/enroute-dp/internal/metrics" "github.com/saarasio/enroute/enroute-dp/internal/protobuf" - v1 "k8s.io/api/core/v1" - "k8s.io/api/networking/v1beta1" + corev1 "k8s.io/api/core/v1" + netv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -153,25 +153,29 @@ func TestRouteVisit(t *testing.T) { }, "one http only ingress with service": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -221,13 +225,13 @@ func TestRouteVisit(t *testing.T) { }}, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -255,23 +259,27 @@ func TestRouteVisit(t *testing.T) { }, "default backend ingress with secret": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"whatever.example.com"}, SecretName: "secret", }}, - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Secret{ + &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", @@ -279,13 +287,13 @@ func TestRouteVisit(t *testing.T) { Type: "kubernetes.io/tls", Data: secretdata("certificate", "key"), }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -313,24 +321,28 @@ func TestRouteVisit(t *testing.T) { }, "vhost ingress with secret": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"www.example.com"}, SecretName: "secret", }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "www.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("www"), + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "www", + }, + }, }, }}, }, @@ -338,7 +350,7 @@ func TestRouteVisit(t *testing.T) { }}, }, }, - &v1.Secret{ + &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", @@ -346,13 +358,13 @@ func TestRouteVisit(t *testing.T) { Type: "kubernetes.io/tls", Data: secretdata("certificate", "key"), }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "www", Protocol: "TCP", Port: 8080, @@ -414,7 +426,7 @@ func TestRouteVisit(t *testing.T) { }, }, }, - &v1.Secret{ + &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", @@ -422,13 +434,13 @@ func TestRouteVisit(t *testing.T) { Type: "kubernetes.io/tls", Data: secretdata("certificate", "key"), }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "www", Protocol: "TCP", Port: 8080, @@ -471,7 +483,7 @@ func TestRouteVisit(t *testing.T) { }, "simple tls ingress with allow-http:false": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", @@ -479,19 +491,23 @@ func TestRouteVisit(t *testing.T) { "kubernetes.io/ingress.allow-http": "false", }, }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"www.example.com"}, SecretName: "secret", }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "www.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("www"), + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "www", + }, + }, }, }}, }, @@ -499,7 +515,7 @@ func TestRouteVisit(t *testing.T) { }}, }, }, - &v1.Secret{ + &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", @@ -507,13 +523,13 @@ func TestRouteVisit(t *testing.T) { Type: "kubernetes.io/tls", Data: secretdata("certificate", "key"), }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "www", Protocol: "TCP", Port: 8080, @@ -542,7 +558,7 @@ func TestRouteVisit(t *testing.T) { }, "simple tls ingress with force-ssl-redirect": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", @@ -550,19 +566,23 @@ func TestRouteVisit(t *testing.T) { "ingress.kubernetes.io/force-ssl-redirect": "true", }, }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"www.example.com"}, SecretName: "secret", }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "www.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("www"), + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "www", + }, + }, }, }}, }, @@ -570,7 +590,7 @@ func TestRouteVisit(t *testing.T) { }}, }, }, - &v1.Secret{ + &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", @@ -578,13 +598,13 @@ func TestRouteVisit(t *testing.T) { Type: "kubernetes.io/tls", Data: secretdata("certificate", "key"), }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "www", Protocol: "TCP", Port: 8080, @@ -627,7 +647,7 @@ func TestRouteVisit(t *testing.T) { }, "ingress with websocket annotation": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", @@ -635,22 +655,30 @@ func TestRouteVisit(t *testing.T) { "enroute.saaras.io/websocket-routes": "/ws1 , /ws2", }, }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "www.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("www"), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "www", + }, + }, }, }, { Path: "/ws1", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("www"), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "www", + }, + }, }, }}, }, @@ -658,13 +686,13 @@ func TestRouteVisit(t *testing.T) { }}, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "www", Protocol: "TCP", Port: 8080, @@ -697,7 +725,7 @@ func TestRouteVisit(t *testing.T) { }, "ingress invalid timeout": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", @@ -705,20 +733,24 @@ func TestRouteVisit(t *testing.T) { "enroute.saaras.io/request-timeout": "heptio", }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -746,7 +778,7 @@ func TestRouteVisit(t *testing.T) { }, "ingress infinite timeout": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", @@ -754,20 +786,24 @@ func TestRouteVisit(t *testing.T) { "enroute.saaras.io/request-timeout": "infinity", }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -795,7 +831,7 @@ func TestRouteVisit(t *testing.T) { }, "ingress 90 second timeout": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", @@ -803,20 +839,24 @@ func TestRouteVisit(t *testing.T) { "enroute.saaras.io/request-timeout": "1m30s", }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -844,21 +884,25 @@ func TestRouteVisit(t *testing.T) { }, "vhost name exceeds 60 chars": { // saarasio/enroute#25 objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "my-service-name", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "my-very-very-long-service-host-name.subdomain.boring-dept.my.company", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("www"), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "www", + }, + }, }, }}, }, @@ -866,13 +910,13 @@ func TestRouteVisit(t *testing.T) { }}, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "www", Protocol: "TCP", Port: 80, @@ -901,25 +945,29 @@ func TestRouteVisit(t *testing.T) { }, "Ingress: empty ingress class": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "incorrect", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -947,7 +995,7 @@ func TestRouteVisit(t *testing.T) { }, "Ingress: explicit kubernetes.io/ingress.class": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "incorrect", Namespace: "default", @@ -955,20 +1003,24 @@ func TestRouteVisit(t *testing.T) { "kubernetes.io/ingress.class": new(ResourceEventHandler).ingressClass(), }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -996,7 +1048,7 @@ func TestRouteVisit(t *testing.T) { }, "Ingress: explicit enroute.saaras.io/ingress.class": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "incorrect", Namespace: "default", @@ -1004,20 +1056,24 @@ func TestRouteVisit(t *testing.T) { "enroute.saaras.io/ingress.class": new(ResourceEventHandler).ingressClass(), }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -1067,13 +1123,13 @@ func TestRouteVisit(t *testing.T) { }}, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -1126,13 +1182,13 @@ func TestRouteVisit(t *testing.T) { }}, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -1185,13 +1241,13 @@ func TestRouteVisit(t *testing.T) { }}, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -1219,7 +1275,7 @@ func TestRouteVisit(t *testing.T) { }, "ingress retry-on": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", @@ -1227,20 +1283,24 @@ func TestRouteVisit(t *testing.T) { "enroute.saaras.io/retry-on": "5xx,gateway-error", }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -1268,7 +1328,7 @@ func TestRouteVisit(t *testing.T) { }, "ingress retry-on, num-retries": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", @@ -1277,20 +1337,24 @@ func TestRouteVisit(t *testing.T) { "enroute.saaras.io/num-retries": "7", // not five or six or eight, but seven. }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -1318,7 +1382,7 @@ func TestRouteVisit(t *testing.T) { }, "ingress retry-on, per-try-timeout": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", @@ -1327,20 +1391,24 @@ func TestRouteVisit(t *testing.T) { "enroute.saaras.io/per-try-timeout": "150ms", }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -1394,26 +1462,26 @@ func TestRouteVisit(t *testing.T) { }}, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), }}, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backendtwo", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -1480,26 +1548,26 @@ func TestRouteVisit(t *testing.T) { }}, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), }}, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backendtwo", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -1567,26 +1635,26 @@ func TestRouteVisit(t *testing.T) { }}, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), }}, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backendtwo", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -1646,13 +1714,13 @@ func TestRouteVisit(t *testing.T) { }}, }, }, - &v1.Service{ + &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), diff --git a/enroute-dp/internal/contour/secret_test.go b/enroute-dp/internal/contour/secret_test.go index 5754c16..1ea3576 100644 --- a/enroute-dp/internal/contour/secret_test.go +++ b/enroute-dp/internal/contour/secret_test.go @@ -12,14 +12,13 @@ import ( "github.com/golang/protobuf/proto" "github.com/google/go-cmp/cmp" "github.com/prometheus/client_golang/prometheus" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/internal/dag" "github.com/saarasio/enroute/enroute-dp/internal/metrics" "google.golang.org/protobuf/testing/protocmp" - v1 "k8s.io/api/core/v1" - "k8s.io/api/networking/v1beta1" + corev1 "k8s.io/api/core/v1" + netv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" ) func TestSecretCacheContents(t *testing.T) { @@ -117,19 +116,23 @@ func TestSecretVisit(t *testing.T) { }, "simple ingress with secret": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"whatever.example.com"}, SecretName: "secret", }}, - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, @@ -141,35 +144,43 @@ func TestSecretVisit(t *testing.T) { }, "multiple ingresses with shared secret": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple-a", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"whatever.example.com"}, SecretName: "secret", }}, - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple-b", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"omg.example.com"}, SecretName: "secret", }}, - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, @@ -181,35 +192,43 @@ func TestSecretVisit(t *testing.T) { }, "multiple ingresses with different secrets": { objs: []interface{}{ - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple-a", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"whatever.example.com"}, SecretName: "secret-a", }}, - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, - &v1beta1.Ingress{ + &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple-b", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"omg.example.com"}, SecretName: "secret-b", }}, - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, @@ -414,14 +433,14 @@ func secret(name, cert, key string) *envoy_extensions_transport_sockets_tls_v3.S } } -// tlssecert creates a new v1.Secret object of type kubernetes.io/tls. -func tlssecret(namespace, name string, data map[string][]byte) *v1.Secret { - return &v1.Secret{ +// tlssecert creates a new corev1.Secret object of type kubernetes.io/tls. +func tlssecret(namespace, name string, data map[string][]byte) *corev1.Secret { + return &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, }, - Type: v1.SecretTypeTLS, + Type: corev1.SecretTypeTLS, Data: data, } } diff --git a/enroute-dp/internal/dag/annotations.go b/enroute-dp/internal/dag/annotations.go index e47b954..842ace9 100644 --- a/enroute-dp/internal/dag/annotations.go +++ b/enroute-dp/internal/dag/annotations.go @@ -23,7 +23,7 @@ import ( "time" "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3" - "k8s.io/api/networking/v1beta1" + "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -110,17 +110,17 @@ func parseUpstreamProtocols(annotations map[string]string, annotation string, pr // httpAllowed returns true unless the kubernetes.io/ingress.allow-http annotation is // present and set to false. -func httpAllowed(i *v1beta1.Ingress) bool { +func httpAllowed(i *v1.Ingress) bool { return !(i.Annotations["kubernetes.io/ingress.allow-http"] == "false") } // tlsRequired returns true if the ingress.kubernetes.io/force-ssl-redirect annotation is // present and set to true. -func tlsRequired(i *v1beta1.Ingress) bool { +func tlsRequired(i *v1.Ingress) bool { return i.Annotations["ingress.kubernetes.io/force-ssl-redirect"] == "true" } -func websocketRoutes(i *v1beta1.Ingress) map[string]bool { +func websocketRoutes(i *v1.Ingress) map[string]bool { routes := make(map[string]bool) for _, v := range strings.Split(i.Annotations[annotationWebsocketRoutes], ",") { route := strings.TrimSpace(v) @@ -146,11 +146,11 @@ func MinProtoVersion(version string) envoy_extensions_transport_sockets_tls_v3.T } // perTryTimeout returns the duration envoy will wait per retry cycle. -func perTryTimeout(i *v1beta1.Ingress) time.Duration { +func perTryTimeout(i *v1.Ingress) time.Duration { return parseTimeout(compatAnnotation(i, "per-try-timeout")) } // numRetries returns the number of retries specified by the "enroute.saaras.io/num-retries" -func numRetries(i *v1beta1.Ingress) uint32 { +func numRetries(i *v1.Ingress) uint32 { return parseUInt32(compatAnnotation(i, "num-retries")) } diff --git a/enroute-dp/internal/dag/annotations_test.go b/enroute-dp/internal/dag/annotations_test.go index bec0b9a..4305791 100644 --- a/enroute-dp/internal/dag/annotations_test.go +++ b/enroute-dp/internal/dag/annotations_test.go @@ -21,7 +21,7 @@ import ( "reflect" "testing" - "k8s.io/api/networking/v1beta1" + "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -116,11 +116,11 @@ func TestParseUpstreamProtocols(t *testing.T) { func TestWebsocketRoutes(t *testing.T) { tests := map[string]struct { - a *v1beta1.Ingress + a *v1.Ingress want map[string]bool }{ "empty": { - a: &v1beta1.Ingress{ + a: &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{annotationWebsocketRoutes: ""}, }, @@ -128,7 +128,7 @@ func TestWebsocketRoutes(t *testing.T) { want: map[string]bool{}, }, "empty with spaces": { - a: &v1beta1.Ingress{ + a: &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{annotationWebsocketRoutes: ", ,"}, }, @@ -136,7 +136,7 @@ func TestWebsocketRoutes(t *testing.T) { want: map[string]bool{}, }, "single value": { - a: &v1beta1.Ingress{ + a: &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{annotationWebsocketRoutes: "/ws1"}, }, @@ -146,7 +146,7 @@ func TestWebsocketRoutes(t *testing.T) { }, }, "multiple values": { - a: &v1beta1.Ingress{ + a: &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{annotationWebsocketRoutes: "/ws1,/ws2"}, }, @@ -157,7 +157,7 @@ func TestWebsocketRoutes(t *testing.T) { }, }, "multiple values with spaces and invalid entries": { - a: &v1beta1.Ingress{ + a: &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{annotationWebsocketRoutes: " /ws1, , /ws2 "}, }, @@ -181,27 +181,27 @@ func TestWebsocketRoutes(t *testing.T) { func TestHttpAllowed(t *testing.T) { tests := map[string]struct { - i *v1beta1.Ingress + i *v1.Ingress valid bool }{ "basic ingress": { - i: &v1beta1.Ingress{ + i: &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: v1.IngressSpec{ + TLS: []v1.IngressTLS{{ Hosts: []string{"whatever.example.com"}, SecretName: "secret", }}, - Backend: backend("backend", intstr.FromInt(80)), + DefaultBackend: backend("backend", intstr.FromInt(80)), }, }, valid: true, }, "kubernetes.io/ingress.allow-http: \"false\"": { - i: &v1beta1.Ingress{ + i: &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", @@ -209,12 +209,12 @@ func TestHttpAllowed(t *testing.T) { "kubernetes.io/ingress.allow-http": "false", }, }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: v1.IngressSpec{ + TLS: []v1.IngressTLS{{ Hosts: []string{"whatever.example.com"}, SecretName: "secret", }}, - Backend: backend("backend", intstr.FromInt(80)), + DefaultBackend: backend("backend", intstr.FromInt(80)), }, }, valid: false, diff --git a/enroute-dp/internal/dag/builder.go b/enroute-dp/internal/dag/builder.go index d2557d2..10f2f43 100644 --- a/enroute-dp/internal/dag/builder.go +++ b/enroute-dp/internal/dag/builder.go @@ -25,12 +25,11 @@ import ( "strings" v1 "k8s.io/api/core/v1" - "k8s.io/api/networking/v1beta1" - "k8s.io/apimachinery/pkg/util/intstr" + net_v1 "k8s.io/api/networking/v1" _ "github.com/davecgh/go-spew/spew" "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/internal/logger" "github.com/sirupsen/logrus" ) @@ -80,7 +79,7 @@ type builder struct { log logrus.FieldLogger } -func (b *builder) debugPrintServices(m Meta, port intstr.IntOrString) { +func (b *builder) debugPrintServices(m Meta, port net_v1.ServiceBackendPort) { if logger.EL.ELogger != nil && logger.EL.ELogger.GetLevel() >= logrus.DebugLevel { logger.EL.ELogger.Debugf("dag:builder:debugPrintServices(): Cannot find service meta [%+v] port [%+v]\n", m, port) @@ -91,7 +90,7 @@ func (b *builder) debugPrintServices(m Meta, port intstr.IntOrString) { } // lookupHTTPService returns a HTTPService that matches the Meta and port supplied. -func (b *builder) lookupHTTPService(m Meta, port intstr.IntOrString) *HTTPService { +func (b *builder) lookupHTTPService(m Meta, port net_v1.ServiceBackendPort) *HTTPService { s := b.lookupService(m, port) switch s := s.(type) { case *HTTPService: @@ -104,10 +103,11 @@ func (b *builder) lookupHTTPService(m Meta, port intstr.IntOrString) *HTTPServic } for i := range svc.Spec.Ports { p := &svc.Spec.Ports[i] - if int(p.Port) == port.IntValue() { + if p.Port == port.Number { return b.addHTTPService(svc, p) } - if port.String() == p.Name { + // When comparing names, one of them should be non-empty for comparison to be valid + if port.Name == p.Name && ((port.Name != "") || (p.Name != "")) { return b.addHTTPService(svc, p) } } @@ -121,7 +121,7 @@ func (b *builder) lookupHTTPService(m Meta, port intstr.IntOrString) *HTTPServic } // lookupTCPService returns a TCPService that matches the Meta and port supplied. -func (b *builder) lookupTCPService(m Meta, port intstr.IntOrString) *TCPService { +func (b *builder) lookupTCPService(m Meta, port net_v1.ServiceBackendPort) *TCPService { s := b.lookupService(m, port) switch s := s.(type) { case *TCPService: @@ -133,10 +133,10 @@ func (b *builder) lookupTCPService(m Meta, port intstr.IntOrString) *TCPService } for i := range svc.Spec.Ports { p := &svc.Spec.Ports[i] - if int(p.Port) == port.IntValue() { + if p.Port == port.Number { return b.addTCPService(svc, p) } - if port.String() == p.Name { + if port.Name == p.Name { return b.addTCPService(svc, p) } } @@ -146,15 +146,15 @@ func (b *builder) lookupTCPService(m Meta, port intstr.IntOrString) *TCPService return nil } } -func (b *builder) lookupService(m Meta, port intstr.IntOrString) Service { - if port.Type != intstr.Int { +func (b *builder) lookupService(m Meta, port net_v1.ServiceBackendPort) Service { + if port.Number < 0 || port.Number > 65535 { // can't handle, give up return nil } sm := servicemeta{ name: m.name, namespace: m.namespace, - port: int32(port.IntValue()), + port: port.Number, } s, ok := b.services[sm] if !ok { @@ -318,7 +318,7 @@ func (b *builder) compute() *DAG { } // route builds a dag.Route for the supplied Ingress. -func route(ingress *v1beta1.Ingress, path string, service *HTTPService) *Route { +func route(ingress *net_v1.Ingress, path string, service *HTTPService) *Route { wr := websocketRoutes(ingress) r := &Route{ HTTPSUpgrade: tlsRequired(ingress), @@ -484,10 +484,10 @@ func (b *builder) computeIngresses() { for _, httppath := range httppaths(rule) { path := stringOrDefault(httppath.Path, "/") be := httppath.Backend - m := Meta{name: be.ServiceName, namespace: ing.Namespace} + m := Meta{name: be.Service.Name, namespace: ing.Namespace} // XXX: We now read the protocol directly from gatewayhostv1.Service // s.Protocol = be.Protocol - s := b.lookupHTTPService(m, be.ServicePort) + s := b.lookupHTTPService(m, be.Service.Port) if s == nil { continue } @@ -582,9 +582,9 @@ func (b *builder) secureVirtualhostExists(host string) bool { // rulesFromSpec merges the IngressSpec's Rules with a synthetic // rule representing the default backend. -func rulesFromSpec(spec v1beta1.IngressSpec) []v1beta1.IngressRule { +func rulesFromSpec(spec net_v1.IngressSpec) []net_v1.IngressRule { rules := spec.Rules - if backend := spec.Backend; backend != nil { + if backend := spec.DefaultBackend; backend != nil { rule := defaultBackendRule(backend) rules = append(rules, rule) } @@ -592,14 +592,16 @@ func rulesFromSpec(spec v1beta1.IngressSpec) []v1beta1.IngressRule { } // defaultBackendRule returns an IngressRule that represents the IngressBackend. -func defaultBackendRule(be *v1beta1.IngressBackend) v1beta1.IngressRule { - return v1beta1.IngressRule{ - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: be.ServiceName, - ServicePort: be.ServicePort, +func defaultBackendRule(be *net_v1.IngressBackend) net_v1.IngressRule { + return net_v1.IngressRule{ + IngressRuleValue: net_v1.IngressRuleValue{ + HTTP: &net_v1.HTTPIngressRuleValue{ + Paths: []net_v1.HTTPIngressPath{{ + Backend: net_v1.IngressBackend{ + Service: &net_v1.IngressServiceBackend{ + Name: be.Service.Name, + Port: be.Service.Port, + }, }, }}, }, @@ -775,7 +777,7 @@ func (b *builder) processRoutes(ir *gatewayhostv1.GatewayHost, visited []*gatewa return } m := Meta{name: service.Name, namespace: ir.Namespace} - s := b.lookupHTTPService(m, intstr.FromInt(service.Port)) + s := b.lookupHTTPService(m, net_v1.ServiceBackendPort{Number: int32(service.Port)}) if ir != nil && ir.Spec.VirtualHost != nil && logger.EL.ELogger != nil && logger.EL.ELogger.GetLevel() >= logrus.DebugLevel { logger.EL.ELogger.Debugf("dag:builder:processRoutes() Valid: IR [%s] Looked up Service [%s:%d]\n", @@ -961,7 +963,7 @@ func (b *builder) processTCPProxy(ir *gatewayhostv1.GatewayHost, visited []*gate var proxy TCPProxy for _, service := range tcpproxy.Services { m := Meta{name: service.Name, namespace: ir.Namespace} - s := b.lookupTCPService(m, intstr.FromInt(service.Port)) + s := b.lookupTCPService(m, net_v1.ServiceBackendPort{Number: int32(service.Port)}) if s == nil { b.setStatus(Status{Object: ir, Status: StatusInvalid, Description: fmt.Sprintf("tcpproxy: service %s/%s/%d: not found", ir.Namespace, service.Name, service.Port), Vhost: host}) return @@ -1020,7 +1022,7 @@ func routeEnforceTLS(enforceTLS, permitInsecure bool) bool { // httppaths returns a slice of HTTPIngressPath values for a given IngressRule. // In the case that the IngressRule contains no valid HTTPIngressPaths, a // nil slice is returned. -func httppaths(rule v1beta1.IngressRule) []v1beta1.HTTPIngressPath { +func httppaths(rule net_v1.IngressRule) []net_v1.HTTPIngressPath { if rule.IngressRuleValue.HTTP == nil { // rule.IngressRuleValue.HTTP value is optional. return nil diff --git a/enroute-dp/internal/dag/builder_httpfilters.go b/enroute-dp/internal/dag/builder_httpfilters.go index defe255..d49a6f6 100644 --- a/enroute-dp/internal/dag/builder_httpfilters.go +++ b/enroute-dp/internal/dag/builder_httpfilters.go @@ -4,7 +4,7 @@ package dag import ( _ "github.com/davecgh/go-spew/spew" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/internal/logger" "github.com/sirupsen/logrus" ) diff --git a/enroute-dp/internal/dag/builder_routefilters.go b/enroute-dp/internal/dag/builder_routefilters.go index bc87af4..983765a 100644 --- a/enroute-dp/internal/dag/builder_routefilters.go +++ b/enroute-dp/internal/dag/builder_routefilters.go @@ -3,7 +3,7 @@ package dag import ( // "fmt" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" ) func (b *builder) lookupRouteFilter(m RouteFilterMeta) *RouteFilter { diff --git a/enroute-dp/internal/dag/builder_test.go b/enroute-dp/internal/dag/builder_test.go index e048f8a..7c36cc8 100644 --- a/enroute-dp/internal/dag/builder_test.go +++ b/enroute-dp/internal/dag/builder_test.go @@ -23,9 +23,9 @@ import ( "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3" "github.com/google/go-cmp/cmp" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" - v1 "k8s.io/api/core/v1" - "k8s.io/api/networking/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" + corev1 "k8s.io/api/core/v1" + netv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -34,41 +34,41 @@ func TestDAGInsert(t *testing.T) { // The DAG is sensitive to ordering, adding an ingress, then a service, // should have the same result as adding a service, then an ingress. - sec1 := &v1.Secret{ + sec1 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", }, - Type: v1.SecretTypeTLS, + Type: corev1.SecretTypeTLS, Data: secretdata(CERTIFICATE, RSA_PRIVATE_KEY), } // Invalid cert in the secret - sec2 := &v1.Secret{ + sec2 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", }, - Type: v1.SecretTypeTLS, + Type: corev1.SecretTypeTLS, Data: secretdata("wrong", "wronger"), } // weird secret with a blank ca.crt that // cert manager creates. #1644 - sec3 := &v1.Secret{ + sec3 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", }, - Type: v1.SecretTypeTLS, + Type: corev1.SecretTypeTLS, Data: map[string][]byte{ - "ca.crt": []byte(""), - v1.TLSCertKey: []byte(CERTIFICATE), - v1.TLSPrivateKeyKey: []byte(RSA_PRIVATE_KEY), + "ca.crt": []byte(""), + corev1.TLSCertKey: []byte(CERTIFICATE), + corev1.TLSPrivateKeyKey: []byte(RSA_PRIVATE_KEY), }, } - cert1 := &v1.Secret{ + cert1 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "ca", Namespace: "default", @@ -78,15 +78,15 @@ func TestDAGInsert(t *testing.T) { }, } - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: backend("kuard", intstr.FromInt(8080))}, + Spec: netv1.IngressSpec{ + DefaultBackend: backend("kuard", intstr.FromInt(8080))}, } - i1a := &v1beta1.Ingress{ + i1a := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", @@ -94,18 +94,18 @@ func TestDAGInsert(t *testing.T) { "kubernetes.io/ingress.allow-http": "false", }, }, - Spec: v1beta1.IngressSpec{ - Backend: backend("kuard", intstr.FromInt(8080))}, + Spec: netv1.IngressSpec{ + DefaultBackend: backend("kuard", intstr.FromInt(8080))}, } // i2 is functionally identical to i1 - i2 := &v1beta1.Ingress{ + i2 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ IngressRuleValue: ingressrulevalue(backend("kuard", intstr.FromInt(8080))), }}, }, @@ -113,69 +113,69 @@ func TestDAGInsert(t *testing.T) { // i2a is missing a http key from the spec.rule. // see issue 606 - i2a := &v1beta1.Ingress{ + i2a := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "test1.test.com", }}, }, } // i3 is similar to i2 but includes a hostname on the ingress rule - i3 := &v1beta1.Ingress{ + i3 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"kuard.example.com"}, SecretName: sec1.Name, }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "kuard.example.com", IngressRuleValue: ingressrulevalue(backend("kuard", intstr.FromInt(8080))), }}, }, } // i4 is like i1 except it uses a named service port - i4 := &v1beta1.Ingress{ + i4 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: backend("kuard", intstr.FromString("http"))}, + Spec: netv1.IngressSpec{ + DefaultBackend: backend("kuard", intstr.FromString("http"))}, } // i5 is functionally identical to i2 - i5 := &v1beta1.Ingress{ + i5 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ IngressRuleValue: ingressrulevalue(backend("kuard", intstr.FromString("http"))), }}, }, } // i6 contains two named vhosts which point to the same service // one of those has TLS - i6 := &v1beta1.Ingress{ + i6 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "two-vhosts", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"b.example.com"}, SecretName: sec1.Name, }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "a.example.com", IngressRuleValue: ingressrulevalue(backend("kuard", intstr.FromInt(8080))), }, { @@ -184,7 +184,7 @@ func TestDAGInsert(t *testing.T) { }}, }, } - i6a := &v1beta1.Ingress{ + i6a := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "two-vhosts", Namespace: "default", @@ -192,12 +192,12 @@ func TestDAGInsert(t *testing.T) { "kubernetes.io/ingress.allow-http": "false", }, }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"b.example.com"}, SecretName: sec1.Name, }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "a.example.com", IngressRuleValue: ingressrulevalue(backend("kuard", intstr.FromInt(8080))), }, { @@ -206,7 +206,7 @@ func TestDAGInsert(t *testing.T) { }}, }, } - i6b := &v1beta1.Ingress{ + i6b := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "two-vhosts", Namespace: "default", @@ -214,18 +214,18 @@ func TestDAGInsert(t *testing.T) { "ingress.kubernetes.io/force-ssl-redirect": "true", }, }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"b.example.com"}, SecretName: sec1.Name, }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "b.example.com", IngressRuleValue: ingressrulevalue(backend("kuard", intstr.FromString("http"))), }}, }, } - i6c := &v1beta1.Ingress{ + i6c := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "two-vhosts", Namespace: "default", @@ -234,12 +234,12 @@ func TestDAGInsert(t *testing.T) { "kubernetes.io/ingress.allow-http": "false", }, }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"b.example.com"}, SecretName: sec1.Name, }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "b.example.com", IngressRuleValue: ingressrulevalue(backend("kuard", intstr.FromString("http"))), }}, @@ -247,30 +247,38 @@ func TestDAGInsert(t *testing.T) { } // i7 contains a single vhost with two paths - i7 := &v1beta1.Ingress{ + i7 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "two-paths", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"b.example.com"}, SecretName: sec1.Name, }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "b.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("http"), + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "http", + }, + }, }, }, { Path: "/kuarder", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuarder", - ServicePort: intstr.FromInt(8080), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuarder", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }}, }, @@ -280,37 +288,45 @@ func TestDAGInsert(t *testing.T) { } // i8 is identical to i7 but uses multiple IngressRules - i8 := &v1beta1.Ingress{ + i8 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "two-rules", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"b.example.com"}, SecretName: sec1.Name, }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "b.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("http"), + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "http", + }, + }, }, }}, }, }, }, { Host: "b.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/kuarder", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuarder", - ServicePort: intstr.FromInt(8080), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuarder", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }}, }, @@ -319,7 +335,7 @@ func TestDAGInsert(t *testing.T) { }, } // i9 is identical to i8 but disables non TLS connections - i9 := &v1beta1.Ingress{ + i9 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "two-rules", Namespace: "default", @@ -327,32 +343,40 @@ func TestDAGInsert(t *testing.T) { "kubernetes.io/ingress.allow-http": "false", }, }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"b.example.com"}, SecretName: sec1.Name, }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "b.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("http"), + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "http", + }, + }, }, }}, }, }, }, { Host: "b.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/kuarder", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuarder", - ServicePort: intstr.FromInt(8080), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuarder", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }}, }, @@ -362,7 +386,7 @@ func TestDAGInsert(t *testing.T) { } // i10 specifies a minimum tls version - i10 := &v1beta1.Ingress{ + i10 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "two-rules", Namespace: "default", @@ -370,19 +394,23 @@ func TestDAGInsert(t *testing.T) { "enroute.saaras.io/tls-minimum-protocol-version": "1.3", }, }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"b.example.com"}, SecretName: sec1.Name, }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "b.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("http"), + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "http", + }, + }, }, }}, }, @@ -392,7 +420,7 @@ func TestDAGInsert(t *testing.T) { } // i11 has a websocket route - i11 := &v1beta1.Ingress{ + i11 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "websocket", Namespace: "default", @@ -400,20 +428,28 @@ func TestDAGInsert(t *testing.T) { "enroute.saaras.io/websocket-routes": "/ws1 , /ws2", }, }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("http"), + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "http", + }, + }, }, }, { Path: "/ws1", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("http"), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "http", + }, + }, }, }}, }, @@ -423,7 +459,7 @@ func TestDAGInsert(t *testing.T) { } // i12a has an invalid timeout - i12a := &v1beta1.Ingress{ + i12a := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "timeout", Namespace: "default", @@ -431,15 +467,19 @@ func TestDAGInsert(t *testing.T) { "enroute.saaras.io/request-timeout": "peanut", }, }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("http"), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "http", + }, + }, }, }}, }, @@ -449,7 +489,7 @@ func TestDAGInsert(t *testing.T) { } // i12b has a reasonable timeout - i12b := &v1beta1.Ingress{ + i12b := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "timeout", Namespace: "default", @@ -457,15 +497,19 @@ func TestDAGInsert(t *testing.T) { "enroute.saaras.io/request-timeout": "1m30s", // 90 seconds y'all }, }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("http"), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "http", + }, + }, }, }}, }, @@ -475,7 +519,7 @@ func TestDAGInsert(t *testing.T) { } // i12c has an unreasonable timeout - i12c := &v1beta1.Ingress{ + i12c := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "timeout", Namespace: "default", @@ -483,12 +527,18 @@ func TestDAGInsert(t *testing.T) { "enroute.saaras.io/request-timeout": "infinite", }, }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ - IngressRuleValue: v1beta1.IngressRuleValue{HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{Path: "/", - Backend: v1beta1.IngressBackend{ServiceName: "kuard", - ServicePort: intstr.FromString("http")}, + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ + IngressRuleValue: netv1.IngressRuleValue{HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{Path: "/", + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "http", + }, + }, + }, }}}, }}}}, } @@ -496,7 +546,7 @@ func TestDAGInsert(t *testing.T) { // i13 a and b are a pair of ingresses for the same vhost // they represent a tricky way over 'overlaying' routes from one // ingress onto another - i13a := &v1beta1.Ingress{ + i13a := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "app", Namespace: "default", @@ -504,20 +554,24 @@ func TestDAGInsert(t *testing.T) { "ingress.kubernetes.io/force-ssl-redirect": "true", }, }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"example.com"}, SecretName: "example-tls", }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "app-service", - ServicePort: intstr.FromInt(8080), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "app-service", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }}, }, @@ -525,18 +579,22 @@ func TestDAGInsert(t *testing.T) { }}, }, } - i13b := &v1beta1.Ingress{ + i13b := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{Name: "challenge", Namespace: "nginx-ingress"}, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/.well-known/acme-challenge/gVJl5NWL2owUqZekjHkt_bo3OHYC2XNDURRRgLI5JTk", - Backend: v1beta1.IngressBackend{ - ServiceName: "challenge-service", - ServicePort: intstr.FromInt(8009), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "challenge-service", + Port: netv1.ServiceBackendPort{ + Number: 8009, + }, + }, }, }}, }, @@ -545,19 +603,19 @@ func TestDAGInsert(t *testing.T) { }, } - i3a := &v1beta1.Ingress{ + i3a := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ IngressRuleValue: ingressrulevalue(backend("kuard", intstr.FromInt(80))), }}, }, } - i14 := &v1beta1.Ingress{ + i14 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "timeout", Namespace: "default", @@ -567,15 +625,19 @@ func TestDAGInsert(t *testing.T) { "enroute.saaras.io/per-try-timeout": "10s", }, }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("http"), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "http", + }, + }, }, }}, }, @@ -585,7 +647,7 @@ func TestDAGInsert(t *testing.T) { } // s3a and b have http/2 protocol annotations - s3a := &v1.Service{ + s3a := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", @@ -593,8 +655,8 @@ func TestDAGInsert(t *testing.T) { "enroute.saaras.io/upstream-protocol.h2c": "80,http", }, }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -603,7 +665,7 @@ func TestDAGInsert(t *testing.T) { }, } - s3b := &v1.Service{ + s3b := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: s3a.Name, Namespace: s3a.Namespace, @@ -614,7 +676,7 @@ func TestDAGInsert(t *testing.T) { Spec: s3a.Spec, } - s3c := &v1.Service{ + s3c := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: s3b.Name, Namespace: s3b.Namespace, @@ -622,8 +684,8 @@ func TestDAGInsert(t *testing.T) { "enroute.saaras.io/upstream-protocol.tls": "80,http", }, }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -632,25 +694,25 @@ func TestDAGInsert(t *testing.T) { }, } - sec13 := &v1.Secret{ + sec13 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "example-tls", Namespace: "default", }, - Type: v1.SecretTypeTLS, + Type: corev1.SecretTypeTLS, Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, } - s13a := &v1.Service{ + s13a := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "app-service", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -659,13 +721,13 @@ func TestDAGInsert(t *testing.T) { }, } - s13b := &v1.Service{ + s13b := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "challenge-service", Namespace: "nginx-ingress", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8009, @@ -1328,13 +1390,13 @@ func TestDAGInsert(t *testing.T) { }, } - s5 := &v1.Service{ + s5 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "blog-admin", Namespace: "operations", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -1343,13 +1405,13 @@ func TestDAGInsert(t *testing.T) { }, } - s1 := &v1.Service{ + s1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -1359,7 +1421,7 @@ func TestDAGInsert(t *testing.T) { } // s1a carries the tls annotation - s1a := &v1.Service{ + s1a := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", @@ -1367,8 +1429,8 @@ func TestDAGInsert(t *testing.T) { "enroute.saaras.io/upstream-protocol.tls": "8080", }, }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -1378,7 +1440,7 @@ func TestDAGInsert(t *testing.T) { } // s1b carries all four ingress annotations{ - s1b := &v1.Service{ + s1b := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", @@ -1389,8 +1451,8 @@ func TestDAGInsert(t *testing.T) { "enroute.saaras.io/max-retries": "7", }, }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -1400,13 +1462,13 @@ func TestDAGInsert(t *testing.T) { } // s2 is like s1 but with a different name - s2 := &v1.Service{ + s2 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuarder", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -1415,13 +1477,13 @@ func TestDAGInsert(t *testing.T) { }, } // s3 is like s1 but has a different port - s3 := &v1.Service{ + s3 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 9999, @@ -1430,13 +1492,13 @@ func TestDAGInsert(t *testing.T) { }, } - s4 := &v1.Service{ + s4 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "blog", Namespace: "marketing", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -1445,13 +1507,13 @@ func TestDAGInsert(t *testing.T) { }, } - s6 := &v1.Service{ + s6 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "marketing", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -1460,13 +1522,13 @@ func TestDAGInsert(t *testing.T) { }, } - s7 := &v1.Service{ + s7 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "home", Namespace: "finance", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -1474,13 +1536,13 @@ func TestDAGInsert(t *testing.T) { }, } - //s8 := &v1.Service{ + //s8 := &corev1.Service{ // ObjectMeta: metav1.ObjectMeta{ // Name: "green", // Namespace: "marketing", // }, - // Spec: v1.ServiceSpec{ - // Ports: []v1.ServicePort{{ + // Spec: corev1.ServiceSpec{ + // Ports: []corev1.ServicePort{{ // Name: "http", // Protocol: "TCP", // Port: 80, @@ -1488,26 +1550,26 @@ func TestDAGInsert(t *testing.T) { // }, //} - //s9 := &v1.Service{ + //s9 := &corev1.Service{ // ObjectMeta: metav1.ObjectMeta{ // Name: "nginx", // Namespace: "default", // }, - // Spec: v1.ServiceSpec{ - // Ports: []v1.ServicePort{{ + // Spec: corev1.ServiceSpec{ + // Ports: []corev1.ServicePort{{ // Protocol: "TCP", // Port: 80, // }}, // }, //} - //s10 := &v1.Service{ + //s10 := &corev1.Service{ // ObjectMeta: metav1.ObjectMeta{ // Name: "tls-passthrough", // Namespace: "default", // }, - // Spec: v1.ServiceSpec{ - // Ports: []v1.ServicePort{{ + // Spec: corev1.ServiceSpec{ + // Ports: []corev1.ServicePort{{ // Name: "https", // Protocol: "TCP", // Port: 443, @@ -1521,13 +1583,13 @@ func TestDAGInsert(t *testing.T) { // }, //} - //s11 := &v1.Service{ + //s11 := &corev1.Service{ // ObjectMeta: metav1.ObjectMeta{ // Name: "blog", // Namespace: "it", // }, - // Spec: v1.ServiceSpec{ - // Ports: []v1.ServicePort{{ + // Spec: corev1.ServiceSpec{ + // Ports: []corev1.ServicePort{{ // Name: "blog", // Protocol: "TCP", // Port: 8080, @@ -1535,13 +1597,13 @@ func TestDAGInsert(t *testing.T) { // }, //} - //s12 := &v1.Service{ + //s12 := &corev1.Service{ // ObjectMeta: metav1.ObjectMeta{ // Name: "kuard", // Namespace: "teama", // }, - // Spec: v1.ServiceSpec{ - // Ports: []v1.ServicePort{{ + // Spec: corev1.ServiceSpec{ + // Ports: []corev1.ServicePort{{ // Name: "http", // Protocol: "TCP", // Port: 8080, @@ -1550,13 +1612,13 @@ func TestDAGInsert(t *testing.T) { // }, //} - //s13 := &v1.Service{ + //s13 := &corev1.Service{ // ObjectMeta: metav1.ObjectMeta{ // Name: "kuard", // Namespace: "teamb", // }, - // Spec: v1.ServiceSpec{ - // Ports: []v1.ServicePort{{ + // Spec: corev1.ServiceSpec{ + // Ports: []corev1.ServicePort{{ // Name: "http", // Protocol: "TCP", // Port: 8080, @@ -3171,17 +3233,17 @@ func TestDAGInsert(t *testing.T) { // objs: []interface{}{ // sec1, // s9, - // &v1beta1.Ingress{ + // &netv1.Ingress{ // ObjectMeta: metav1.ObjectMeta{ // Name: "nginx", // Namespace: "default", // }, - // Spec: v1beta1.IngressSpec{ - // TLS: []v1beta1.IngressTLS{{ + // Spec: netv1.IngressSpec{ + // TLS: []netv1.IngressTLS{{ // Hosts: []string{"example.com"}, // SecretName: s1.Name, // }}, - // Rules: []v1beta1.IngressRule{{ + // Rules: []netv1.IngressRule{{ // Host: "example.com", // IngressRuleValue: ingressrulevalue(backend(s9.Name, intstr.FromInt(80))), // }}, @@ -3271,17 +3333,32 @@ func (lm listenerMap) Visit(v Vertex) { } } -func backend(name string, port intstr.IntOrString) *v1beta1.IngressBackend { - return &v1beta1.IngressBackend{ - ServiceName: name, - ServicePort: port, +func backend(name string, port intstr.IntOrString) *netv1.IngressBackend { + if port.Type == intstr.Int { + return &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: name, + Port: netv1.ServiceBackendPort{ + Number: port.IntVal, + }, + }, + } + } else { + return &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: name, + Port: netv1.ServiceBackendPort{ + Name: port.StrVal, + }, + }, + } } } -func ingressrulevalue(backend *v1beta1.IngressBackend) v1beta1.IngressRuleValue { - return v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ +func ingressrulevalue(backend *netv1.IngressBackend) netv1.IngressRuleValue { + return netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Backend: *backend, }}, }, @@ -3289,13 +3366,13 @@ func ingressrulevalue(backend *v1beta1.IngressBackend) v1beta1.IngressRuleValue } func TestBuilderLookupHTTPService(t *testing.T) { - s1 := &v1.Service{ + s1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -3303,33 +3380,33 @@ func TestBuilderLookupHTTPService(t *testing.T) { }}, }, } - services := map[Meta]*v1.Service{ + services := map[Meta]*corev1.Service{ {name: "service1", namespace: "default"}: s1, } tests := map[string]struct { Meta - port intstr.IntOrString + port netv1.ServiceBackendPort want *HTTPService }{ "lookup service by port number": { Meta: Meta{name: "service1", namespace: "default"}, - port: intstr.FromInt(8080), + port: netv1.ServiceBackendPort{Number: 8080}, want: httpService(s1), }, "lookup service by port name": { Meta: Meta{name: "service1", namespace: "default"}, - port: intstr.FromString("http"), + port: netv1.ServiceBackendPort{Name: "http"}, want: httpService(s1), }, "lookup service by port number (as string)": { Meta: Meta{name: "service1", namespace: "default"}, - port: intstr.Parse("8080"), + port: netv1.ServiceBackendPort{Number: 8080}, want: httpService(s1), }, "lookup service by port number (from string)": { Meta: Meta{name: "service1", namespace: "default"}, - port: intstr.FromString("8080"), + port: netv1.ServiceBackendPort{Number: 8080}, want: httpService(s1), }, } @@ -3393,13 +3470,13 @@ func TestDAGRootNamespaces(t *testing.T) { }, } - s2 := &v1.Service{ + s2 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "allowed1", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -3407,13 +3484,13 @@ func TestDAGRootNamespaces(t *testing.T) { }, } - s3 := &v1.Service{ + s3 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "allowed2", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -3908,13 +3985,13 @@ func TestDAGGatewayHostStatus(t *testing.T) { }, } - s4 := &v1.Service{ + s4 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "home", Namespace: "roots", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -3922,13 +3999,13 @@ func TestDAGGatewayHostStatus(t *testing.T) { }, } - s5 := &v1.Service{ + s5 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Namespace: "roots", Name: "parent", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -3936,13 +4013,13 @@ func TestDAGGatewayHostStatus(t *testing.T) { }, } - s6 := &v1.Service{ + s6 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Namespace: "roots", Name: "foo2", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -3950,13 +4027,13 @@ func TestDAGGatewayHostStatus(t *testing.T) { }, } - s7 := &v1.Service{ + s7 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "foo3", Namespace: "roots", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 12345678, @@ -4118,13 +4195,13 @@ func TestDAGGatewayHostUniqueFQDNs(t *testing.T) { }, } - s1 := &v1.Service{ + s1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -4221,49 +4298,66 @@ func TestDAGGatewayHostUniqueFQDNs(t *testing.T) { func TestHttpPaths(t *testing.T) { tests := map[string]struct { - rule v1beta1.IngressRule - want []v1beta1.HTTPIngressPath + rule netv1.IngressRule + want []netv1.HTTPIngressPath }{ "zero value": { - rule: v1beta1.IngressRule{}, + rule: netv1.IngressRule{}, want: nil, }, "empty paths": { - rule: v1beta1.IngressRule{ - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{}, + rule: netv1.IngressRule{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{}, }, }, want: nil, }, "several paths": { - rule: v1beta1.IngressRule{ - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("http"), + rule: netv1.IngressRule{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "http", + }, + }, }, }, { Path: "/kuarder", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuarder", - ServicePort: intstr.FromInt(8080), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuarder", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }}, }, }, }, - want: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("http"), + want: []netv1.HTTPIngressPath{{ + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "http", + }, + }, }, }, { Path: "/kuarder", - Backend: v1beta1.IngressBackend{ServiceName: "kuarder", - ServicePort: intstr.FromInt(8080), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuarder", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }}, }, @@ -4426,7 +4520,7 @@ func clusters(services ...Service) (c []*Cluster) { return c } -func tcpService(s *v1.Service) *TCPService { +func tcpService(s *corev1.Service) *TCPService { return &TCPService{ Name: s.Name, Namespace: s.Namespace, @@ -4434,7 +4528,7 @@ func tcpService(s *v1.Service) *TCPService { } } -func httpService(s *v1.Service) *HTTPService { +func httpService(s *corev1.Service) *HTTPService { return &HTTPService{ TCPService: TCPService{ Name: s.Name, @@ -4444,7 +4538,7 @@ func httpService(s *v1.Service) *HTTPService { } } -func clustermap(services ...*v1.Service) []*Cluster { +func clustermap(services ...*corev1.Service) []*Cluster { var c []*Cluster for _, s := range services { c = append(c, &Cluster{ @@ -4454,7 +4548,7 @@ func clustermap(services ...*v1.Service) []*Cluster { return c } -func secret(s *v1.Secret) *Secret { +func secret(s *corev1.Secret) *Secret { return &Secret{ Object: s, } @@ -4482,7 +4576,7 @@ func virtualhost(name string, routes ...*Route) *VirtualHost { } } -func securevirtualhost(name string, sec *v1.Secret, routes ...*Route) *SecureVirtualHost { +func securevirtualhost(name string, sec *corev1.Secret, routes ...*Route) *SecureVirtualHost { return &SecureVirtualHost{ VirtualHost: VirtualHost{ Name: name, diff --git a/enroute-dp/internal/dag/cache.go b/enroute-dp/internal/dag/cache.go index 5adf2fe..967002d 100644 --- a/enroute-dp/internal/dag/cache.go +++ b/enroute-dp/internal/dag/cache.go @@ -22,10 +22,10 @@ import ( "sync" v1 "k8s.io/api/core/v1" - "k8s.io/api/networking/v1beta1" + net_v1 "k8s.io/api/networking/v1" "k8s.io/client-go/tools/cache" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/sirupsen/logrus" ) @@ -40,7 +40,7 @@ type KubernetesCache struct { mu sync.RWMutex logrus.FieldLogger - ingresses map[Meta]*v1beta1.Ingress + ingresses map[Meta]*net_v1.Ingress gatewayhosts map[Meta]*gatewayhostv1.GatewayHost secrets map[Meta]*v1.Secret delegations map[Meta]*gatewayhostv1.TLSCertificateDelegation @@ -81,10 +81,10 @@ func (kc *KubernetesCache) Insert(obj interface{}) { kc.services = make(map[Meta]*v1.Service) } kc.services[m] = obj - case *v1beta1.Ingress: + case *net_v1.Ingress: m := Meta{name: obj.Name, namespace: obj.Namespace} if kc.ingresses == nil { - kc.ingresses = make(map[Meta]*v1beta1.Ingress) + kc.ingresses = make(map[Meta]*net_v1.Ingress) } kc.ingresses[m] = obj case *gatewayhostv1.GatewayHost: @@ -140,7 +140,7 @@ func (kc *KubernetesCache) remove(obj interface{}) { case *v1.Service: m := Meta{name: obj.Name, namespace: obj.Namespace} delete(kc.services, m) - case *v1beta1.Ingress: + case *net_v1.Ingress: m := Meta{name: obj.Name, namespace: obj.Namespace} delete(kc.ingresses, m) case *gatewayhostv1.GatewayHost: diff --git a/enroute-dp/internal/dag/conditions.go b/enroute-dp/internal/dag/conditions.go index 30c4517..6576517 100644 --- a/enroute-dp/internal/dag/conditions.go +++ b/enroute-dp/internal/dag/conditions.go @@ -18,7 +18,7 @@ import ( "regexp" "strings" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" ) // mergePathConditions merges the given slice of prefix Conditions into a single diff --git a/enroute-dp/internal/dag/conditions_test.go b/enroute-dp/internal/dag/conditions_test.go index 5e77ec7..604777e 100644 --- a/enroute-dp/internal/dag/conditions_test.go +++ b/enroute-dp/internal/dag/conditions_test.go @@ -16,7 +16,7 @@ package dag import ( "testing" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/internal/assert" ) diff --git a/enroute-dp/internal/dag/dag.go b/enroute-dp/internal/dag/dag.go index 36b9963..72ca0a4 100644 --- a/enroute-dp/internal/dag/dag.go +++ b/enroute-dp/internal/dag/dag.go @@ -24,7 +24,7 @@ import ( "time" "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" cfg "github.com/saarasio/enroute/enroute-dp/saarasconfig" "k8s.io/api/core/v1" ) diff --git a/enroute-dp/internal/dag/policy.go b/enroute-dp/internal/dag/policy.go index c303f95..f0f2532 100644 --- a/enroute-dp/internal/dag/policy.go +++ b/enroute-dp/internal/dag/policy.go @@ -19,8 +19,8 @@ package dag import ( "time" - enrouteapi "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" - k8sapi "k8s.io/api/networking/v1beta1" + enrouteapi "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" + k8sapi "k8s.io/api/networking/v1" ) func retryPolicy(rp *enrouteapi.RetryPolicy) *RetryPolicy { diff --git a/enroute-dp/internal/dag/policy_test.go b/enroute-dp/internal/dag/policy_test.go index a4320f1..7ed72a6 100644 --- a/enroute-dp/internal/dag/policy_test.go +++ b/enroute-dp/internal/dag/policy_test.go @@ -21,12 +21,12 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" ) func TestRetryPolicyGatewayHost(t *testing.T) { tests := map[string]struct { - rp *v1beta1.RetryPolicy + rp *v1.RetryPolicy want *RetryPolicy }{ "nil retry policy": { @@ -34,14 +34,14 @@ func TestRetryPolicyGatewayHost(t *testing.T) { want: nil, }, "empty policy": { - rp: &v1beta1.RetryPolicy{}, + rp: &v1.RetryPolicy{}, want: &RetryPolicy{ RetryOn: "5xx", NumRetries: 1, }, }, "explicitly zero retries": { - rp: &v1beta1.RetryPolicy{ + rp: &v1.RetryPolicy{ NumRetries: 0, // zero value for NumRetries }, want: &RetryPolicy{ @@ -50,7 +50,7 @@ func TestRetryPolicyGatewayHost(t *testing.T) { }, }, "no retry count, per try timeout": { - rp: &v1beta1.RetryPolicy{ + rp: &v1.RetryPolicy{ PerTryTimeout: "10s", }, want: &RetryPolicy{ @@ -60,7 +60,7 @@ func TestRetryPolicyGatewayHost(t *testing.T) { }, }, "explicit 0s timeout": { - rp: &v1beta1.RetryPolicy{ + rp: &v1.RetryPolicy{ PerTryTimeout: "0s", }, want: &RetryPolicy{ @@ -83,7 +83,7 @@ func TestRetryPolicyGatewayHost(t *testing.T) { func TestTimeoutPolicyGatewayHost(t *testing.T) { tests := map[string]struct { - tp *v1beta1.TimeoutPolicy + tp *v1.TimeoutPolicy want *TimeoutPolicy }{ "nil timeout policy": { @@ -91,13 +91,13 @@ func TestTimeoutPolicyGatewayHost(t *testing.T) { want: nil, }, "empty timeout policy": { - tp: &v1beta1.TimeoutPolicy{}, + tp: &v1.TimeoutPolicy{}, want: &TimeoutPolicy{ Timeout: 0 * time.Second, }, }, "valid request timeout": { - tp: &v1beta1.TimeoutPolicy{ + tp: &v1.TimeoutPolicy{ Request: "1m30s", }, want: &TimeoutPolicy{ @@ -105,7 +105,7 @@ func TestTimeoutPolicyGatewayHost(t *testing.T) { }, }, "invalid request timeout": { - tp: &v1beta1.TimeoutPolicy{ + tp: &v1.TimeoutPolicy{ Request: "90", // 90 what? }, want: &TimeoutPolicy{ @@ -117,7 +117,7 @@ func TestTimeoutPolicyGatewayHost(t *testing.T) { }, }, "infinite request timeout": { - tp: &v1beta1.TimeoutPolicy{ + tp: &v1.TimeoutPolicy{ Request: "infinite", }, want: &TimeoutPolicy{ diff --git a/enroute-dp/internal/e2e/cds_test.go b/enroute-dp/internal/e2e/cds_test.go index d944209..82ec9bf 100644 --- a/enroute-dp/internal/e2e/cds_test.go +++ b/enroute-dp/internal/e2e/cds_test.go @@ -27,12 +27,12 @@ import ( "github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3" "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/internal/envoy" "github.com/saarasio/enroute/enroute-dp/internal/protobuf" "google.golang.org/grpc" - v1 "k8s.io/api/core/v1" - "k8s.io/api/networking/v1beta1" + corev1 "k8s.io/api/core/v1" + netv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -43,15 +43,19 @@ func TestClusterLongServiceName(t *testing.T) { rh, cc, done := setup(t) defer done() - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Namespace: "default", Name: "kuard", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kbujbkuhdod66gjdmwmijz8xzgsx1nkfbrloezdjiulquzk4x3p0nnvpzi8r", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kbujbkuhdod66gjdmwmijz8xzgsx1nkfbrloezdjiulquzk4x3p0nnvpzi8r", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, } @@ -60,7 +64,7 @@ func TestClusterLongServiceName(t *testing.T) { rh.OnAdd(service( "default", "kbujbkuhdod66gjdmwmijz8xzgsx1nkfbrloezdjiulquzk4x3p0nnvpzi8r", - v1.ServicePort{ + corev1.ServicePort{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -84,35 +88,43 @@ func TestClusterAddUpdateDelete(t *testing.T) { rh, cc, done := setup(t) defer done() - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(80), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }, } rh.OnAdd(i1) - i2 := &v1beta1.Ingress{ + i2 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuarder", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "www.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/kuarder", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("https"), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "https", + }, + }, }, }}, }, @@ -123,7 +135,7 @@ func TestClusterAddUpdateDelete(t *testing.T) { rh.OnAdd(i2) // s1 is a simple tcp 80 -> 8080 service. - s1 := service("default", "kuard", v1.ServicePort{ + s1 := service("default", "kuard", corev1.ServicePort{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -140,7 +152,7 @@ func TestClusterAddUpdateDelete(t *testing.T) { }, streamCDS(t, cc)) // s2 is the same as s2, but the service port has a name - s2 := service("default", "kuard", v1.ServicePort{ + s2 := service("default", "kuard", corev1.ServicePort{ Name: "http", Protocol: "TCP", Port: 80, @@ -163,13 +175,13 @@ func TestClusterAddUpdateDelete(t *testing.T) { // s3 is like s2, but has a second named port. The k8s spec // requires all ports to be named if there is more than one of them. s3 := service("default", "kuard", - v1.ServicePort{ + corev1.ServicePort{ Name: "http", Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), }, - v1.ServicePort{ + corev1.ServicePort{ Name: "https", Protocol: "TCP", Port: 443, @@ -194,7 +206,7 @@ func TestClusterAddUpdateDelete(t *testing.T) { // s4 is s3 with the http port removed. s4 := service("default", "kuard", - v1.ServicePort{ + corev1.ServicePort{ Name: "https", Protocol: "TCP", Port: 443, @@ -222,26 +234,34 @@ func TestClusterRenameUpdateDelete(t *testing.T) { rh, cc, done := setup(t) defer done() - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "www.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromString("http"), + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Name: "http", + }, + }, }, }, { Path: "/kuarder", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(443), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 443, + }, + }, }, }}, }, @@ -252,13 +272,13 @@ func TestClusterRenameUpdateDelete(t *testing.T) { rh.OnAdd(i1) s1 := service("default", "kuard", - v1.ServicePort{ + corev1.ServicePort{ Name: "http", Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), }, - v1.ServicePort{ + corev1.ServicePort{ Name: "https", Protocol: "TCP", Port: 443, @@ -279,7 +299,7 @@ func TestClusterRenameUpdateDelete(t *testing.T) { // s2 removes the name on port 80, moves it to port 443 and deletes the https port s2 := service("default", "kuard", - v1.ServicePort{ + corev1.ServicePort{ Protocol: "TCP", Port: 443, TargetPort: intstr.FromInt(8000), @@ -325,21 +345,25 @@ func TestIssue243(t *testing.T) { t.Run("single unnamed service with a different numeric target port", func(t *testing.T) { - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(80), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }, } rh.OnAdd(i1) s1 := service("default", "kuard", - v1.ServicePort{ + corev1.ServicePort{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -362,15 +386,19 @@ func TestIssue247(t *testing.T) { rh, cc, done := setup(t) defer done() - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(80), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }, } @@ -382,7 +410,7 @@ func TestIssue247(t *testing.T) { // protocol: TCP // targetPort: kuard s1 := service("default", "kuard", - v1.ServicePort{ + corev1.ServicePort{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromString("kuard"), @@ -402,26 +430,34 @@ func TestCDSResourceFiltering(t *testing.T) { rh, cc, done := setup(t) defer done() - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "www.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(80), + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }, { Path: "/httpbin", - Backend: v1beta1.IngressBackend{ - ServiceName: "httpbin", - ServicePort: intstr.FromInt(8080), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "httpbin", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }}, }, @@ -433,7 +469,7 @@ func TestCDSResourceFiltering(t *testing.T) { // add two services, check that they are there s1 := service("default", "kuard", - v1.ServicePort{ + corev1.ServicePort{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromString("kuard"), @@ -441,7 +477,7 @@ func TestCDSResourceFiltering(t *testing.T) { ) rh.OnAdd(s1) s2 := service("default", "httpbin", - v1.ServicePort{ + corev1.ServicePort{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromString("httpbin"), @@ -481,15 +517,19 @@ func TestClusterCircuitbreakerAnnotations(t *testing.T) { rh, cc, done := setup(t) defer done() - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Namespace: "default", Name: "kuard", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, } @@ -504,7 +544,7 @@ func TestClusterCircuitbreakerAnnotations(t *testing.T) { "enroute.saaras.io/max-requests": "404", "enroute.saaras.io/max-retries": "7", }, - v1.ServicePort{ + corev1.ServicePort{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -551,7 +591,7 @@ func TestClusterCircuitbreakerAnnotations(t *testing.T) { "enroute.saaras.io/max-requests": "1e6", "enroute.saaras.io/max-retries": "0", }, - v1.ServicePort{ + corev1.ServicePort{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -593,13 +633,13 @@ func TestClusterPerServiceParameters(t *testing.T) { rh, cc, done := setup(t) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -652,13 +692,13 @@ func TestClusterLoadBalancerStrategyPerRoute(t *testing.T) { rh, cc, done := setup(t) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -735,13 +775,13 @@ func TestClusterWithHealthChecks(t *testing.T) { rh, cc, done := setup(t) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -788,21 +828,25 @@ func TestClusterServiceTLSBackend(t *testing.T) { rh, cc, done := setup(t) defer done() - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(443), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 443, + }, + }, }, }, } rh.OnAdd(i1) - s1 := &v1.Service{ + s1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", @@ -810,8 +854,8 @@ func TestClusterServiceTLSBackend(t *testing.T) { "enroute.saaras.io/upstream-protocol.tls": "securebackend", }, }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "securebackend", Protocol: "TCP", Port: 443, @@ -835,7 +879,7 @@ func TestClusterServiceTLSBackendCAValidation(t *testing.T) { rh, cc, done := setup(t) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", @@ -843,8 +887,8 @@ func TestClusterServiceTLSBackendCAValidation(t *testing.T) { "enroute.saaras.io/upstream-protocol.tls": "securebackend,443", }, }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "securebackend", Protocol: "TCP", Port: 443, @@ -853,7 +897,7 @@ func TestClusterServiceTLSBackendCAValidation(t *testing.T) { }, }) - secret := &v1.Secret{ + secret := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "foo", Namespace: "default", @@ -945,22 +989,26 @@ func TestExternalNameService(t *testing.T) { rh, cc, done := setup(t) defer done() - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(80), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }, } rh.OnAdd(i1) // s1 is a simple tcp 80 -> 8080 service. - s1 := externalnameservice("default", "kuard", "foo.io", v1.ServicePort{ + s1 := externalnameservice("default", "kuard", "foo.io", corev1.ServicePort{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -977,14 +1025,14 @@ func TestExternalNameService(t *testing.T) { }, streamCDS(t, cc)) } -func serviceWithAnnotations(ns, name string, annotations map[string]string, ports ...v1.ServicePort) *v1.Service { - return &v1.Service{ +func serviceWithAnnotations(ns, name string, annotations map[string]string, ports ...corev1.ServicePort) *corev1.Service { + return &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: ns, Annotations: annotations, }, - Spec: v1.ServiceSpec{ + Spec: corev1.ServiceSpec{ Ports: ports, }, } diff --git a/enroute-dp/internal/e2e/lds_test.go b/enroute-dp/internal/e2e/lds_test.go index db37ab2..5d3d082 100644 --- a/enroute-dp/internal/e2e/lds_test.go +++ b/enroute-dp/internal/e2e/lds_test.go @@ -21,7 +21,7 @@ import ( "testing" "time" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/tcp_proxy/v3" @@ -38,8 +38,8 @@ import ( "github.com/saarasio/enroute/enroute-dp/internal/k8s" "github.com/saarasio/enroute/enroute-dp/internal/protobuf" "google.golang.org/grpc" - v1 "k8s.io/api/core/v1" - "k8s.io/api/networking/v1beta1" + corev1 "k8s.io/api/core/v1" + netv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -60,23 +60,30 @@ func TestNonTLSListener(t *testing.T) { }, streamLDS(t, cc)) // i1 is a simple ingress, no hostname, no tls. - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "backend", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, + }, }, } - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -101,7 +108,7 @@ func TestNonTLSListener(t *testing.T) { }, streamLDS(t, cc)) // i2 is the same as i1 but has the kubernetes.io/ingress.allow-http: "false" annotation - i2 := &v1beta1.Ingress{ + i2 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", @@ -109,8 +116,15 @@ func TestNonTLSListener(t *testing.T) { "kubernetes.io/ingress.allow-http": "false", }, }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "backend", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, + }, }, } @@ -127,7 +141,7 @@ func TestNonTLSListener(t *testing.T) { // i3 is similar to i2, but uses the ingress.kubernetes.io/force-ssl-redirect: "true" annotation // to force 80 -> 443 upgrade - i3 := &v1beta1.Ingress{ + i3 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", @@ -135,8 +149,15 @@ func TestNonTLSListener(t *testing.T) { "ingress.kubernetes.io/force-ssl-redirect": "true", }, }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "backend", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, + }, }, } @@ -162,40 +183,47 @@ func TestTLSListener(t *testing.T) { defer done() // s1 is a tls secret - s1 := &v1.Secret{ + s1 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, } // i1 is a tls ingress - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "backend", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, + }, + TLS: []netv1.IngressTLS{{ Hosts: []string{"kuard.example.com"}, SecretName: "secret", }}, }, } - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -241,7 +269,7 @@ func TestTLSListener(t *testing.T) { }, streamLDS(t, cc)) // i2 is the same as i1 but has the kubernetes.io/ingress.allow-http: "false" annotation - i2 := &v1beta1.Ingress{ + i2 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", @@ -249,9 +277,16 @@ func TestTLSListener(t *testing.T) { "kubernetes.io/ingress.allow-http": "false", }, }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "backend", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, + }, + TLS: []netv1.IngressTLS{{ Hosts: []string{"kuard.example.com"}, SecretName: "secret", }}, @@ -294,15 +329,15 @@ func TestGatewayHostTLSListener(t *testing.T) { defer done() // secret1 is a tls secret - secret1 := &v1.Secret{ + secret1 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, } @@ -358,13 +393,13 @@ func TestGatewayHostTLSListener(t *testing.T) { }, } - svc1 := &v1.Service{ + svc1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -476,40 +511,47 @@ func TestLDSFilter(t *testing.T) { defer done() // s1 is a tls secret - s1 := &v1.Secret{ + s1 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, } // i1 is a tls ingress - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "backend", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, + }, + TLS: []netv1.IngressTLS{{ Hosts: []string{"kuard.example.com"}, SecretName: "secret", }}, }, } - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -577,28 +619,35 @@ func TestLDSTLSMinimumProtocolVersion(t *testing.T) { defer done() // s1 is a tls secret - s1 := &v1.Secret{ + s1 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, } rh.OnAdd(s1) // i1 is a tls ingress - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "backend", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, + }, + TLS: []netv1.IngressTLS{{ Hosts: []string{"kuard.example.com"}, SecretName: "secret", }}, @@ -625,7 +674,7 @@ func TestLDSTLSMinimumProtocolVersion(t *testing.T) { Nonce: "3", }, streamLDS(t, cc, "ingress_https")) - i2 := &v1beta1.Ingress{ + i2 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", @@ -633,9 +682,16 @@ func TestLDSTLSMinimumProtocolVersion(t *testing.T) { "enroute.saaras.io/tls-minimum-protocol-version": "1.3", }, }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "backend", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, + }, + TLS: []netv1.IngressTLS{{ Hosts: []string{"kuard.example.com"}, SecretName: "secret", }}, @@ -692,22 +748,29 @@ func TestLDSIngressHTTPUseProxyProtocol(t *testing.T) { }, streamLDS(t, cc)) // i1 is a simple ingress, no hostname, no tls. - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "backend", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, + }, }, } - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -743,27 +806,34 @@ func TestLDSIngressHTTPSUseProxyProtocol(t *testing.T) { defer done() // s1 is a tls secret - s1 := &v1.Secret{ + s1 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, } // i1 is a tls ingress - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "backend", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, + }, + TLS: []netv1.IngressTLS{{ Hosts: []string{"kuard.example.com"}, SecretName: "secret", }}, @@ -783,13 +853,13 @@ func TestLDSIngressHTTPSUseProxyProtocol(t *testing.T) { Nonce: "1", }, streamLDS(t, cc)) - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -839,27 +909,34 @@ func TestLDSCustomAddressAndPort(t *testing.T) { defer done() // s1 is a tls secret - s1 := &v1.Secret{ + s1 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, } // i1 is a tls ingress - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "backend", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, + }, + TLS: []netv1.IngressTLS{{ Hosts: []string{"kuard.example.com"}, SecretName: "secret", }}, @@ -879,13 +956,13 @@ func TestLDSCustomAddressAndPort(t *testing.T) { Nonce: "1", }, streamLDS(t, cc)) - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -930,40 +1007,47 @@ func TestLDSCustomAccessLogPaths(t *testing.T) { defer done() // s1 is a tls secret - s1 := &v1.Secret{ + s1 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, } // i1 is a tls ingress - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "backend", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, + }, + TLS: []netv1.IngressTLS{{ Hosts: []string{"kuard.example.com"}, SecretName: "secret", }}, }, } - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -1050,13 +1134,13 @@ func TestLDSGatewayHostInsideRootNamespaces(t *testing.T) { }, } - svc1 := &v1.Service{ + svc1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "roots", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -1157,15 +1241,15 @@ func TestGatewayHostHTTPS(t *testing.T) { }, streamLDS(t, cc)) // s1 is a tls secret - s1 := &v1.Secret{ + s1 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, } @@ -1194,13 +1278,13 @@ func TestGatewayHostHTTPS(t *testing.T) { }, } - svc1 := &v1.Service{ + svc1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -1279,7 +1363,7 @@ func TestLDSGatewayHostTCPProxyTLSPassthrough(t *testing.T) { }, }, } - svc := service("default", "correct-backend", v1.ServicePort{ + svc := service("default", "correct-backend", corev1.ServicePort{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -1319,15 +1403,15 @@ func TestLDSGatewayHostTCPForward(t *testing.T) { defer done() // s1 is a tls secret - s1 := &v1.Secret{ + s1 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, } @@ -1361,7 +1445,7 @@ func TestLDSGatewayHostTCPForward(t *testing.T) { }, } rh.OnAdd(s1) - svc := service("default", "correct-backend", v1.ServicePort{ + svc := service("default", "correct-backend", corev1.ServicePort{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -1404,28 +1488,28 @@ func TestGatewayHostTLSCertificateDelegation(t *testing.T) { Nonce: "0", }, streamLDS(t, cc)) - s1 := &v1.Secret{ + s1 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "wildcard", Namespace: "secret", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, } // add a secret object secret/wildcard. rh.OnAdd(s1) - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -1607,14 +1691,29 @@ func streamLDS(t *testing.T, cc *grpc.ClientConn, rn ...string) *envoy_service_d }) } -func backend(name string, port intstr.IntOrString) *v1beta1.IngressBackend { - return &v1beta1.IngressBackend{ - ServiceName: name, - ServicePort: port, +func backend(name string, port intstr.IntOrString) *netv1.IngressBackend { + if port.Type == intstr.Int { + return &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: name, + Port: netv1.ServiceBackendPort{ + Number: port.IntVal, + }, + }, + } + } else { + return &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: name, + Port: netv1.ServiceBackendPort{ + Name: port.StrVal, + }, + }, + } } } -func filterchaintls(domain string, secret *v1.Secret, filter *envoy_config_listener_v3.Filter, alpn ...string) []*envoy_config_listener_v3.FilterChain { +func filterchaintls(domain string, secret *corev1.Secret, filter *envoy_config_listener_v3.Filter, alpn ...string) []*envoy_config_listener_v3.FilterChain { return []*envoy_config_listener_v3.FilterChain{ envoy.FilterChainTLS( domain, diff --git a/enroute-dp/internal/e2e/rds_test.go b/enroute-dp/internal/e2e/rds_test.go index 34913a0..58c9a8a 100644 --- a/enroute-dp/internal/e2e/rds_test.go +++ b/enroute-dp/internal/e2e/rds_test.go @@ -28,7 +28,7 @@ import ( "github.com/envoyproxy/go-control-plane/envoy/service/route/v3" "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/fake" "github.com/saarasio/enroute/enroute-dp/internal/contour" "github.com/saarasio/enroute/enroute-dp/internal/envoy" @@ -36,15 +36,15 @@ import ( "github.com/saarasio/enroute/enroute-dp/internal/protobuf" cfg "github.com/saarasio/enroute/enroute-dp/saarasconfig" "google.golang.org/grpc" - v1 "k8s.io/api/core/v1" - "k8s.io/api/networking/v1beta1" + corev1 "k8s.io/api/core/v1" + netv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) // saarasio/enroute#172. Updating an object from // -// apiVersion: networking/v1beta1 +// apiVersion: networking/v1 // kind: Ingress // metadata: // name: kuard @@ -55,7 +55,7 @@ import ( // // to // -// apiVersion: networking/v1beta1 +// apiVersion: networking/v1 // kind: Ingress // metadata: // name: kuard @@ -75,13 +75,13 @@ func TestEditIngress(t *testing.T) { meta := metav1.ObjectMeta{Name: "kuard", Namespace: "default"} - s1 := &v1.Service{ + s1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -92,12 +92,16 @@ func TestEditIngress(t *testing.T) { rh.OnAdd(s1) // add default/kuard to translator. - old := &v1beta1.Ingress{ + old := &netv1.Ingress{ ObjectMeta: meta, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(80), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }, } @@ -128,17 +132,21 @@ func TestEditIngress(t *testing.T) { }, streamRDS(t, cc)) // update old to new - rh.OnUpdate(old, &v1beta1.Ingress{ + rh.OnUpdate(old, &netv1.Ingress{ ObjectMeta: meta, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/testing", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(80), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }}, }, @@ -175,7 +183,7 @@ func TestEditIngress(t *testing.T) { // saarasio/enroute#101 // The path /hello should point to default/hello/80 on "*" // -// apiVersion: networking/v1beta1 +// apiVersion: networking/v1 // kind: Ingress // metadata: // name: hello @@ -192,17 +200,21 @@ func TestIngressPathRouteWithoutHost(t *testing.T) { defer done() // add default/hello to translator. - rh.OnAdd(&v1beta1.Ingress{ + rh.OnAdd(&netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{Name: "hello", Namespace: "default"}, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/hello", - Backend: v1beta1.IngressBackend{ - ServiceName: "hello", - ServicePort: intstr.FromInt(80), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "hello", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }}, }, @@ -211,13 +223,13 @@ func TestIngressPathRouteWithoutHost(t *testing.T) { }, }) - s1 := &v1.Service{ + s1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "hello", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -256,18 +268,22 @@ func TestEditIngressInPlace(t *testing.T) { rh, cc, done := setup(t) defer done() - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{Name: "hello", Namespace: "default"}, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "hello.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "wowie", - ServicePort: intstr.FromString("http"), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "wowie", + Port: netv1.ServiceBackendPort{ + Name: "http", + }, + }, }, }}, }, @@ -277,13 +293,13 @@ func TestEditIngressInPlace(t *testing.T) { } rh.OnAdd(i1) - s1 := &v1.Service{ + s1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "wowie", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -293,13 +309,13 @@ func TestEditIngressInPlace(t *testing.T) { } rh.OnAdd(s1) - s2 := &v1.Service{ + s2 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kerpow", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 9000, @@ -333,24 +349,32 @@ func TestEditIngressInPlace(t *testing.T) { }, streamRDS(t, cc)) // i2 is like i1 but adds a second route - i2 := &v1beta1.Ingress{ + i2 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{Name: "hello", Namespace: "default"}, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "hello.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "wowie", - ServicePort: intstr.FromInt(80), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "wowie", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }, { Path: "/whoop", - Backend: v1beta1.IngressBackend{ - ServiceName: "kerpow", - ServicePort: intstr.FromInt(9000), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kerpow", + Port: netv1.ServiceBackendPort{ + Number: 9000, + }, + }, }, }}, }, @@ -387,29 +411,37 @@ func TestEditIngressInPlace(t *testing.T) { }, streamRDS(t, cc)) // i3 is like i2, but adds the ingress.kubernetes.io/force-ssl-redirect: "true" annotation - i3 := &v1beta1.Ingress{ + i3 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "hello", Namespace: "default", Annotations: map[string]string{ "ingress.kubernetes.io/force-ssl-redirect": "true"}, }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "hello.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "wowie", - ServicePort: intstr.FromInt(80), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "wowie", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }, { Path: "/whoop", - Backend: v1beta1.IngressBackend{ - ServiceName: "kerpow", - ServicePort: intstr.FromInt(9000), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kerpow", + Port: netv1.ServiceBackendPort{ + Number: 9000, + }, + }, }, }}, }, @@ -441,47 +473,55 @@ func TestEditIngressInPlace(t *testing.T) { Nonce: "5", }, streamRDS(t, cc)) - rh.OnAdd(&v1.Secret{ + rh.OnAdd(&corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "hello-kitty", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, }) // i4 is the same as i3, and includes a TLS spec object to enable ingress_https routes // i3 is like i2, but adds the ingress.kubernetes.io/force-ssl-redirect: "true" annotation - i4 := &v1beta1.Ingress{ + i4 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "hello", Namespace: "default", Annotations: map[string]string{ "ingress.kubernetes.io/force-ssl-redirect": "true"}, }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"hello.example.com"}, SecretName: "hello-kitty", }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "hello.example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "wowie", - ServicePort: intstr.FromInt(80), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "wowie", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }, { Path: "/whoop", - Backend: v1beta1.IngressBackend{ - ServiceName: "kerpow", - ServicePort: intstr.FromInt(9000), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kerpow", + Port: netv1.ServiceBackendPort{ + Number: 9000, + }, + }, }, }}, }, @@ -539,13 +579,13 @@ func TestRequestTimeout(t *testing.T) { rh, cc, done := setup(t) defer done() - s1 := &v1.Service{ + s1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -555,10 +595,10 @@ func TestRequestTimeout(t *testing.T) { rh.OnAdd(s1) // i1 is a simple ingress bound to the default vhost. - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{Name: "hello", Namespace: "default"}, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), + Spec: netv1.IngressSpec{ + DefaultBackend: backend("backend", intstr.FromInt(80)), }, } rh.OnAdd(i1) @@ -573,14 +613,14 @@ func TestRequestTimeout(t *testing.T) { }}, nil) // i2 adds an _invalid_ timeout, which we interpret as _infinite_. - i2 := &v1beta1.Ingress{ + i2 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{Name: "hello", Namespace: "default", Annotations: map[string]string{ "enroute.saaras.io/request-timeout": "600", // not valid }, }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), + Spec: netv1.IngressSpec{ + DefaultBackend: backend("backend", intstr.FromInt(80)), }, } rh.OnUpdate(i1, i2) @@ -595,14 +635,14 @@ func TestRequestTimeout(t *testing.T) { }}, nil) // i3 corrects i2 to use a proper duration - i3 := &v1beta1.Ingress{ + i3 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{Name: "hello", Namespace: "default", Annotations: map[string]string{ "enroute.saaras.io/request-timeout": "600s", // 10 * time.Minute }, }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), + Spec: netv1.IngressSpec{ + DefaultBackend: backend("backend", intstr.FromInt(80)), }, } rh.OnUpdate(i2, i3) @@ -617,14 +657,14 @@ func TestRequestTimeout(t *testing.T) { }}, nil) // i4 updates i3 to explicitly request infinite timeout - i4 := &v1beta1.Ingress{ + i4 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{Name: "hello", Namespace: "default", Annotations: map[string]string{ "enroute.saaras.io/request-timeout": "infinity", }, }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), + Spec: netv1.IngressSpec{ + DefaultBackend: backend("backend", intstr.FromInt(80)), }, } rh.OnUpdate(i3, i4) @@ -646,7 +686,7 @@ func TestSSLRedirectOverlay(t *testing.T) { defer done() // i1 is a stock ingress with force-ssl-redirect on the / route - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "app", Namespace: "default", @@ -654,20 +694,24 @@ func TestSSLRedirectOverlay(t *testing.T) { "ingress.kubernetes.io/force-ssl-redirect": "true", }, }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"example.com"}, SecretName: "example-tls", }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "app-service", - ServicePort: intstr.FromInt(8080), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "app-service", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }}, }, @@ -677,25 +721,25 @@ func TestSSLRedirectOverlay(t *testing.T) { } rh.OnAdd(i1) - rh.OnAdd(&v1.Secret{ + rh.OnAdd(&corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "example-tls", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, }) - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "app-service", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -705,18 +749,22 @@ func TestSSLRedirectOverlay(t *testing.T) { }) // i2 is an overlay to add the let's encrypt handler. - i2 := &v1beta1.Ingress{ + i2 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{Name: "challenge", Namespace: "nginx-ingress"}, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/.well-known/acme-challenge/gVJl5NWL2owUqZekjHkt_bo3OHYC2XNDURRRgLI5JTk", - Backend: v1beta1.IngressBackend{ - ServiceName: "challenge-service", - ServicePort: intstr.FromInt(8009), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "challenge-service", + Port: netv1.ServiceBackendPort{ + Number: 8009, + }, + }, }, }}, }, @@ -726,13 +774,13 @@ func TestSSLRedirectOverlay(t *testing.T) { } rh.OnAdd(i2) - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "challenge-service", Namespace: "nginx-ingress", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8009, @@ -772,27 +820,27 @@ func TestInvalidCertInIngress(t *testing.T) { defer done() // Create an invalid TLS secret - secret := &v1.Secret{ + secret := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "example-tls", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: nil, - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: nil, + corev1.TLSPrivateKeyKey: []byte("key"), }, } rh.OnAdd(secret) // Create a service - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -801,21 +849,25 @@ func TestInvalidCertInIngress(t *testing.T) { }) // Create an ingress that uses the invalid secret - rh.OnAdd(&v1beta1.Ingress{ + rh.OnAdd(&netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{Name: "kuard-ing", Namespace: "default"}, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"kuard.io"}, SecretName: "example-tls", }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "kuard.io", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(80), + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }}, }, @@ -835,15 +887,15 @@ func TestInvalidCertInIngress(t *testing.T) { }}, nil) // Correct the secret - rh.OnUpdate(secret, &v1.Secret{ + rh.OnUpdate(secret, &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "example-tls", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("cert"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("cert"), + corev1.TLSPrivateKeyKey: []byte("key"), }, }) @@ -871,7 +923,7 @@ func TestIssue257(t *testing.T) { rh, cc, done := setup(t) defer done() - // apiVersion: networking/v1beta1 + // apiVersion: networking/v1 // kind: Ingress // metadata: // name: kuard-ing @@ -883,7 +935,7 @@ func TestIssue257(t *testing.T) { // backend: // serviceName: kuard // servicePort: 80 - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard-ing", Namespace: "default", @@ -891,22 +943,26 @@ func TestIssue257(t *testing.T) { "kubernetes.io/ingress.class": "contour", }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(80), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }, } rh.OnAdd(i1) - s1 := &v1.Service{ + s1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -926,7 +982,7 @@ func TestIssue257(t *testing.T) { }}, }}, nil) - // apiVersion: networking/v1beta1 + // apiVersion: networking/v1 // kind: Ingress // metadata: // name: kuard-ing @@ -943,7 +999,7 @@ func TestIssue257(t *testing.T) { // serviceName: kuard // servicePort: 80 // path: / - i2 := &v1beta1.Ingress{ + i2 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard-ing", Namespace: "default", @@ -951,16 +1007,20 @@ func TestIssue257(t *testing.T) { "kubernetes.io/ingress.class": "contour", }, }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "kuard.db.gd-ms.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(80), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }}, }, @@ -986,7 +1046,7 @@ func TestRDSFilter(t *testing.T) { defer done() // i1 is a stock ingress with force-ssl-redirect on the / route - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "app", Namespace: "default", @@ -994,20 +1054,24 @@ func TestRDSFilter(t *testing.T) { "ingress.kubernetes.io/force-ssl-redirect": "true", }, }, - Spec: v1beta1.IngressSpec{ - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + TLS: []netv1.IngressTLS{{ Hosts: []string{"example.com"}, SecretName: "example-tls", }}, - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "app-service", - ServicePort: intstr.FromInt(8080), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "app-service", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }}, }, @@ -1017,25 +1081,25 @@ func TestRDSFilter(t *testing.T) { } rh.OnAdd(i1) - rh.OnAdd(&v1.Secret{ + rh.OnAdd(&corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "example-tls", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, }) - s1 := &v1.Service{ + s1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "app-service", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, @@ -1046,18 +1110,22 @@ func TestRDSFilter(t *testing.T) { rh.OnAdd(s1) // i2 is an overlay to add the let's encrypt handler. - i2 := &v1beta1.Ingress{ + i2 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{Name: "challenge", Namespace: "nginx-ingress"}, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "example.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/.well-known/acme-challenge/gVJl5NWL2owUqZekjHkt_bo3OHYC2XNDURRRgLI5JTk", - Backend: v1beta1.IngressBackend{ - ServiceName: "challenge-service", - ServicePort: intstr.FromInt(8009), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "challenge-service", + Port: netv1.ServiceBackendPort{ + Number: 8009, + }, + }, }, }}, }, @@ -1067,13 +1135,13 @@ func TestRDSFilter(t *testing.T) { } rh.OnAdd(i2) - s2 := &v1.Service{ + s2 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "challenge-service", Namespace: "nginx-ingress", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8009, @@ -1135,13 +1203,13 @@ func TestWebsocketIngress(t *testing.T) { rh, cc, done := setup(t) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "ws", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -1149,7 +1217,7 @@ func TestWebsocketIngress(t *testing.T) { }, }) - rh.OnAdd(&v1beta1.Ingress{ + rh.OnAdd(&netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "ws", Namespace: "default", @@ -1157,16 +1225,20 @@ func TestWebsocketIngress(t *testing.T) { "enroute.saaras.io/websocket-routes": "/", }, }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "websocket.hello.world", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "ws", - ServicePort: intstr.FromInt(80), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "ws", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }}, }, @@ -1190,13 +1262,13 @@ func TestWebsocketGatewayHost(t *testing.T) { rh, cc, done := setup(t) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "ws", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -1263,13 +1335,13 @@ func TestPrefixRewriteGatewayHost(t *testing.T) { rh, cc, done := setup(t) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "ws", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -1338,13 +1410,13 @@ func TestDefaultBackendDoesNotOverwriteNamedHost(t *testing.T) { rh, cc, done := setup(t) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -1358,13 +1430,13 @@ func TestDefaultBackendDoesNotOverwriteNamedHost(t *testing.T) { }, }) - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "test-gui", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -1373,38 +1445,49 @@ func TestDefaultBackendDoesNotOverwriteNamedHost(t *testing.T) { }, }) - rh.OnAdd(&v1beta1.Ingress{ + rh.OnAdd(&netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "hello", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(80), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, - - Rules: []v1beta1.IngressRule{{ + Rules: []netv1.IngressRule{{ Host: "test-gui", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "test-gui", - ServicePort: intstr.FromInt(80), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "test-gui", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }}, }, }, }, { - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/kuard", - Backend: v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }}, }, @@ -1455,13 +1538,13 @@ func TestRDSGatewayHostInsideRootNamespaces(t *testing.T) { }) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "roots", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -1522,13 +1605,13 @@ func TestRDSGatewayHostOutsideRootNamespaces(t *testing.T) { }) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -1579,13 +1662,13 @@ func TestRDSGatewayHostClassAnnotation(t *testing.T) { }) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -1769,13 +1852,13 @@ func TestRDSIngressClassAnnotation(t *testing.T) { }) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), @@ -1783,15 +1866,19 @@ func TestRDSIngressClassAnnotation(t *testing.T) { }, }) - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard-ing", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, } @@ -1806,7 +1893,7 @@ func TestRDSIngressClassAnnotation(t *testing.T) { }}, }}, nil) - i2 := &v1beta1.Ingress{ + i2 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard-ing", Namespace: "default", @@ -1814,17 +1901,21 @@ func TestRDSIngressClassAnnotation(t *testing.T) { "kubernetes.io/ingress.class": "contour", }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, } rh.OnUpdate(i1, i2) assertRDS(t, cc, "3", nil, nil) - i3 := &v1beta1.Ingress{ + i3 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard-ing", Namespace: "default", @@ -1832,17 +1923,21 @@ func TestRDSIngressClassAnnotation(t *testing.T) { "enroute.saaras.io/ingress.class": "contour", }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, } rh.OnUpdate(i2, i3) assertRDS(t, cc, "3", nil, nil) - i4 := &v1beta1.Ingress{ + i4 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard-ing", Namespace: "default", @@ -1850,10 +1945,14 @@ func TestRDSIngressClassAnnotation(t *testing.T) { "kubernetes.io/ingress.class": "linkerd", }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, } @@ -1868,7 +1967,7 @@ func TestRDSIngressClassAnnotation(t *testing.T) { }}, }}, nil) - i5 := &v1beta1.Ingress{ + i5 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard-ing", Namespace: "default", @@ -1876,10 +1975,14 @@ func TestRDSIngressClassAnnotation(t *testing.T) { "enroute.saaras.io/ingress.class": "linkerd", }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "kuard", - ServicePort: intstr.FromInt(8080), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "kuard", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, } @@ -1906,13 +2009,13 @@ func TestRDSAssertNoDataRaceDuringInsertAndStream(t *testing.T) { stop := make(chan struct{}) - s1 := &v1.Service{ + s1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, @@ -1957,7 +2060,7 @@ func TestRDSAssertNoDataRaceDuringInsertAndStream(t *testing.T) { } // issue 606: spec.rules.host without a http key causes panic. -// apiVersion: networking/v1beta1 +// apiVersion: networking/v1 // kind: Ingress // metadata: // name: test-ingress3 @@ -1978,23 +2081,27 @@ func TestRDSIngressSpecMissingHTTPKey(t *testing.T) { rh, cc, done := setup(t) defer done() - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "test-ingress3", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "test1.test.com", }, { Host: "test2.test.com", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ Path: "/", - Backend: v1beta1.IngressBackend{ - ServiceName: "network-test", - ServicePort: intstr.FromInt(9001), + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "network-test", + Port: netv1.ServiceBackendPort{ + Number: 9001, + }, + }, }, }}, }, @@ -2004,13 +2111,13 @@ func TestRDSIngressSpecMissingHTTPKey(t *testing.T) { } rh.OnAdd(i1) - s1 := &v1.Service{ + s1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "network-test", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 9001, @@ -2035,13 +2142,13 @@ func TestRouteWithAServiceWeight(t *testing.T) { rh, cc, done := setup(t) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -2123,13 +2230,13 @@ func TestRouteWithTLS(t *testing.T) { rh, cc, done := setup(t) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -2137,15 +2244,15 @@ func TestRouteWithTLS(t *testing.T) { }, }) - rh.OnAdd(&v1.Secret{ + rh.OnAdd(&corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "example-tls", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, }) @@ -2209,13 +2316,13 @@ func TestRouteWithTLS_InsecurePaths(t *testing.T) { rh, cc, done := setup(t) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -2223,13 +2330,13 @@ func TestRouteWithTLS_InsecurePaths(t *testing.T) { }, }) - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "svc2", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -2237,15 +2344,15 @@ func TestRouteWithTLS_InsecurePaths(t *testing.T) { }, }) - rh.OnAdd(&v1.Secret{ + rh.OnAdd(&corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "example-tls", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, }) @@ -2331,13 +2438,13 @@ func TestRouteRetryAnnotations(t *testing.T) { rh, cc, done := setup(t) defer done() - s1 := &v1.Service{ + s1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -2346,7 +2453,7 @@ func TestRouteRetryAnnotations(t *testing.T) { } rh.OnAdd(s1) - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "hello", Namespace: "default", Annotations: map[string]string{ @@ -2355,8 +2462,15 @@ func TestRouteRetryAnnotations(t *testing.T) { "enroute.saaras.io/per-try-timeout": "120ms", }, }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), + Spec: netv1.IngressSpec{ + DefaultBackend: &netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "backend", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, + }, }, } rh.OnAdd(i1) @@ -2376,13 +2490,13 @@ func TestRouteRetryGatewayHost(t *testing.T) { rh, cc, done := setup(t) defer done() - s1 := &v1.Service{ + s1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -2436,13 +2550,13 @@ func TestRouteTimeoutPolicyGatewayHost(t *testing.T) { rh, cc, done := setup(t) defer done() - s1 := &v1.Service{ + s1 := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "backend", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -2583,13 +2697,13 @@ func TestRouteWithSessionAffinity(t *testing.T) { rh, cc, done := setup(t) defer done() - rh.OnAdd(&v1.Service{ + rh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "app", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -2731,13 +2845,13 @@ func TestLoadBalancingStrategies(t *testing.T) { rh, cc, done := setup(t) defer done() - st := v1.Service{ + st := corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "template", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -2805,13 +2919,13 @@ func TestCorsFilter(t *testing.T) { rh, cc, done := setup(t) defer done() - st := v1.Service{ + st := corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "template", Namespace: "default", }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), @@ -2870,9 +2984,7 @@ func TestCorsFilter(t *testing.T) { }, } - fmt.Printf("\nBefore HTTP filter add \n") rh.OnAdd(&hf) - fmt.Printf("\nAfter HTTP filter add \n") ir := &gatewayhostv1.GatewayHost{ ObjectMeta: metav1.ObjectMeta{ @@ -3041,28 +3153,28 @@ func clustertimeout(c string, timeout time.Duration) *envoy_config_route_v3.Rout return cl } -func service(ns, name string, ports ...v1.ServicePort) *v1.Service { - return &v1.Service{ +func service(ns, name string, ports ...corev1.ServicePort) *corev1.Service { + return &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: ns, }, - Spec: v1.ServiceSpec{ + Spec: corev1.ServiceSpec{ Ports: ports, }, } } -func externalnameservice(ns, name, externalname string, ports ...v1.ServicePort) *v1.Service { - return &v1.Service{ +func externalnameservice(ns, name, externalname string, ports ...corev1.ServicePort) *corev1.Service { + return &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: ns, }, - Spec: v1.ServiceSpec{ + Spec: corev1.ServiceSpec{ Ports: ports, ExternalName: externalname, - Type: v1.ServiceTypeExternalName, + Type: corev1.ServiceTypeExternalName, }, } } diff --git a/enroute-dp/internal/e2e/sds_test.go b/enroute-dp/internal/e2e/sds_test.go index 0f276a4..a5a2a0a 100644 --- a/enroute-dp/internal/e2e/sds_test.go +++ b/enroute-dp/internal/e2e/sds_test.go @@ -24,8 +24,8 @@ import ( "github.com/saarasio/enroute/enroute-dp/internal/dag" "github.com/saarasio/enroute/enroute-dp/internal/envoy" - v1 "k8s.io/api/core/v1" - "k8s.io/api/networking/v1beta1" + corev1 "k8s.io/api/core/v1" + netv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -40,15 +40,15 @@ func TestSDSVisibility(t *testing.T) { } // s1 is a tls secret - s1 := &v1.Secret{ + s1 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, } // add secret @@ -64,14 +64,14 @@ func TestSDSVisibility(t *testing.T) { }) // i1 is a tls ingress - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + DefaultBackend: backend("backend", intstr.FromInt(80)), + TLS: []netv1.IngressTLS{{ Hosts: []string{"kuard.example.com"}, SecretName: "secret", }}, @@ -102,29 +102,29 @@ func TestSDSShouldNotIncrementVersionNumberForUnrelatedSecret(t *testing.T) { } // s1 is a tls secret - s1 := &v1.Secret{ + s1 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, } // add secret rh.OnAdd(s1) // i1 is a tls ingress - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + DefaultBackend: backend("backend", intstr.FromInt(80)), + TLS: []netv1.IngressTLS{{ Hosts: []string{"kuard.example.com"}, SecretName: "secret", }}, @@ -154,15 +154,15 @@ func TestSDSShouldNotIncrementVersionNumberForUnrelatedSecret(t *testing.T) { }) // s2 is not referenced by any active ingress object. - s2 := &v1.Secret{ + s2 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "unrelated", Namespace: "default", }, Type: "kubernetes.io/tls", Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, } rh.OnAdd(s2) @@ -193,7 +193,7 @@ func TestSDSshouldNotPublishInvalidSecret(t *testing.T) { } // s1 is NOT a tls secret - s1 := &v1.Secret{ + s1 := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "invalid", Namespace: "default", @@ -207,14 +207,14 @@ func TestSDSshouldNotPublishInvalidSecret(t *testing.T) { rh.OnAdd(s1) // i1 is a tls ingress - i1 := &v1beta1.Ingress{ + i1 := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Backend: backend("backend", intstr.FromInt(80)), - TLS: []v1beta1.IngressTLS{{ + Spec: netv1.IngressSpec{ + DefaultBackend: backend("backend", intstr.FromInt(80)), + TLS: []netv1.IngressTLS{{ Hosts: []string{"kuard.example.com"}, SecretName: "invalid", }}, @@ -231,7 +231,7 @@ func TestSDSshouldNotPublishInvalidSecret(t *testing.T) { }) } -func secret(sec *v1.Secret) *envoy_extensions_transport_sockets_tls_v3.Secret { +func secret(sec *corev1.Secret) *envoy_extensions_transport_sockets_tls_v3.Secret { return envoy.Secret(&dag.Secret{ Object: sec, }) diff --git a/enroute-dp/internal/envoy/cluster_test.go b/enroute-dp/internal/envoy/cluster_test.go index cf6f380..bc2770c 100644 --- a/enroute-dp/internal/envoy/cluster_test.go +++ b/enroute-dp/internal/envoy/cluster_test.go @@ -26,7 +26,7 @@ import ( "github.com/envoyproxy/go-control-plane/envoy/type/v3" "github.com/golang/protobuf/ptypes/wrappers" "github.com/google/go-cmp/cmp" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/internal/dag" "github.com/saarasio/enroute/enroute-dp/internal/protobuf" "google.golang.org/protobuf/testing/protocmp" diff --git a/enroute-dp/internal/envoy/healthcheck_test.go b/enroute-dp/internal/envoy/healthcheck_test.go index a61af55..cefea2a 100644 --- a/enroute-dp/internal/envoy/healthcheck_test.go +++ b/enroute-dp/internal/envoy/healthcheck_test.go @@ -22,7 +22,7 @@ import ( "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" "github.com/google/go-cmp/cmp" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/internal/dag" "github.com/saarasio/enroute/enroute-dp/internal/protobuf" "google.golang.org/protobuf/testing/protocmp" diff --git a/enroute-dp/internal/envoy/route_filter.go b/enroute-dp/internal/envoy/route_filter.go index b3caea7..c824f5f 100644 --- a/enroute-dp/internal/envoy/route_filter.go +++ b/enroute-dp/internal/envoy/route_filter.go @@ -1,7 +1,6 @@ package envoy import ( - "fmt" //"strings" //"encoding/json" //"github.com/pkg/errors" @@ -98,33 +97,25 @@ func SaarasConfigToEnvoyConfig(cfg *cfg.CorsFilterConfig) *envoy_config_route_v3 func corsConfig(vh *dag.VirtualHost) *envoy_config_route_v3.CorsPolicy { if vh != nil { - fmt.Printf("envoy:corsConfig() VH [%+v]\n", vh) // VH Cors cors_http_filter := dag.GetVHHttpFilterConfigIfPresent(cfg.FILTER_TYPE_HTTP_CORS, vh) // No CORS filter if cors_http_filter == nil { - fmt.Printf("envoy:corsConfig(): No cors filter found \n") return nil } filter_config := cors_http_filter.Filter.Filter_config - fmt.Printf("envoy:corsConfig() Received CORS Filter Config %s\n", filter_config) // Unmarshal config unmsh_cfg, e := cfg.UnmarshalCorsFilterConfig(filter_config) if e != nil { - fmt.Printf("envoy:corsConfig() Failed to Unmarshal cors config \n") return nil } - fmt.Printf("envoy:corsConfig() Unmarshalled Filter Config [%+v]\n", unmsh_cfg) - c_cfg := SaarasConfigToEnvoyConfig(unmsh_cfg) - fmt.Printf("envoy:corsConfig() Envoy Cors Config [%+v]\n", c_cfg) - return c_cfg } diff --git a/enroute-dp/internal/grpc/server_test.go b/enroute-dp/internal/grpc/server_test.go index 7c820ea..1a59e8a 100644 --- a/enroute-dp/internal/grpc/server_test.go +++ b/enroute-dp/internal/grpc/server_test.go @@ -38,8 +38,8 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "k8s.io/api/core/v1" - "k8s.io/api/networking/v1beta1" + corev1 "k8s.io/api/core/v1" + netv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -51,16 +51,16 @@ func TestGRPC(t *testing.T) { tests := map[string]func(*testing.T, *grpc.ClientConn){ "StreamClusters": func(t *testing.T, cc *grpc.ClientConn) { - reh.OnAdd(&v1.Service{ + reh.OnAdd(&corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, - Spec: v1.ServiceSpec{ + Spec: corev1.ServiceSpec{ Selector: map[string]string{ "app": "simple", }, - Ports: []v1.ServicePort{{ + Ports: []corev1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(6502), @@ -78,16 +78,16 @@ func TestGRPC(t *testing.T) { checktimeout(t, stream) // check that the second receive times out }, "StreamEndpoints": func(t *testing.T, cc *grpc.ClientConn) { - et.OnAdd(&v1.Endpoints{ + et.OnAdd(&corev1.Endpoints{ ObjectMeta: metav1.ObjectMeta{ Name: "kube-scheduler", Namespace: "kube-system", }, - Subsets: []v1.EndpointSubset{{ - Addresses: []v1.EndpointAddress{{ + Subsets: []corev1.EndpointSubset{{ + Addresses: []corev1.EndpointAddress{{ IP: "130.211.139.167", }}, - Ports: []v1.EndpointPort{{ + Ports: []corev1.EndpointPort{{ Port: 80, }, { Port: 443, @@ -106,20 +106,25 @@ func TestGRPC(t *testing.T) { }, "StreamListeners": func(t *testing.T, cc *grpc.ClientConn) { // add an ingress, which will create a non tls listener - reh.OnAdd(&v1beta1.Ingress{ + reh.OnAdd(&netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "httpbin-org", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "httpbin.org", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: "httpbin-org", - ServicePort: intstr.FromInt(80), + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ + + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "httpbin-org", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }}, }, @@ -138,20 +143,24 @@ func TestGRPC(t *testing.T) { checktimeout(t, stream) // check that the second receive times out }, "StreamRoutes": func(t *testing.T, cc *grpc.ClientConn) { - reh.OnAdd(&v1beta1.Ingress{ + reh.OnAdd(&netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "httpbin-org", Namespace: "default", }, - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{{ Host: "httpbin.org", - IngressRuleValue: v1beta1.IngressRuleValue{ - HTTP: &v1beta1.HTTPIngressRuleValue{ - Paths: []v1beta1.HTTPIngressPath{{ - Backend: v1beta1.IngressBackend{ - ServiceName: "httpbin-org", - ServicePort: intstr.FromInt(80), + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{{ + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "httpbin-org", + Port: netv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }}, }, @@ -170,14 +179,14 @@ func TestGRPC(t *testing.T) { checktimeout(t, stream) // check that the second receive times out }, "StreamSecrets": func(t *testing.T, cc *grpc.ClientConn) { - reh.OnAdd(&v1.Secret{ + reh.OnAdd(&corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "secret", Namespace: "default", }, Data: map[string][]byte{ - v1.TLSCertKey: []byte("certificate"), - v1.TLSPrivateKeyKey: []byte("key"), + corev1.TLSCertKey: []byte("certificate"), + corev1.TLSPrivateKeyKey: []byte("key"), }, }) diff --git a/enroute-dp/internal/k8s/status.go b/enroute-dp/internal/k8s/status.go index 1fa71c2..780fcf8 100644 --- a/enroute-dp/internal/k8s/status.go +++ b/enroute-dp/internal/k8s/status.go @@ -18,14 +18,14 @@ package k8s import ( - "encoding/json" "context" + "encoding/json" jsonpatch "github.com/evanphx/json-patch" - gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" clientset "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned" - "k8s.io/apimachinery/pkg/types" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" ) // GatewayHostStatus allows for updating the object's Status field @@ -67,8 +67,8 @@ func (irs *GatewayHostStatus) setStatus(existing, updated *gatewayhostv1.Gateway var po meta_v1.PatchOptions - if irs != nil && irs.Client != nil && irs.Client.EnrouteV1beta1() != nil && existing != nil { - _, err = irs.Client.EnrouteV1beta1().GatewayHosts(existing.GetNamespace()).Patch(context.TODO(), existing.GetName(), types.MergePatchType, patchBytes, po) + if irs != nil && irs.Client != nil && irs.Client.EnrouteV1() != nil && existing != nil { + _, err = irs.Client.EnrouteV1().GatewayHosts(existing.GetNamespace()).Patch(context.TODO(), existing.GetName(), types.MergePatchType, patchBytes, po) } return err } diff --git a/enroute-dp/internal/k8s/status_test.go b/enroute-dp/internal/k8s/status_test.go index 88a6d11..e07b63d 100644 --- a/enroute-dp/internal/k8s/status_test.go +++ b/enroute-dp/internal/k8s/status_test.go @@ -20,7 +20,7 @@ import ( "fmt" "testing" - gatewayhostv1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + gatewayhostv1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/apis/generated/clientset/versioned/fake" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -31,19 +31,19 @@ func TestSetStatus(t *testing.T) { tests := map[string]struct { msg string desc string - existing *gatewayhostv1beta1.GatewayHost + existing *gatewayhostv1.GatewayHost expectedPatch string expectedVerbs []string }{ "simple update": { msg: "valid", desc: "this is a valid IR", - existing: &gatewayhostv1beta1.GatewayHost{ + existing: &gatewayhostv1.GatewayHost{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "default", }, - Status: gatewayhostv1beta1.Status{ + Status: gatewayhostv1.Status{ CurrentStatus: "", Description: "", }, @@ -54,12 +54,12 @@ func TestSetStatus(t *testing.T) { "no update": { msg: "valid", desc: "this is a valid IR", - existing: &gatewayhostv1beta1.GatewayHost{ + existing: &gatewayhostv1.GatewayHost{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "default", }, - Status: gatewayhostv1beta1.Status{ + Status: gatewayhostv1.Status{ CurrentStatus: "valid", Description: "this is a valid IR", }, @@ -70,12 +70,12 @@ func TestSetStatus(t *testing.T) { "replace existing status": { msg: "valid", desc: "this is a valid IR", - existing: &gatewayhostv1beta1.GatewayHost{ + existing: &gatewayhostv1.GatewayHost{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "default", }, - Status: gatewayhostv1beta1.Status{ + Status: gatewayhostv1.Status{ CurrentStatus: "invalid", Description: "boo hiss", }, diff --git a/enroute-dp/saaras/ir.go b/enroute-dp/saaras/ir.go index 9df1c44..9de9dbd 100644 --- a/enroute-dp/saaras/ir.go +++ b/enroute-dp/saaras/ir.go @@ -5,7 +5,7 @@ package saaras import ( "github.com/davecgh/go-spew/spew" - "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/internal/logger" cfg "github.com/saarasio/enroute/enroute-dp/saarasconfig" "github.com/sirupsen/logrus" @@ -258,11 +258,11 @@ type DataPayloadSaarasApp2 struct { ////////////// GatewayHost ////////////////////////////////////////////// -func upstream_hc(oneService *cfg.SaarasMicroService2) *v1beta1.HealthCheck { +func upstream_hc(oneService *cfg.SaarasMicroService2) *v1.HealthCheck { if need_hc(oneService) { - hc := v1beta1.HealthCheck{} + hc := v1.HealthCheck{} if len(oneService.Upstream.Upstream_hc_path) > 0 { hc.Path = oneService.Upstream.Upstream_hc_path } @@ -308,9 +308,9 @@ func need_hc(oneService *cfg.SaarasMicroService2) bool { return false } -func upstream_service(oneService *cfg.SaarasMicroService2) v1beta1.Service { +func upstream_service(oneService *cfg.SaarasMicroService2) v1.Service { - s := v1beta1.Service{ + s := v1.Service{ Name: serviceName2(oneService.Upstream.Upstream_name), Port: int(oneService.Upstream.Upstream_port), } @@ -337,10 +337,10 @@ func saaras_set_sni_for_externalname_service(sir *cfg.SaarasMicroService2) strin return "" } -func saaras_upstream_to_v1b1_uv(sir *cfg.SaarasMicroService2) *v1beta1.UpstreamValidation { +func saaras_upstream_to_v1b1_uv(sir *cfg.SaarasMicroService2) *v1.UpstreamValidation { if sir != nil && sir.Upstream.Upstream_validation_cacertificate != "" && sir.Upstream.Upstream_validation_subjectname != "" { - return &v1beta1.UpstreamValidation{ + return &v1.UpstreamValidation{ CACertificate: sir.Upstream.Upstream_validation_cacertificate, SubjectName: sir.Upstream.Upstream_validation_subjectname, } @@ -348,8 +348,8 @@ func saaras_upstream_to_v1b1_uv(sir *cfg.SaarasMicroService2) *v1beta1.UpstreamV return nil } -func saaras_service__to__v1b1_service(sm *cfg.SaarasMicroService2) v1beta1.Service { - s := v1beta1.Service{ +func saaras_service__to__v1b1_service(sm *cfg.SaarasMicroService2) v1.Service { + s := v1.Service{ Name: serviceName2(sm.Upstream.Upstream_name), Port: int(sm.Upstream.Upstream_port), Weight: uint32(sm.Upstream.Upstream_weight), @@ -361,8 +361,8 @@ func saaras_service__to__v1b1_service(sm *cfg.SaarasMicroService2) v1beta1.Servi return s } -func saaras_route_to_v1b1_service_slice2(sir *SaarasGatewayHostService, r SaarasRoute2) []v1beta1.Service { - services := make([]v1beta1.Service, 0) +func saaras_route_to_v1b1_service_slice2(sir *SaarasGatewayHostService, r SaarasRoute2) []v1.Service { + services := make([]v1.Service, 0) for _, oneService := range r.Route_upstreams { s := saaras_service__to__v1b1_service(&oneService) services = append(services, s) @@ -382,10 +382,10 @@ func getIrSecretName2(sir *SaarasGatewayHostService) string { return secret_name } -func getIrTLS(sir *SaarasGatewayHostService) *v1beta1.TLS { +func getIrTLS(sir *SaarasGatewayHostService) *v1.TLS { secret_name := getIrSecretName2(sir) if len(secret_name) > 0 { - return &v1beta1.TLS{ + return &v1.TLS{ SecretName: secret_name, } } else { @@ -393,11 +393,11 @@ func getIrTLS(sir *SaarasGatewayHostService) *v1beta1.TLS { } } -func saaras_ir_host_filter__to__v1b1_host_filter(sir *SaarasGatewayHostService) []v1beta1.HostAttachedFilter { - haf_slice := []v1beta1.HostAttachedFilter{} +func saaras_ir_host_filter__to__v1b1_host_filter(sir *SaarasGatewayHostService) []v1.HostAttachedFilter { + haf_slice := []v1.HostAttachedFilter{} for _, oneServiceFilter := range sir.Service.Service_filters { - v1b1_haf := v1beta1.HostAttachedFilter{ + v1b1_haf := v1.HostAttachedFilter{ Name: oneServiceFilter.Filter.Filter_name, Type: oneServiceFilter.Filter.Filter_type, } @@ -407,11 +407,11 @@ func saaras_ir_host_filter__to__v1b1_host_filter(sir *SaarasGatewayHostService) return haf_slice } -func saaras_ir_route_filter__to__v1b1_route_filter(r SaarasRoute2) []v1beta1.RouteAttachedFilter { - raf_slice := []v1beta1.RouteAttachedFilter{} +func saaras_ir_route_filter__to__v1b1_route_filter(r SaarasRoute2) []v1.RouteAttachedFilter { + raf_slice := []v1.RouteAttachedFilter{} for _, oneRouteFilter := range r.Route_filters { - v1b1_raf := v1beta1.RouteAttachedFilter{ + v1b1_raf := v1.RouteAttachedFilter{ Name: oneRouteFilter.Filter.Filter_name, Type: oneRouteFilter.Filter.Filter_type, } @@ -421,31 +421,31 @@ func saaras_ir_route_filter__to__v1b1_route_filter(r SaarasRoute2) []v1beta1.Rou } // TODO: This needs a test -func saaras_routecondition_to_v1b1_ir_routecondition(r SaarasRoute2) []v1beta1.Condition { - conds := make([]v1beta1.Condition, 0) +func saaras_routecondition_to_v1b1_ir_routecondition(r SaarasRoute2) []v1.Condition { + conds := make([]v1.Condition, 0) // If Route_prefix is populated, ignore Route_config if len(r.Route_prefix) > 0 { - conds = append(conds, v1beta1.Condition{Prefix: r.Route_prefix}) + conds = append(conds, v1.Condition{Prefix: r.Route_prefix}) return conds } // Route configuration provided in Route_config, unmarshal and convert to dag Conditions saarasRouteCond, err := cfg.UnmarshalRouteMatchCondition(r.Route_config) if err != nil { - conds = append(conds, v1beta1.Condition{Prefix: "/"}) + conds = append(conds, v1.Condition{Prefix: "/"}) return conds } - cond := v1beta1.Condition{ + cond := v1.Condition{ Prefix: saarasRouteCond.Prefix, } conds = append(conds, cond) for _, rmc := range saarasRouteCond.MatchConditions { - cond2 := v1beta1.Condition{ - Header: &v1beta1.HeaderCondition{ + cond2 := v1.Condition{ + Header: &v1.HeaderCondition{ Name: rmc.Name, Exact: strings.TrimSpace(rmc.Exact), }, @@ -457,23 +457,23 @@ func saaras_routecondition_to_v1b1_ir_routecondition(r SaarasRoute2) []v1beta1.C return conds } -func Saaras_ir__to__v1b1_ir2(sir *SaarasGatewayHostService) *v1beta1.GatewayHost { - routes := make([]v1beta1.Route, 0) +func Saaras_ir__to__v1b1_ir2(sir *SaarasGatewayHostService) *v1.GatewayHost { + routes := make([]v1.Route, 0) for _, oneRoute := range sir.Service.Routes { - routes = append(routes, v1beta1.Route{ + routes = append(routes, v1.Route{ Conditions: saaras_routecondition_to_v1b1_ir_routecondition(oneRoute), Services: saaras_route_to_v1b1_service_slice2(sir, oneRoute), Filters: saaras_ir_route_filter__to__v1b1_route_filter(oneRoute), }) } - return &v1beta1.GatewayHost{ + return &v1.GatewayHost{ ObjectMeta: metav1.ObjectMeta{ Name: sir.Service.Service_name, Namespace: ENROUTE_NAME, }, - Spec: v1beta1.GatewayHostSpec{ - VirtualHost: &v1beta1.VirtualHost{ + Spec: v1.GatewayHostSpec{ + VirtualHost: &v1.VirtualHost{ Fqdn: sir.Service.Fqdn, // TODO TLS: getIrTLS(sir), @@ -484,22 +484,22 @@ func Saaras_ir__to__v1b1_ir2(sir *SaarasGatewayHostService) *v1beta1.GatewayHost } } -func saaras_ir_slice__to__v1b1_ir_map(s *[]SaarasGatewayHostService, log logrus.FieldLogger) *map[string]*v1beta1.GatewayHost { - var m map[string]*v1beta1.GatewayHost - m = make(map[string]*v1beta1.GatewayHost) +func saaras_ir_slice__to__v1b1_ir_map(s *[]SaarasGatewayHostService, log logrus.FieldLogger) *map[string]*v1.GatewayHost { + var m map[string]*v1.GatewayHost + m = make(map[string]*v1.GatewayHost) for _, oneSaarasIRService := range *s { onev1b1ir := Saaras_ir__to__v1b1_ir2(&oneSaarasIRService) if logger.EL.ELogger != nil && logger.EL.ELogger.GetLevel() >= logrus.DebugLevel { spew.Dump(onev1b1ir) } - m[onev1b1ir.Name + "_" + onev1b1ir.Namespace] = onev1b1ir + m[onev1b1ir.Name+"_"+onev1b1ir.Namespace] = onev1b1ir } return &m } -func v1b1_tcpproxy_equal(log logrus.FieldLogger, t1, t2 *v1beta1.TCPProxy) bool { +func v1b1_tcpproxy_equal(log logrus.FieldLogger, t1, t2 *v1.TCPProxy) bool { if t1 == nil && t2 == nil { return true } @@ -512,7 +512,7 @@ func v1b1_tcpproxy_equal(log logrus.FieldLogger, t1, t2 *v1beta1.TCPProxy) bool return v1b1_service_slice_equal(log, t1.Services, t2.Services) } -type sliceOfIRService []v1beta1.Service +type sliceOfIRService []v1.Service func (o sliceOfIRService) Len() int { return len(o) @@ -526,7 +526,7 @@ func (o sliceOfIRService) Less(i, j int) bool { return o[i].Name > o[j].Name } -func v1b1_service_slice_equal(log logrus.FieldLogger, s1, s2 []v1beta1.Service) bool { +func v1b1_service_slice_equal(log logrus.FieldLogger, s1, s2 []v1.Service) bool { sort.Sort(sliceOfIRService(s1)) sort.Sort(sliceOfIRService(s2)) @@ -546,7 +546,7 @@ func v1b1_service_slice_equal(log logrus.FieldLogger, s1, s2 []v1beta1.Service) return true } -func v1b1_route_equal(log logrus.FieldLogger, ir_r1, ir_r2 v1beta1.Route) bool { +func v1b1_route_equal(log logrus.FieldLogger, ir_r1, ir_r2 v1.Route) bool { if len(ir_r1.Conditions) > 0 && len(ir_r2.Conditions) > 0 { if len(ir_r1.Conditions) == len(ir_r2.Conditions) { // TODO: We only compare the prefix here (if present) @@ -564,7 +564,7 @@ func v1b1_route_equal(log logrus.FieldLogger, ir_r1, ir_r2 v1beta1.Route) bool { return false } -type sliceOfIRRoutes []v1beta1.Route +type sliceOfIRRoutes []v1.Route func (o sliceOfIRRoutes) Len() int { return len(o) @@ -574,7 +574,7 @@ func (o sliceOfIRRoutes) Swap(i, j int) { o[i], o[j] = o[j], o[i] } -func conditionsToString(r *v1beta1.Route) string { +func conditionsToString(r *v1.Route) string { s := []string{} for _, cond := range r.Conditions { if cond.Header != nil { @@ -590,7 +590,7 @@ func (o sliceOfIRRoutes) Less(i, j int) bool { return conditionsToString(&o[i]) > conditionsToString(&o[j]) } -func v1b1_route_slice_equal(log logrus.FieldLogger, r1, r2 []v1beta1.Route) bool { +func v1b1_route_slice_equal(log logrus.FieldLogger, r1, r2 []v1.Route) bool { sort.Sort(sliceOfIRRoutes(r1)) sort.Sort(sliceOfIRRoutes(r2)) for idx, oneRoute := range r1 { @@ -605,7 +605,7 @@ func v1b1_route_slice_equal(log logrus.FieldLogger, r1, r2 []v1beta1.Route) bool return true } -func v1b1_tls_equal(tls1, tls2 *v1beta1.TLS) bool { +func v1b1_tls_equal(tls1, tls2 *v1.TLS) bool { if tls1 == nil && tls2 == nil { return true } @@ -620,12 +620,12 @@ func v1b1_tls_equal(tls1, tls2 *v1beta1.TLS) bool { (tls1.MinimumProtocolVersion == tls2.MinimumProtocolVersion) } -func v1b1_vh_equal(log logrus.FieldLogger, vh1, vh2 *v1beta1.VirtualHost) bool { +func v1b1_vh_equal(log logrus.FieldLogger, vh1, vh2 *v1.VirtualHost) bool { return vh1.Fqdn == vh2.Fqdn && v1b1_tls_equal(vh1.TLS, vh2.TLS) } -func v1b1_ir_equal(log logrus.FieldLogger, ir1, ir2 *v1beta1.GatewayHost) bool { +func v1b1_ir_equal(log logrus.FieldLogger, ir1, ir2 *v1.GatewayHost) bool { return ir1.Name == ir2.Name && ir1.Namespace == ir2.Namespace && v1b1_vh_equal(log, ir1.Spec.VirtualHost, ir2.Spec.VirtualHost) && diff --git a/enroute-dp/saaras/ir_test.go b/enroute-dp/saaras/ir_test.go index 896bc0a..d2937bc 100644 --- a/enroute-dp/saaras/ir_test.go +++ b/enroute-dp/saaras/ir_test.go @@ -3,7 +3,7 @@ package saaras import ( "testing" - ir "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + ir "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/internal/assert" ) diff --git a/enroute-dp/saaras/saarascloudcache.go b/enroute-dp/saaras/saarascloudcache.go index 6834bfc..5270c1b 100644 --- a/enroute-dp/saaras/saarascloudcache.go +++ b/enroute-dp/saaras/saarascloudcache.go @@ -8,7 +8,7 @@ import ( "encoding/json" "github.com/davecgh/go-spew/spew" "github.com/pkg/errors" - "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + enroutev1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/internal/config" "github.com/saarasio/enroute/enroute-dp/internal/contour" "github.com/saarasio/enroute/enroute-dp/internal/logger" @@ -33,14 +33,14 @@ type SaarasCloudCache struct { sdbpg map[string]*cfg.SaarasProxyGroupConfig sdbsecrets map[string]*v1.Secret - ir map[string]*v1beta1.GatewayHost + ir map[string]*enroutev1.GatewayHost svc map[string]*v1.Service ep map[string]*v1.Endpoints sec map[string]*v1.Secret - rf map[string]*v1beta1.RouteFilter - vf map[string]*v1beta1.HttpFilter - pc map[string]*v1beta1.GlobalConfig + rf map[string]*enroutev1.RouteFilter + vf map[string]*enroutev1.HttpFilter + pc map[string]*enroutev1.GlobalConfig } // CloudEventHandler fetches state from the cloud and generates @@ -50,7 +50,7 @@ type CloudEventHandler interface { } func (sac *SaarasCloudCache) update__v1b1_ir__cache( - saaras_ir_cloud_map *map[string]*v1beta1.GatewayHost, + saaras_ir_cloud_map *map[string]*enroutev1.GatewayHost, reh *contour.ResourceEventHandler, log logrus.FieldLogger) { for cloud_ir_id, cloud_ir := range *saaras_ir_cloud_map { @@ -75,7 +75,7 @@ func (sac *SaarasCloudCache) update__v1b1_ir__cache( log.Infof("update__v1b1_ir__cache() -> IR [%s, %s] - not in cache - OnAdd()\n", cloud_ir_id, cloud_ir.Spec.VirtualHost.Fqdn) if sac.ir == nil { - sac.ir = make(map[string]*v1beta1.GatewayHost) + sac.ir = make(map[string]*enroutev1.GatewayHost) } sac.ir[cache_key] = cloud_ir //spew.Dump(cloud_ir) @@ -134,23 +134,23 @@ func (sac *SaarasCloudCache) update__v1b1_service__cache( } func saaras_ir_slice__to__v1b1_routefilter_map( - s *[]SaarasGatewayHostService, log logrus.FieldLogger) *map[string]*v1beta1.RouteFilter { - rf := make(map[string]*v1beta1.RouteFilter, 0) + s *[]SaarasGatewayHostService, log logrus.FieldLogger) *map[string]*enroutev1.RouteFilter { + rf := make(map[string]*enroutev1.RouteFilter, 0) for _, oneSaarasIRService := range *s { for _, oneRoute := range oneSaarasIRService.Service.Routes { for _, oneRF := range oneRoute.Route_filters { - var one_routefilter *v1beta1.RouteFilter + var one_routefilter *enroutev1.RouteFilter - one_routefilter = &v1beta1.RouteFilter{ + one_routefilter = &enroutev1.RouteFilter{ ObjectMeta: metav1.ObjectMeta{ Name: oneRF.Filter.Filter_name, Namespace: ENROUTE_NAME, }, - Spec: v1beta1.RouteFilterSpec{ + Spec: enroutev1.RouteFilterSpec{ Name: oneRF.Filter.Filter_name, Type: oneRF.Filter.Filter_type, - RouteFilterConfig: v1beta1.GenericRouteFilterConfig{ + RouteFilterConfig: enroutev1.GenericRouteFilterConfig{ Config: oneRF.Filter.Filter_config, }, }, @@ -165,18 +165,18 @@ func saaras_ir_slice__to__v1b1_routefilter_map( } func saaras_ir_slice__to__v1b1__pc_map(s *[]SaarasGatewayHostService, - log logrus.FieldLogger) *map[string]*v1beta1.GlobalConfig { + log logrus.FieldLogger) *map[string]*enroutev1.GlobalConfig { - pc := make(map[string]*v1beta1.GlobalConfig, 0) + pc := make(map[string]*enroutev1.GlobalConfig, 0) for _, oneSaarasIRService := range *s { for _, onePC := range oneSaarasIRService.Proxy.ProxyGlobalconfigs { - one_pcf := &v1beta1.GlobalConfig{ + one_pcf := &enroutev1.GlobalConfig{ ObjectMeta: metav1.ObjectMeta{ Name: onePC.Globalconfig.GlobalconfigName, Namespace: ENROUTE_NAME, }, - Spec: v1beta1.GlobalConfigSpec{ + Spec: enroutev1.GlobalConfigSpec{ Name: "proxy_config_name", Type: onePC.Globalconfig.GlobalconfigType, Config: onePC.Globalconfig.Config, @@ -191,21 +191,21 @@ func saaras_ir_slice__to__v1b1__pc_map(s *[]SaarasGatewayHostService, } func saaras_ir_slice__to__v1b1_httpfilter_map( - s *[]SaarasGatewayHostService, log logrus.FieldLogger) *map[string]*v1beta1.HttpFilter { - vf := make(map[string]*v1beta1.HttpFilter, 0) + s *[]SaarasGatewayHostService, log logrus.FieldLogger) *map[string]*enroutev1.HttpFilter { + vf := make(map[string]*enroutev1.HttpFilter, 0) for _, oneSaarasIRService := range *s { for _, oneServiceFilter := range oneSaarasIRService.Service.Service_filters { - var one_vhfilter *v1beta1.HttpFilter - one_vhfilter = &v1beta1.HttpFilter{ + var one_vhfilter *enroutev1.HttpFilter + one_vhfilter = &enroutev1.HttpFilter{ ObjectMeta: metav1.ObjectMeta{ Name: oneServiceFilter.Filter.Filter_name, Namespace: ENROUTE_NAME, }, - Spec: v1beta1.HttpFilterSpec{ + Spec: enroutev1.HttpFilterSpec{ Name: oneServiceFilter.Filter.Filter_name, Type: oneServiceFilter.Filter.Filter_type, - HttpFilterConfig: v1beta1.GenericHttpFilterConfig{ + HttpFilterConfig: enroutev1.GenericHttpFilterConfig{ Config: oneServiceFilter.Filter.Filter_config, }, }, @@ -471,7 +471,7 @@ func (sac *SaarasCloudCache) update_saaras_secret_cache( } } -func (sac *SaarasCloudCache) update__v1__rf_cache(v1b1_rf_map *map[string]*v1beta1.RouteFilter, +func (sac *SaarasCloudCache) update__v1__rf_cache(v1b1_rf_map *map[string]*enroutev1.RouteFilter, reh *contour.ResourceEventHandler, log logrus.FieldLogger) { for _, cloud_rf := range *v1b1_rf_map { @@ -485,7 +485,7 @@ func (sac *SaarasCloudCache) update__v1__rf_cache(v1b1_rf_map *map[string]*v1bet } } else { if sac.rf == nil { - sac.rf = make(map[string]*v1beta1.RouteFilter, 0) + sac.rf = make(map[string]*enroutev1.RouteFilter, 0) } sac.rf[cloud_rf.ObjectMeta.Namespace+cloud_rf.ObjectMeta.Name+cloud_rf.Spec.Type] = cloud_rf log.Infof("update__v1__rf_cache() - RF [%s] on saaras cloud not in cache - OnAdd()\n", cloud_rf.ObjectMeta.Name) @@ -504,7 +504,7 @@ func (sac *SaarasCloudCache) update__v1__rf_cache(v1b1_rf_map *map[string]*v1bet } } -func (sac *SaarasCloudCache) update__v1b1__pc(v1b1_pc_map *map[string]*v1beta1.GlobalConfig, +func (sac *SaarasCloudCache) update__v1b1__pc(v1b1_pc_map *map[string]*enroutev1.GlobalConfig, pct *contour.GlobalConfigTranslator, log logrus.FieldLogger) { for _, cloud_pc := range *v1b1_pc_map { @@ -516,7 +516,7 @@ func (sac *SaarasCloudCache) update__v1b1__pc(v1b1_pc_map *map[string]*v1beta1.G } } else { if sac.pc == nil { - sac.pc = make(map[string]*v1beta1.GlobalConfig, 0) + sac.pc = make(map[string]*enroutev1.GlobalConfig, 0) } sac.pc[cloud_pc.ObjectMeta.Namespace+cloud_pc.ObjectMeta.Name+cloud_pc.Spec.Type] = cloud_pc pct.OnAdd(cloud_pc) @@ -533,7 +533,7 @@ func (sac *SaarasCloudCache) update__v1b1__pc(v1b1_pc_map *map[string]*v1beta1.G } } -func (sac *SaarasCloudCache) update__v1__vf_cache(v1b1_vf_map *map[string]*v1beta1.HttpFilter, +func (sac *SaarasCloudCache) update__v1__vf_cache(v1b1_vf_map *map[string]*enroutev1.HttpFilter, reh *contour.ResourceEventHandler, log logrus.FieldLogger) { for _, cloud_vf := range *v1b1_vf_map { @@ -547,7 +547,7 @@ func (sac *SaarasCloudCache) update__v1__vf_cache(v1b1_vf_map *map[string]*v1bet } } else { if sac.vf == nil { - sac.vf = make(map[string]*v1beta1.HttpFilter, 0) + sac.vf = make(map[string]*enroutev1.HttpFilter, 0) } sac.vf[cloud_vf.ObjectMeta.Namespace+cloud_vf.ObjectMeta.Name+cloud_vf.Spec.Type] = cloud_vf log.Infof("update__v1__vf_cache() - HTTPFilter [%s] on saaras cloud not in cache - OnAdd()\n", cloud_vf.ObjectMeta.Name) diff --git a/enroutectl/openapi/openapi.go b/enroutectl/openapi/openapi.go index e582aec..3a09352 100644 --- a/enroutectl/openapi/openapi.go +++ b/enroutectl/openapi/openapi.go @@ -11,7 +11,7 @@ import ( "github.com/go-openapi/loads" "github.com/go-openapi/spec" //"github.com/go-openapi/swag" - v1beta1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1beta1" + v1 "github.com/saarasio/enroute/enroute-dp/apis/enroute/v1" "github.com/saarasio/enroute/enroute-dp/saaras" "github.com/saarasio/enroute/enroute-dp/saarasconfig" "github.com/saarasio/enroute/enroutectl/config" @@ -449,12 +449,12 @@ func CreateOnEnroute(url string, ecfg *config.EnrouteConfig) { } } -func ProxyConfigToHttpFilters(proxy config.SaarasDbProxy) v1beta1.HttpFilterList { - return v1beta1.HttpFilterList{} +func ProxyConfigToHttpFilters(proxy config.SaarasDbProxy) v1.HttpFilterList { + return v1.HttpFilterList{} } -func ProxyConfigToRouteFilters(proxy config.SaarasDbProxy) v1beta1.RouteFilterList { - return v1beta1.RouteFilterList{} +func ProxyConfigToRouteFilters(proxy config.SaarasDbProxy) v1.RouteFilterList { + return v1.RouteFilterList{} } func ru_to_saaras_ru(ru []config.RouteUpstreams) []saarasconfig.SaarasMicroService2 { @@ -575,49 +575,49 @@ func EnrouteCtlServiceToSaarasGatewayHost(saarassvc *config.Service) *saaras.Saa return &sghs } -func SanitizeGatewayHost(gh *v1beta1.GatewayHost) { - //v1b1gh.apiVersion = "enroute.saaras.io/v1beta1" +func SanitizeGatewayHost(gh *v1.GatewayHost) { + //v1b1gh.apiVersion = "enroute.saaras.io/v1" gh.ObjectMeta.Namespace = "openapi" - gh.TypeMeta.APIVersion = "enroute.saaras.io/v1beta1" + gh.TypeMeta.APIVersion = "enroute.saaras.io/v1" gh.TypeMeta.Kind = "GatewayHost" } -func SaarasServiceToGatewayHost(saarassvc config.Service) *v1beta1.GatewayHost { +func SaarasServiceToGatewayHost(saarassvc config.Service) *v1.GatewayHost { // Convert config.Service to saaras.SaarasGatewayHostService - // Call Saaras_ir__to__v1b1_ir2() to convert saaras.SaarasGatewayHostService to v1beta1.GatewayHost + // Call Saaras_ir__to__v1b1_ir2() to convert saaras.SaarasGatewayHostService to v1.GatewayHost sghs := EnrouteCtlServiceToSaarasGatewayHost(&saarassvc) v1b1gh := saaras.Saaras_ir__to__v1b1_ir2(sghs) SanitizeGatewayHost(v1b1gh) return v1b1gh } -func ProxyConfigToGatewayHosts(proxy config.SaarasDbProxy) *v1beta1.GatewayHostList { - items := make([]v1beta1.GatewayHost, 0) +func ProxyConfigToGatewayHosts(proxy config.SaarasDbProxy) *v1.GatewayHostList { + items := make([]v1.GatewayHost, 0) for _, oneSvc := range proxy.ProxyServices { gwHost := SaarasServiceToGatewayHost(oneSvc.Service) items = append(items, *gwHost) } - return &v1beta1.GatewayHostList{ + return &v1.GatewayHostList{ Items: items, } } -func ProxyConfigToGlobalConfig(proxy config.SaarasDbProxy) v1beta1.GlobalConfigList { - var gcl v1beta1.GlobalConfigList +func ProxyConfigToGlobalConfig(proxy config.SaarasDbProxy) v1.GlobalConfigList { + var gcl v1.GlobalConfigList for _, oneGc := range proxy.ProxyGlobalconfigs { gc := oneGc.Globalconfig if gcl.Items == nil { - gcl.Items = make([]v1beta1.GlobalConfig, 1) + gcl.Items = make([]v1.GlobalConfig, 1) } - oneGlobalConfig := v1beta1.GlobalConfig{ + oneGlobalConfig := v1.GlobalConfig{ ObjectMeta: metav1.ObjectMeta{ Name: gc.GlobalconfigName, Namespace: "gw" + "-" + "openapi", //TODO }, - Spec: v1beta1.GlobalConfigSpec{ + Spec: v1.GlobalConfigSpec{ Name: "proxy_config_name", Type: gc.GlobalconfigType, Config: gc.Config, @@ -628,7 +628,7 @@ func ProxyConfigToGlobalConfig(proxy config.SaarasDbProxy) v1beta1.GlobalConfigL return gcl } -func SyncProxyToK8sApi(ecfg *config.EnrouteConfig) *v1beta1.GatewayHostList { +func SyncProxyToK8sApi(ecfg *config.EnrouteConfig) *v1.GatewayHostList { if ecfg == nil { return nil }