Merge pull request #1602 from benoitg31/main

Migrate istio VirtualService/DestinationRule to APIversion v1beta1 (current v1alpha3)
This commit is contained in:
Stefan Prodan
2024-03-26 10:26:30 +02:00
committed by GitHub
42 changed files with 395 additions and 395 deletions

View File

@@ -1,5 +1,5 @@
{{- if and (.Values.istio.enabled) (.Values.istio.gateway.enabled) }}
apiVersion: networking.istio.io/v1alpha3
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: {{ include "loadtester.fullname" . }}

View File

@@ -1,5 +1,5 @@
{{- if .Values.istio.enabled }}
apiVersion: networking.istio.io/v1alpha3
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: {{ include "loadtester.fullname" . }}

View File

@@ -600,7 +600,7 @@ spec:
For the above spec Flagger will generate the following virtual service:
```yaml
apiVersion: networking.istio.io/v1alpha3
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: frontend
@@ -653,7 +653,7 @@ spec:
For each destination in the virtual service a rule is generated:
```yaml
apiVersion: networking.istio.io/v1alpha3
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: frontend-primary
@@ -664,7 +664,7 @@ spec:
tls:
mode: DISABLE
---
apiVersion: networking.istio.io/v1alpha3
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: frontend-canary
@@ -751,7 +751,7 @@ spec:
Based on the above spec, Flagger will create the following virtual service:
```yaml
apiVersion: networking.istio.io/v1alpha3
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: backend
@@ -777,7 +777,7 @@ spec:
Therefore, the following virtual service forwards the traffic to `/podinfo` by the above delegate VirtualService.
```yaml
apiVersion: networking.istio.io/v1alpha3
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: frontend

View File

