Skip to content

Commit 794fbf6

Browse files
authored
Merge branch 'main' into parallel-docs
2 parents f0340a6 + 71b230f commit 794fbf6

10 files changed

Lines changed: 19 additions & 379 deletions

File tree

Dockerfile

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,38 +48,11 @@ RUN mkdir -p /output/usr/bin && \
4848
-ldflags "${LDFLAGS}" ${PKG}/cmd/velero-helper && \
4949
go clean -modcache -cache
5050

51-
# Restic binary build section
52-
FROM --platform=$BUILDPLATFORM golang:1.25-trixie AS restic-builder
53-
54-
ARG GOPROXY
55-
ARG BIN
56-
ARG TARGETOS
57-
ARG TARGETARCH
58-
ARG TARGETVARIANT
59-
ARG RESTIC_VERSION
60-
61-
ENV CGO_ENABLED=0 \
62-
GO111MODULE=on \
63-
GOPROXY=${GOPROXY} \
64-
GOOS=${TARGETOS} \
65-
GOARCH=${TARGETARCH} \
66-
GOARM=${TARGETVARIANT}
67-
68-
COPY . /go/src/github.com/vmware-tanzu/velero
69-
70-
RUN mkdir -p /output/usr/bin && \
71-
export GOARM=$(echo "${GOARM}" | cut -c2-) && \
72-
/go/src/github.com/vmware-tanzu/velero/hack/build-restic.sh && \
73-
go clean -modcache -cache
74-
7551
# Velero image packing section
7652
FROM paketobuildpacks/run-jammy-tiny:latest
7753

7854
LABEL maintainer="Xun Jiang <jxun@vmware.com>"
7955

8056
COPY --from=velero-builder /output /
8157

82-
COPY --from=restic-builder /output /
83-
8458
USER cnb:cnb
85-

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ see: https://velero.io/docs/main/build-from-source/#making-images-and-updating-v
105105
endef
106106
# comma cannot be escaped and can only be used in Make function arguments by putting into variable
107107
comma=,
108-
# The version of restic binary to be downloaded
109-
RESTIC_VERSION ?= 0.15.0
110108

111109
CLI_PLATFORMS ?= linux-amd64 linux-arm linux-arm64 darwin-amd64 darwin-arm64 windows-amd64 linux-ppc64le linux-s390x
112110
BUILD_OUTPUT_TYPE ?= docker
@@ -260,7 +258,6 @@ container-linux:
260258
--build-arg=GIT_SHA=$(GIT_SHA) \
261259
--build-arg=GIT_TREE_STATE=$(GIT_TREE_STATE) \
262260
--build-arg=REGISTRY=$(REGISTRY) \
263-
--build-arg=RESTIC_VERSION=$(RESTIC_VERSION) \
264261
--provenance=false \
265262
--sbom=false \
266263
-f $(VELERO_DOCKERFILE) .

Tiltfile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,6 @@ local_resource(
103103
deps = ["internal", "pkg/cmd"],
104104
)
105105

106-
local_resource(
107-
"restic_binary",
108-
cmd = 'cd ' + '.' + ';mkdir -p _tiltbuild/restic; BIN=velero GOOS=linux GOARCH=amd64 GOARM="" RESTIC_VERSION=0.13.1 OUTPUT_DIR=_tiltbuild/restic ./hack/build-restic.sh',
109-
)
110-
111106
# Note: we need a distro with a bash shell to exec into the Velero container
112107
tilt_dockerfile_header = """
113108
FROM ubuntu:22.04 as tilt
@@ -118,7 +113,6 @@ WORKDIR /
118113
COPY --from=tilt-helper /start.sh .
119114
COPY --from=tilt-helper /restart.sh .
120115
COPY velero .
121-
COPY restic/restic /usr/bin/restic
122116
"""
123117

124118
dockerfile_contents = "\n".join([

changelogs/unreleased/9705-emirot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
perf: better string concatenation
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove Restic build from Dockerfile, Makefile and Tiltfile.

hack/build-restic.sh

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

hack/fix_restic_cve.txt

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

pkg/util/csi/volume_snapshot.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -708,17 +708,18 @@ func DiagnoseVS(vs *snapshotv1api.VolumeSnapshot, events *corev1api.EventList) s
708708
}
709709
}
710710

711-
diag := fmt.Sprintf("VS %s/%s, bind to %s, readyToUse %v, errMessage %s\n", vs.Namespace, vs.Name, vscName, readyToUse, errMessage)
711+
var diag strings.Builder
712+
_, _ = fmt.Fprintf(&diag, "VS %s/%s, bind to %s, readyToUse %v, errMessage %s\n", vs.Namespace, vs.Name, vscName, readyToUse, errMessage)
712713

