Skip to content

Commit

Permalink
Bump go to v1.23.4
Browse files Browse the repository at this point in the history
Signed-off-by: Jian Wang <[email protected]>
(cherry picked from commit 568d639)
  • Loading branch information
w13915984028 committed Feb 14, 2025
1 parent 1741161 commit 9df8446
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM registry.suse.com/bci/golang:1.22.8
FROM registry.suse.com/bci/golang:1.23

ARG DAPPER_HOST_ARCH
ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH}

RUN zypper -n rm container-suseconnect && \
zypper -n install git curl docker gzip tar wget awk
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.57.1
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.64.4

# The docker version in dapper is too old to have buildx. Install it manually.
RUN curl -sSfL https://github.com/docker/buildx/releases/download/v0.17.1/buildx-v0.17.1.linux-${ARCH} -o buildx-v0.17.1.linux-${ARCH} && \
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/harvester/harvester-load-balancer

go 1.22.8
go 1.23.4

replace (
github.com/containerd/containerd => github.com/containerd/containerd v1.6.18
Expand Down
4 changes: 4 additions & 0 deletions pkg/lb/servicelb/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,14 @@ func (m *Manager) generateOneProber(lb *lbv1.LoadBalancer, ep *discoveryv1.Endpo
if lb.Spec.HealthCheck.TimeoutSeconds == 0 {
option.Timeout = defaultTimeout
} else {
// escape gosec error: G115: integer overflow conversion uint -> int64 (gosec)
//#nosec
option.Timeout = time.Duration(lb.Spec.HealthCheck.TimeoutSeconds) * time.Second
}
if lb.Spec.HealthCheck.PeriodSeconds == 0 {
option.Period = defaultPeriod
} else {
//#nosec
option.Period = time.Duration(lb.Spec.HealthCheck.PeriodSeconds) * time.Second
}
if ep.Conditions.Ready != nil {
Expand All @@ -472,6 +475,7 @@ func unMarshalUID(uid string) (namespace, name string, err error) {
}

func marshalPorberAddress(lb *lbv1.LoadBalancer, ep *discoveryv1.Endpoint) string {
//#nosec
return ep.Addresses[0] + ":" + strconv.Itoa(int(lb.Spec.HealthCheck.Port))
}

Expand Down
16 changes: 10 additions & 6 deletions pkg/webhook/loadbalancer/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ func (c *converter) convertFromV1alpha1ToV1beta1(obj *unstructured.Unstructured)
for _, listener := range listeners {
l := listener.(map[string]interface{})
v1beta1Listeners = append(v1beta1Listeners, lbv1beta1.Listener{
Name: l[keyName].(string),
Port: int32(l[keyPort].(int64)),
Protocol: corev1.Protocol(l[keyProtocol].(string)),
Name: l[keyName].(string),
//#nosec
Port: int32(l[keyPort].(int64)),
Protocol: corev1.Protocol(l[keyProtocol].(string)),
//#nosec
BackendPort: int32(l[keyBackendPort].(int64)),
})
}
Expand Down Expand Up @@ -133,9 +135,11 @@ func (c *converter) convertFromV1beta1ToV1alpha1(obj *unstructured.Unstructured)
for _, listener := range listeners {
l := listener.(map[string]interface{})
v1alpha1Listeners = append(v1alpha1Listeners, &lbv1alpha1.Listener{
Name: l[keyName].(string),
Port: int32(l[keyPort].(int64)),
Protocol: corev1.Protocol(l[keyProtocol].(string)),
Name: l[keyName].(string),
//#nosec
Port: int32(l[keyPort].(int64)),
Protocol: corev1.Protocol(l[keyProtocol].(string)),
//#nosec
BackendPort: int32(l[keyBackendPort].(int64)),
})
}
Expand Down
1 change: 1 addition & 0 deletions pkg/webhook/loadbalancer/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func checkHealthyCheck(lb *lbv1.LoadBalancer) error {
wrongProtocol := false
for _, listener := range lb.Spec.Listeners {
// check listener port and protocol, only TCP is supported now
//#nosec
if uint(listener.BackendPort) == lb.Spec.HealthCheck.Port {
if listener.Protocol == corev1.ProtocolTCP {
if lb.Spec.HealthCheck.SuccessThreshold == 0 {
Expand Down

0 comments on commit 9df8446

Please sign in to comment.