@@ -374,7 +374,7 @@ helm upgrade -i flagger-grafana flagger/grafana \
Expose Grafana through the public gateway by creating a virtual service \(replace `example.com` with your domain\):
```yaml
apiVersion: networking.istio.io/v1alpha3
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: grafana

View File

@@ -31,7 +31,7 @@ chmod +x ${CODEGEN_PKG}/generate-internal-groups.sh
${CODEGEN_PKG}/generate-groups.sh client,deepcopy,informer,lister \
github.com/fluxcd/flagger/pkg/client github.com/fluxcd/flagger/pkg/apis \
"flagger:v1beta1 appmesh:v1beta2 appmesh:v1beta1 istio:v1alpha3 smi:v1alpha1 smi:v1alpha2 smi:v1alpha3 gloo/gloo:v1 gloo/gateway:v1 projectcontour:v1 traefik:v1alpha1 kuma:v1alpha1 gatewayapi:v1beta1 gatewayapi:v1 keda:v1alpha1 apisix:v2" \
"flagger:v1beta1 appmesh:v1beta2 appmesh:v1beta1 istio:v1beta1 smi:v1alpha1 smi:v1alpha2 smi:v1alpha3 gloo/gloo:v1 gloo/gateway:v1 projectcontour:v1 traefik:v1alpha1 kuma:v1alpha1 gatewayapi:v1beta1 gatewayapi:v1 keda:v1alpha1 apisix:v2" \
--output-base "${TEMP_DIR}" \
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt

View File

@@ -21,7 +21,7 @@ import (
"time"
"github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1beta1"
istiov1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)
@@ -173,11 +173,11 @@ type CanaryService struct {
// TrafficPolicy attached to the generated Istio destination rules
// +optional
TrafficPolicy *istiov1alpha3.TrafficPolicy `json:"trafficPolicy,omitempty"`
TrafficPolicy *istiov1beta1.TrafficPolicy `json:"trafficPolicy,omitempty"`
// URI match conditions for the generated service
// +optional
Match []istiov1alpha3.HTTPMatchRequest `json:"match,omitempty"`
Match []istiov1beta1.HTTPMatchRequest `json:"match,omitempty"`
// Rewrite HTTP URIs for the generated service
// +optional
@@ -185,11 +185,11 @@ type CanaryService struct {
// Retries policy for the generated virtual service
// +optional
Retries *istiov1alpha3.HTTPRetry `json:"retries,omitempty"`
Retries *istiov1beta1.HTTPRetry `json:"retries,omitempty"`
// Headers operations for the generated Istio virtual service
// +optional
Headers *istiov1alpha3.Headers `json:"headers,omitempty"`
Headers *istiov1beta1.Headers `json:"headers,omitempty"`
// Mirror specifies the destination for request mirroring.
// Responses from this destination are dropped.
@@ -197,7 +197,7 @@ type CanaryService struct {
// Cross-Origin Resource Sharing policy for the generated Istio virtual service
// +optional
CorsPolicy *istiov1alpha3.CorsPolicy `json:"corsPolicy,omitempty"`
CorsPolicy *istiov1beta1.CorsPolicy `json:"corsPolicy,omitempty"`
// Mesh name of the generated App Mesh virtual nodes and virtual service
// +optional
@@ -275,7 +275,7 @@ type CanaryAnalysis struct {
// A/B testing HTTP header match conditions
// +optional
Match []istiov1alpha3.HTTPMatchRequest `json:"match,omitempty"`
Match []istiov1beta1.HTTPMatchRequest `json:"match,omitempty"`
// SessionAffinity represents the session affinity settings for a canary run.
// +optional
@@ -516,10 +516,10 @@ func (r *HTTPRewrite) GetType() string {
return string(v1beta1.FullPathHTTPPathModifier)
}
// GetIstioRewrite returns a istiov1alpha3.HTTPRewrite object.
func (s *CanaryService) GetIstioRewrite() *istiov1alpha3.HTTPRewrite {
// GetIstioRewrite returns a istiov1beta1.HTTPRewrite object.
func (s *CanaryService) GetIstioRewrite() *istiov1beta1.HTTPRewrite {
if s.Rewrite != nil {
return &istiov1alpha3.HTTPRewrite{
return &istiov1beta1.HTTPRewrite{
Authority: s.Rewrite.Authority,
Uri: s.Rewrite.Uri,
}

View File

@@ -23,7 +23,7 @@ package v1beta1
import (
gatewayapiv1beta1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1beta1"
v1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
v1 "k8s.io/api/core/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@@ -263,7 +263,7 @@ func (in *CanaryAnalysis) DeepCopyInto(out *CanaryAnalysis) {
}
if in.Match != nil {
in, out := &in.Match, &out.Match
*out = make([]v1alpha3.HTTPMatchRequest, len(*in))
*out = make([]istiov1beta1.HTTPMatchRequest, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
@@ -393,12 +393,12 @@ func (in *CanaryService) DeepCopyInto(out *CanaryService) {
}
if in.TrafficPolicy != nil {
in, out := &in.TrafficPolicy, &out.TrafficPolicy
*out = new(v1alpha3.TrafficPolicy)
*out = new(istiov1beta1.TrafficPolicy)
(*in).DeepCopyInto(*out)
}
if in.Match != nil {
in, out := &in.Match, &out.Match
*out = make([]v1alpha3.HTTPMatchRequest, len(*in))
*out = make([]istiov1beta1.HTTPMatchRequest, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
@@ -410,12 +410,12 @@ func (in *CanaryService) DeepCopyInto(out *CanaryService) {
}
if in.Retries != nil {
in, out := &in.Retries, &out.Retries
*out = new(v1alpha3.HTTPRetry)
*out = new(istiov1beta1.HTTPRetry)
**out = **in
}
if in.Headers != nil {
in, out := &in.Headers, &out.Headers
*out = new(v1alpha3.Headers)
*out = new(istiov1beta1.Headers)
(*in).DeepCopyInto(*out)
}
if in.Mirror != nil {
@@ -427,7 +427,7 @@ func (in *CanaryService) DeepCopyInto(out *CanaryService) {
}
if in.CorsPolicy != nil {
in, out := &in.CorsPolicy, &out.CorsPolicy
*out = new(v1alpha3.CorsPolicy)
*out = new(istiov1beta1.CorsPolicy)
(*in).DeepCopyInto(*out)
}
if in.Backends != nil {

View File

@@ -1,5 +1,5 @@
// proto: https://github.com/istio/api/blob/master/networking/v1alpha3/destination_rule.pb.go
package v1alpha3
// proto: https://github.com/istio/api/blob/master/networking/v1beta1/destination_rule.pb.go
package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -21,7 +21,7 @@ type DestinationRule struct {
// balancing pool. For example, a simple load balancing policy for the
// ratings service would look as follows:
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: DestinationRule
// metadata:
//
@@ -40,7 +40,7 @@ type DestinationRule struct {
// going to a subset named testversion that is composed of endpoints (e.g.,
// pods) with labels (version:v3).
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: DestinationRule
// metadata:
//
@@ -68,7 +68,7 @@ type DestinationRule struct {
// traffic to port 80, while uses a round robin load balancing setting for
// traffic to the port 9080.
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: DestinationRule
// metadata:
//
@@ -172,7 +172,7 @@ type PortTrafficPolicy struct {
// subset named testversion that is composed of endpoints (e.g., pods) with
// labels (version:v3).
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: DestinationRule
// metadata:
//
@@ -218,7 +218,7 @@ type Subset struct {
// For example, the following rule uses a round robin load balancing policy
// for all traffic going to the ratings service.
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: DestinationRule
// metadata:
//
@@ -235,7 +235,7 @@ type Subset struct {
// hashing-based load balancer for the same ratings service using the
// the User cookie as the hash key.
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: DestinationRule
// metadata:
// name: bookinfo-ratings
@@ -486,7 +486,7 @@ type HTTPCookie struct {
// For example, the following rule sets a limit of 100 connections to redis
// service called myredissrv with a connect timeout of 30ms
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: DestinationRule
// metadata:
//
@@ -563,7 +563,7 @@ type HTTPSettings struct {
// scanned every 5 mins, such that any host that fails 7 consecutive times
// with 5XX error code will be ejected for 15 minutes.
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: DestinationRule
// metadata:
//
@@ -652,7 +652,7 @@ type OutlierDetection struct {
// For example, the following rule configures a client to use mutual TLS
// for connections to upstream database cluster.
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: DestinationRule
// metadata:
//
@@ -671,7 +671,7 @@ type OutlierDetection struct {
// The following rule configures a client to use TLS when talking to a
// foreign service whose domain matches *.foo.com.
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: DestinationRule
// metadata:
//
@@ -687,7 +687,7 @@ type OutlierDetection struct {
// The following rule configures a client to use Istio mutual TLS when talking
// to rating services.
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: DestinationRule
// metadata:
//

View File

@@ -4,4 +4,4 @@
// +k8s:deepcopy-gen=package
// +groupName=networking.istio.io
package v1alpha3
package v1beta1

View File

@@ -1,4 +1,4 @@
package v1alpha3
package v1beta1
import (
"github.com/fluxcd/flagger/pkg/apis/istio"
@@ -8,7 +8,7 @@ import (
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: istio.GroupName, Version: "v1alpha3"}
var SchemeGroupVersion = schema.GroupVersion{Group: istio.GroupName, Version: "v1beta1"}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {

View File

@@ -1,5 +1,5 @@
// proto: https://github.com/istio/api/blob/master/networking/v1alpha3/virtual_service.proto
package v1alpha3
// proto: https://github.com/istio/api/blob/master/networking/v1beta1/virtual_service.proto
package v1beta1
import (
"github.com/fluxcd/flagger/pkg/apis/istio/common/v1alpha1"
@@ -31,7 +31,7 @@ type VirtualService struct {
// be rewritten to /newcatalog and sent to pods with label "version: v2".
//
// ```yaml
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: VirtualService
// metadata:
//
@@ -65,7 +65,7 @@ type VirtualService struct {
// `DestinationRule`.
//
// ```yaml
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: DestinationRule
// metadata:
//
@@ -156,7 +156,7 @@ type VirtualServiceSpec struct {
// some to subset v2, in a kubernetes environment.
//
// ```yaml
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: VirtualService
// metadata:
//
@@ -189,7 +189,7 @@ type VirtualServiceSpec struct {
// # And the associated DestinationRule
//
// ```yaml
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: DestinationRule
// metadata:
//
@@ -220,7 +220,7 @@ type VirtualServiceSpec struct {
// not have an impact in resolving the name of the productpage service.
//
// ```yaml
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: VirtualService
// metadata:
//
@@ -246,7 +246,7 @@ type VirtualServiceSpec struct {
// Service for wikipedia.org and set a timeout of 5s for http requests.
//
// ```yaml
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: ServiceEntry
// metadata:
//
@@ -263,7 +263,7 @@ type VirtualServiceSpec struct {
// protocol: HTTP
// resolution: DNS
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: VirtualService
// metadata:
//
@@ -403,7 +403,7 @@ type HeaderOperations struct {
// starts with /ratings/v2/ and the request contains a "cookie" with value
// "user=jason".
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: VirtualService
// metadata:
// name: ratings-route
@@ -565,7 +565,7 @@ type PortSelector struct {
// server on port 5555.
//
// ```yaml
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: VirtualService
// metadata:
//
@@ -636,7 +636,7 @@ type L4MatchAttributes struct {
// requests for /v1/getProductRatings API on the ratings service to
// /v1/bookRatings provided by the bookratings service.
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: VirtualService
// metadata:
// name: ratings-route
@@ -668,7 +668,7 @@ type HTTPRedirect struct {
// demonstrates how to rewrite the URL prefix for api call (/ratings) to
// ratings service before making the actual API call.
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: VirtualService
// metadata:
// name: ratings-route
@@ -700,7 +700,7 @@ type HTTPRewrite struct {
// calling ratings:v1 service, with a 2s timeout per retry attempt.
//
// ```yaml
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: VirtualService
// metadata:
//
@@ -747,7 +747,7 @@ type HTTPRetry struct {
// Access-Control-Allow-Credentials header to false. In addition, it only
// exposes X-Foo-bar header and sets an expiry period of 1 day.
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: VirtualService
// metadata:
// name: ratings-route
@@ -826,7 +826,7 @@ type HTTPFaultInjection struct {
// in 10% of the requests to the "v1" version of the "reviews"
// service from all pods with label env: prod
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: VirtualService
// metadata:
// name: reviews-route
@@ -868,7 +868,7 @@ type InjectDelay struct {
// pre-specified error code. The following example will return an HTTP
// 400 error code for 10% of the requests to the "ratings" service "v1".
//
// apiVersion: networking.istio.io/v1alpha3
// apiVersion: networking.istio.io/v1beta1
// kind: VirtualService
// metadata:
// name: ratings-route

View File

@@ -19,7 +19,7 @@ limitations under the License.
// Code generated by deepcopy-gen. DO NOT EDIT.
package v1alpha3
package v1beta1
import (
v1alpha1 "github.com/fluxcd/flagger/pkg/apis/istio/common/v1alpha1"

View File

@@ -30,7 +30,7 @@ import (
gatewayapiv1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gatewayapi/v1"
gatewayapiv1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gatewayapi/v1beta1"
gloov1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gloo/v1"
networkingv1alpha3 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/istio/v1alpha3"
networkingv1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/istio/v1beta1"
kedav1alpha1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/keda/v1alpha1"
kumav1alpha1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/kuma/v1alpha1"
projectcontourv1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/projectcontour/v1"
@@ -53,7 +53,7 @@ type Interface interface {
GatewayapiV1beta1() gatewayapiv1beta1.GatewayapiV1beta1Interface
GatewayapiV1() gatewayapiv1.GatewayapiV1Interface
GlooV1() gloov1.GlooV1Interface
NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface
NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface
KedaV1alpha1() kedav1alpha1.KedaV1alpha1Interface
KumaV1alpha1() kumav1alpha1.KumaV1alpha1Interface
ProjectcontourV1() projectcontourv1.ProjectcontourV1Interface
@@ -66,22 +66,22 @@ type Interface interface {
// Clientset contains the clients for groups.
type Clientset struct {
*discovery.DiscoveryClient
apisixV2 *apisixv2.ApisixV2Client
appmeshV1beta2 *appmeshv1beta2.AppmeshV1beta2Client
appmeshV1beta1 *appmeshv1beta1.AppmeshV1beta1Client
flaggerV1beta1 *flaggerv1beta1.FlaggerV1beta1Client
gatewayV1 *gatewayv1.GatewayV1Client
gatewayapiV1beta1 *gatewayapiv1beta1.GatewayapiV1beta1Client
gatewayapiV1 *gatewayapiv1.GatewayapiV1Client
glooV1 *gloov1.GlooV1Client
networkingV1alpha3 *networkingv1alpha3.NetworkingV1alpha3Client
kedaV1alpha1 *kedav1alpha1.KedaV1alpha1Client
kumaV1alpha1 *kumav1alpha1.KumaV1alpha1Client
projectcontourV1 *projectcontourv1.ProjectcontourV1Client
splitV1alpha1 *splitv1alpha1.SplitV1alpha1Client
splitV1alpha2 *splitv1alpha2.SplitV1alpha2Client
splitV1alpha3 *splitv1alpha3.SplitV1alpha3Client
traefikV1alpha1 *traefikv1alpha1.TraefikV1alpha1Client
apisixV2 *apisixv2.ApisixV2Client
appmeshV1beta2 *appmeshv1beta2.AppmeshV1beta2Client
appmeshV1beta1 *appmeshv1beta1.AppmeshV1beta1Client
flaggerV1beta1 *flaggerv1beta1.FlaggerV1beta1Client
gatewayV1 *gatewayv1.GatewayV1Client
gatewayapiV1beta1 *gatewayapiv1beta1.GatewayapiV1beta1Client
gatewayapiV1 *gatewayapiv1.GatewayapiV1Client
glooV1 *gloov1.GlooV1Client
networkingV1beta1 *networkingv1beta1.NetworkingV1beta1Client
kedaV1alpha1 *kedav1alpha1.KedaV1alpha1Client
kumaV1alpha1 *kumav1alpha1.KumaV1alpha1Client
projectcontourV1 *projectcontourv1.ProjectcontourV1Client
splitV1alpha1 *splitv1alpha1.SplitV1alpha1Client
splitV1alpha2 *splitv1alpha2.SplitV1alpha2Client
splitV1alpha3 *splitv1alpha3.SplitV1alpha3Client
traefikV1alpha1 *traefikv1alpha1.TraefikV1alpha1Client
}
// ApisixV2 retrieves the ApisixV2Client
@@ -124,9 +124,9 @@ func (c *Clientset) GlooV1() gloov1.GlooV1Interface {
return c.glooV1
}
// NetworkingV1alpha3 retrieves the NetworkingV1alpha3Client
func (c *Clientset) NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface {
return c.networkingV1alpha3
// NetworkingV1beta1 retrieves the NetworkingV1beta1Client
func (c *Clientset) NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface {
return c.networkingV1beta1
}
// KedaV1alpha1 retrieves the KedaV1alpha1Client
@@ -240,7 +240,7 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset,
if err != nil {
return nil, err
}
cs.networkingV1alpha3, err = networkingv1alpha3.NewForConfigAndClient(&configShallowCopy, httpClient)
cs.networkingV1beta1, err = networkingv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
}
@@ -301,7 +301,7 @@ func New(c rest.Interface) *Clientset {
cs.gatewayapiV1beta1 = gatewayapiv1beta1.New(c)
cs.gatewayapiV1 = gatewayapiv1.New(c)
cs.glooV1 = gloov1.New(c)
cs.networkingV1alpha3 = networkingv1alpha3.New(c)
cs.networkingV1beta1 = networkingv1beta1.New(c)
cs.kedaV1alpha1 = kedav1alpha1.New(c)
cs.kumaV1alpha1 = kumav1alpha1.New(c)
cs.projectcontourV1 = projectcontourv1.New(c)

View File

@@ -36,8 +36,8 @@ import (
fakegatewayapiv1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gatewayapi/v1beta1/fake"
gloov1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gloo/v1"
fakegloov1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gloo/v1/fake"
networkingv1alpha3 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/istio/v1alpha3"
fakenetworkingv1alpha3 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake"
networkingv1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/istio/v1beta1"
fakenetworkingv1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/istio/v1beta1/fake"
kedav1alpha1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/keda/v1alpha1"
fakekedav1alpha1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/keda/v1alpha1/fake"
kumav1alpha1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/kuma/v1alpha1"
@@ -149,9 +149,9 @@ func (c *Clientset) GlooV1() gloov1.GlooV1Interface {
return &fakegloov1.FakeGlooV1{Fake: &c.Fake}
}
// NetworkingV1alpha3 retrieves the NetworkingV1alpha3Client
func (c *Clientset) NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface {
return &fakenetworkingv1alpha3.FakeNetworkingV1alpha3{Fake: &c.Fake}
// NetworkingV1beta1 retrieves the NetworkingV1beta1Client
func (c *Clientset) NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface {
return &fakenetworkingv1beta1.FakeNetworkingV1beta1{Fake: &c.Fake}
}
// KedaV1alpha1 retrieves the KedaV1alpha1Client

View File

@@ -27,7 +27,7 @@ import (
gatewayapiv1beta1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1beta1"
gatewayv1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1"
gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/gloo/v1"
networkingv1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
networkingv1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
kedav1alpha1 "github.com/fluxcd/flagger/pkg/apis/keda/v1alpha1"
kumav1alpha1 "github.com/fluxcd/flagger/pkg/apis/kuma/v1alpha1"
projectcontourv1 "github.com/fluxcd/flagger/pkg/apis/projectcontour/v1"
@@ -54,7 +54,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{
gatewayapiv1beta1.AddToScheme,
gatewayapiv1.AddToScheme,
gloov1.AddToScheme,
networkingv1alpha3.AddToScheme,
networkingv1beta1.AddToScheme,
kedav1alpha1.AddToScheme,
kumav1alpha1.AddToScheme,
projectcontourv1.AddToScheme,

View File

@@ -27,7 +27,7 @@ import (
gatewayapiv1beta1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1beta1"
gatewayv1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1"
gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/gloo/v1"
networkingv1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
networkingv1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
kedav1alpha1 "github.com/fluxcd/flagger/pkg/apis/keda/v1alpha1"
kumav1alpha1 "github.com/fluxcd/flagger/pkg/apis/kuma/v1alpha1"
projectcontourv1 "github.com/fluxcd/flagger/pkg/apis/projectcontour/v1"
@@ -54,7 +54,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{
gatewayapiv1beta1.AddToScheme,
gatewayapiv1.AddToScheme,
gloov1.AddToScheme,
networkingv1alpha3.AddToScheme,
networkingv1beta1.AddToScheme,
kedav1alpha1.AddToScheme,
kumav1alpha1.AddToScheme,
projectcontourv1.AddToScheme,

View File

@@ -16,13 +16,13 @@ limitations under the License.
// Code generated by client-gen. DO NOT EDIT.
package v1alpha3
package v1beta1
import (
"context"
"time"
v1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
v1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
@@ -38,14 +38,14 @@ type DestinationRulesGetter interface {
// DestinationRuleInterface has methods to work with DestinationRule resources.
type DestinationRuleInterface interface {
Create(ctx context.Context, destinationRule *v1alpha3.DestinationRule, opts v1.CreateOptions) (*v1alpha3.DestinationRule, error)
Update(ctx context.Context, destinationRule *v1alpha3.DestinationRule, opts v1.UpdateOptions) (*v1alpha3.DestinationRule, error)
Create(ctx context.Context, destinationRule *v1beta1.DestinationRule, opts v1.CreateOptions) (*v1beta1.DestinationRule, error)
Update(ctx context.Context, destinationRule *v1beta1.DestinationRule, opts v1.UpdateOptions) (*v1beta1.DestinationRule, 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) (*v1alpha3.DestinationRule, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha3.DestinationRuleList, error)
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.DestinationRule, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.DestinationRuleList, 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 *v1alpha3.DestinationRule, err error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DestinationRule, err error)
DestinationRuleExpansion
}
@@ -56,7 +56,7 @@ type destinationRules struct {
}
// newDestinationRules returns a DestinationRules
func newDestinationRules(c *NetworkingV1alpha3Client, namespace string) *destinationRules {
func newDestinationRules(c *NetworkingV1beta1Client, namespace string) *destinationRules {
return &destinationRules{
client: c.RESTClient(),
ns: namespace,
@@ -64,8 +64,8 @@ func newDestinationRules(c *NetworkingV1alpha3Client, namespace string) *destina
}
// Get takes name of the destinationRule, and returns the corresponding destinationRule object, and an error if there is any.
func (c *destinationRules) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha3.DestinationRule, err error) {
result = &v1alpha3.DestinationRule{}
func (c *destinationRules) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DestinationRule, err error) {
result = &v1beta1.DestinationRule{}
err = c.client.Get().
Namespace(c.ns).
Resource("destinationrules").
@@ -77,12 +77,12 @@ func (c *destinationRules) Get(ctx context.Context, name string, options v1.GetO
}
// List takes label and field selectors, and returns the list of DestinationRules that match those selectors.
func (c *destinationRules) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha3.DestinationRuleList, err error) {
func (c *destinationRules) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DestinationRuleList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha3.DestinationRuleList{}
result = &v1beta1.DestinationRuleList{}
err = c.client.Get().
Namespace(c.ns).
Resource("destinationrules").
@@ -109,8 +109,8 @@ func (c *destinationRules) Watch(ctx context.Context, opts v1.ListOptions) (watc
}
// Create takes the representation of a destinationRule and creates it. Returns the server's representation of the destinationRule, and an error, if there is any.
func (c *destinationRules) Create(ctx context.Context, destinationRule *v1alpha3.DestinationRule, opts v1.CreateOptions) (result *v1alpha3.DestinationRule, err error) {
result = &v1alpha3.DestinationRule{}
func (c *destinationRules) Create(ctx context.Context, destinationRule *v1beta1.DestinationRule, opts v1.CreateOptions) (result *v1beta1.DestinationRule, err error) {
result = &v1beta1.DestinationRule{}
err = c.client.Post().
Namespace(c.ns).
Resource("destinationrules").
@@ -122,8 +122,8 @@ func (c *destinationRules) Create(ctx context.Context, destinationRule *v1alpha3
}
// Update takes the representation of a destinationRule and updates it. Returns the server's representation of the destinationRule, and an error, if there is any.
func (c *destinationRules) Update(ctx context.Context, destinationRule *v1alpha3.DestinationRule, opts v1.UpdateOptions) (result *v1alpha3.DestinationRule, err error) {
result = &v1alpha3.DestinationRule{}
func (c *destinationRules) Update(ctx context.Context, destinationRule *v1beta1.DestinationRule, opts v1.UpdateOptions) (result *v1beta1.DestinationRule, err error) {
result = &v1beta1.DestinationRule{}
err = c.client.Put().
Namespace(c.ns).
Resource("destinationrules").
@@ -163,8 +163,8 @@ func (c *destinationRules) DeleteCollection(ctx context.Context, opts v1.DeleteO
}
// Patch applies the patch and returns the patched destinationRule.
func (c *destinationRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha3.DestinationRule, err error) {
result = &v1alpha3.DestinationRule{}
func (c *destinationRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DestinationRule, err error) {
result = &v1beta1.DestinationRule{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("destinationrules").

View File

@@ -17,4 +17,4 @@ limitations under the License.
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1alpha3
package v1beta1

View File

@@ -21,7 +21,7 @@ package fake
import (
"context"
v1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
v1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
@@ -31,29 +31,29 @@ import (
// FakeDestinationRules implements DestinationRuleInterface
type FakeDestinationRules struct {
Fake *FakeNetworkingV1alpha3
Fake *FakeNetworkingV1beta1
ns string
}
var destinationrulesResource = v1alpha3.SchemeGroupVersion.WithResource("destinationrules")
var destinationrulesResource = v1beta1.SchemeGroupVersion.WithResource("destinationrules")
var destinationrulesKind = v1alpha3.SchemeGroupVersion.WithKind("DestinationRule")
var destinationrulesKind = v1beta1.SchemeGroupVersion.WithKind("DestinationRule")
// Get takes name of the destinationRule, and returns the corresponding destinationRule object, and an error if there is any.
func (c *FakeDestinationRules) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha3.DestinationRule, err error) {
func (c *FakeDestinationRules) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DestinationRule, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(destinationrulesResource, c.ns, name), &v1alpha3.DestinationRule{})
Invokes(testing.NewGetAction(destinationrulesResource, c.ns, name), &v1beta1.DestinationRule{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.DestinationRule), err
return obj.(*v1beta1.DestinationRule), err
}
// List takes label and field selectors, and returns the list of DestinationRules that match those selectors.
func (c *FakeDestinationRules) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha3.DestinationRuleList, err error) {
func (c *FakeDestinationRules) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DestinationRuleList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(destinationrulesResource, destinationrulesKind, c.ns, opts), &v1alpha3.DestinationRuleList{})
Invokes(testing.NewListAction(destinationrulesResource, destinationrulesKind, c.ns, opts), &v1beta1.DestinationRuleList{})
if obj == nil {
return nil, err
@@ -63,8 +63,8 @@ func (c *FakeDestinationRules) List(ctx context.Context, opts v1.ListOptions) (r
if label == nil {
label = labels.Everything()
}
list := &v1alpha3.DestinationRuleList{ListMeta: obj.(*v1alpha3.DestinationRuleList).ListMeta}
for _, item := range obj.(*v1alpha3.DestinationRuleList).Items {
list := &v1beta1.DestinationRuleList{ListMeta: obj.(*v1beta1.DestinationRuleList).ListMeta}
for _, item := range obj.(*v1beta1.DestinationRuleList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
@@ -80,31 +80,31 @@ func (c *FakeDestinationRules) Watch(ctx context.Context, opts v1.ListOptions) (
}
// Create takes the representation of a destinationRule and creates it. Returns the server's representation of the destinationRule, and an error, if there is any.
func (c *FakeDestinationRules) Create(ctx context.Context, destinationRule *v1alpha3.DestinationRule, opts v1.CreateOptions) (result *v1alpha3.DestinationRule, err error) {
func (c *FakeDestinationRules) Create(ctx context.Context, destinationRule *v1beta1.DestinationRule, opts v1.CreateOptions) (result *v1beta1.DestinationRule, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(destinationrulesResource, c.ns, destinationRule), &v1alpha3.DestinationRule{})
Invokes(testing.NewCreateAction(destinationrulesResource, c.ns, destinationRule), &v1beta1.DestinationRule{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.DestinationRule), err
return obj.(*v1beta1.DestinationRule), err
}
// Update takes the representation of a destinationRule and updates it. Returns the server's representation of the destinationRule, and an error, if there is any.
func (c *FakeDestinationRules) Update(ctx context.Context, destinationRule *v1alpha3.DestinationRule, opts v1.UpdateOptions) (result *v1alpha3.DestinationRule, err error) {
func (c *FakeDestinationRules) Update(ctx context.Context, destinationRule *v1beta1.DestinationRule, opts v1.UpdateOptions) (result *v1beta1.DestinationRule, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(destinationrulesResource, c.ns, destinationRule), &v1alpha3.DestinationRule{})
Invokes(testing.NewUpdateAction(destinationrulesResource, c.ns, destinationRule), &v1beta1.DestinationRule{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.DestinationRule), err
return obj.(*v1beta1.DestinationRule), err
}
// Delete takes name of the destinationRule and deletes it. Returns an error if one occurs.
func (c *FakeDestinationRules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(destinationrulesResource, c.ns, name, opts), &v1alpha3.DestinationRule{})
Invokes(testing.NewDeleteActionWithOptions(destinationrulesResource, c.ns, name, opts), &v1beta1.DestinationRule{})
return err
}
@@ -113,17 +113,17 @@ func (c *FakeDestinationRules) Delete(ctx context.Context, name string, opts v1.
func (c *FakeDestinationRules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(destinationrulesResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha3.DestinationRuleList{})
_, err := c.Fake.Invokes(action, &v1beta1.DestinationRuleList{})
return err
}
// Patch applies the patch and returns the patched destinationRule.
func (c *FakeDestinationRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha3.DestinationRule, err error) {
func (c *FakeDestinationRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DestinationRule, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(destinationrulesResource, c.ns, name, pt, data, subresources...), &v1alpha3.DestinationRule{})
Invokes(testing.NewPatchSubresourceAction(destinationrulesResource, c.ns, name, pt, data, subresources...), &v1beta1.DestinationRule{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.DestinationRule), err
return obj.(*v1beta1.DestinationRule), err
}

View File

@@ -19,26 +19,26 @@ limitations under the License.
package fake
import (
v1alpha3 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/istio/v1alpha3"
v1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/istio/v1beta1"
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)
type FakeNetworkingV1alpha3 struct {
type FakeNetworkingV1beta1 struct {
*testing.Fake
}
func (c *FakeNetworkingV1alpha3) DestinationRules(namespace string) v1alpha3.DestinationRuleInterface {
func (c *FakeNetworkingV1beta1) DestinationRules(namespace string) v1beta1.DestinationRuleInterface {
return &FakeDestinationRules{c, namespace}
}
func (c *FakeNetworkingV1alpha3) VirtualServices(namespace string) v1alpha3.VirtualServiceInterface {
func (c *FakeNetworkingV1beta1) VirtualServices(namespace string) v1beta1.VirtualServiceInterface {
return &FakeVirtualServices{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeNetworkingV1alpha3) RESTClient() rest.Interface {
func (c *FakeNetworkingV1beta1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@@ -21,7 +21,7 @@ package fake
import (
"context"
v1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
v1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
@@ -31,29 +31,29 @@ import (
// FakeVirtualServices implements VirtualServiceInterface
type FakeVirtualServices struct {
Fake *FakeNetworkingV1alpha3
Fake *FakeNetworkingV1beta1
ns string
}
var virtualservicesResource = v1alpha3.SchemeGroupVersion.WithResource("virtualservices")
var virtualservicesResource = v1beta1.SchemeGroupVersion.WithResource("virtualservices")
var virtualservicesKind = v1alpha3.SchemeGroupVersion.WithKind("VirtualService")
var virtualservicesKind = v1beta1.SchemeGroupVersion.WithKind("VirtualService")
// Get takes name of the virtualService, and returns the corresponding virtualService object, and an error if there is any.
func (c *FakeVirtualServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha3.VirtualService, err error) {
func (c *FakeVirtualServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VirtualService, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(virtualservicesResource, c.ns, name), &v1alpha3.VirtualService{})
Invokes(testing.NewGetAction(virtualservicesResource, c.ns, name), &v1beta1.VirtualService{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.VirtualService), err
return obj.(*v1beta1.VirtualService), err
}
// List takes label and field selectors, and returns the list of VirtualServices that match those selectors.
func (c *FakeVirtualServices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha3.VirtualServiceList, err error) {
func (c *FakeVirtualServices) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VirtualServiceList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(virtualservicesResource, virtualservicesKind, c.ns, opts), &v1alpha3.VirtualServiceList{})
Invokes(testing.NewListAction(virtualservicesResource, virtualservicesKind, c.ns, opts), &v1beta1.VirtualServiceList{})
if obj == nil {
return nil, err
@@ -63,8 +63,8 @@ func (c *FakeVirtualServices) List(ctx context.Context, opts v1.ListOptions) (re
if label == nil {
label = labels.Everything()
}
list := &v1alpha3.VirtualServiceList{ListMeta: obj.(*v1alpha3.VirtualServiceList).ListMeta}
for _, item := range obj.(*v1alpha3.VirtualServiceList).Items {
list := &v1beta1.VirtualServiceList{ListMeta: obj.(*v1beta1.VirtualServiceList).ListMeta}
for _, item := range obj.(*v1beta1.VirtualServiceList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
@@ -80,31 +80,31 @@ func (c *FakeVirtualServices) Watch(ctx context.Context, opts v1.ListOptions) (w
}
// Create takes the representation of a virtualService and creates it. Returns the server's representation of the virtualService, and an error, if there is any.
func (c *FakeVirtualServices) Create(ctx context.Context, virtualService *v1alpha3.VirtualService, opts v1.CreateOptions) (result *v1alpha3.VirtualService, err error) {
func (c *FakeVirtualServices) Create(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.CreateOptions) (result *v1beta1.VirtualService, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(virtualservicesResource, c.ns, virtualService), &v1alpha3.VirtualService{})
Invokes(testing.NewCreateAction(virtualservicesResource, c.ns, virtualService), &v1beta1.VirtualService{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.VirtualService), err
return obj.(*v1beta1.VirtualService), err
}
// Update takes the representation of a virtualService and updates it. Returns the server's representation of the virtualService, and an error, if there is any.
func (c *FakeVirtualServices) Update(ctx context.Context, virtualService *v1alpha3.VirtualService, opts v1.UpdateOptions) (result *v1alpha3.VirtualService, err error) {
func (c *FakeVirtualServices) Update(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.UpdateOptions) (result *v1beta1.VirtualService, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(virtualservicesResource, c.ns, virtualService), &v1alpha3.VirtualService{})
Invokes(testing.NewUpdateAction(virtualservicesResource, c.ns, virtualService), &v1beta1.VirtualService{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.VirtualService), err
return obj.(*v1beta1.VirtualService), err
}
// Delete takes name of the virtualService and deletes it. Returns an error if one occurs.
func (c *FakeVirtualServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(virtualservicesResource, c.ns, name, opts), &v1alpha3.VirtualService{})
Invokes(testing.NewDeleteActionWithOptions(virtualservicesResource, c.ns, name, opts), &v1beta1.VirtualService{})
return err
}
@@ -113,17 +113,17 @@ func (c *FakeVirtualServices) Delete(ctx context.Context, name string, opts v1.D
func (c *FakeVirtualServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(virtualservicesResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha3.VirtualServiceList{})
_, err := c.Fake.Invokes(action, &v1beta1.VirtualServiceList{})
return err
}
// Patch applies the patch and returns the patched virtualService.
func (c *FakeVirtualServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha3.VirtualService, err error) {
func (c *FakeVirtualServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VirtualService, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(virtualservicesResource, c.ns, name, pt, data, subresources...), &v1alpha3.VirtualService{})
Invokes(testing.NewPatchSubresourceAction(virtualservicesResource, c.ns, name, pt, data, subresources...), &v1beta1.VirtualService{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha3.VirtualService), err
return obj.(*v1beta1.VirtualService), err
}

View File

@@ -16,7 +16,7 @@ limitations under the License.
// Code generated by client-gen. DO NOT EDIT.
package v1alpha3
package v1beta1
type DestinationRuleExpansion interface{}

View File

@@ -16,39 +16,39 @@ limitations under the License.
// Code generated by client-gen. DO NOT EDIT.
package v1alpha3
package v1beta1
import (
"net/http"
v1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
v1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
"github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme"
rest "k8s.io/client-go/rest"
)
type NetworkingV1alpha3Interface interface {
type NetworkingV1beta1Interface interface {
RESTClient() rest.Interface
DestinationRulesGetter
VirtualServicesGetter
}
// NetworkingV1alpha3Client is used to interact with features provided by the networking.istio.io group.
type NetworkingV1alpha3Client struct {
// NetworkingV1beta1Client is used to interact with features provided by the networking.istio.io group.
type NetworkingV1beta1Client struct {
restClient rest.Interface
}
func (c *NetworkingV1alpha3Client) DestinationRules(namespace string) DestinationRuleInterface {
func (c *NetworkingV1beta1Client) DestinationRules(namespace string) DestinationRuleInterface {
return newDestinationRules(c, namespace)
}
func (c *NetworkingV1alpha3Client) VirtualServices(namespace string) VirtualServiceInterface {
func (c *NetworkingV1beta1Client) VirtualServices(namespace string) VirtualServiceInterface {
return newVirtualServices(c, namespace)
}
// NewForConfig creates a new NetworkingV1alpha3Client for the given config.
// NewForConfig creates a new NetworkingV1beta1Client for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
func NewForConfig(c *rest.Config) (*NetworkingV1alpha3Client, error) {
func NewForConfig(c *rest.Config) (*NetworkingV1beta1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
@@ -60,9 +60,9 @@ func NewForConfig(c *rest.Config) (*NetworkingV1alpha3Client, error) {
return NewForConfigAndClient(&config, httpClient)
}
// NewForConfigAndClient creates a new NetworkingV1alpha3Client for the given config and http client.
// NewForConfigAndClient creates a new NetworkingV1beta1Client for the given config and http client.
// Note the http client provided takes precedence over the configured transport values.
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*NetworkingV1alpha3Client, error) {
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*NetworkingV1beta1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
@@ -71,12 +71,12 @@ func NewForConfigAndClient(c *rest.Config, h *http.Client) (*NetworkingV1alpha3C
if err != nil {
return nil, err
}
return &NetworkingV1alpha3Client{client}, nil
return &NetworkingV1beta1Client{client}, nil
}
// NewForConfigOrDie creates a new NetworkingV1alpha3Client for the given config and
// NewForConfigOrDie creates a new NetworkingV1beta1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *NetworkingV1alpha3Client {
func NewForConfigOrDie(c *rest.Config) *NetworkingV1beta1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
@@ -84,13 +84,13 @@ func NewForConfigOrDie(c *rest.Config) *NetworkingV1alpha3Client {
return client
}
// New creates a new NetworkingV1alpha3Client for the given RESTClient.
func New(c rest.Interface) *NetworkingV1alpha3Client {
return &NetworkingV1alpha3Client{c}
// New creates a new NetworkingV1beta1Client for the given RESTClient.
func New(c rest.Interface) *NetworkingV1beta1Client {
return &NetworkingV1beta1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha3.SchemeGroupVersion
gv := v1beta1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
@@ -104,7 +104,7 @@ func setConfigDefaults(config *rest.Config) error {
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *NetworkingV1alpha3Client) RESTClient() rest.Interface {
func (c *NetworkingV1beta1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}

View File

@@ -16,13 +16,13 @@ limitations under the License.
// Code generated by client-gen. DO NOT EDIT.
package v1alpha3
package v1beta1
import (
"context"
"time"
v1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
v1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
@@ -38,14 +38,14 @@ type VirtualServicesGetter interface {
// VirtualServiceInterface has methods to work with VirtualService resources.
type VirtualServiceInterface interface {
Create(ctx context.Context, virtualService *v1alpha3.VirtualService, opts v1.CreateOptions) (*v1alpha3.VirtualService, error)
Update(ctx context.Context, virtualService *v1alpha3.VirtualService, opts v1.UpdateOptions) (*v1alpha3.VirtualService, error)
Create(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.CreateOptions) (*v1beta1.VirtualService, error)
Update(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.UpdateOptions) (*v1beta1.VirtualService, 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) (*v1alpha3.VirtualService, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha3.VirtualServiceList, error)
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.VirtualService, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.VirtualServiceList, 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 *v1alpha3.VirtualService, err error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VirtualService, err error)
VirtualServiceExpansion
}
@@ -56,7 +56,7 @@ type virtualServices struct {
}
// newVirtualServices returns a VirtualServices
func newVirtualServices(c *NetworkingV1alpha3Client, namespace string) *virtualServices {
func newVirtualServices(c *NetworkingV1beta1Client, namespace string) *virtualServices {
return &virtualServices{
client: c.RESTClient(),
ns: namespace,
@@ -64,8 +64,8 @@ func newVirtualServices(c *NetworkingV1alpha3Client, namespace string) *virtualS
}
// Get takes name of the virtualService, and returns the corresponding virtualService object, and an error if there is any.
func (c *virtualServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha3.VirtualService, err error) {
result = &v1alpha3.VirtualService{}
func (c *virtualServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VirtualService, err error) {
result = &v1beta1.VirtualService{}
err = c.client.Get().
Namespace(c.ns).
Resource("virtualservices").
@@ -77,12 +77,12 @@ func (c *virtualServices) Get(ctx context.Context, name string, options v1.GetOp
}
// List takes label and field selectors, and returns the list of VirtualServices that match those selectors.
func (c *virtualServices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha3.VirtualServiceList, err error) {
func (c *virtualServices) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VirtualServiceList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha3.VirtualServiceList{}
result = &v1beta1.VirtualServiceList{}
err = c.client.Get().
Namespace(c.ns).
Resource("virtualservices").
@@ -109,8 +109,8 @@ func (c *virtualServices) Watch(ctx context.Context, opts v1.ListOptions) (watch
}
// Create takes the representation of a virtualService and creates it. Returns the server's representation of the virtualService, and an error, if there is any.
func (c *virtualServices) Create(ctx context.Context, virtualService *v1alpha3.VirtualService, opts v1.CreateOptions) (result *v1alpha3.VirtualService, err error) {
result = &v1alpha3.VirtualService{}
func (c *virtualServices) Create(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.CreateOptions) (result *v1beta1.VirtualService, err error) {
result = &v1beta1.VirtualService{}
err = c.client.Post().
Namespace(c.ns).
Resource("virtualservices").
@@ -122,8 +122,8 @@ func (c *virtualServices) Create(ctx context.Context, virtualService *v1alpha3.V
}
// Update takes the representation of a virtualService and updates it. Returns the server's representation of the virtualService, and an error, if there is any.
func (c *virtualServices) Update(ctx context.Context, virtualService *v1alpha3.VirtualService, opts v1.UpdateOptions) (result *v1alpha3.VirtualService, err error) {
result = &v1alpha3.VirtualService{}
func (c *virtualServices) Update(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.UpdateOptions) (result *v1beta1.VirtualService, err error) {
result = &v1beta1.VirtualService{}
err = c.client.Put().
Namespace(c.ns).
Resource("virtualservices").
@@ -163,8 +163,8 @@ func (c *virtualServices) DeleteCollection(ctx context.Context, opts v1.DeleteOp
}
// Patch applies the patch and returns the patched virtualService.
func (c *virtualServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha3.VirtualService, err error) {
result = &v1alpha3.VirtualService{}
func (c *virtualServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VirtualService, err error) {
result = &v1beta1.VirtualService{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("virtualservices").

View File

@@ -29,13 +29,13 @@ import (
gatewayapiv1beta1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1beta1"
v1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1"
gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/gloo/v1"
v1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
v1alpha1 "github.com/fluxcd/flagger/pkg/apis/keda/v1alpha1"
kumav1alpha1 "github.com/fluxcd/flagger/pkg/apis/kuma/v1alpha1"
projectcontourv1 "github.com/fluxcd/flagger/pkg/apis/projectcontour/v1"
smiv1alpha1 "github.com/fluxcd/flagger/pkg/apis/smi/v1alpha1"
v1alpha2 "github.com/fluxcd/flagger/pkg/apis/smi/v1alpha2"
smiv1alpha3 "github.com/fluxcd/flagger/pkg/apis/smi/v1alpha3"
v1alpha3 "github.com/fluxcd/flagger/pkg/apis/smi/v1alpha3"
traefikv1alpha1 "github.com/fluxcd/flagger/pkg/apis/traefik/v1alpha1"
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
@@ -119,11 +119,11 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
case kumav1alpha1.SchemeGroupVersion.WithResource("trafficroutes"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kuma().V1alpha1().TrafficRoutes().Informer()}, nil
// Group=networking.istio.io, Version=v1alpha3
case v1alpha3.SchemeGroupVersion.WithResource("destinationrules"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().DestinationRules().Informer()}, nil
case v1alpha3.SchemeGroupVersion.WithResource("virtualservices"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().VirtualServices().Informer()}, nil
// Group=networking.istio.io, Version=v1beta1
case istiov1beta1.SchemeGroupVersion.WithResource("destinationrules"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().DestinationRules().Informer()}, nil
case istiov1beta1.SchemeGroupVersion.WithResource("virtualservices"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().VirtualServices().Informer()}, nil
// Group=projectcontour.io, Version=v1
case projectcontourv1.SchemeGroupVersion.WithResource("httpproxies"):
@@ -138,7 +138,7 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Split().V1alpha2().TrafficSplits().Informer()}, nil
// Group=split.smi-spec.io, Version=v1alpha3
case smiv1alpha3.SchemeGroupVersion.WithResource("trafficsplits"):
case v1alpha3.SchemeGroupVersion.WithResource("trafficsplits"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Split().V1alpha3().TrafficSplits().Informer()}, nil
// Group=traefik.containo.us, Version=v1alpha1

View File

@@ -20,13 +20,13 @@ package istio
import (
internalinterfaces "github.com/fluxcd/flagger/pkg/client/informers/externalversions/internalinterfaces"
v1alpha3 "github.com/fluxcd/flagger/pkg/client/informers/externalversions/istio/v1alpha3"
v1beta1 "github.com/fluxcd/flagger/pkg/client/informers/externalversions/istio/v1beta1"
)
// Interface provides access to each of this group's versions.
type Interface interface {
// V1alpha3 provides access to shared informers for resources in V1alpha3.
V1alpha3() v1alpha3.Interface
// V1beta1 provides access to shared informers for resources in V1beta1.
V1beta1() v1beta1.Interface
}
type group struct {
@@ -40,7 +40,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// V1alpha3 returns a new v1alpha3.Interface.
func (g *group) V1alpha3() v1alpha3.Interface {
return v1alpha3.New(g.factory, g.namespace, g.tweakListOptions)
// V1beta1 returns a new v1beta1.Interface.
func (g *group) V1beta1() v1beta1.Interface {
return v1beta1.New(g.factory, g.namespace, g.tweakListOptions)
}

View File

@@ -16,16 +16,16 @@ limitations under the License.
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha3
package v1beta1
import (
"context"
time "time"
istiov1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
versioned "github.com/fluxcd/flagger/pkg/client/clientset/versioned"
internalinterfaces "github.com/fluxcd/flagger/pkg/client/informers/externalversions/internalinterfaces"
v1alpha3 "github.com/fluxcd/flagger/pkg/client/listers/istio/v1alpha3"
v1beta1 "github.com/fluxcd/flagger/pkg/client/listers/istio/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
@@ -36,7 +36,7 @@ import (
// DestinationRules.
type DestinationRuleInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha3.DestinationRuleLister
Lister() v1beta1.DestinationRuleLister
}
type destinationRuleInformer struct {
@@ -62,16 +62,16 @@ func NewFilteredDestinationRuleInformer(client versioned.Interface, namespace st
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkingV1alpha3().DestinationRules(namespace).List(context.TODO(), options)
return client.NetworkingV1beta1().DestinationRules(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkingV1alpha3().DestinationRules(namespace).Watch(context.TODO(), options)
return client.NetworkingV1beta1().DestinationRules(namespace).Watch(context.TODO(), options)
},
},
&istiov1alpha3.DestinationRule{},
&istiov1beta1.DestinationRule{},
resyncPeriod,
indexers,
)
@@ -82,9 +82,9 @@ func (f *destinationRuleInformer) defaultInformer(client versioned.Interface, re
}
func (f *destinationRuleInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&istiov1alpha3.DestinationRule{}, f.defaultInformer)
return f.factory.InformerFor(&istiov1beta1.DestinationRule{}, f.defaultInformer)
}
func (f *destinationRuleInformer) Lister() v1alpha3.DestinationRuleLister {
return v1alpha3.NewDestinationRuleLister(f.Informer().GetIndexer())
func (f *destinationRuleInformer) Lister() v1beta1.DestinationRuleLister {
return v1beta1.NewDestinationRuleLister(f.Informer().GetIndexer())
}

View File

@@ -16,7 +16,7 @@ limitations under the License.
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha3
package v1beta1
import (
internalinterfaces "github.com/fluxcd/flagger/pkg/client/informers/externalversions/internalinterfaces"

View File

@@ -16,16 +16,16 @@ limitations under the License.
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha3
package v1beta1
import (
"context"
time "time"
istiov1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
versioned "github.com/fluxcd/flagger/pkg/client/clientset/versioned"
internalinterfaces "github.com/fluxcd/flagger/pkg/client/informers/externalversions/internalinterfaces"
v1alpha3 "github.com/fluxcd/flagger/pkg/client/listers/istio/v1alpha3"
v1beta1 "github.com/fluxcd/flagger/pkg/client/listers/istio/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
@@ -36,7 +36,7 @@ import (
// VirtualServices.
type VirtualServiceInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha3.VirtualServiceLister
Lister() v1beta1.VirtualServiceLister
}
type virtualServiceInformer struct {
@@ -62,16 +62,16 @@ func NewFilteredVirtualServiceInformer(client versioned.Interface, namespace str
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkingV1alpha3().VirtualServices(namespace).List(context.TODO(), options)
return client.NetworkingV1beta1().VirtualServices(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkingV1alpha3().VirtualServices(namespace).Watch(context.TODO(), options)
return client.NetworkingV1beta1().VirtualServices(namespace).Watch(context.TODO(), options)
},
},
&istiov1alpha3.VirtualService{},
&istiov1beta1.VirtualService{},
resyncPeriod,
indexers,
)
@@ -82,9 +82,9 @@ func (f *virtualServiceInformer) defaultInformer(client versioned.Interface, res
}
func (f *virtualServiceInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&istiov1alpha3.VirtualService{}, f.defaultInformer)
return f.factory.InformerFor(&istiov1beta1.VirtualService{}, f.defaultInformer)
}
func (f *virtualServiceInformer) Lister() v1alpha3.VirtualServiceLister {
return v1alpha3.NewVirtualServiceLister(f.Informer().GetIndexer())
func (f *virtualServiceInformer) Lister() v1beta1.VirtualServiceLister {
return v1beta1.NewVirtualServiceLister(f.Informer().GetIndexer())
}

View File

@@ -16,10 +16,10 @@ limitations under the License.
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha3
package v1beta1
import (
v1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
v1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
@@ -30,7 +30,7 @@ import (
type DestinationRuleLister interface {
// List lists all DestinationRules in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha3.DestinationRule, err error)
List(selector labels.Selector) (ret []*v1beta1.DestinationRule, err error)
// DestinationRules returns an object that can list and get DestinationRules.
DestinationRules(namespace string) DestinationRuleNamespaceLister
DestinationRuleListerExpansion
@@ -47,9 +47,9 @@ func NewDestinationRuleLister(indexer cache.Indexer) DestinationRuleLister {
}
// List lists all DestinationRules in the indexer.
func (s *destinationRuleLister) List(selector labels.Selector) (ret []*v1alpha3.DestinationRule, err error) {
func (s *destinationRuleLister) List(selector labels.Selector) (ret []*v1beta1.DestinationRule, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha3.DestinationRule))
ret = append(ret, m.(*v1beta1.DestinationRule))
})
return ret, err
}
@@ -64,10 +64,10 @@ func (s *destinationRuleLister) DestinationRules(namespace string) DestinationRu
type DestinationRuleNamespaceLister interface {
// List lists all DestinationRules in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha3.DestinationRule, err error)
List(selector labels.Selector) (ret []*v1beta1.DestinationRule, err error)
// Get retrieves the DestinationRule from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1alpha3.DestinationRule, error)
Get(name string) (*v1beta1.DestinationRule, error)
DestinationRuleNamespaceListerExpansion
}
@@ -79,21 +79,21 @@ type destinationRuleNamespaceLister struct {
}
// List lists all DestinationRules in the indexer for a given namespace.
func (s destinationRuleNamespaceLister) List(selector labels.Selector) (ret []*v1alpha3.DestinationRule, err error) {
func (s destinationRuleNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.DestinationRule, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha3.DestinationRule))
ret = append(ret, m.(*v1beta1.DestinationRule))
})
return ret, err
}
// Get retrieves the DestinationRule from the indexer for a given namespace and name.
func (s destinationRuleNamespaceLister) Get(name string) (*v1alpha3.DestinationRule, error) {
func (s destinationRuleNamespaceLister) Get(name string) (*v1beta1.DestinationRule, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha3.Resource("destinationrule"), name)
return nil, errors.NewNotFound(v1beta1.Resource("destinationrule"), name)
}
return obj.(*v1alpha3.DestinationRule), nil
return obj.(*v1beta1.DestinationRule), nil
}

View File

@@ -16,7 +16,7 @@ limitations under the License.
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha3
package v1beta1
// DestinationRuleListerExpansion allows custom methods to be added to
// DestinationRuleLister.

View File

@@ -16,10 +16,10 @@ limitations under the License.
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha3
package v1beta1
import (
v1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
v1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
@@ -30,7 +30,7 @@ import (
type VirtualServiceLister interface {
// List lists all VirtualServices in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha3.VirtualService, err error)
List(selector labels.Selector) (ret []*v1beta1.VirtualService, err error)
// VirtualServices returns an object that can list and get VirtualServices.
VirtualServices(namespace string) VirtualServiceNamespaceLister
VirtualServiceListerExpansion
@@ -47,9 +47,9 @@ func NewVirtualServiceLister(indexer cache.Indexer) VirtualServiceLister {
}
// List lists all VirtualServices in the indexer.
func (s *virtualServiceLister) List(selector labels.Selector) (ret []*v1alpha3.VirtualService, err error) {
func (s *virtualServiceLister) List(selector labels.Selector) (ret []*v1beta1.VirtualService, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha3.VirtualService))
ret = append(ret, m.(*v1beta1.VirtualService))
})
return ret, err
}
@@ -64,10 +64,10 @@ func (s *virtualServiceLister) VirtualServices(namespace string) VirtualServiceN
type VirtualServiceNamespaceLister interface {
// List lists all VirtualServices in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha3.VirtualService, err error)
List(selector labels.Selector) (ret []*v1beta1.VirtualService, err error)
// Get retrieves the VirtualService from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1alpha3.VirtualService, error)
Get(name string) (*v1beta1.VirtualService, error)
VirtualServiceNamespaceListerExpansion
}
@@ -79,21 +79,21 @@ type virtualServiceNamespaceLister struct {
}
// List lists all VirtualServices in the indexer for a given namespace.
func (s virtualServiceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha3.VirtualService, err error) {
func (s virtualServiceNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.VirtualService, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha3.VirtualService))
ret = append(ret, m.(*v1beta1.VirtualService))
})
return ret, err
}
// Get retrieves the VirtualService from the indexer for a given namespace and name.
func (s virtualServiceNamespaceLister) Get(name string) (*v1alpha3.VirtualService, error) {
func (s virtualServiceNamespaceLister) Get(name string) (*v1beta1.VirtualService, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha3.Resource("virtualservice"), name)
return nil, errors.NewNotFound(v1beta1.Resource("virtualservice"), name)
}
return obj.(*v1alpha3.VirtualService), nil
return obj.(*v1beta1.VirtualService), nil
}

View File

@@ -32,7 +32,7 @@ import (
flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1"
istiov1alpha1 "github.com/fluxcd/flagger/pkg/apis/istio/common/v1alpha1"
istiov1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
"github.com/fluxcd/flagger/pkg/canary"
clientset "github.com/fluxcd/flagger/pkg/client/clientset/versioned"
fakeFlagger "github.com/fluxcd/flagger/pkg/client/clientset/versioned/fake"
@@ -327,7 +327,7 @@ func newDaemonSetTestCanaryAB() *flaggerv1.Canary {
}, Analysis: &flaggerv1.CanaryAnalysis{
Threshold: 10,
Iterations: 10,
Match: []istiov1alpha3.HTTPMatchRequest{
Match: []istiov1beta1.HTTPMatchRequest{
{
Headers: map[string]istiov1alpha1.StringMatch{
"x-user-type": {

View File

@@ -37,7 +37,7 @@ import (
flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1"
istiov1alpha1 "github.com/fluxcd/flagger/pkg/apis/istio/common/v1alpha1"
istiov1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
"github.com/fluxcd/flagger/pkg/canary"
clientset "github.com/fluxcd/flagger/pkg/client/clientset/versioned"
fakeFlagger "github.com/fluxcd/flagger/pkg/client/clientset/versioned/fake"
@@ -367,7 +367,7 @@ func newDeploymentTestCanaryAB() *flaggerv1.Canary {
}, Analysis: &flaggerv1.CanaryAnalysis{
Threshold: 10,
Iterations: 10,
Match: []istiov1alpha3.HTTPMatchRequest{
Match: []istiov1beta1.HTTPMatchRequest{
{
Headers: map[string]istiov1alpha1.StringMatch{
"x-user-type": {

View File

@@ -25,7 +25,7 @@ import (
flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1"
v1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1"
"github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1beta1"
"github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
clientset "github.com/fluxcd/flagger/pkg/client/clientset/versioned"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
@@ -532,7 +532,7 @@ func (gwr *GatewayAPIRouter) getSessionAffinityRouteRules(canary *flaggerv1.Cana
return []v1.HTTPRouteRule{stickyRouteRule, *weightedRouteRule}, nil
}
func (gwr *GatewayAPIRouter) mapRouteMatches(requestMatches []v1alpha3.HTTPMatchRequest) ([]v1.HTTPRouteMatch, error) {
func (gwr *GatewayAPIRouter) mapRouteMatches(requestMatches []istiov1beta1.HTTPMatchRequest) ([]v1.HTTPRouteMatch, error) {
matches := []v1.HTTPRouteMatch{}
for _, requestMatch := range requestMatches {

View File

@@ -24,7 +24,7 @@ import (
flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1"
"github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1beta1"
"github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
clientset "github.com/fluxcd/flagger/pkg/client/clientset/versioned"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
@@ -493,7 +493,7 @@ func (gwr *GatewayAPIV1Beta1Router) getSessionAffinityRouteRules(canary *flagger
return []v1beta1.HTTPRouteRule{stickyRouteRule, *weightedRouteRule}, nil
}
func (gwr *GatewayAPIV1Beta1Router) mapRouteMatches(requestMatches []v1alpha3.HTTPMatchRequest) ([]v1beta1.HTTPRouteMatch, error) {
func (gwr *GatewayAPIV1Beta1Router) mapRouteMatches(requestMatches []istiov1beta1.HTTPMatchRequest) ([]v1beta1.HTTPRouteMatch, error) {
matches := []v1beta1.HTTPRouteMatch{}
for _, requestMatch := range requestMatches {

View File

@@ -27,7 +27,7 @@ import (
flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1"
istiov1alpha1 "github.com/fluxcd/flagger/pkg/apis/istio/common/v1alpha1"
istiov1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
)
func TestIngressRouter_Reconcile(t *testing.T) {
@@ -116,7 +116,7 @@ func TestIngressRouter_ABTest(t *testing.T) {
{
makeCanary: func() *flaggerv1.Canary {
mocks.ingressCanary.Spec.Analysis.Iterations = 1
mocks.ingressCanary.Spec.Analysis.Match = []istiov1alpha3.HTTPMatchRequest{
mocks.ingressCanary.Spec.Analysis.Match = []istiov1beta1.HTTPMatchRequest{
{
Headers: map[string]istiov1alpha1.StringMatch{
"x-user-type": {
@@ -133,7 +133,7 @@ func TestIngressRouter_ABTest(t *testing.T) {
{
makeCanary: func() *flaggerv1.Canary {
mocks.ingressCanary.Spec.Analysis.Iterations = 1
mocks.ingressCanary.Spec.Analysis.Match = []istiov1alpha3.HTTPMatchRequest{
mocks.ingressCanary.Spec.Analysis.Match = []istiov1beta1.HTTPMatchRequest{
{
Headers: map[string]istiov1alpha1.StringMatch{
"x-user-type": {
@@ -150,7 +150,7 @@ func TestIngressRouter_ABTest(t *testing.T) {
{
makeCanary: func() *flaggerv1.Canary {
mocks.ingressCanary.Spec.Analysis.Iterations = 1
mocks.ingressCanary.Spec.Analysis.Match = []istiov1alpha3.HTTPMatchRequest{
mocks.ingressCanary.Spec.Analysis.Match = []istiov1beta1.HTTPMatchRequest{
{
Headers: map[string]istiov1alpha1.StringMatch{
"cookie": {

View File

@@ -34,7 +34,7 @@ import (
flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1"
istiov1alpha1 "github.com/fluxcd/flagger/pkg/apis/istio/common/v1alpha1"
istiov1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
clientset "github.com/fluxcd/flagger/pkg/client/clientset/versioned"
)
@@ -73,15 +73,15 @@ func (ir *IstioRouter) Reconcile(canary *flaggerv1.Canary) error {
}
func (ir *IstioRouter) reconcileDestinationRule(canary *flaggerv1.Canary, name string) error {
newSpec := istiov1alpha3.DestinationRuleSpec{
newSpec := istiov1beta1.DestinationRuleSpec{
Host: name,
TrafficPolicy: canary.Spec.Service.TrafficPolicy,
}
destinationRule, err := ir.istioClient.NetworkingV1alpha3().DestinationRules(canary.Namespace).Get(context.TODO(), name, metav1.GetOptions{})
destinationRule, err := ir.istioClient.NetworkingV1beta1().DestinationRules(canary.Namespace).Get(context.TODO(), name, metav1.GetOptions{})
// insert
if errors.IsNotFound(err) {
destinationRule = &istiov1alpha3.DestinationRule{
destinationRule = &istiov1beta1.DestinationRule{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: canary.Namespace,
@@ -97,7 +97,7 @@ func (ir *IstioRouter) reconcileDestinationRule(canary *flaggerv1.Canary, name s
}),
}
}
_, err = ir.istioClient.NetworkingV1alpha3().DestinationRules(canary.Namespace).Create(context.TODO(), destinationRule, metav1.CreateOptions{})
_, err = ir.istioClient.NetworkingV1beta1().DestinationRules(canary.Namespace).Create(context.TODO(), destinationRule, metav1.CreateOptions{})
if err != nil {
return fmt.Errorf("DestinationRule %s.%s create error: %w", name, canary.Namespace, err)
}
@@ -113,7 +113,7 @@ func (ir *IstioRouter) reconcileDestinationRule(canary *flaggerv1.Canary, name s
if diff := cmp.Diff(newSpec, destinationRule.Spec); diff != "" {
clone := destinationRule.DeepCopy()
clone.Spec = newSpec
_, err = ir.istioClient.NetworkingV1alpha3().DestinationRules(canary.Namespace).Update(context.TODO(), clone, metav1.UpdateOptions{})
_, err = ir.istioClient.NetworkingV1beta1().DestinationRules(canary.Namespace).Update(context.TODO(), clone, metav1.UpdateOptions{})
if err != nil {
return fmt.Errorf("DestinationRule %s.%s update error: %w", name, canary.Namespace, err)
}
@@ -131,10 +131,10 @@ func isTcp(canary *flaggerv1.Canary) bool {
}
// map canary.spec.service.match into L4Match
func canaryToL4Match(canary *flaggerv1.Canary) []istiov1alpha3.L4MatchAttributes {
var match []istiov1alpha3.L4MatchAttributes
func canaryToL4Match(canary *flaggerv1.Canary) []istiov1beta1.L4MatchAttributes {
var match []istiov1beta1.L4MatchAttributes
for _, m := range canary.Spec.Service.Match {
match = append(match, istiov1alpha3.L4MatchAttributes{
match = append(match, istiov1beta1.L4MatchAttributes{
Port: int(m.Port),
})
}
@@ -181,7 +181,7 @@ func (ir *IstioRouter) reconcileVirtualService(canary *flaggerv1.Canary) error {
}
// create destinations with primary weight 100% and canary weight 0%
canaryRoute := []istiov1alpha3.HTTPRouteDestination{
canaryRoute := []istiov1beta1.HTTPRouteDestination{
makeDestination(canary, primaryName, 100),
makeDestination(canary, canaryName, 0),
}
@@ -192,13 +192,13 @@ func (ir *IstioRouter) reconcileVirtualService(canary *flaggerv1.Canary) error {
gateways = []string{}
}
var newSpec istiov1alpha3.VirtualServiceSpec
var newSpec istiov1beta1.VirtualServiceSpec
if isTcp(canary) {
newSpec = istiov1alpha3.VirtualServiceSpec{
newSpec = istiov1beta1.VirtualServiceSpec{
Hosts: hosts,
Gateways: gateways,
Tcp: []istiov1alpha3.TCPRoute{
Tcp: []istiov1beta1.TCPRoute{
{
Match: canaryToL4Match(canary),
Route: canaryRoute,
@@ -206,10 +206,10 @@ func (ir *IstioRouter) reconcileVirtualService(canary *flaggerv1.Canary) error {
},
}
} else {
newSpec = istiov1alpha3.VirtualServiceSpec{
newSpec = istiov1beta1.VirtualServiceSpec{
Hosts: hosts,
Gateways: gateways,
Http: []istiov1alpha3.HTTPRoute{
Http: []istiov1beta1.HTTPRoute{
{
Match: canary.Spec.Service.Match,
Rewrite: canary.Spec.Service.GetIstioRewrite(),
@@ -237,7 +237,7 @@ func (ir *IstioRouter) reconcileVirtualService(canary *flaggerv1.Canary) error {
if !isTcp(canary) && len(canary.GetAnalysis().Match) > 0 {
canaryMatch := mergeMatchConditions(canary.GetAnalysis().Match, canary.Spec.Service.Match)
newSpec.Http = []istiov1alpha3.HTTPRoute{
newSpec.Http = []istiov1beta1.HTTPRoute{
{
Match: canaryMatch,
Rewrite: canary.Spec.Service.GetIstioRewrite(),
@@ -254,17 +254,17 @@ func (ir *IstioRouter) reconcileVirtualService(canary *flaggerv1.Canary) error {
Retries: canary.Spec.Service.Retries,
CorsPolicy: canary.Spec.Service.CorsPolicy,
Headers: canary.Spec.Service.Headers,
Route: []istiov1alpha3.HTTPRouteDestination{
Route: []istiov1beta1.HTTPRouteDestination{
makeDestination(canary, primaryName, 100),
},
},
}
}
virtualService, err := ir.istioClient.NetworkingV1alpha3().VirtualServices(canary.Namespace).Get(context.TODO(), apexName, metav1.GetOptions{})
virtualService, err := ir.istioClient.NetworkingV1beta1().VirtualServices(canary.Namespace).Get(context.TODO(), apexName, metav1.GetOptions{})
// insert
if errors.IsNotFound(err) {
virtualService = &istiov1alpha3.VirtualService{
virtualService = &istiov1beta1.VirtualService{
ObjectMeta: metav1.ObjectMeta{
Name: apexName,
Namespace: canary.Namespace,
@@ -282,7 +282,7 @@ func (ir *IstioRouter) reconcileVirtualService(canary *flaggerv1.Canary) error {
}),
}
}
_, err = ir.istioClient.NetworkingV1alpha3().VirtualServices(canary.Namespace).Create(context.TODO(), virtualService, metav1.CreateOptions{})
_, err = ir.istioClient.NetworkingV1beta1().VirtualServices(canary.Namespace).Create(context.TODO(), virtualService, metav1.CreateOptions{})
if err != nil {
return fmt.Errorf("VirtualService %s.%s create error: %w", apexName, canary.Namespace, err)
}
@@ -300,20 +300,20 @@ func (ir *IstioRouter) reconcileVirtualService(canary *flaggerv1.Canary) error {
}
ignoreCmpOptions := []cmp.Option{
cmpopts.IgnoreFields(istiov1alpha3.HTTPRouteDestination{}, "Weight"),
cmpopts.IgnoreFields(istiov1alpha3.HTTPRoute{}, "Mirror", "MirrorPercentage"),
cmpopts.IgnoreFields(istiov1beta1.HTTPRouteDestination{}, "Weight"),
cmpopts.IgnoreFields(istiov1beta1.HTTPRoute{}, "Mirror", "MirrorPercentage"),
}
if canary.Spec.Analysis.SessionAffinity != nil {
// We ignore this route as this does not do weighted routing and is handled exclusively
// by SetRoutes().
ignoreSlice := cmpopts.IgnoreSliceElements(func(t istiov1alpha3.HTTPRoute) bool {
ignoreSlice := cmpopts.IgnoreSliceElements(func(t istiov1beta1.HTTPRoute) bool {
if t.Name == stickyRouteName {
return true
}
return false
})
ignoreCmpOptions = append(ignoreCmpOptions, ignoreSlice)
ignoreCmpOptions = append(ignoreCmpOptions, cmpopts.IgnoreFields(istiov1alpha3.HTTPRouteDestination{}, "Headers"))
ignoreCmpOptions = append(ignoreCmpOptions, cmpopts.IgnoreFields(istiov1beta1.HTTPRouteDestination{}, "Headers"))
}
if v, ok := virtualService.Annotations[kubectlAnnotation]; ok {
newMetadata.Annotations[kubectlAnnotation] = v
@@ -354,7 +354,7 @@ func (ir *IstioRouter) reconcileVirtualService(canary *flaggerv1.Canary) error {
vtClone.ObjectMeta.Annotations[configAnnotation] = string(b)
}
_, err = ir.istioClient.NetworkingV1alpha3().VirtualServices(canary.Namespace).Update(context.TODO(), vtClone, metav1.UpdateOptions{})
_, err = ir.istioClient.NetworkingV1beta1().VirtualServices(canary.Namespace).Update(context.TODO(), vtClone, metav1.UpdateOptions{})
if err != nil {
return fmt.Errorf("VirtualService %s.%s update error: %w", apexName, canary.Namespace, err)
}
@@ -374,8 +374,8 @@ func (ir *IstioRouter) GetRoutes(canary *flaggerv1.Canary) (
err error,
) {
apexName, primaryName, canaryName := canary.GetServiceNames()
vs := &istiov1alpha3.VirtualService{}
vs, err = ir.istioClient.NetworkingV1alpha3().VirtualServices(canary.Namespace).Get(context.TODO(), apexName, metav1.GetOptions{})
vs := &istiov1beta1.VirtualService{}
vs, err = ir.istioClient.NetworkingV1beta1().VirtualServices(canary.Namespace).Get(context.TODO(), apexName, metav1.GetOptions{})
if err != nil {
err = fmt.Errorf("VirtualService %s.%s get query error %v", apexName, canary.Namespace, err)
return
@@ -383,7 +383,7 @@ func (ir *IstioRouter) GetRoutes(canary *flaggerv1.Canary) (
if isTcp(canary) {
ir.logger.Infof("Canary %s.%s uses TCP service", canary.Name, canary.Namespace)
var tcpRoute istiov1alpha3.TCPRoute
var tcpRoute istiov1beta1.TCPRoute
for _, tcp := range vs.Spec.Tcp {
for _, r := range tcp.Route {
if r.Destination.Host == canaryName {
@@ -413,7 +413,7 @@ func (ir *IstioRouter) GetRoutes(canary *flaggerv1.Canary) (
ir.logger.Infof("Canary %s.%s uses HTTP service", canary.Name, canary.Namespace)
var httpRoute istiov1alpha3.HTTPRoute
var httpRoute istiov1beta1.HTTPRoute
for _, http := range vs.Spec.Http {
for _, r := range http.Route {
if r.Destination.Host == canaryName {
@@ -469,7 +469,7 @@ func (ir *IstioRouter) SetRoutes(
) error {
apexName, primaryName, canaryName := canary.GetServiceNames()
vs, err := ir.istioClient.NetworkingV1alpha3().VirtualServices(canary.Namespace).Get(context.TODO(), apexName, metav1.GetOptions{})
vs, err := ir.istioClient.NetworkingV1beta1().VirtualServices(canary.Namespace).Get(context.TODO(), apexName, metav1.GetOptions{})
if err != nil {
return fmt.Errorf("VirtualService %s.%s get query error %v", apexName, canary.Namespace, err)
}
@@ -478,18 +478,18 @@ func (ir *IstioRouter) SetRoutes(
if isTcp(canary) {
// weighted routing (progressive canary)
weightedRoute := istiov1alpha3.TCPRoute{
weightedRoute := istiov1beta1.TCPRoute{
Match: canaryToL4Match(canary),
Route: []istiov1alpha3.HTTPRouteDestination{
Route: []istiov1beta1.HTTPRouteDestination{
makeDestination(canary, primaryName, primaryWeight),
makeDestination(canary, canaryName, canaryWeight),
},
}
vsCopy.Spec.Tcp = []istiov1alpha3.TCPRoute{
vsCopy.Spec.Tcp = []istiov1beta1.TCPRoute{
weightedRoute,
}
vs, err = ir.istioClient.NetworkingV1alpha3().VirtualServices(canary.Namespace).Update(context.TODO(), vsCopy, metav1.UpdateOptions{})
vs, err = ir.istioClient.NetworkingV1beta1().VirtualServices(canary.Namespace).Update(context.TODO(), vsCopy, metav1.UpdateOptions{})
if err != nil {
return fmt.Errorf("VirtualService %s.%s update failed: %w", apexName, canary.Namespace, err)
}
@@ -497,19 +497,19 @@ func (ir *IstioRouter) SetRoutes(
}
// weighted routing (progressive canary)
weightedRoute := istiov1alpha3.HTTPRoute{
weightedRoute := istiov1beta1.HTTPRoute{
Match: canary.Spec.Service.Match,
Rewrite: canary.Spec.Service.GetIstioRewrite(),
Timeout: canary.Spec.Service.Timeout,
Retries: canary.Spec.Service.Retries,
CorsPolicy: canary.Spec.Service.CorsPolicy,
Headers: canary.Spec.Service.Headers,
Route: []istiov1alpha3.HTTPRouteDestination{
Route: []istiov1beta1.HTTPRouteDestination{
makeDestination(canary, primaryName, primaryWeight),
makeDestination(canary, canaryName, canaryWeight),
},
}
vsCopy.Spec.Http = []istiov1alpha3.HTTPRoute{
vsCopy.Spec.Http = []istiov1beta1.HTTPRoute{
weightedRoute,
}
@@ -527,8 +527,8 @@ func (ir *IstioRouter) SetRoutes(
for i, routeDest := range weightedRoute.Route {
if routeDest.Destination.Host == canaryName {
if routeDest.Headers == nil {
routeDest.Headers = &istiov1alpha3.Headers{
Response: &istiov1alpha3.HeaderOperations{},
routeDest.Headers = &istiov1beta1.Headers{
Response: &istiov1beta1.HeaderOperations{},
}
}
routeDest.Headers.Response.Add = map[string]string{
@@ -541,16 +541,16 @@ func (ir *IstioRouter) SetRoutes(
}
cookieKeyAndVal := strings.Split(canary.Status.SessionAffinityCookie, "=")
cookieMatch := istiov1alpha3.HTTPMatchRequest{
cookieMatch := istiov1beta1.HTTPMatchRequest{
Headers: map[string]istiov1alpha1.StringMatch{
cookieHeader: {
Regex: fmt.Sprintf(".*%s.*%s.*", cookieKeyAndVal[0], cookieKeyAndVal[1]),
},
},
}
canaryMatch := mergeMatchConditions([]istiov1alpha3.HTTPMatchRequest{cookieMatch}, canary.Spec.Service.Match)
canaryMatch := mergeMatchConditions([]istiov1beta1.HTTPMatchRequest{cookieMatch}, canary.Spec.Service.Match)
stickyRoute.Match = canaryMatch
stickyRoute.Route = []istiov1alpha3.HTTPRouteDestination{
stickyRoute.Route = []istiov1beta1.HTTPRouteDestination{
makeDestination(canary, primaryName, 0),
makeDestination(canary, canaryName, 100),
}
@@ -564,24 +564,24 @@ func (ir *IstioRouter) SetRoutes(
// Match against the previous session cookie and delete that cookie
if previousCookie != "" {
cookieKeyAndVal := strings.Split(previousCookie, "=")
cookieMatch := istiov1alpha3.HTTPMatchRequest{
cookieMatch := istiov1beta1.HTTPMatchRequest{
Headers: map[string]istiov1alpha1.StringMatch{
cookieHeader: {
Regex: fmt.Sprintf(".*%s.*%s.*", cookieKeyAndVal[0], cookieKeyAndVal[1]),
},
},
}
canaryMatch := mergeMatchConditions([]istiov1alpha3.HTTPMatchRequest{cookieMatch}, canary.Spec.Service.Match)
canaryMatch := mergeMatchConditions([]istiov1beta1.HTTPMatchRequest{cookieMatch}, canary.Spec.Service.Match)
stickyRoute.Match = canaryMatch
if stickyRoute.Headers == nil {
stickyRoute.Headers = &istiov1alpha3.Headers{
Response: &istiov1alpha3.HeaderOperations{
stickyRoute.Headers = &istiov1beta1.Headers{
Response: &istiov1beta1.HeaderOperations{
Add: map[string]string{},
},
}
} else if stickyRoute.Headers.Response == nil {
stickyRoute.Headers.Response = &istiov1alpha3.HeaderOperations{
stickyRoute.Headers.Response = &istiov1beta1.HeaderOperations{
Add: map[string]string{},
}
} else if stickyRoute.Headers.Response.Add == nil {
@@ -592,18 +592,18 @@ func (ir *IstioRouter) SetRoutes(
canary.Status.SessionAffinityCookie = ""
}
vsCopy.Spec.Http = []istiov1alpha3.HTTPRoute{
vsCopy.Spec.Http = []istiov1beta1.HTTPRoute{
stickyRoute, weightedRoute,
}
}
if mirrored {
vsCopy.Spec.Http[0].Mirror = &istiov1alpha3.Destination{
vsCopy.Spec.Http[0].Mirror = &istiov1beta1.Destination{
Host: canaryName,
}
if mw := canary.GetAnalysis().MirrorWeight; mw > 0 {
vsCopy.Spec.Http[0].MirrorPercentage = &istiov1alpha3.Percent{Value: float64(mw)}
vsCopy.Spec.Http[0].MirrorPercentage = &istiov1beta1.Percent{Value: float64(mw)}
}
}
@@ -611,7 +611,7 @@ func (ir *IstioRouter) SetRoutes(
if len(canary.GetAnalysis().Match) > 0 {
// merge the common routes with the canary ones
canaryMatch := mergeMatchConditions(canary.GetAnalysis().Match, canary.Spec.Service.Match)
vsCopy.Spec.Http = []istiov1alpha3.HTTPRoute{
vsCopy.Spec.Http = []istiov1beta1.HTTPRoute{
{
Match: canaryMatch,
Rewrite: canary.Spec.Service.GetIstioRewrite(),
@@ -619,7 +619,7 @@ func (ir *IstioRouter) SetRoutes(
Retries: canary.Spec.Service.Retries,
CorsPolicy: canary.Spec.Service.CorsPolicy,
Headers: canary.Spec.Service.Headers,
Route: []istiov1alpha3.HTTPRouteDestination{
Route: []istiov1beta1.HTTPRouteDestination{
makeDestination(canary, primaryName, primaryWeight),
makeDestination(canary, canaryName, canaryWeight),
},
@@ -631,14 +631,14 @@ func (ir *IstioRouter) SetRoutes(
Retries: canary.Spec.Service.Retries,
CorsPolicy: canary.Spec.Service.CorsPolicy,
Headers: canary.Spec.Service.Headers,
Route: []istiov1alpha3.HTTPRouteDestination{
Route: []istiov1beta1.HTTPRouteDestination{
makeDestination(canary, primaryName, primaryWeight),
},
},
}
}
vs, err = ir.istioClient.NetworkingV1alpha3().VirtualServices(canary.Namespace).Update(context.TODO(), vsCopy, metav1.UpdateOptions{})
vs, err = ir.istioClient.NetworkingV1beta1().VirtualServices(canary.Namespace).Update(context.TODO(), vsCopy, metav1.UpdateOptions{})
if err != nil {
return fmt.Errorf("VirtualService %s.%s update failed: %w", apexName, canary.Namespace, err)
}
@@ -649,14 +649,14 @@ func (ir *IstioRouter) Finalize(canary *flaggerv1.Canary) error {
// Need to see if I can get the annotation orig-configuration
apexName, _, _ := canary.GetServiceNames()
vs, err := ir.istioClient.NetworkingV1alpha3().VirtualServices(canary.Namespace).Get(context.TODO(), apexName, metav1.GetOptions{})
vs, err := ir.istioClient.NetworkingV1beta1().VirtualServices(canary.Namespace).Get(context.TODO(), apexName, metav1.GetOptions{})
if err != nil {
return fmt.Errorf("VirtualService %s.%s get query error: %w", apexName, canary.Namespace, err)
}
var storedSpec istiov1alpha3.VirtualServiceSpec
var storedSpec istiov1beta1.VirtualServiceSpec
if a, ok := vs.ObjectMeta.Annotations[kubectlAnnotation]; ok {
var storedVS istiov1alpha3.VirtualService
var storedVS istiov1beta1.VirtualService
if err := json.Unmarshal([]byte(a), &storedVS); err != nil {
return fmt.Errorf("VirtualService %s.%s failed to unMarshal annotation %s",
apexName, canary.Namespace, kubectlAnnotation)
@@ -675,7 +675,7 @@ func (ir *IstioRouter) Finalize(canary *flaggerv1.Canary) error {
clone := vs.DeepCopy()
clone.Spec = storedSpec
_, err = ir.istioClient.NetworkingV1alpha3().VirtualServices(canary.Namespace).Update(context.TODO(), clone, metav1.UpdateOptions{})
_, err = ir.istioClient.NetworkingV1beta1().VirtualServices(canary.Namespace).Update(context.TODO(), clone, metav1.UpdateOptions{})
if err != nil {
return fmt.Errorf("VirtualService %s.%s update error: %w", apexName, canary.Namespace, err)
}
@@ -683,12 +683,12 @@ func (ir *IstioRouter) Finalize(canary *flaggerv1.Canary) error {
}
// mergeMatchConditions appends the URI match rules to canary conditions
func mergeMatchConditions(canary, defaults []istiov1alpha3.HTTPMatchRequest) []istiov1alpha3.HTTPMatchRequest {
func mergeMatchConditions(canary, defaults []istiov1beta1.HTTPMatchRequest) []istiov1beta1.HTTPMatchRequest {
if len(defaults) == 0 {
return canary
}
merged := make([]istiov1alpha3.HTTPMatchRequest, len(canary)*len(defaults))
merged := make([]istiov1beta1.HTTPMatchRequest, len(canary)*len(defaults))
num := 0
for _, c := range canary {
for _, d := range defaults {
@@ -707,9 +707,9 @@ func mergeMatchConditions(canary, defaults []istiov1alpha3.HTTPMatchRequest) []i
}
// makeDestination returns a an destination weight for the specified host
func makeDestination(canary *flaggerv1.Canary, host string, weight int) istiov1alpha3.HTTPRouteDestination {
dest := istiov1alpha3.HTTPRouteDestination{
Destination: istiov1alpha3.Destination{
func makeDestination(canary *flaggerv1.Canary, host string, weight int) istiov1beta1.HTTPRouteDestination {
dest := istiov1beta1.HTTPRouteDestination{
Destination: istiov1beta1.Destination{
Host: host,
},
Weight: weight,
@@ -719,10 +719,10 @@ func makeDestination(canary *flaggerv1.Canary, host string, weight int) istiov1a
if canary.Spec.Service.PortDiscovery &&
(len(canary.Spec.Service.Gateways) > 0 &&
canary.Spec.Service.Gateways[0] != "mesh" || canary.Spec.Service.Delegation) {
dest = istiov1alpha3.HTTPRouteDestination{
Destination: istiov1alpha3.Destination{
dest = istiov1beta1.HTTPRouteDestination{
Destination: istiov1beta1.Destination{
Host: host,
Port: &istiov1alpha3.PortSelector{
Port: &istiov1beta1.PortSelector{
Number: uint32(canary.Spec.Service.Port),
},
},

View File

@@ -31,7 +31,7 @@ import (
"github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1"
flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1"
istiov1alpha1 "github.com/fluxcd/flagger/pkg/apis/istio/common/v1alpha1"
istiov1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
)
func TestUnmarshalVirtualService(t *testing.T) {
@@ -69,7 +69,7 @@ func TestUnmarshalVirtualService(t *testing.T) {
}
`
var vs istiov1alpha3.VirtualService
var vs istiov1beta1.VirtualService
err := json.Unmarshal([]byte(body), &vs)
require.NoError(t, err)
}
@@ -87,13 +87,13 @@ func TestIstioRouter_Sync(t *testing.T) {
require.NoError(t, err)
// test insert
_, err = mocks.meshClient.NetworkingV1alpha3().DestinationRules("default").Get(context.TODO(), "podinfo-canary", metav1.GetOptions{})
_, err = mocks.meshClient.NetworkingV1beta1().DestinationRules("default").Get(context.TODO(), "podinfo-canary", metav1.GetOptions{})
require.NoError(t, err)
_, err = mocks.meshClient.NetworkingV1alpha3().DestinationRules("default").Get(context.TODO(), "podinfo-primary", metav1.GetOptions{})
_, err = mocks.meshClient.NetworkingV1beta1().DestinationRules("default").Get(context.TODO(), "podinfo-primary", metav1.GetOptions{})
require.NoError(t, err)
vs, err := mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
vs, err := mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
require.NoError(t, err)
require.Len(t, vs.Spec.Http, 1)
require.Len(t, vs.Spec.Http[0].Route, 2)
@@ -114,7 +114,7 @@ func TestIstioRouter_Sync(t *testing.T) {
require.NoError(t, err)
// verify
vs, err = mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
vs, err = mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
require.NoError(t, err)
assert.Len(t, vs.Spec.Hosts, 2)
@@ -125,7 +125,7 @@ func TestIstioRouter_Sync(t *testing.T) {
vsClone.Spec.Gateways = gateways
totalGateways := len(mocks.canary.Spec.Service.Gateways)
vsGateways, err := mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Update(context.TODO(), vsClone, metav1.UpdateOptions{})
vsGateways, err := mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Update(context.TODO(), vsClone, metav1.UpdateOptions{})
require.NoError(t, err)
totalGateways++
@@ -137,7 +137,7 @@ func TestIstioRouter_Sync(t *testing.T) {
require.NoError(t, err)
// verify
vs, err = mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
vs, err = mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
require.NoError(t, err)
assert.Len(t, vs.Spec.Gateways, totalGateways)
}
@@ -162,11 +162,11 @@ func TestIstioRouter_SetRoutes(t *testing.T) {
err := router.SetRoutes(mocks.canary, p, c, false)
require.NoError(t, err)
vs, err := mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
vs, err := mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
require.NoError(t, err)
var pRoute, cRoute istiov1alpha3.HTTPRouteDestination
var mirror *istiov1alpha3.Destination
var pRoute, cRoute istiov1beta1.HTTPRouteDestination
var mirror *istiov1beta1.Destination
for _, http := range vs.Spec.Http {
for _, route := range http.Route {
if route.Destination.Host == pHost {
@@ -195,7 +195,7 @@ func TestIstioRouter_SetRoutes(t *testing.T) {
}
err := router.SetRoutes(canary, 0, 10, false)
vs, err := mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
vs, err := mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
require.NoError(t, err)
assert.Len(t, vs.Spec.Http, 2)
@@ -240,7 +240,7 @@ func TestIstioRouter_SetRoutes(t *testing.T) {
err = router.Reconcile(canary)
require.NoError(t, err)
reconciledVS, err := mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
reconciledVS, err := mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
require.NoError(t, err)
// routes should not be changed.
@@ -253,7 +253,7 @@ func TestIstioRouter_SetRoutes(t *testing.T) {
err = router.SetRoutes(canary, 50, 50, false)
require.NoError(t, err)
vs, err = mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
vs, err = mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
require.NoError(t, err)
assert.Len(t, vs.Spec.Http, 2)
@@ -296,7 +296,7 @@ func TestIstioRouter_SetRoutes(t *testing.T) {
err = router.SetRoutes(canary, 100, 0, false)
require.NoError(t, err)
vs, err = mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
vs, err = mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
require.NoError(t, err)
assert.Len(t, vs.Spec.Http, 2)
@@ -352,12 +352,12 @@ func TestIstioRouter_SetRoutes(t *testing.T) {
err := router.SetRoutes(mocks.canary, p, c, true)
require.NoError(t, err)
vs, err := mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
vs, err := mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
require.NoError(t, err)
var pRoute, cRoute istiov1alpha3.HTTPRouteDestination
var mirror *istiov1alpha3.Destination
var mirrorWeight *istiov1alpha3.Percent
var pRoute, cRoute istiov1beta1.HTTPRouteDestination
var mirror *istiov1beta1.Destination
var mirrorWeight *istiov1beta1.Percent
for _, http := range vs.Spec.Http {
for _, route := range http.Route {
if route.Destination.Host == pHost {
@@ -419,20 +419,20 @@ func TestIstioRouter_GetRoutes(t *testing.T) {
assert.False(t, m)
// Adjust vs to activate mirroring.
vs, err := mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
vs, err := mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
require.NoError(t, err)
cHost := fmt.Sprintf("%s-canary", mocks.canary.Spec.TargetRef.Name)
for i, http := range vs.Spec.Http {
for _, route := range http.Route {
if route.Destination.Host == cHost {
vs.Spec.Http[i].Mirror = &istiov1alpha3.Destination{
vs.Spec.Http[i].Mirror = &istiov1beta1.Destination{
Host: cHost,
}
}
}
}
_, err = mocks.meshClient.NetworkingV1alpha3().VirtualServices(mocks.canary.Namespace).Update(context.TODO(), vs, metav1.UpdateOptions{})
_, err = mocks.meshClient.NetworkingV1beta1().VirtualServices(mocks.canary.Namespace).Update(context.TODO(), vs, metav1.UpdateOptions{})
require.NoError(t, err)
p, c, m, err = router.GetRoutes(mocks.canary)
@@ -454,7 +454,7 @@ func TestIstioRouter_HTTPRequestHeaders(t *testing.T) {
err := router.Reconcile(mocks.canary)
require.NoError(t, err)
vs, err := mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
vs, err := mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
require.NoError(t, err)
require.Len(t, vs.Spec.Http, 1)
assert.Equal(t, "15000", vs.Spec.Http[0].Headers.Request.Add["x-envoy-upstream-rq-timeout-ms"])
@@ -474,7 +474,7 @@ func TestIstioRouter_CORS(t *testing.T) {
err := router.Reconcile(mocks.canary)
require.NoError(t, err)
vs, err := mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
vs, err := mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
require.NoError(t, err)
require.NoError(t, err)
require.Len(t, vs.Spec.Http, 1)
@@ -495,7 +495,7 @@ func TestIstioRouter_ABTest(t *testing.T) {
require.NoError(t, err)
// test insert
vs, err := mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "abtest", metav1.GetOptions{})
vs, err := mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "abtest", metav1.GetOptions{})
require.NoError(t, err)
assert.Len(t, vs.Spec.Http, 2)
@@ -506,14 +506,14 @@ func TestIstioRouter_ABTest(t *testing.T) {
err = router.SetRoutes(mocks.abtest, p, c, m)
require.NoError(t, err)
vs, err = mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "abtest", metav1.GetOptions{})
vs, err = mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "abtest", metav1.GetOptions{})
require.NoError(t, err)
pHost := fmt.Sprintf("%s-primary", mocks.abtest.Spec.TargetRef.Name)
cHost := fmt.Sprintf("%s-canary", mocks.abtest.Spec.TargetRef.Name)
pRoute := istiov1alpha3.HTTPRouteDestination{}
cRoute := istiov1alpha3.HTTPRouteDestination{}
var mirror *istiov1alpha3.Destination
pRoute := istiov1beta1.HTTPRouteDestination{}
cRoute := istiov1beta1.HTTPRouteDestination{}
var mirror *istiov1beta1.Destination
for _, http := range vs.Spec.Http {
for _, route := range http.Route {
@@ -544,7 +544,7 @@ func TestIstioRouter_GatewayPort(t *testing.T) {
err := router.Reconcile(mocks.canary)
require.NoError(t, err)
vs, err := mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
vs, err := mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
require.NoError(t, err)
port := vs.Spec.Http[0].Route[0].Destination.Port.Number
@@ -568,7 +568,7 @@ func TestIstioRouter_Delegate(t *testing.T) {
err := router.Reconcile(mocks.canary)
require.NoError(t, err)
vs, err := mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
vs, err := mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
require.NoError(t, err)
assert.Equal(t, 0, len(vs.Spec.Hosts))
@@ -610,8 +610,8 @@ func TestIstioRouter_Finalize(t *testing.T) {
kubeClient: mocks.kubeClient,
}
flaggerSpec := &istiov1alpha3.VirtualServiceSpec{
Http: []istiov1alpha3.HTTPRoute{
flaggerSpec := &istiov1beta1.VirtualServiceSpec{
Http: []istiov1beta1.HTTPRoute{
{
Match: mocks.canary.Spec.Service.Match,
Rewrite: mocks.canary.Spec.Service.GetIstioRewrite(),
@@ -622,15 +622,15 @@ func TestIstioRouter_Finalize(t *testing.T) {
},
}
kubectlSpec := &istiov1alpha3.VirtualServiceSpec{
kubectlSpec := &istiov1beta1.VirtualServiceSpec{
Hosts: []string{"podinfo"},
Gateways: []string{"istio-system/ingressgateway"},
Http: []istiov1alpha3.HTTPRoute{
Http: []istiov1beta1.HTTPRoute{
{
Match: nil,
Route: []istiov1alpha3.HTTPRouteDestination{
Route: []istiov1beta1.HTTPRouteDestination{
{
Destination: istiov1alpha3.Destination{Host: "podinfo"},
Destination: istiov1beta1.Destination{Host: "podinfo"},
},
},
},
@@ -639,7 +639,7 @@ func TestIstioRouter_Finalize(t *testing.T) {
tables := []struct {
router *IstioRouter
spec *istiov1alpha3.VirtualServiceSpec
spec *istiov1beta1.VirtualServiceSpec
shouldError bool
createVS bool
canary *v1beta1.Canary
@@ -659,7 +659,7 @@ func TestIstioRouter_Finalize(t *testing.T) {
for _, table := range tables {
var err error
if table.createVS {
vs, err := router.istioClient.NetworkingV1alpha3().VirtualServices(table.canary.Namespace).Get(context.TODO(), table.canary.Name, metav1.GetOptions{})
vs, err := router.istioClient.NetworkingV1beta1().VirtualServices(table.canary.Namespace).Get(context.TODO(), table.canary.Name, metav1.GetOptions{})
require.NoError(t, err)
if vs.Annotations == nil {
@@ -672,9 +672,9 @@ func TestIstioRouter_Finalize(t *testing.T) {
require.NoError(t, err)
vs.Annotations[configAnnotation] = string(b)
case "kubectl":
vs.Annotations[kubectlAnnotation] = `{"apiVersion": "networking.istio.io/v1alpha3","kind": "VirtualService","metadata": {"annotations": {},"name": "podinfo","namespace": "test"}, "spec": {"gateways": ["istio-system/ingressgateway"],"hosts": ["podinfo"],"http": [{"route": [{"destination": {"host": "podinfo"}}]}]}}`
vs.Annotations[kubectlAnnotation] = `{"apiVersion": "networking.istio.io/v1beta1","kind": "VirtualService","metadata": {"annotations": {},"name": "podinfo","namespace": "test"}, "spec": {"gateways": ["istio-system/ingressgateway"],"hosts": ["podinfo"],"http": [{"route": [{"destination": {"host": "podinfo"}}]}]}}`
}
_, err = router.istioClient.NetworkingV1alpha3().VirtualServices(table.canary.Namespace).Update(context.TODO(), vs, metav1.UpdateOptions{})
_, err = router.istioClient.NetworkingV1beta1().VirtualServices(table.canary.Namespace).Update(context.TODO(), vs, metav1.UpdateOptions{})
require.NoError(t, err)
}
@@ -691,7 +691,7 @@ func TestIstioRouter_Finalize(t *testing.T) {
}
if table.spec != nil {
vs, err := router.istioClient.NetworkingV1alpha3().VirtualServices(table.canary.Namespace).Get(context.TODO(), table.canary.Name, metav1.GetOptions{})
vs, err := router.istioClient.NetworkingV1beta1().VirtualServices(table.canary.Namespace).Get(context.TODO(), table.canary.Name, metav1.GetOptions{})
require.NoError(t, err)
require.Equal(t, *table.spec, vs.Spec)
}
@@ -712,7 +712,7 @@ func TestIstioRouter_Match(t *testing.T) {
require.NoError(t, err)
// test insert
vs, err := mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "abtest", metav1.GetOptions{})
vs, err := mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "abtest", metav1.GetOptions{})
require.NoError(t, err)
assert.Len(t, vs.Spec.Http, 2)
assert.Len(t, vs.Spec.Http[0].Match, 1) // check for abtest-canary
@@ -720,7 +720,7 @@ func TestIstioRouter_Match(t *testing.T) {
assert.Len(t, vs.Spec.Http[1].Match, 0) // check for abtest-primary
// Test Case that is service.match exists and multiple analysis.match
mocks.abtest.Spec.Service.Match = []istiov1alpha3.HTTPMatchRequest{
mocks.abtest.Spec.Service.Match = []istiov1beta1.HTTPMatchRequest{
{
Name: "podinfo",
Uri: &istiov1alpha1.StringMatch{
@@ -732,7 +732,7 @@ func TestIstioRouter_Match(t *testing.T) {
IgnoreUriCase: true,
},
}
mocks.abtest.Spec.Analysis.Match = []istiov1alpha3.HTTPMatchRequest{
mocks.abtest.Spec.Analysis.Match = []istiov1beta1.HTTPMatchRequest{
{
Headers: map[string]istiov1alpha1.StringMatch{
"x-user-type": {
@@ -756,7 +756,7 @@ func TestIstioRouter_Match(t *testing.T) {
err = router.Reconcile(mocks.abtest)
require.NoError(t, err)
vs, err = mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "abtest", metav1.GetOptions{})
vs, err = mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "abtest", metav1.GetOptions{})
require.NoError(t, err)
assert.Len(t, vs.Spec.Http, 2)
assert.Len(t, vs.Spec.Http[0].Match, 2) // check for abtest-canary
@@ -787,7 +787,7 @@ func newTestCanaryTCP() *flaggerv1.Canary {
Port: 9898,
PortDiscovery: true,
AppProtocol: "TCP",
Match: []istiov1alpha3.HTTPMatchRequest{
Match: []istiov1beta1.HTTPMatchRequest{
{
Port: 9898,
},
@@ -838,10 +838,10 @@ func TestIstioRouter_SetRoutesTCP(t *testing.T) {
err := router.SetRoutes(mocks.canary, p, c, false)
require.NoError(t, err)
vs, err := mocks.meshClient.NetworkingV1alpha3().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
vs, err := mocks.meshClient.NetworkingV1beta1().VirtualServices("default").Get(context.TODO(), "podinfo", metav1.GetOptions{})
require.NoError(t, err)
var pRoute, cRoute istiov1alpha3.HTTPRouteDestination
var pRoute, cRoute istiov1beta1.HTTPRouteDestination
for _, tcp := range vs.Spec.Tcp {
for _, route := range tcp.Route {
if route.Destination.Host == pHost {

View File

@@ -31,7 +31,7 @@ import (
flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1"
gatewayapiv1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1beta1"
istiov1alpha1 "github.com/fluxcd/flagger/pkg/apis/istio/common/v1alpha1"
istiov1alpha3 "github.com/fluxcd/flagger/pkg/apis/istio/v1alpha3"
istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1"
clientset "github.com/fluxcd/flagger/pkg/client/clientset/versioned"
fakeFlagger "github.com/fluxcd/flagger/pkg/client/clientset/versioned/fake"
"github.com/fluxcd/flagger/pkg/logger"
@@ -143,24 +143,24 @@ func newTestCanary() *flaggerv1.Canary {
Port: 9898,
PortDiscovery: true,
AppProtocol: "http",
Headers: &istiov1alpha3.Headers{
Request: &istiov1alpha3.HeaderOperations{
Headers: &istiov1beta1.Headers{
Request: &istiov1beta1.HeaderOperations{
Add: map[string]string{
"x-envoy-upstream-rq-timeout-ms": "15000",
},
Remove: []string{"test"},
},
Response: &istiov1alpha3.HeaderOperations{
Response: &istiov1beta1.HeaderOperations{
Remove: []string{"token"},
},
},
CorsPolicy: &istiov1alpha3.CorsPolicy{
CorsPolicy: &istiov1beta1.CorsPolicy{
AllowMethods: []string{
"GET",
"POST",
},
},
Match: []istiov1alpha3.HTTPMatchRequest{
Match: []istiov1beta1.HTTPMatchRequest{
{
Name: "podinfo",
Uri: &istiov1alpha1.StringMatch{
@@ -172,7 +172,7 @@ func newTestCanary() *flaggerv1.Canary {
IgnoreUriCase: true,
},
},
Retries: &istiov1alpha3.HTTPRetry{
Retries: &istiov1beta1.HTTPRetry{
Attempts: 10,
PerTryTimeout: "30s",
RetryOn: "connect-failure,gateway-error",
@@ -225,7 +225,7 @@ func newTestCanaryAppMesh() *flaggerv1.Canary {
Hosts: []string{"*"},
Backends: []string{"backend.default"},
Timeout: "30s",
Retries: &istiov1alpha3.HTTPRetry{
Retries: &istiov1beta1.HTTPRetry{
Attempts: 5,
PerTryTimeout: "gateway-error",
RetryOn: "5s",
@@ -322,7 +322,7 @@ func newTestABTest() *flaggerv1.Canary {
}, Analysis: &flaggerv1.CanaryAnalysis{
Threshold: 10,
Iterations: 2,
Match: []istiov1alpha3.HTTPMatchRequest{
Match: []istiov1beta1.HTTPMatchRequest{
{
Headers: map[string]istiov1alpha1.StringMatch{
"x-user-type": {

View File

@@ -460,7 +460,7 @@ spec:
app: podinfo
type: ClusterIP
---
apiVersion: networking.istio.io/v1alpha3
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: podinfo