Skip to content

Commit 9615a19

Browse files
authored
add listener policy status (#10917)
1 parent 2282e8b commit 9615a19

File tree

11 files changed

+106
-259
lines changed

11 files changed

+106
-259
lines changed

api/applyconfiguration/api/v1alpha1/httplistenerpolicy.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/applyconfiguration/api/v1alpha1/policyancestorstatus.go

Lines changed: 0 additions & 51 deletions
This file was deleted.

api/applyconfiguration/api/v1alpha1/policystatus.go

Lines changed: 0 additions & 46 deletions
This file was deleted.

api/applyconfiguration/internal/internal.go

Lines changed: 1 addition & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/applyconfiguration/utils.go

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha1/http_listener_policy_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type HTTPListenerPolicy struct {
2020
metav1.ObjectMeta `json:"metadata,omitempty"`
2121

2222
Spec HTTPListenerPolicySpec `json:"spec,omitempty"`
23-
Status PolicyStatus `json:"status,omitempty"`
23+
Status SimpleStatus `json:"status,omitempty"`
2424
}
2525

2626
// +kubebuilder:object:root=true

install/helm/kgateway-crds/templates/gateway.kgateway.dev_httplistenerpolicies.yaml

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -486,93 +486,6 @@ spec:
486486
type: object
487487
status:
488488
properties:
489-
ancestors:
490-
items:
491-
properties:
492-
ancestorRef:
493-
properties:
494-
group:
495-
default: gateway.networking.k8s.io
496-
maxLength: 253
497-
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
498-
type: string
499-
kind:
500-
default: Gateway
501-
maxLength: 63
502-
minLength: 1
503-
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
504-
type: string
505-
name:
506-
maxLength: 253
507-
minLength: 1
508-
type: string
509-
namespace:
510-
maxLength: 63
511-
minLength: 1
512-
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
513-
type: string
514-
port:
515-
format: int32
516-
maximum: 65535
517-
minimum: 1
518-
type: integer
519-
sectionName:
520-
maxLength: 253
521-
minLength: 1
522-
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
523-
type: string
524-
required:
525-
- name
526-
type: object
527-
conditions:
528-
items:
529-
properties:
530-
lastTransitionTime:
531-
format: date-time
532-
type: string
533-
message:
534-
maxLength: 32768
535-
type: string
536-
observedGeneration:
537-
format: int64
538-
minimum: 0
539-
type: integer
540-
reason:
541-
maxLength: 1024
542-
minLength: 1
543-
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
544-
type: string
545-
status:
546-
enum:
547-
- "True"
548-
- "False"
549-
- Unknown
550-
type: string
551-
type:
552-
maxLength: 316
553-
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
554-
type: string
555-
required:
556-
- lastTransitionTime
557-
- message
558-
- reason
559-
- status
560-
- type
561-
type: object
562-
maxItems: 8
563-
minItems: 1
564-
type: array
565-
x-kubernetes-list-map-keys:
566-
- type
567-
x-kubernetes-list-type: map
568-
controllerName:
569-
type: string
570-
required:
571-
- ancestorRef
572-
- controllerName
573-
type: object
574-
maxItems: 16
575-
type: array
576489
conditions:
577490
items:
578491
properties:
@@ -613,8 +526,6 @@ spec:
613526
x-kubernetes-list-map-keys:
614527
- type
615528
x-kubernetes-list-type: map
616-
required:
617-
- ancestors
618529
type: object
619530
type: object
620531
served: true

internal/kgateway/extensions2/plugins/httplistenerpolicy/httplistener_plugin.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
type httpListenerPolicy struct {
3434
ct time.Time
3535
accessLog []*envoyaccesslog.AccessLog
36+
errors []error
3637
}
3738

3839
func (d *httpListenerPolicy) CreationTime() time.Time {
@@ -94,11 +95,11 @@ func NewPlugin(ctx context.Context, commoncol *common.CommonCollections) extensi
9495
Name: i.Name,
9596
}
9697

97-
errors := []error{}
98+
errs := []error{}
9899
accessLog, err := convertAccessLogConfig(ctx, i, commoncol, krtctx, objSrc)
99100
if err != nil {
100101
contextutils.LoggerFrom(ctx).Error(err)
101-
errors = append(errors, err)
102+
errs = append(errs, err)
102103
}
103104

104105
pol := &ir.PolicyWrapper{
@@ -107,9 +108,9 @@ func NewPlugin(ctx context.Context, commoncol *common.CommonCollections) extensi
107108
PolicyIR: &httpListenerPolicy{
108109
ct: i.CreationTimestamp.Time,
109110
accessLog: accessLog,
111+
errors: errs,
110112
},
111113
TargetRefs: convert(i.Spec.TargetRefs),
112-
Errors: errors,
113114
}
114115

115116
return pol
@@ -123,6 +124,9 @@ func NewPlugin(ctx context.Context, commoncol *common.CommonCollections) extensi
123124
Policies: policyCol,
124125
},
125126
},
127+
ContributesRegistration: map[schema.GroupKind]func(){
128+
wellknown.HTTPListenerPolicyGVK.GroupKind(): buildRegisterCallback(ctx, commoncol.CrudClient, policyCol),
129+
},
126130
}
127131
}
128132

0 commit comments

Comments
 (0)