Skip to content
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ Adding a new version? You'll need three changes:
[#7751](https://github.com/Kong/kubernetes-ingress-controller/pull/7751)
- Reject CA Secrets with multiple PEM certs.
[#7763](https://github.com/Kong/kubernetes-ingress-controller/pull/7763)
- Translate `healtchchecks.thershold` in `KongUpstreamPolicy` to the
`healthchecks.thershold` field in Kong upstreams.
(Thanks to [@elbrogan-vizio](https://github.com/elbrogan-vizio) who contributed to the fix.)
[#7784](https://github.com/Kong/kubernetes-ingress-controller/pull/7784)

## [3.5.2]

Expand Down
12 changes: 10 additions & 2 deletions internal/dataplane/kongstate/kongupstreampolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ func translateHealthchecks(healthchecks *configurationv1beta1.KongUpstreamHealth
return nil
}
return &kong.Healthcheck{
Active: translateActiveHealthcheck(healthchecks.Active),
Passive: translatePassiveHealthcheck(healthchecks.Passive),
Active: translateActiveHealthcheck(healthchecks.Active),
Passive: translatePassiveHealthcheck(healthchecks.Passive),
Threshold: translateThreshold(healthchecks.Threshold),
}
}

Expand Down Expand Up @@ -204,6 +205,13 @@ func translatePassiveHealthcheck(healthcheck *configurationv1beta1.KongUpstreamP
}
}

func translateThreshold(threshold *int) *float64 {
if threshold == nil {
return nil
}
return lo.ToPtr(float64(*threshold))
}

func translateHealthy(healthy *configurationv1beta1.KongUpstreamHealthcheckHealthy) *kong.Healthy {
if healthy == nil {
return nil
Expand Down
3 changes: 2 additions & 1 deletion internal/dataplane/kongstate/kongupstreampolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ func TestTranslateKongUpstreamPolicy(t *testing.T) {
Timeouts: lo.ToPtr(120),
},
},
Threshold: lo.ToPtr(140),
Threshold: lo.ToPtr(15),
},
},
expectedUpstream: &kong.Upstream{
Expand Down Expand Up @@ -418,6 +418,7 @@ func TestTranslateKongUpstreamPolicy(t *testing.T) {
Timeouts: lo.ToPtr(120),
},
},
Threshold: lo.ToPtr(15.0),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions test/kongintegration/kongupstreampolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func TestKongUpstreamPolicyTranslation(t *testing.T) {
Timeouts: lo.ToPtr(120),
},
},
Threshold: lo.ToPtr(140),
Threshold: lo.ToPtr(10),
},
},
expectedUpstream: &kong.Upstream{
Expand Down Expand Up @@ -214,7 +214,7 @@ func TestKongUpstreamPolicyTranslation(t *testing.T) {
Timeouts: lo.ToPtr(120),
},
},
Threshold: lo.ToPtr(0.),
Threshold: lo.ToPtr(10.0),
},
},
},
Expand Down