Skip to content

Commit

Permalink
fix ingress, trafficsplit crd
Browse files Browse the repository at this point in the history
- e2e uses networkv1.ingress

Signed-off-by: Hui Kang <[email protected]>
  • Loading branch information
Hui Kang committed Jan 4, 2022
1 parent 731b5ad commit 4c35845
Show file tree
Hide file tree
Showing 10 changed files with 265 additions and 18 deletions.
254 changes: 246 additions & 8 deletions test/e2e/crds/split.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,261 @@ metadata:
name: trafficsplits.split.smi-spec.io
spec:
group: split.smi-spec.io
scope: Namespaced
names:
kind: TrafficSplit
listKind: TrafficSplitList
plural: trafficsplits
shortNames:
- ts
plural: trafficsplits
singular: trafficsplit
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: TrafficSplit is the Schema for the trafficsplits API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: TrafficSplitSpec defines the desired state of TrafficSplit
properties:
backends:
items:
description: TrafficSplitBackend defines a backend
properties:
service:
type: string
weight:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
type: array
service:
type: string
type: object
status:
description: TrafficSplitStatus defines the observed state of TrafficSplit
type: object
type: object
served: true
storage: true
additionalPrinterColumns:
- name: Service
type: string
description: The apex service of this split.
jsonPath: .spec.service
storage: false
subresources:
status: {}
- name: v1alpha2
schema:
openAPIV3Schema:
description: TrafficSplit is the Schema for the trafficsplits API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: TrafficSplitSpec defines the desired state of TrafficSplit
properties:
backends:
items:
description: TrafficSplitBackend defines a backend
properties:
service:
type: string
weight:
type: integer
required:
- service
- weight
type: object
type: array
service:
type: string
type: object
status:
description: TrafficSplitStatus defines the observed state of TrafficSplit
type: object
type: object
served: true
storage: false
subresources:
status: {}
- name: v1alpha3
schema:
openAPIV3Schema:
description: TrafficSplit is the Schema for the trafficsplits API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: TrafficSplitSpec defines the desired state of TrafficSplit
properties:
backends:
description: Backends defines a list of Kubernetes services used as
the traffic split destination
items:
description: TrafficSplitBackend defines a backend
properties:
service:
description: Service is the name of a Kubernetes service
type: string
weight:
description: Weight defines the traffic split percentage
type: integer
required:
- service
- weight
type: object
type: array
matches:
description: Matches allows defining a list of HTTP route groups that
this traffic split object should match
items:
description: TypedLocalObjectReference contains enough information
to let you locate the typed referenced object inside the same
namespace.
properties:
apiGroup:
description: APIGroup is the group for the resource being referenced.
If APIGroup is not specified, the specified Kind must be in
the core API group. For any other third-party types, APIGroup
is required.
type: string
kind:
description: Kind is the type of resource being referenced
type: string
name:
description: Name is the name of resource being referenced
type: string
required:
- kind
- name
type: object
type: array
service:
description: Service represents the apex service
type: string
required:
- backends
- service
type: object
status:
description: TrafficSplitStatus defines the observed state of TrafficSplit
type: object
type: object
served: true
storage: false
subresources:
status: {}
- name: v1alpha4
schema:
openAPIV3Schema:
description: TrafficSplit is the Schema for the trafficsplits API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: TrafficSplitSpec defines the desired state of TrafficSplit
properties:
backends:
description: Backends defines a list of Kubernetes services used as
the traffic split destination
items:
description: TrafficSplitBackend defines a backend
properties:
service:
description: Service is the name of a Kubernetes service
type: string
weight:
description: Weight defines the traffic split percentage
type: integer
required:
- service
- weight
type: object
type: array
matches:
description: Matches allows defining a list of HTTP route groups that
this traffic split object should match
items:
description: TypedLocalObjectReference contains enough information
to let you locate the typed referenced object inside the same
namespace.
properties:
apiGroup:
description: APIGroup is the group for the resource being referenced.
If APIGroup is not specified, the specified Kind must be in
the core API group. For any other third-party types, APIGroup
is required.
type: string
kind:
description: Kind is the type of resource being referenced
type: string
name:
description: Name is the name of resource being referenced
type: string
required:
- kind
- name
type: object
type: array
service:
description: Service represents the apex service
type: string
required:
- backends
- service
type: object
status:
description: TrafficSplitStatus defines the observed state of TrafficSplit
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
1 change: 1 addition & 0 deletions test/e2e/functional/alb-bluegreen-rollout.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ spec:
- http:
paths:
- path: /*
pathType: Prefix
backend:
service:
name: alb-bluegreen-stable
Expand Down
1 change: 1 addition & 0 deletions test/e2e/functional/alb-canary-rollout.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
- http:
paths:
- path: /*
pathType: Prefix
backend:
service:
name: alb-canary-root
Expand Down
1 change: 1 addition & 0 deletions test/e2e/functional/canary-dynamic-stable-scale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ spec:
- http:
paths:
- path: /*
pathType: Prefix
backend:
service:
name: dynamic-stable-scale-root
Expand Down
1 change: 1 addition & 0 deletions test/e2e/functional/canary-scaledowndelay.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
- http:
paths:
- path: /*
pathType: Prefix
backend:
service:
name: canary-scaledowndelay-root
Expand Down
1 change: 1 addition & 0 deletions test/e2e/functional/canary-scaledownonabort.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
- http:
paths:
- path: /*
pathType: Prefix
backend:
service:
name: canary-scaledowndelay-root
Expand Down
8 changes: 5 additions & 3 deletions test/e2e/functional/canary-unscaledownonabort.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ spec:
- http:
paths:
- path: /*
pathType: Prefix
backend:
name:: canary-scaledowndelay-root
port:
name: use-annotation
service:
name: canary-scaledowndelay-root
port:
name: use-annotation
---
apiVersion: argoproj.io/v1alpha1
kind: Rollout
Expand Down
1 change: 1 addition & 0 deletions test/e2e/functional/nginx-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ spec:
- http:
paths:
- path: /*
pathType: Prefix
backend:
service:
name: REPLACEME-stable
Expand Down
1 change: 1 addition & 0 deletions test/e2e/smi_ingress/rollout-smi-ingress-canary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ spec:
http:
paths:
- path: /
pathType: Prefix
backend:
# Reference to a Service name, also specified in the Rollout spec.strategy.canary.stableService field
service:
Expand Down
14 changes: 7 additions & 7 deletions test/fixtures/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
appsv1 "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
networkingv1 "k8s.io/api/networking/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand Down Expand Up @@ -527,26 +527,26 @@ func (c *Common) GetServices() (*corev1.Service, *corev1.Service) {
return desiredSvc, stableSvc
}

func (c *Common) GetALBIngress() *extensionsv1beta1.Ingress {
func (c *Common) GetALBIngress() *networkingv1.Ingress {
ro := c.Rollout()
name := ro.Spec.Strategy.Canary.TrafficRouting.ALB.Ingress
ingress, err := c.kubeClient.ExtensionsV1beta1().Ingresses(c.namespace).Get(c.Context, name, metav1.GetOptions{})
ingress, err := c.kubeClient.NetworkingV1().Ingresses(c.namespace).Get(c.Context, name, metav1.GetOptions{})
c.CheckError(err)
return ingress
}

func (c *Common) GetNginxIngressStable() *extensionsv1beta1.Ingress {
func (c *Common) GetNginxIngressStable() *networkingv1.Ingress {
ro := c.Rollout()
name := ro.Spec.Strategy.Canary.TrafficRouting.Nginx.StableIngress
ingress, err := c.kubeClient.ExtensionsV1beta1().Ingresses(c.namespace).Get(c.Context, name, metav1.GetOptions{})
ingress, err := c.kubeClient.NetworkingV1().Ingresses(c.namespace).Get(c.Context, name, metav1.GetOptions{})
c.CheckError(err)
return ingress
}

func (c *Common) GetNginxIngressCanary() *extensionsv1beta1.Ingress {
func (c *Common) GetNginxIngressCanary() *networkingv1.Ingress {
ro := c.Rollout()
name := ro.Name + "-" + ro.Spec.Strategy.Canary.TrafficRouting.Nginx.StableIngress + "-canary"
ingress, err := c.kubeClient.ExtensionsV1beta1().Ingresses(c.namespace).Get(c.Context, name, metav1.GetOptions{})
ingress, err := c.kubeClient.NetworkingV1().Ingresses(c.namespace).Get(c.Context, name, metav1.GetOptions{})
c.CheckError(err)
return ingress
}
Expand Down

0 comments on commit 4c35845

Please sign in to comment.