feat: add v2beta1 structure for ApisixRoute (#572)
* feat: add v2beta1 version for ApisixRoute
* fix: crd versions
* fix: storage version
diff --git a/pkg/kube/apisix/apis/config/v2beta1/doc.go b/pkg/kube/apisix/apis/config/v2beta1/doc.go
new file mode 100644
index 0000000..51aa7e9
--- /dev/null
+++ b/pkg/kube/apisix/apis/config/v2beta1/doc.go
@@ -0,0 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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.
+
+// +k8s:deepcopy-gen=package
+// +groupName=apisix.apache.org
+package v2beta1
diff --git a/pkg/kube/apisix/apis/config/v2beta1/register.go b/pkg/kube/apisix/apis/config/v2beta1/register.go
new file mode 100644
index 0000000..9531d6b
--- /dev/null
+++ b/pkg/kube/apisix/apis/config/v2beta1/register.go
@@ -0,0 +1,50 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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.
+package v2beta1
+
+import (
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+)
+
+const (
+ _groupName = "apisix.apache.org"
+ _version = "v2beta1"
+)
+
+var (
+ SchemeGroupVersion = schema.GroupVersion{
+ Group: _groupName,
+ Version: _version,
+ }
+ SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
+ AddToScheme = SchemeBuilder.AddToScheme
+)
+
+func Resource(resource string) schema.GroupResource {
+ return SchemeGroupVersion.WithResource(resource).GroupResource()
+}
+
+func addKnownTypes(scheme *runtime.Scheme) error {
+ scheme.AddKnownTypes(SchemeGroupVersion,
+ &ApisixRoute{},
+ &ApisixRouteList{},
+ )
+
+ // register the type in the scheme
+ metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
+ return nil
+}
diff --git a/pkg/kube/apisix/apis/config/v2beta1/types.go b/pkg/kube/apisix/apis/config/v2beta1/types.go
new file mode 100644
index 0000000..d2d4335
--- /dev/null
+++ b/pkg/kube/apisix/apis/config/v2beta1/types.go
@@ -0,0 +1,226 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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.
+package v2beta1
+
+import (
+ "encoding/json"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/util/intstr"
+)
+
+// +genclient
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+// +kubebuilder:subresource:status
+// ApisixRoute is used to define the route rules and upstreams for Apache APISIX.
+type ApisixRoute struct {
+ metav1.TypeMeta `json:",inline" yaml:",inline"`
+ metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
+ Spec ApisixRouteSpec `json:"spec,omitempty" yaml:"spec,omitempty"`
+ Status ApisixStatus `json:"status,omitempty" yaml:"status,omitempty"`
+}
+
+// ApisixStatus is the status report for Apisix ingress Resources
+type ApisixStatus struct {
+ Conditions []metav1.Condition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
+}
+
+// ApisixRouteSpec is the spec definition for ApisixRouteSpec.
+type ApisixRouteSpec struct {
+ HTTP []ApisixRouteHTTP `json:"http,omitempty" yaml:"http,omitempty"`
+ Stream []ApisixRouteStream `json:"stream,omitempty" yaml:"stream,omitempty"`
+}
+
+// ApisixRouteHTTP represents a single route in for HTTP traffic.
+type ApisixRouteHTTP struct {
+ // The rule name, cannot be empty.
+ Name string `json:"name" yaml:"name"`
+ // Route priority, when multiple routes contains
+ // same URI path (for path matching), route with
+ // higher priority will take effect.
+ Priority int `json:"priority,omitempty" yaml:"priority,omitempty"`
+ Match ApisixRouteHTTPMatch `json:"match,omitempty" yaml:"match,omitempty"`
+ // Deprecated: Backend will be removed in the future, use Backends instead.
+ Backend ApisixRouteHTTPBackend `json:"backend" yaml:"backend"`
+ // Backends represents potential backends to proxy after the route
+ // rule matched. When number of backends are more than one, traffic-split
+ // plugin in APISIX will be used to split traffic based on the backend weight.
+ Backends []ApisixRouteHTTPBackend `json:"backends" yaml:"backends"`
+ Websocket bool `json:"websocket" yaml:"websocket"`
+ Plugins []ApisixRouteHTTPPlugin `json:"plugins,omitempty" yaml:"plugins,omitempty"`
+ Authentication ApisixRouteAuthentication `json:"authentication,omitempty" yaml:"authentication,omitempty"`
+}
+
+// ApisixRouteHTTPMatch represents the match condition for hitting this route.
+type ApisixRouteHTTPMatch struct {
+ // URI path predicates, at least one path should be
+ // configured, path could be exact or prefix, for prefix path,
+ // append "*" after it, for instance, "/foo*".
+ Paths []string `json:"paths" yaml:"paths"`
+ // HTTP request method predicates.
+ Methods []string `json:"methods,omitempty" yaml:"methods,omitempty"`
+ // HTTP Host predicates, host can be a wildcard domain or
+ // an exact domain. For wildcard domain, only one generic
+ // level is allowed, for instance, "*.foo.com" is valid but
+ // "*.*.foo.com" is not.
+ Hosts []string `json:"hosts,omitempty" yaml:"hosts,omitempty"`
+ // Remote address predicates, items can be valid IPv4 address
+ // or IPv6 address or CIDR.
+ RemoteAddrs []string `json:"remoteAddrs,omitempty" yaml:"remoteAddrs,omitempty"`
+ // NginxVars represents generic match predicates,
+ // it uses Nginx variable systems, so any predicate
+ // like headers, querystring and etc can be leveraged
+ // here to match the route.
+ // For instance, it can be:
+ // nginxVars:
+ // - subject: "$remote_addr"
+ // op: in
+ // value:
+ // - "127.0.0.1"
+ // - "10.0.5.11"
+ NginxVars []ApisixRouteHTTPMatchExpr `json:"exprs,omitempty" yaml:"exprs,omitempty"`
+}
+
+// ApisixRouteHTTPMatchExpr represents a binary route match expression .
+type ApisixRouteHTTPMatchExpr struct {
+ // Subject is the expression subject, it can
+ // be any string composed by literals and nginx
+ // vars.
+ Subject ApisixRouteHTTPMatchExprSubject `json:"subject" yaml:"subject"`
+ // Op is the operator.
+ Op string `json:"op" yaml:"op"`
+ // Set is an array type object of the expression.
+ // It should be used when the Op is "in" or "not_in";
+ Set []string `json:"set" yaml:"set"`
+ // Value is the normal type object for the expression,
+ // it should be used when the Op is not "in" and "not_in".
+ // Set and Value are exclusive so only of them can be set
+ // in the same time.
+ Value string `json:"value" yaml:"value"`
+}
+
+// ApisixRouteHTTPMatchExprSubject describes the route match expression subject.
+type ApisixRouteHTTPMatchExprSubject struct {
+ // The subject scope, can be:
+ // ScopeQuery, ScopeHeader, ScopePath
+ // when subject is ScopePath, Name field
+ // will be ignored.
+ Scope string `json:"scope" yaml:"scope"`
+ // The name of subject.
+ Name string `json:"name" yaml:"name"`
+}
+
+// ApisixRouteHTTPBackend represents a HTTP backend (a Kuberentes Service).
+type ApisixRouteHTTPBackend struct {
+ // The name (short) of the service, note cross namespace is forbidden,
+ // so be sure the ApisixRoute and Service are in the same namespace.
+ ServiceName string `json:"serviceName" yaml:"serviceName"`
+ // The service port, could be the name or the port number.
+ ServicePort intstr.IntOrString `json:"servicePort" yaml:"servicePort"`
+ // The resolve granularity, can be "endpoints" or "service",
+ // when set to "endpoints", the pod ips will be used; other
+ // wise, the service ClusterIP or ExternalIP will be used,
+ // default is endpoints.
+ ResolveGranularity string `json:"resolveGranularity" yaml:"resolveGranularity"`
+ // Weight of this backend.
+ Weight int `json:"weight" yaml:"weight"`
+ // Subset specifies a subset for the target Service. The subset should be pre-defined
+ // in ApisixUpstream about this service.
+ Subset string `json:"subset" yaml:"subset"`
+}
+
+// ApisixRouteHTTPPlugin represents an APISIX plugin.
+type ApisixRouteHTTPPlugin struct {
+ // The plugin name.
+ Name string `json:"name" yaml:"name"`
+ // Whether this plugin is in use, default is true.
+ Enable bool `json:"enable" yaml:"enable"`
+ // Plugin configuration.
+ Config ApisixRouteHTTPPluginConfig `json:"config" yaml:"config"`
+}
+
+// ApisixRouteHTTPPluginConfig is the configuration for
+// any plugins.
+type ApisixRouteHTTPPluginConfig map[string]interface{}
+
+// ApisixRouteAuthentication is the authentication-related
+// configuration in ApisixRoute.
+type ApisixRouteAuthentication struct {
+ Enable bool `json:"enable" yaml:"enable"`
+ Type string `json:"type" yaml:"type"`
+ KeyAuth ApisixRouteAuthenticationKeyAuth `json:"keyauth,omitempty" yaml:"keyauth,omitempty"`
+}
+
+// ApisixRouteAuthenticationKeyAuth is the keyAuth-related
+// configuration in ApisixRouteAuthentication.
+type ApisixRouteAuthenticationKeyAuth struct {
+ Header string `json:"header,omitempty" yaml:"header,omitempty"`
+}
+
+func (p ApisixRouteHTTPPluginConfig) DeepCopyInto(out *ApisixRouteHTTPPluginConfig) {
+ b, _ := json.Marshal(&p)
+ _ = json.Unmarshal(b, out)
+}
+
+func (p *ApisixRouteHTTPPluginConfig) DeepCopy() *ApisixRouteHTTPPluginConfig {
+ if p == nil {
+ return nil
+ }
+ out := new(ApisixRouteHTTPPluginConfig)
+ p.DeepCopyInto(out)
+ return out
+}
+
+// ApisixRouteStream is the configuration for level 4 route
+type ApisixRouteStream struct {
+ // The rule name, cannot be empty.
+ Name string `json:"name" yaml:"name"`
+ Protocol string `json:"protocol" yaml:"protocol"`
+ Match ApisixRouteStreamMatch `json:"match" yaml:"match"`
+ Backend ApisixRouteStreamBackend `json:"backend" yaml:"backend"`
+}
+
+// ApisixRouteStreamMatch represents the match conditions of stream route.
+type ApisixRouteStreamMatch struct {
+ // IngressPort represents the port listening on the Ingress proxy server.
+ // It should be pre-defined as APISIX doesn't support dynamic listening.
+ IngressPort int32 `json:"ingressPort" yaml:"ingressPort"`
+}
+
+// ApisixRouteStreamBackend represents a TCP backend (a Kubernetes Service).
+type ApisixRouteStreamBackend struct {
+ // The name (short) of the service, note cross namespace is forbidden,
+ // so be sure the ApisixRoute and Service are in the same namespace.
+ ServiceName string `json:"serviceName" yaml:"serviceName"`
+ // The service port, could be the name or the port number.
+ ServicePort intstr.IntOrString `json:"servicePort" yaml:"servicePort"`
+ // The resolve granularity, can be "endpoints" or "service",
+ // when set to "endpoints", the pod ips will be used; other
+ // wise, the service ClusterIP or ExternalIP will be used,
+ // default is endpoints.
+ ResolveGranularity string `json:"resolveGranularity" yaml:"resolveGranularity"`
+ // Subset specifies a subset for the target Service. The subset should be pre-defined
+ // in ApisixUpstream about this service.
+ Subset string `json:"subset" yaml:"subset"`
+}
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+// ApisixRouteList contains a list of ApisixRoute.
+type ApisixRouteList struct {
+ metav1.TypeMeta `json:",inline" yaml:",inline"`
+ metav1.ListMeta `json:"metadata" yaml:"metadata"`
+ Items []ApisixRoute `json:"items,omitempty" yaml:"items,omitempty"`
+}
diff --git a/pkg/kube/apisix/apis/config/v2beta1/zz_generated.deepcopy.go b/pkg/kube/apisix/apis/config/v2beta1/zz_generated.deepcopy.go
new file mode 100644
index 0000000..ac06d4d
--- /dev/null
+++ b/pkg/kube/apisix/apis/config/v2beta1/zz_generated.deepcopy.go
@@ -0,0 +1,367 @@
+// +build !ignore_autogenerated
+
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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 deepcopy-gen. DO NOT EDIT.
+
+package v2beta1
+
+import (
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ 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 *ApisixRoute) DeepCopyInto(out *ApisixRoute) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
+ in.Spec.DeepCopyInto(&out.Spec)
+ in.Status.DeepCopyInto(&out.Status)
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApisixRoute.
+func (in *ApisixRoute) DeepCopy() *ApisixRoute {
+ if in == nil {
+ return nil
+ }
+ out := new(ApisixRoute)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *ApisixRoute) 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 *ApisixRouteAuthentication) DeepCopyInto(out *ApisixRouteAuthentication) {
+ *out = *in
+ out.KeyAuth = in.KeyAuth
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApisixRouteAuthentication.
+func (in *ApisixRouteAuthentication) DeepCopy() *ApisixRouteAuthentication {
+ if in == nil {
+ return nil
+ }
+ out := new(ApisixRouteAuthentication)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ApisixRouteAuthenticationKeyAuth) DeepCopyInto(out *ApisixRouteAuthenticationKeyAuth) {
+ *out = *in
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApisixRouteAuthenticationKeyAuth.
+func (in *ApisixRouteAuthenticationKeyAuth) DeepCopy() *ApisixRouteAuthenticationKeyAuth {
+ if in == nil {
+ return nil
+ }
+ out := new(ApisixRouteAuthenticationKeyAuth)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ApisixRouteHTTP) DeepCopyInto(out *ApisixRouteHTTP) {
+ *out = *in
+ in.Match.DeepCopyInto(&out.Match)
+ out.Backend = in.Backend
+ if in.Backends != nil {
+ in, out := &in.Backends, &out.Backends
+ *out = make([]ApisixRouteHTTPBackend, len(*in))
+ copy(*out, *in)
+ }
+ if in.Plugins != nil {
+ in, out := &in.Plugins, &out.Plugins
+ *out = make([]ApisixRouteHTTPPlugin, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+ out.Authentication = in.Authentication
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApisixRouteHTTP.
+func (in *ApisixRouteHTTP) DeepCopy() *ApisixRouteHTTP {
+ if in == nil {
+ return nil
+ }
+ out := new(ApisixRouteHTTP)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ApisixRouteHTTPBackend) DeepCopyInto(out *ApisixRouteHTTPBackend) {
+ *out = *in
+ out.ServicePort = in.ServicePort
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApisixRouteHTTPBackend.
+func (in *ApisixRouteHTTPBackend) DeepCopy() *ApisixRouteHTTPBackend {
+ if in == nil {
+ return nil
+ }
+ out := new(ApisixRouteHTTPBackend)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ApisixRouteHTTPMatch) DeepCopyInto(out *ApisixRouteHTTPMatch) {
+ *out = *in
+ if in.Paths != nil {
+ in, out := &in.Paths, &out.Paths
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
+ if in.Methods != nil {
+ in, out := &in.Methods, &out.Methods
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
+ if in.Hosts != nil {
+ in, out := &in.Hosts, &out.Hosts
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
+ if in.RemoteAddrs != nil {
+ in, out := &in.RemoteAddrs, &out.RemoteAddrs
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
+ if in.NginxVars != nil {
+ in, out := &in.NginxVars, &out.NginxVars
+ *out = make([]ApisixRouteHTTPMatchExpr, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApisixRouteHTTPMatch.
+func (in *ApisixRouteHTTPMatch) DeepCopy() *ApisixRouteHTTPMatch {
+ if in == nil {
+ return nil
+ }
+ out := new(ApisixRouteHTTPMatch)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ApisixRouteHTTPMatchExpr) DeepCopyInto(out *ApisixRouteHTTPMatchExpr) {
+ *out = *in
+ out.Subject = in.Subject
+ if in.Set != nil {
+ in, out := &in.Set, &out.Set
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApisixRouteHTTPMatchExpr.
+func (in *ApisixRouteHTTPMatchExpr) DeepCopy() *ApisixRouteHTTPMatchExpr {
+ if in == nil {
+ return nil
+ }
+ out := new(ApisixRouteHTTPMatchExpr)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ApisixRouteHTTPMatchExprSubject) DeepCopyInto(out *ApisixRouteHTTPMatchExprSubject) {
+ *out = *in
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApisixRouteHTTPMatchExprSubject.
+func (in *ApisixRouteHTTPMatchExprSubject) DeepCopy() *ApisixRouteHTTPMatchExprSubject {
+ if in == nil {
+ return nil
+ }
+ out := new(ApisixRouteHTTPMatchExprSubject)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ApisixRouteHTTPPlugin) DeepCopyInto(out *ApisixRouteHTTPPlugin) {
+ *out = *in
+ in.Config.DeepCopyInto(&out.Config)
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApisixRouteHTTPPlugin.
+func (in *ApisixRouteHTTPPlugin) DeepCopy() *ApisixRouteHTTPPlugin {
+ if in == nil {
+ return nil
+ }
+ out := new(ApisixRouteHTTPPlugin)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ApisixRouteList) DeepCopyInto(out *ApisixRouteList) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ListMeta.DeepCopyInto(&out.ListMeta)
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]ApisixRoute, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApisixRouteList.
+func (in *ApisixRouteList) DeepCopy() *ApisixRouteList {
+ if in == nil {
+ return nil
+ }
+ out := new(ApisixRouteList)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *ApisixRouteList) 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 *ApisixRouteSpec) DeepCopyInto(out *ApisixRouteSpec) {
+ *out = *in
+ if in.HTTP != nil {
+ in, out := &in.HTTP, &out.HTTP
+ *out = make([]ApisixRouteHTTP, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+ if in.Stream != nil {
+ in, out := &in.Stream, &out.Stream
+ *out = make([]ApisixRouteStream, len(*in))
+ copy(*out, *in)
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApisixRouteSpec.
+func (in *ApisixRouteSpec) DeepCopy() *ApisixRouteSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(ApisixRouteSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ApisixRouteStream) DeepCopyInto(out *ApisixRouteStream) {
+ *out = *in
+ out.Match = in.Match
+ out.Backend = in.Backend
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApisixRouteStream.
+func (in *ApisixRouteStream) DeepCopy() *ApisixRouteStream {
+ if in == nil {
+ return nil
+ }
+ out := new(ApisixRouteStream)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ApisixRouteStreamBackend) DeepCopyInto(out *ApisixRouteStreamBackend) {
+ *out = *in
+ out.ServicePort = in.ServicePort
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApisixRouteStreamBackend.
+func (in *ApisixRouteStreamBackend) DeepCopy() *ApisixRouteStreamBackend {
+ if in == nil {
+ return nil
+ }
+ out := new(ApisixRouteStreamBackend)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ApisixRouteStreamMatch) DeepCopyInto(out *ApisixRouteStreamMatch) {
+ *out = *in
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApisixRouteStreamMatch.
+func (in *ApisixRouteStreamMatch) DeepCopy() *ApisixRouteStreamMatch {
+ if in == nil {
+ return nil
+ }
+ out := new(ApisixRouteStreamMatch)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ApisixStatus) DeepCopyInto(out *ApisixStatus) {
+ *out = *in
+ if in.Conditions != nil {
+ in, out := &in.Conditions, &out.Conditions
+ *out = make([]v1.Condition, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApisixStatus.
+func (in *ApisixStatus) DeepCopy() *ApisixStatus {
+ if in == nil {
+ return nil
+ }
+ out := new(ApisixStatus)
+ in.DeepCopyInto(out)
+ return out
+}
diff --git a/pkg/kube/apisix/client/clientset/versioned/clientset.go b/pkg/kube/apisix/client/clientset/versioned/clientset.go
index dbc9b4a..be11cfd 100644
--- a/pkg/kube/apisix/client/clientset/versioned/clientset.go
+++ b/pkg/kube/apisix/client/clientset/versioned/clientset.go
@@ -22,6 +22,7 @@
apisixv1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/typed/config/v1"
apisixv2alpha1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/typed/config/v2alpha1"
+ apisixv2beta1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"
@@ -31,6 +32,7 @@
Discovery() discovery.DiscoveryInterface
ApisixV1() apisixv1.ApisixV1Interface
ApisixV2alpha1() apisixv2alpha1.ApisixV2alpha1Interface
+ ApisixV2beta1() apisixv2beta1.ApisixV2beta1Interface
}
// Clientset contains the clients for groups. Each group has exactly one
@@ -39,6 +41,7 @@
*discovery.DiscoveryClient
apisixV1 *apisixv1.ApisixV1Client
apisixV2alpha1 *apisixv2alpha1.ApisixV2alpha1Client
+ apisixV2beta1 *apisixv2beta1.ApisixV2beta1Client
}
// ApisixV1 retrieves the ApisixV1Client
@@ -51,6 +54,11 @@
return c.apisixV2alpha1
}
+// ApisixV2beta1 retrieves the ApisixV2beta1Client
+func (c *Clientset) ApisixV2beta1() apisixv2beta1.ApisixV2beta1Interface {
+ return c.apisixV2beta1
+}
+
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
if c == nil {
@@ -80,6 +88,10 @@
if err != nil {
return nil, err
}
+ cs.apisixV2beta1, err = apisixv2beta1.NewForConfig(&configShallowCopy)
+ if err != nil {
+ return nil, err
+ }
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil {
@@ -94,6 +106,7 @@
var cs Clientset
cs.apisixV1 = apisixv1.NewForConfigOrDie(c)
cs.apisixV2alpha1 = apisixv2alpha1.NewForConfigOrDie(c)
+ cs.apisixV2beta1 = apisixv2beta1.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
@@ -104,6 +117,7 @@
var cs Clientset
cs.apisixV1 = apisixv1.New(c)
cs.apisixV2alpha1 = apisixv2alpha1.New(c)
+ cs.apisixV2beta1 = apisixv2beta1.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &cs
diff --git a/pkg/kube/apisix/client/clientset/versioned/fake/clientset_generated.go b/pkg/kube/apisix/client/clientset/versioned/fake/clientset_generated.go
index 096bf1b..53f5e49 100644
--- a/pkg/kube/apisix/client/clientset/versioned/fake/clientset_generated.go
+++ b/pkg/kube/apisix/client/clientset/versioned/fake/clientset_generated.go
@@ -23,6 +23,8 @@
fakeapisixv1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/typed/config/v1/fake"
apisixv2alpha1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/typed/config/v2alpha1"
fakeapisixv2alpha1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/typed/config/v2alpha1/fake"
+ apisixv2beta1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1"
+ fakeapisixv2beta1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/fake"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/discovery"
@@ -86,3 +88,8 @@
func (c *Clientset) ApisixV2alpha1() apisixv2alpha1.ApisixV2alpha1Interface {
return &fakeapisixv2alpha1.FakeApisixV2alpha1{Fake: &c.Fake}
}
+
+// ApisixV2beta1 retrieves the ApisixV2beta1Client
+func (c *Clientset) ApisixV2beta1() apisixv2beta1.ApisixV2beta1Interface {
+ return &fakeapisixv2beta1.FakeApisixV2beta1{Fake: &c.Fake}
+}
diff --git a/pkg/kube/apisix/client/clientset/versioned/fake/register.go b/pkg/kube/apisix/client/clientset/versioned/fake/register.go
index d9da578..0fc3a97 100644
--- a/pkg/kube/apisix/client/clientset/versioned/fake/register.go
+++ b/pkg/kube/apisix/client/clientset/versioned/fake/register.go
@@ -20,6 +20,7 @@
import (
apisixv1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1"
apisixv2alpha1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2alpha1"
+ apisixv2beta1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
@@ -33,6 +34,7 @@
var localSchemeBuilder = runtime.SchemeBuilder{
apisixv1.AddToScheme,
apisixv2alpha1.AddToScheme,
+ apisixv2beta1.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
diff --git a/pkg/kube/apisix/client/clientset/versioned/scheme/register.go b/pkg/kube/apisix/client/clientset/versioned/scheme/register.go
index 3ae5f92..fd8ede2 100644
--- a/pkg/kube/apisix/client/clientset/versioned/scheme/register.go
+++ b/pkg/kube/apisix/client/clientset/versioned/scheme/register.go
@@ -20,6 +20,7 @@
import (
apisixv1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1"
apisixv2alpha1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2alpha1"
+ apisixv2beta1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
@@ -33,6 +34,7 @@
var localSchemeBuilder = runtime.SchemeBuilder{
apisixv1.AddToScheme,
apisixv2alpha1.AddToScheme,
+ apisixv2beta1.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/apisixroute.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/apisixroute.go
new file mode 100644
index 0000000..d949c75
--- /dev/null
+++ b/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/apisixroute.go
@@ -0,0 +1,194 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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 v2beta1
+
+import (
+ "context"
+ "time"
+
+ v2beta1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2beta1"
+ scheme "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/scheme"
+ v1 "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"
+)
+
+// ApisixRoutesGetter has a method to return a ApisixRouteInterface.
+// A group's client should implement this interface.
+type ApisixRoutesGetter interface {
+ ApisixRoutes(namespace string) ApisixRouteInterface
+}
+
+// ApisixRouteInterface has methods to work with ApisixRoute resources.
+type ApisixRouteInterface interface {
+ Create(ctx context.Context, apisixRoute *v2beta1.ApisixRoute, opts v1.CreateOptions) (*v2beta1.ApisixRoute, error)
+ Update(ctx context.Context, apisixRoute *v2beta1.ApisixRoute, opts v1.UpdateOptions) (*v2beta1.ApisixRoute, error)
+ UpdateStatus(ctx context.Context, apisixRoute *v2beta1.ApisixRoute, opts v1.UpdateOptions) (*v2beta1.ApisixRoute, 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) (*v2beta1.ApisixRoute, error)
+ List(ctx context.Context, opts v1.ListOptions) (*v2beta1.ApisixRouteList, 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 *v2beta1.ApisixRoute, err error)
+ ApisixRouteExpansion
+}
+
+// apisixRoutes implements ApisixRouteInterface
+type apisixRoutes struct {
+ client rest.Interface
+ ns string
+}
+
+// newApisixRoutes returns a ApisixRoutes
+func newApisixRoutes(c *ApisixV2beta1Client, namespace string) *apisixRoutes {
+ return &apisixRoutes{
+ client: c.RESTClient(),
+ ns: namespace,
+ }
+}
+
+// Get takes name of the apisixRoute, and returns the corresponding apisixRoute object, and an error if there is any.
+func (c *apisixRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.ApisixRoute, err error) {
+ result = &v2beta1.ApisixRoute{}
+ err = c.client.Get().
+ Namespace(c.ns).
+ Resource("apisixroutes").
+ Name(name).
+ VersionedParams(&options, scheme.ParameterCodec).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// List takes label and field selectors, and returns the list of ApisixRoutes that match those selectors.
+func (c *apisixRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.ApisixRouteList, err error) {
+ var timeout time.Duration
+ if opts.TimeoutSeconds != nil {
+ timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
+ }
+ result = &v2beta1.ApisixRouteList{}
+ err = c.client.Get().
+ Namespace(c.ns).
+ Resource("apisixroutes").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Watch returns a watch.Interface that watches the requested apisixRoutes.
+func (c *apisixRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
+ var timeout time.Duration
+ if opts.TimeoutSeconds != nil {
+ timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
+ }
+ opts.Watch = true
+ return c.client.Get().
+ Namespace(c.ns).
+ Resource("apisixroutes").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Watch(ctx)
+}
+
+// Create takes the representation of a apisixRoute and creates it. Returns the server's representation of the apisixRoute, and an error, if there is any.
+func (c *apisixRoutes) Create(ctx context.Context, apisixRoute *v2beta1.ApisixRoute, opts v1.CreateOptions) (result *v2beta1.ApisixRoute, err error) {
+ result = &v2beta1.ApisixRoute{}
+ err = c.client.Post().
+ Namespace(c.ns).
+ Resource("apisixroutes").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(apisixRoute).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Update takes the representation of a apisixRoute and updates it. Returns the server's representation of the apisixRoute, and an error, if there is any.
+func (c *apisixRoutes) Update(ctx context.Context, apisixRoute *v2beta1.ApisixRoute, opts v1.UpdateOptions) (result *v2beta1.ApisixRoute, err error) {
+ result = &v2beta1.ApisixRoute{}
+ err = c.client.Put().
+ Namespace(c.ns).
+ Resource("apisixroutes").
+ Name(apisixRoute.Name).
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(apisixRoute).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *apisixRoutes) UpdateStatus(ctx context.Context, apisixRoute *v2beta1.ApisixRoute, opts v1.UpdateOptions) (result *v2beta1.ApisixRoute, err error) {
+ result = &v2beta1.ApisixRoute{}
+ err = c.client.Put().
+ Namespace(c.ns).
+ Resource("apisixroutes").
+ Name(apisixRoute.Name).
+ SubResource("status").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(apisixRoute).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Delete takes name of the apisixRoute and deletes it. Returns an error if one occurs.
+func (c *apisixRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
+ return c.client.Delete().
+ Namespace(c.ns).
+ Resource("apisixroutes").
+ Name(name).
+ Body(&opts).
+ Do(ctx).
+ Error()
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *apisixRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
+ var timeout time.Duration
+ if listOpts.TimeoutSeconds != nil {
+ timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
+ }
+ return c.client.Delete().
+ Namespace(c.ns).
+ Resource("apisixroutes").
+ VersionedParams(&listOpts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Body(&opts).
+ Do(ctx).
+ Error()
+}
+
+// Patch applies the patch and returns the patched apisixRoute.
+func (c *apisixRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.ApisixRoute, err error) {
+ result = &v2beta1.ApisixRoute{}
+ err = c.client.Patch(pt).
+ Namespace(c.ns).
+ Resource("apisixroutes").
+ Name(name).
+ SubResource(subresources...).
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(data).
+ Do(ctx).
+ Into(result)
+ return
+}
diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/config_client.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/config_client.go
new file mode 100644
index 0000000..220b125
--- /dev/null
+++ b/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/config_client.go
@@ -0,0 +1,88 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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 v2beta1
+
+import (
+ v2beta1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2beta1"
+ "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/scheme"
+ rest "k8s.io/client-go/rest"
+)
+
+type ApisixV2beta1Interface interface {
+ RESTClient() rest.Interface
+ ApisixRoutesGetter
+}
+
+// ApisixV2beta1Client is used to interact with features provided by the apisix.apache.org group.
+type ApisixV2beta1Client struct {
+ restClient rest.Interface
+}
+
+func (c *ApisixV2beta1Client) ApisixRoutes(namespace string) ApisixRouteInterface {
+ return newApisixRoutes(c, namespace)
+}
+
+// NewForConfig creates a new ApisixV2beta1Client for the given config.
+func NewForConfig(c *rest.Config) (*ApisixV2beta1Client, error) {
+ config := *c
+ if err := setConfigDefaults(&config); err != nil {
+ return nil, err
+ }
+ client, err := rest.RESTClientFor(&config)
+ if err != nil {
+ return nil, err
+ }
+ return &ApisixV2beta1Client{client}, nil
+}
+
+// NewForConfigOrDie creates a new ApisixV2beta1Client for the given config and
+// panics if there is an error in the config.
+func NewForConfigOrDie(c *rest.Config) *ApisixV2beta1Client {
+ client, err := NewForConfig(c)
+ if err != nil {
+ panic(err)
+ }
+ return client
+}
+
+// New creates a new ApisixV2beta1Client for the given RESTClient.
+func New(c rest.Interface) *ApisixV2beta1Client {
+ return &ApisixV2beta1Client{c}
+}
+
+func setConfigDefaults(config *rest.Config) error {
+ gv := v2beta1.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 *ApisixV2beta1Client) RESTClient() rest.Interface {
+ if c == nil {
+ return nil
+ }
+ return c.restClient
+}
diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/doc.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/doc.go
new file mode 100644
index 0000000..4dc6082
--- /dev/null
+++ b/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/doc.go
@@ -0,0 +1,19 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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 v2beta1
diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/fake/doc.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/fake/doc.go
new file mode 100644
index 0000000..cfa1988
--- /dev/null
+++ b/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/fake/doc.go
@@ -0,0 +1,19 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/fake/fake_apisixroute.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/fake/fake_apisixroute.go
new file mode 100644
index 0000000..3fead80
--- /dev/null
+++ b/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/fake/fake_apisixroute.go
@@ -0,0 +1,141 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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 (
+ "context"
+
+ v2beta1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2beta1"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ labels "k8s.io/apimachinery/pkg/labels"
+ schema "k8s.io/apimachinery/pkg/runtime/schema"
+ types "k8s.io/apimachinery/pkg/types"
+ watch "k8s.io/apimachinery/pkg/watch"
+ testing "k8s.io/client-go/testing"
+)
+
+// FakeApisixRoutes implements ApisixRouteInterface
+type FakeApisixRoutes struct {
+ Fake *FakeApisixV2beta1
+ ns string
+}
+
+var apisixroutesResource = schema.GroupVersionResource{Group: "apisix.apache.org", Version: "v2beta1", Resource: "apisixroutes"}
+
+var apisixroutesKind = schema.GroupVersionKind{Group: "apisix.apache.org", Version: "v2beta1", Kind: "ApisixRoute"}
+
+// Get takes name of the apisixRoute, and returns the corresponding apisixRoute object, and an error if there is any.
+func (c *FakeApisixRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.ApisixRoute, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(apisixroutesResource, c.ns, name), &v2beta1.ApisixRoute{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2beta1.ApisixRoute), err
+}
+
+// List takes label and field selectors, and returns the list of ApisixRoutes that match those selectors.
+func (c *FakeApisixRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.ApisixRouteList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(apisixroutesResource, apisixroutesKind, c.ns, opts), &v2beta1.ApisixRouteList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v2beta1.ApisixRouteList{ListMeta: obj.(*v2beta1.ApisixRouteList).ListMeta}
+ for _, item := range obj.(*v2beta1.ApisixRouteList).Items {
+ if label.Matches(labels.Set(item.Labels)) {
+ list.Items = append(list.Items, item)
+ }
+ }
+ return list, err
+}
+
+// Watch returns a watch.Interface that watches the requested apisixRoutes.
+func (c *FakeApisixRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(apisixroutesResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a apisixRoute and creates it. Returns the server's representation of the apisixRoute, and an error, if there is any.
+func (c *FakeApisixRoutes) Create(ctx context.Context, apisixRoute *v2beta1.ApisixRoute, opts v1.CreateOptions) (result *v2beta1.ApisixRoute, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(apisixroutesResource, c.ns, apisixRoute), &v2beta1.ApisixRoute{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2beta1.ApisixRoute), err
+}
+
+// Update takes the representation of a apisixRoute and updates it. Returns the server's representation of the apisixRoute, and an error, if there is any.
+func (c *FakeApisixRoutes) Update(ctx context.Context, apisixRoute *v2beta1.ApisixRoute, opts v1.UpdateOptions) (result *v2beta1.ApisixRoute, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(apisixroutesResource, c.ns, apisixRoute), &v2beta1.ApisixRoute{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2beta1.ApisixRoute), 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 *FakeApisixRoutes) UpdateStatus(ctx context.Context, apisixRoute *v2beta1.ApisixRoute, opts v1.UpdateOptions) (*v2beta1.ApisixRoute, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(apisixroutesResource, "status", c.ns, apisixRoute), &v2beta1.ApisixRoute{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2beta1.ApisixRoute), err
+}
+
+// Delete takes name of the apisixRoute and deletes it. Returns an error if one occurs.
+func (c *FakeApisixRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteAction(apisixroutesResource, c.ns, name), &v2beta1.ApisixRoute{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeApisixRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(apisixroutesResource, c.ns, listOpts)
+
+ _, err := c.Fake.Invokes(action, &v2beta1.ApisixRouteList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched apisixRoute.
+func (c *FakeApisixRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.ApisixRoute, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(apisixroutesResource, c.ns, name, pt, data, subresources...), &v2beta1.ApisixRoute{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v2beta1.ApisixRoute), err
+}
diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/fake/fake_config_client.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/fake/fake_config_client.go
new file mode 100644
index 0000000..e5efef9
--- /dev/null
+++ b/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/fake/fake_config_client.go
@@ -0,0 +1,39 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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 (
+ v2beta1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeApisixV2beta1 struct {
+ *testing.Fake
+}
+
+func (c *FakeApisixV2beta1) ApisixRoutes(namespace string) v2beta1.ApisixRouteInterface {
+ return &FakeApisixRoutes{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeApisixV2beta1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
diff --git a/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/generated_expansion.go b/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/generated_expansion.go
new file mode 100644
index 0000000..0c6a094
--- /dev/null
+++ b/pkg/kube/apisix/client/clientset/versioned/typed/config/v2beta1/generated_expansion.go
@@ -0,0 +1,20 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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 v2beta1
+
+type ApisixRouteExpansion interface{}
diff --git a/pkg/kube/apisix/client/informers/externalversions/config/interface.go b/pkg/kube/apisix/client/informers/externalversions/config/interface.go
index 063da85..9e6cc23 100644
--- a/pkg/kube/apisix/client/informers/externalversions/config/interface.go
+++ b/pkg/kube/apisix/client/informers/externalversions/config/interface.go
@@ -20,6 +20,7 @@
import (
v1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/informers/externalversions/config/v1"
v2alpha1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/informers/externalversions/config/v2alpha1"
+ v2beta1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/informers/externalversions/config/v2beta1"
internalinterfaces "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/informers/externalversions/internalinterfaces"
)
@@ -29,6 +30,8 @@
V1() v1.Interface
// V2alpha1 provides access to shared informers for resources in V2alpha1.
V2alpha1() v2alpha1.Interface
+ // V2beta1 provides access to shared informers for resources in V2beta1.
+ V2beta1() v2beta1.Interface
}
type group struct {
@@ -51,3 +54,8 @@
func (g *group) V2alpha1() v2alpha1.Interface {
return v2alpha1.New(g.factory, g.namespace, g.tweakListOptions)
}
+
+// V2beta1 returns a new v2beta1.Interface.
+func (g *group) V2beta1() v2beta1.Interface {
+ return v2beta1.New(g.factory, g.namespace, g.tweakListOptions)
+}
diff --git a/pkg/kube/apisix/client/informers/externalversions/config/v2beta1/apisixroute.go b/pkg/kube/apisix/client/informers/externalversions/config/v2beta1/apisixroute.go
new file mode 100644
index 0000000..7be5683
--- /dev/null
+++ b/pkg/kube/apisix/client/informers/externalversions/config/v2beta1/apisixroute.go
@@ -0,0 +1,89 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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 v2beta1
+
+import (
+ "context"
+ time "time"
+
+ configv2beta1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2beta1"
+ versioned "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned"
+ internalinterfaces "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/informers/externalversions/internalinterfaces"
+ v2beta1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/listers/config/v2beta1"
+ v1 "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"
+)
+
+// ApisixRouteInformer provides access to a shared informer and lister for
+// ApisixRoutes.
+type ApisixRouteInformer interface {
+ Informer() cache.SharedIndexInformer
+ Lister() v2beta1.ApisixRouteLister
+}
+
+type apisixRouteInformer struct {
+ factory internalinterfaces.SharedInformerFactory
+ tweakListOptions internalinterfaces.TweakListOptionsFunc
+ namespace string
+}
+
+// NewApisixRouteInformer constructs a new informer for ApisixRoute type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewApisixRouteInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
+ return NewFilteredApisixRouteInformer(client, namespace, resyncPeriod, indexers, nil)
+}
+
+// NewFilteredApisixRouteInformer constructs a new informer for ApisixRoute type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewFilteredApisixRouteInformer(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) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.ApisixV2beta1().ApisixRoutes(namespace).List(context.TODO(), options)
+ },
+ WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.ApisixV2beta1().ApisixRoutes(namespace).Watch(context.TODO(), options)
+ },
+ },
+ &configv2beta1.ApisixRoute{},
+ resyncPeriod,
+ indexers,
+ )
+}
+
+func (f *apisixRouteInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
+ return NewFilteredApisixRouteInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
+}
+
+func (f *apisixRouteInformer) Informer() cache.SharedIndexInformer {
+ return f.factory.InformerFor(&configv2beta1.ApisixRoute{}, f.defaultInformer)
+}
+
+func (f *apisixRouteInformer) Lister() v2beta1.ApisixRouteLister {
+ return v2beta1.NewApisixRouteLister(f.Informer().GetIndexer())
+}
diff --git a/pkg/kube/apisix/client/informers/externalversions/config/v2beta1/interface.go b/pkg/kube/apisix/client/informers/externalversions/config/v2beta1/interface.go
new file mode 100644
index 0000000..12ddd95
--- /dev/null
+++ b/pkg/kube/apisix/client/informers/externalversions/config/v2beta1/interface.go
@@ -0,0 +1,44 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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 v2beta1
+
+import (
+ internalinterfaces "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/informers/externalversions/internalinterfaces"
+)
+
+// Interface provides access to all the informers in this group version.
+type Interface interface {
+ // ApisixRoutes returns a ApisixRouteInformer.
+ ApisixRoutes() ApisixRouteInformer
+}
+
+type version struct {
+ factory internalinterfaces.SharedInformerFactory
+ namespace string
+ tweakListOptions internalinterfaces.TweakListOptionsFunc
+}
+
+// New returns a new Interface.
+func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
+ return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
+}
+
+// ApisixRoutes returns a ApisixRouteInformer.
+func (v *version) ApisixRoutes() ApisixRouteInformer {
+ return &apisixRouteInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
+}
diff --git a/pkg/kube/apisix/client/informers/externalversions/generic.go b/pkg/kube/apisix/client/informers/externalversions/generic.go
index 480ec09..5f5469c 100644
--- a/pkg/kube/apisix/client/informers/externalversions/generic.go
+++ b/pkg/kube/apisix/client/informers/externalversions/generic.go
@@ -22,6 +22,7 @@
v1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1"
v2alpha1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2alpha1"
+ v2beta1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2beta1"
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
)
@@ -68,6 +69,10 @@
case v2alpha1.SchemeGroupVersion.WithResource("apisixroutes"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Apisix().V2alpha1().ApisixRoutes().Informer()}, nil
+ // Group=apisix.apache.org, Version=v2beta1
+ case v2beta1.SchemeGroupVersion.WithResource("apisixroutes"):
+ return &genericInformer{resource: resource.GroupResource(), informer: f.Apisix().V2beta1().ApisixRoutes().Informer()}, nil
+
}
return nil, fmt.Errorf("no informer found for %v", resource)
diff --git a/pkg/kube/apisix/client/listers/config/v2beta1/apisixroute.go b/pkg/kube/apisix/client/listers/config/v2beta1/apisixroute.go
new file mode 100644
index 0000000..aff9c07
--- /dev/null
+++ b/pkg/kube/apisix/client/listers/config/v2beta1/apisixroute.go
@@ -0,0 +1,98 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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 v2beta1
+
+import (
+ v2beta1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2beta1"
+ "k8s.io/apimachinery/pkg/api/errors"
+ "k8s.io/apimachinery/pkg/labels"
+ "k8s.io/client-go/tools/cache"
+)
+
+// ApisixRouteLister helps list ApisixRoutes.
+// All objects returned here must be treated as read-only.
+type ApisixRouteLister interface {
+ // List lists all ApisixRoutes in the indexer.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*v2beta1.ApisixRoute, err error)
+ // ApisixRoutes returns an object that can list and get ApisixRoutes.
+ ApisixRoutes(namespace string) ApisixRouteNamespaceLister
+ ApisixRouteListerExpansion
+}
+
+// apisixRouteLister implements the ApisixRouteLister interface.
+type apisixRouteLister struct {
+ indexer cache.Indexer
+}
+
+// NewApisixRouteLister returns a new ApisixRouteLister.
+func NewApisixRouteLister(indexer cache.Indexer) ApisixRouteLister {
+ return &apisixRouteLister{indexer: indexer}
+}
+
+// List lists all ApisixRoutes in the indexer.
+func (s *apisixRouteLister) List(selector labels.Selector) (ret []*v2beta1.ApisixRoute, err error) {
+ err = cache.ListAll(s.indexer, selector, func(m interface{}) {
+ ret = append(ret, m.(*v2beta1.ApisixRoute))
+ })
+ return ret, err
+}
+
+// ApisixRoutes returns an object that can list and get ApisixRoutes.
+func (s *apisixRouteLister) ApisixRoutes(namespace string) ApisixRouteNamespaceLister {
+ return apisixRouteNamespaceLister{indexer: s.indexer, namespace: namespace}
+}
+
+// ApisixRouteNamespaceLister helps list and get ApisixRoutes.
+// All objects returned here must be treated as read-only.
+type ApisixRouteNamespaceLister interface {
+ // List lists all ApisixRoutes in the indexer for a given namespace.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*v2beta1.ApisixRoute, err error)
+ // Get retrieves the ApisixRoute from the indexer for a given namespace and name.
+ // Objects returned here must be treated as read-only.
+ Get(name string) (*v2beta1.ApisixRoute, error)
+ ApisixRouteNamespaceListerExpansion
+}
+
+// apisixRouteNamespaceLister implements the ApisixRouteNamespaceLister
+// interface.
+type apisixRouteNamespaceLister struct {
+ indexer cache.Indexer
+ namespace string
+}
+
+// List lists all ApisixRoutes in the indexer for a given namespace.
+func (s apisixRouteNamespaceLister) List(selector labels.Selector) (ret []*v2beta1.ApisixRoute, err error) {
+ err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
+ ret = append(ret, m.(*v2beta1.ApisixRoute))
+ })
+ return ret, err
+}
+
+// Get retrieves the ApisixRoute from the indexer for a given namespace and name.
+func (s apisixRouteNamespaceLister) Get(name string) (*v2beta1.ApisixRoute, error) {
+ obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
+ if err != nil {
+ return nil, err
+ }
+ if !exists {
+ return nil, errors.NewNotFound(v2beta1.Resource("apisixroute"), name)
+ }
+ return obj.(*v2beta1.ApisixRoute), nil
+}
diff --git a/pkg/kube/apisix/client/listers/config/v2beta1/expansion_generated.go b/pkg/kube/apisix/client/listers/config/v2beta1/expansion_generated.go
new file mode 100644
index 0000000..de3ac04
--- /dev/null
+++ b/pkg/kube/apisix/client/listers/config/v2beta1/expansion_generated.go
@@ -0,0 +1,26 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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 v2beta1
+
+// ApisixRouteListerExpansion allows custom methods to be added to
+// ApisixRouteLister.
+type ApisixRouteListerExpansion interface{}
+
+// ApisixRouteNamespaceListerExpansion allows custom methods to be added to
+// ApisixRouteNamespaceLister.
+type ApisixRouteNamespaceListerExpansion interface{}
diff --git a/pkg/kube/apisix_route.go b/pkg/kube/apisix_route.go
index 0cd6bc5..b51a0d6 100644
--- a/pkg/kube/apisix_route.go
+++ b/pkg/kube/apisix_route.go
@@ -19,6 +19,7 @@
configv1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v1"
configv2alpha1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2alpha1"
+ configv2beta1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2beta1"
listersv1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/listers/config/v1"
listersv2alpha1 "github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/listers/config/v2alpha1"
)
@@ -26,8 +27,10 @@
const (
// ApisixRouteV1 represents the ApisixRoute in apisix.apache.org/v1 group version.
ApisixRouteV1 = "apisix.apache.org/v1"
- // ApisixRouteV2alpha1 represents the APisixRoute in apisix.apache.org/v2alpha1 group version
+ // ApisixRouteV2alpha1 represents the ApisixRoute in apisix.apache.org/v2alpha1 group version
ApisixRouteV2alpha1 = "apisix.apache.org/v2alpha1"
+ // ApisixRouteV2beta1 represents the ApisixRoute in apisix.apache.org/v2beta1 group version
+ ApisixRouteV2beta1 = "apisix.apache.org/v2beta1"
)
// ApisixRouteLister is an encapsulation for the lister of ApisixRoute,
@@ -52,11 +55,14 @@
// real ApisixRoute.
GroupVersion() string
// V1 returns the ApisixRoute in apisix.apache.org/v1, the real
- // ApisixRoute must be in this group version, or V1() will panic.
+ // ApisixRoute must be in this group version, otherwise will panic.
V1() *configv1.ApisixRoute
- // V2alpha1 returns the ApisixRoute in apisix.apache.org/v1alpha1, the real
- // ApisixRoute must be in this group version, or V2alpha1() will panic.
+ // V2alpha1 returns the ApisixRoute in apisix.apache.org/v2alpha1, the real
+ // ApisixRoute must be in this group version, otherwise will panic.
V2alpha1() *configv2alpha1.ApisixRoute
+ // V2beta1 returns the ApisixRoute in apisix.apache.org/v2beta1, the real
+ // ApisixRoute must be in this group version, otherwise will panic.
+ V2beta1() *configv2beta1.ApisixRoute
// ResourceVersion returns the the resource version field inside
// the real ApisixRoute.
ResourceVersion() string
@@ -74,6 +80,7 @@
groupVersion string
v1 *configv1.ApisixRoute
v2alpha1 *configv2alpha1.ApisixRoute
+ v2beta1 *configv2beta1.ApisixRoute
}
func (ar *apisixRoute) V1() *configv1.ApisixRoute {
@@ -90,6 +97,13 @@
return ar.v2alpha1
}
+func (ar *apisixRoute) V2beta1() *configv2beta1.ApisixRoute {
+ if ar.groupVersion != ApisixRouteV2beta1 {
+ panic("not a apisix.apache.org/v2beta1 ingress")
+ }
+ return ar.v2beta1
+}
+
func (ar *apisixRoute) GroupVersion() string {
return ar.groupVersion
}
diff --git a/samples/deploy/crd/v1beta1/ApisixRoute.yaml b/samples/deploy/crd/v1beta1/ApisixRoute.yaml
index 619213e..3b8a377 100644
--- a/samples/deploy/crd/v1beta1/ApisixRoute.yaml
+++ b/samples/deploy/crd/v1beta1/ApisixRoute.yaml
@@ -44,9 +44,13 @@
- name: v1
served: true
storage: false
+ deprecated: true
- name: v2alpha1
served: true
storage: true
+ - name: v2beta1
+ served: true
+ storage: false
scope: Namespaced
names:
plural: apisixroutes
@@ -66,6 +70,7 @@
anyOf:
- required: ["http"]
- required: ["tcp"]
+ - required: ["stream"]
properties:
http:
type: array
@@ -262,3 +267,43 @@
required:
- serviceName
- servicePort
+ stream:
+ type: array
+ minItems: 1
+ items:
+ type: object
+ required: [ "name", "match", "backend", "protocol" ]
+ properties:
+ "protocol":
+ type: string
+ enum: [ "TCP", "UDP" ]
+ name:
+ type: string
+ minLength: 1
+ match:
+ type: object
+ properties:
+ ingressPort:
+ type: integer
+ minimum: 1
+ maximum: 65535
+ required:
+ - ingressPort
+ backend:
+ type: object
+ properties:
+ serviceName:
+ type: string
+ minLength: 1
+ servicePort:
+ type: integer
+ minimum: 1
+ maximum: 65535
+ resolveGranualrity:
+ type: string
+ enum: [ "endpoint", "service" ]
+ subset:
+ type: string
+ required:
+ - serviceName
+ - servicePort
diff --git a/utils/update-codegen.sh b/utils/update-codegen.sh
index 851ba7c..e8b9103 100755
--- a/utils/update-codegen.sh
+++ b/utils/update-codegen.sh
@@ -31,7 +31,7 @@
bash "${SCRIPT_ROOT}"/generate-groups.sh "deepcopy,client,informer,lister" \
${PKG_NAME}/pkg/kube/apisix/client ${PKG_NAME}/pkg/kube/apisix/apis \
- config:v1,v2alpha1 ${PKG_NAME} \
+ config:v1,v2alpha1,v2beta1 ${PKG_NAME} \
--output-base "$GENERATED_ROOT" \
--go-header-file "${SCRIPT_ROOT}"/boilerplate.go.txt \
"$@"
diff --git a/utils/verify-codegen.sh b/utils/verify-codegen.sh
index 8463ccb..4e90023 100755
--- a/utils/verify-codegen.sh
+++ b/utils/verify-codegen.sh
@@ -49,7 +49,7 @@
bash "${SCRIPT_ROOT}"/generate-groups.sh "deepcopy,client,informer,lister" \
${PKG_NAME}/pkg/kube/apisix/client ${PKG_NAME}/pkg/kube/apisix/apis \
- config:v1,v2alpha1 ${PKG_NAME} \
+ config:v1,v2alpha1,v2beta1 ${PKG_NAME} \
--output-base "$GENERATED_ROOT" \
--go-header-file "${SCRIPT_ROOT}"/boilerplate.go.txt \
--verify-only || ret=$?