Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

get operator in sync with Contour #464

Merged
merged 1 commit into from
Nov 2, 2021
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
20 changes: 19 additions & 1 deletion config/crd/contour/01-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1890,6 +1890,12 @@ spec:
description: RequestHashPolicy contains configuration for an
individual hash policy on a request attribute.
properties:
hashSourceIP:
description: HashSourceIP should be set to true when request
source IP hash based load balancing is desired. It must
be the only hash option field set, otherwise this request
hash policy object will be ignored.
type: boolean
headerHashOptions:
description: HeaderHashOptions should be set when request
header hash based load balancing is desired. It must be
Expand Down Expand Up @@ -2565,6 +2571,12 @@ spec:
description: RequestHashPolicy contains configuration
for an individual hash policy on a request attribute.
properties:
hashSourceIP:
description: HashSourceIP should be set to true when
request source IP hash based load balancing is desired.
It must be the only hash option field set, otherwise
this request hash policy object will be ignored.
type: boolean
headerHashOptions:
description: HeaderHashOptions should be set when
request header hash based load balancing is desired.
Expand Down Expand Up @@ -3269,6 +3281,12 @@ spec:
description: RequestHashPolicy contains configuration for
an individual hash policy on a request attribute.
properties:
hashSourceIP:
description: HashSourceIP should be set to true when
request source IP hash based load balancing is desired.
It must be the only hash option field set, otherwise
this request hash policy object will be ignored.
type: boolean
headerHashOptions:
description: HeaderHashOptions should be set when request
header hash based load balancing is desired. It must
Expand Down Expand Up @@ -3616,7 +3634,7 @@ spec:
description: The fully qualified domain name of the root of the
ingress tree all leaves of the DAG rooted at this object relate
to the fqdn.
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
pattern: ^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
rateLimitPolicy:
description: The policy for rate limiting on the virtual host.
Expand Down
1 change: 1 addition & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ rules:
- gatewayclasses
- gateways
- httproutes
- referencepolicies
- tlsroutes
verbs:
- get
Expand Down
21 changes: 20 additions & 1 deletion examples/operator/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2525,6 +2525,12 @@ spec:
description: RequestHashPolicy contains configuration for an
individual hash policy on a request attribute.
properties:
hashSourceIP:
description: HashSourceIP should be set to true when request
source IP hash based load balancing is desired. It must
be the only hash option field set, otherwise this request
hash policy object will be ignored.
type: boolean
headerHashOptions:
description: HeaderHashOptions should be set when request
header hash based load balancing is desired. It must be
Expand Down Expand Up @@ -4143,6 +4149,12 @@ spec:
description: RequestHashPolicy contains configuration
for an individual hash policy on a request attribute.
properties:
hashSourceIP:
description: HashSourceIP should be set to true when
request source IP hash based load balancing is desired.
It must be the only hash option field set, otherwise
this request hash policy object will be ignored.
type: boolean
headerHashOptions:
description: HeaderHashOptions should be set when
request header hash based load balancing is desired.
Expand Down Expand Up @@ -4847,6 +4859,12 @@ spec:
description: RequestHashPolicy contains configuration for
an individual hash policy on a request attribute.
properties:
hashSourceIP:
description: HashSourceIP should be set to true when
request source IP hash based load balancing is desired.
It must be the only hash option field set, otherwise
this request hash policy object will be ignored.
type: boolean
headerHashOptions:
description: HeaderHashOptions should be set when request
header hash based load balancing is desired. It must
Expand Down Expand Up @@ -5194,7 +5212,7 @@ spec:
description: The fully qualified domain name of the root of the
ingress tree all leaves of the DAG rooted at this object relate
to the fqdn.
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
pattern: ^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
rateLimitPolicy:
description: The policy for rate limiting on the virtual host.
Expand Down Expand Up @@ -8967,6 +8985,7 @@ rules:
- gatewayclasses
- gateways
- httproutes
- referencepolicies
- tlsroutes
verbs:
- get
Expand Down
3 changes: 2 additions & 1 deletion internal/objects/clusterrole/cluster_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ func desiredClusterRole(name string, contour *operatorv1alpha1.Contour) *rbacv1.
gateway := rbacv1.PolicyRule{
Verbs: verbGLWU,
APIGroups: groupGateway,
Resources: []string{"gatewayclasses", "gateways", "httproutes", "tlsroutes"},
Resources: []string{"gatewayclasses", "gateways", "httproutes", "tlsroutes", "referencepolicies"},
}
// Note, ReferencePolicy does not currently have a .status field so it's omitted from the below.
gatewayStatus := rbacv1.PolicyRule{
Verbs: verbCGU,
APIGroups: groupGateway,
Expand Down
26 changes: 2 additions & 24 deletions internal/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/projectcontour/contour-operator/internal/controller"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/rest"
controller_runtime "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -60,7 +59,8 @@ type Operator struct {
// +kubebuilder:rbac:groups="",resources=configmaps,verbs=get;list;watch;delete;create;update
// +kubebuilder:rbac:groups="",resources=endpoints,verbs=get;list;watch
// +kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;list;watch;create;update
// +kubebuilder:rbac:groups=gateway.networking.k8s.io,resources=gatewayclasses;gateways;httproutes;tlsroutes,verbs=get;list;watch;update
// +kubebuilder:rbac:groups=gateway.networking.k8s.io,resources=gatewayclasses;gateways;httproutes;tlsroutes;referencepolicies,verbs=get;list;watch;update
// Note, ReferencePolicy does not currently have a .status field so it's omitted from the below.
// +kubebuilder:rbac:groups=gateway.networking.k8s.io,resources=gatewayclasses/status;gateways/status;httproutes/status;tlsroutes/status,verbs=create;get;update
// Required for Contour to set "unsupported" status
// +kubebuilder:rbac:groups=gateway.networking.k8s.io,resources=udproutes;tcproutes,verbs=get;list;watch
Expand Down Expand Up @@ -129,25 +129,3 @@ func (o *Operator) Start(ctx context.Context) error {
return err
}
}

// GatewayAPIResources for Operator.
// The list omits TCP and UDP routes since they're unsupported by operator.
func GatewayAPIResources() []schema.GroupVersionResource {
return []schema.GroupVersionResource{{
Group: gatewayv1alpha2.GroupVersion.Group,
Version: gatewayv1alpha2.GroupVersion.Version,
Resource: "gatewayclasses",
}, {
Group: gatewayv1alpha2.GroupVersion.Group,
Version: gatewayv1alpha2.GroupVersion.Version,
Resource: "gateways",
}, {
Group: gatewayv1alpha2.GroupVersion.Group,
Version: gatewayv1alpha2.GroupVersion.Version,
Resource: "httproutes",
}, {
Group: gatewayv1alpha2.GroupVersion.Group,
Version: gatewayv1alpha2.GroupVersion.Version,
Resource: "tlsroutes",
}}
}