Skip to content

Commit

Permalink
add support for KEDA HTTPScaledObjects via HTTPScaledObjectReconciler
Browse files Browse the repository at this point in the history
Signed-off-by: kahirokunn <[email protected]>
  • Loading branch information
kahirokunn committed Nov 7, 2024
1 parent a159421 commit a3e0f56
Show file tree
Hide file tree
Showing 50 changed files with 3,894 additions and 44 deletions.
13 changes: 13 additions & 0 deletions artifacts/flagger/account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,19 @@ rules:
- update
- patch
- delete
- apiGroups:
- http.keda.sh
resources:
- httpscaledobjects
- httpscaledobjects/finalizers
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- apisix.apache.org
resources:
Expand Down
33 changes: 33 additions & 0 deletions artifacts/flagger/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ spec:
enum:
- HorizontalPodAutoscaler
- ScaledObject
- HTTPScaledObject
name:
type: string
primaryScalerQueries:
Expand All @@ -132,6 +133,38 @@ spec:
type: number
maxReplicas:
type: number
canaryInterceptorProxyService:
type: object
description: Specify this service if you want to change the Canary interceptor proxy service from its default value.
properties:
name:
default: keda-http-add-on-interceptor-proxy
maxLength: 253
minLength: 1
type: string
namespace:
default: keda
maxLength: 63
minLength: 1
type: string
primaryScalingSet:
type: object
description: |-
PrimaryScalingSet to be used for primary HTTPScaledObject, if empty, default interceptor and scaler will be used.
properties:
kind:
description: Kind of the resource being referred to. Defaults to HTTPScalingSet.
enum:
- HTTPScalingSet
- ClusterHTTPScalingSet
type: string
name:
description: Name of the scaling set
type: string
namespace:
maxLength: 63
minLength: 1
type: string
ingressRef:
description: Ingress selector
type: object
Expand Down
4 changes: 2 additions & 2 deletions charts/flagger/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: flagger
version: 1.38.0
appVersion: 1.38.0
version: 1.39.0
appVersion: 1.39.0
kubeVersion: ">=1.19.0-0"
engine: gotpl
description: Flagger is a progressive delivery operator for Kubernetes
Expand Down
33 changes: 33 additions & 0 deletions charts/flagger/crds/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ spec:
enum:
- HorizontalPodAutoscaler
- ScaledObject
- HTTPScaledObject
name:
type: string
primaryScalerQueries:
Expand All @@ -132,6 +133,38 @@ spec:
type: number
maxReplicas:
type: number
canaryInterceptorProxyService:
type: object
description: Specify this service if you want to change the Canary interceptor proxy service from its default value.
properties:
name:
default: keda-http-add-on-interceptor-proxy
maxLength: 253
minLength: 1
type: string
namespace:
default: keda
maxLength: 63
minLength: 1
type: string
primaryScalingSet:
type: object
description: |-
PrimaryScalingSet to be used for primary HTTPScaledObject, if empty, default interceptor and scaler will be used.
properties:
kind:
description: Kind of the resource being referred to. Defaults to HTTPScalingSet.
enum:
- HTTPScalingSet
- ClusterHTTPScalingSet
type: string
name:
description: Name of the scaling set
type: string
namespace:
maxLength: 63
minLength: 1
type: string
ingressRef:
description: Ingress selector
type: object
Expand Down
13 changes: 13 additions & 0 deletions charts/flagger/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,19 @@ rules:
- update
- patch
- delete
- apiGroups:
- http.keda.sh
resources:
- httpscaledobjects
- httpscaledobjects/finalizers
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- apisix.apache.org
resources:
Expand Down
1 change: 1 addition & 0 deletions docs/gitbook/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
* [Blue/Green Deployments](tutorials/kubernetes-blue-green.md)
* [Canary analysis with Prometheus Operator](tutorials/prometheus-operator.md)
* [Canary analysis with KEDA ScaledObjects](tutorials/keda-scaledobject.md)
* [Canary analysis with KEDA HTTPScaledObjects](tutorials/keda-httpscaledobject.md)
* [Zero downtime deployments](tutorials/zero-downtime-deployments.md)

