Skip to content

Commit 3152257

Browse files
committed
resolve coment
1 parent c9fa9f4 commit 3152257

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

api/adc/types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ type Route struct {
128128
}
129129

130130
type Timeout struct {
131-
Connect int64 `json:"connect"`
132-
Read int64 `json:"read"`
133-
Send int64 `json:"send"`
131+
Connect float64 `json:"connect"`
132+
Read float64 `json:"read"`
133+
Send float64 `json:"send"`
134134
}
135135

136136
type StreamRoute struct {

internal/controller/policies.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,17 @@ func ProcessBackendTrafficPolicy(c client.Client,
6060
condition := NewPolicyCondition(policy.Generation, true, "Policy has been accepted")
6161
if sectionName != nil && !portNameExist[string(*sectionName)] {
6262
condition = NewPolicyCondition(policy.Generation, false, fmt.Sprintf("SectionName %s not found in Service %s/%s", *sectionName, service.Namespace, service.Name))
63-
goto record_status
63+
if ok := SetAncestors(&policy.Status, tctx.ParentRefs, condition); ok {
64+
updated = true
65+
}
6466
}
6567
if p, ok := conflicts[key.String()]; ok && (p.Name == policy.Name && p.Namespace == policy.Namespace) {
6668
condition = NewPolicyConflictCondition(policy.Generation, fmt.Sprintf("Unable to target Service %s/%s, because it conflicts with another BackendTrafficPolicy", service.Namespace, service.Name))
67-
goto record_status
69+
if ok := SetAncestors(&policy.Status, tctx.ParentRefs, condition); ok {
70+
updated = true
71+
}
6872
}
6973
conflicts[key.String()] = policy
70-
record_status:
71-
if ok := SetAncestors(&policy.Status, tctx.ParentRefs, condition); ok {
72-
updated = true
73-
}
7474
}
7575
if _, ok := tctx.BackendTrafficPolicies[types.NamespacedName{
7676
Name: policy.Name,
@@ -108,6 +108,10 @@ func SetAncestors(status *v1alpha1.PolicyStatus, parentRefs []gatewayv1.ParentRe
108108
func SetAncestorStatus(status *v1alpha1.PolicyStatus, ancestorStatus gatewayv1alpha2.PolicyAncestorStatus) bool {
109109
for _, c := range status.Ancestors {
110110
if c.AncestorRef == ancestorStatus.AncestorRef {
111+
if len(c.Conditions) == 0 || len(ancestorStatus.Conditions) == 0 {
112+
c.Conditions = ancestorStatus.Conditions
113+
return true
114+
}
111115
if c.Conditions[0].ObservedGeneration < ancestorStatus.Conditions[0].ObservedGeneration {
112116
c.Conditions = ancestorStatus.Conditions
113117
return true

internal/provider/adc/translator/policies.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ func (t *Translator) attachBackendTrafficPolicyToUpstream(policy *v1alpha1.Backe
4141
}
4242
if policy.Spec.Timeout != nil {
4343
upstream.Timeout = &adctypes.Timeout{
44-
Connect: policy.Spec.Timeout.Connect.Duration.Milliseconds(),
45-
Read: policy.Spec.Timeout.Read.Duration.Milliseconds(),
46-
Send: policy.Spec.Timeout.Send.Duration.Milliseconds(),
44+
Connect: policy.Spec.Timeout.Connect.Duration.Seconds(),
45+
Read: policy.Spec.Timeout.Read.Duration.Seconds(),
46+
Send: policy.Spec.Timeout.Send.Duration.Seconds(),
4747
}
4848
}
4949
if policy.Spec.LoadBalancer != nil {

0 commit comments

Comments
 (0)