Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate istio VirtualService/DestinationRule to APIversion v1beta1 (current v1alpha3) #1602

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/loadtester/templates/istio-gw.yaml
Original file line number Diff line number Diff line change
@@ -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" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/loadtester/templates/istio-vs.yaml
Original file line number Diff line number Diff line change
@@ -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" . }}
Expand Down
10 changes: 5 additions & 5 deletions docs/gitbook/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -664,7 +664,7 @@ spec:
tls:
mode: DISABLE
---
apiVersion: networking.istio.io/v1alpha3
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: frontend-canary
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/gitbook/install/flagger-install-on-google-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 10 additions & 10 deletions pkg/apis/flagger/v1beta1/canary.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -173,31 +173,31 @@ 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
Rewrite *HTTPRewrite `json:"rewrite,omitempty"`

// 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.
Mirror []v1beta1.HTTPRequestMirrorFilter `json:"mirror,omitempty"`

// 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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/apis/flagger/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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:
//
Expand All @@ -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:
//
Expand Down Expand Up @@ -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:
//
Expand Down Expand Up @@ -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:
//
Expand Down Expand Up @@ -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:
//
Expand All @@ -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
Expand Down Expand Up @@ -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:
//
Expand Down Expand Up @@ -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:
//
Expand Down Expand Up @@ -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:
//
Expand All @@ -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:
//
Expand All @@ -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:
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

// +k8s:deepcopy-gen=package
// +groupName=networking.istio.io
package v1alpha3
package v1beta1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1alpha3
package v1beta1

import (
"github.com/fluxcd/flagger/pkg/apis/istio"
Expand All @@ -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 {
Expand Down
Loading
Loading