713714
if events != nil {
714715
for _, e := range events.Items {
715716
if e.InvolvedObject.UID == vs.UID && e.Type == corev1api.EventTypeWarning {
716-
diag += fmt.Sprintf("VS event reason %s, message %s\n", e.Reason, e.Message)
717+
_, _ = fmt.Fprintf(&diag, "VS event reason %s, message %s\n", e.Reason, e.Message)
717718
}
718719
}
719720
}
720721

721-
return diag
722+
return diag.String()
722723
}
723724

724725
func DiagnoseVSC(vsc *snapshotv1api.VolumeSnapshotContent) string {

pkg/util/kube/pod.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"fmt"
2121
"io"
2222
"os"
23+
"strings"
2324
"time"
2425

2526
"github.com/pkg/errors"
@@ -183,16 +184,16 @@ func GetPodContainerTerminateMessage(pod *corev1api.Pod, container string) strin
183184

184185
// GetPodTerminateMessage returns the terminate message for all containers of a pod
185186
func GetPodTerminateMessage(pod *corev1api.Pod) string {
186-
message := ""
187+
var message strings.Builder
187188
for _, containerStatus := range pod.Status.ContainerStatuses {
188189
if containerStatus.State.Terminated != nil {
189190
if containerStatus.State.Terminated.Message != "" {
190-
message += containerStatus.State.Terminated.Message + "/"
191+
message.WriteString(containerStatus.State.Terminated.Message + "/")
191192
}
192193
}
193194
}
194195

195-
return message
196+
return message.String()
196197
}
197198

198199
func getPodLogReader(ctx context.Context, podGetter corev1client.CoreV1Interface, pod string, namespace string, logOptions *corev1api.PodLogOptions) (io.ReadCloser, error) {
@@ -272,21 +273,22 @@ func ToSystemAffinity(loadAffinity *LoadAffinity, volumeTopology *corev1api.Node
272273
}
273274

274275
func DiagnosePod(pod *corev1api.Pod, events *corev1api.EventList) string {
275-
diag := fmt.Sprintf("Pod %s/%s, phase %s, node name %s, message %s\n", pod.Namespace, pod.Name, pod.Status.Phase, pod.Spec.NodeName, pod.Status.Message)
276+
var diag strings.Builder
277+
_, _ = fmt.Fprintf(&diag, "Pod %s/%s, phase %s, node name %s, message %s\n", pod.Namespace, pod.Name, pod.Status.Phase, pod.Spec.NodeName, pod.Status.Message)
276278

277279
for _, condition := range pod.Status.Conditions {
278-
diag += fmt.Sprintf("Pod condition %s, status %s, reason %s, message %s\n", condition.Type, condition.Status, condition.Reason, condition.Message)
280+
_, _ = fmt.Fprintf(&diag, "Pod condition %s, status %s, reason %s, message %s\n", condition.Type, condition.Status, condition.Reason, condition.Message)
279281
}
280282

281283
if events != nil {
282284
for _, e := range events.Items {
283285
if e.InvolvedObject.UID == pod.UID && e.Type == corev1api.EventTypeWarning {
284-
diag += fmt.Sprintf("Pod event reason %s, message %s\n", e.Reason, e.Message)
286+
_, _ = fmt.Fprintf(&diag, "Pod event reason %s, message %s\n", e.Reason, e.Message)
285287
}
286288
}
287289
}
288290

289-
return diag
291+
return diag.String()
290292
}
291293

292294
var funcExit = os.Exit

pkg/util/kube/pvc_pv.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,17 +464,18 @@ func GetPVCForPodVolume(vol *corev1api.Volume, pod *corev1api.Pod, crClient crcl
464464
}
465465

466466
func DiagnosePVC(pvc *corev1api.PersistentVolumeClaim, events *corev1api.EventList) string {
467-
diag := fmt.Sprintf("PVC %s/%s, phase %s, binding to %s\n", pvc.Namespace, pvc.Name, pvc.Status.Phase, pvc.Spec.VolumeName)
467+
var diag strings.Builder
468+
_, _ = fmt.Fprintf(&diag, "PVC %s/%s, phase %s, binding to %s\n", pvc.Namespace, pvc.Name, pvc.Status.Phase, pvc.Spec.VolumeName)
468469

469470
if events != nil {
470471
for _, e := range events.Items {
471472
if e.InvolvedObject.UID == pvc.UID && e.Type == corev1api.EventTypeWarning {
472-
diag += fmt.Sprintf("PVC event reason %s, message %s\n", e.Reason, e.Message)
473+
_, _ = fmt.Fprintf(&diag, "PVC event reason %s, message %s\n", e.Reason, e.Message)
473474
}
474475
}
475476
}
476477

477-
return diag
478+
return diag.String()
478479
}
479480

480481
func DiagnosePV(pv *corev1api.PersistentVolume) string {

0 commit comments

Comments
 (0)