## Dev
Expand Down
33 changes: 33 additions & 0 deletions kustomize/base/flagger/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ spec:
enum:
- HorizontalPodAutoscaler
- ScaledObject
- HTTPScaledObject
name:
type: string
primaryScalerQueries:
Expand All @@ -132,6 +133,38 @@ spec:
type: number
maxReplicas:
type: number
canaryInterceptorProxyService:
type: object
description: Specify this service if you want to change the Canary interceptor proxy service from its default value.
properties:
name:
default: keda-http-add-on-interceptor-proxy
maxLength: 253
minLength: 1
type: string
namespace:
default: keda
maxLength: 63
minLength: 1
type: string
primaryScalingSet:
type: object
description: |-
PrimaryScalingSet to be used for primary HTTPScaledObject, if empty, default interceptor and scaler will be used.
properties:
kind:
description: Kind of the resource being referred to. Defaults to HTTPScalingSet.
enum:
- HTTPScalingSet
- ClusterHTTPScalingSet
type: string
name:
description: Name of the scaling set
type: string
namespace:
maxLength: 63
minLength: 1
type: string
ingressRef:
description: Ingress selector
type: object
Expand Down
13 changes: 13 additions & 0 deletions kustomize/base/flagger/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,19 @@ rules:
- update
- patch
- delete
- apiGroups:
- http.keda.sh
resources:
- httpscaledobjects
- httpscaledobjects/finalizers
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- apisix.apache.org
resources:
Expand Down
40 changes: 40 additions & 0 deletions pkg/apis/flagger/v1beta1/canary.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"time"

"github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1beta1"
http "github.com/fluxcd/flagger/pkg/apis/http/v1alpha1"
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 @@ -454,6 +455,35 @@ type LocalObjectReference struct {
Name string `json:"name"`
}

// CanaryInterceptorProxyService specifies the service if you want to change
// the Canary interceptor proxy service from its default value.
type CanaryInterceptorProxyService struct {
// Name of the canary interceptor proxy service.
// Defaults to "keda-http-add-on-interceptor-proxy".
// +optional
Name string `json:"name,omitempty"`

// Namespace of the canary interceptor proxy service.
// Defaults to "keda".
// +optional
Namespace string `json:"namespace,omitempty"`
}

// PrimaryScalingSet defines the desired scaling set to be used
type PrimaryScalingSet struct {
// Kind of the resource being referred to. Defaults to HTTPScalingSet.
// +optional
Kind http.ScalingSetKind `json:"kind,omitempty"`

// Name of the scaling set
Name string `json:"name,omitempty"`

// Namespace of the scaling set
// Defaults to "keda".
// +optional
Namespace string `json:"namespace,omitempty"`
}

type AutoscalerRefernce struct {
// API version of the scaler
// +required
Expand All @@ -476,6 +506,16 @@ type AutoscalerRefernce struct {
// autoscaler replicas.
// +optional
PrimaryScalerReplicas *ScalerReplicas `json:"primaryScalerReplicas,omitempty"`

// CanaryInterceptorProxyService specifies the service if you want to change
// the Canary interceptor proxy service from its default value.
// +optional
CanaryInterceptorProxyService *CanaryInterceptorProxyService `json:"canaryInterceptorProxyService,omitempty"`

// PrimaryScalingSet is the scaling set to be used for the primary
// scaler, if a scaler supports scaling using queries.
// +optional
PrimaryScalingSet *PrimaryScalingSet `json:"primaryScalingSet,omitempty"`
}

// ScalerReplicas holds overrides for autoscaler replicas
Expand Down
42 changes: 42 additions & 0 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.

5 changes: 5 additions & 0 deletions pkg/apis/http/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package http

const (
GroupName = "http.keda.sh"
)
Loading

0 comments on commit a3e0f56

Please sign in to comment.