| 1 |
From: Reinhard Tartler <[email protected]> |
| 2 |
Date: Sun, 26 Oct 2025 06:42:29 -0400 |
| 3 |
Subject: Migrate from legacy k8s.io/klog to k8s.io/klog/v2 |
| 4 |
Forwarded: no |
| 5 |
--- |
| 6 |
cmd/imagebuilder/imagebuilder.go | 4 ++-- |
| 7 |
dockerclient/archive.go | 2 +- |
| 8 |
dockerclient/client.go | 6 +++--- |
| 9 |
dockerclient/directory.go | 2 +- |
| 10 |
4 files changed, 7 insertions(+), 7 deletions(-) |
| 11 |
|
| 12 |
diff --git a/cmd/imagebuilder/imagebuilder.go b/cmd/imagebuilder/imagebuilder.go |
| 13 |
index 0e7b274..4b107bb 100644 |
| 14 |
--- a/cmd/imagebuilder/imagebuilder.go |
| 15 |
+++ b/cmd/imagebuilder/imagebuilder.go |
| 16 |
@@ -13,7 +13,7 @@ import ( |
| 17 |
"github.com/distribution/reference" |
| 18 |
docker "github.com/fsouza/go-dockerclient" |
| 19 |
dockerregistrytypes "github.com/moby/moby/api/types/registry" |
| 20 |
- "k8s.io/klog" |
| 21 |
+ "k8s.io/klog/v2" |
| 22 |
|
| 23 |
"github.com/openshift/imagebuilder" |
| 24 |
"github.com/openshift/imagebuilder/dockerclient" |
| 25 |
@@ -152,7 +152,7 @@ func main() { |
| 26 |
return nil, false |
| 27 |
} |
| 28 |
options.LogFn = func(format string, args ...interface{}) { |
| 29 |
- if klog.V(2) { |
| 30 |
+ if klog.V(2).Enabled() { |
| 31 |
log.Printf("Builder: "+format, args...) |
| 32 |
} else { |
| 33 |
fmt.Fprintf(options.Out, "--> %s\n", fmt.Sprintf(format, args...)) |
| 34 |
diff --git a/dockerclient/archive.go b/dockerclient/archive.go |
| 35 |
index 7c2342b..7bc580f 100644 |
| 36 |
--- a/dockerclient/archive.go |
| 37 |
+++ b/dockerclient/archive.go |
| 38 |
@@ -18,7 +18,7 @@ import ( |
| 39 |
"go.podman.io/storage/pkg/fileutils" |
| 40 |
"go.podman.io/storage/pkg/idtools" |
| 41 |
"go.podman.io/storage/pkg/ioutils" |
| 42 |
- "k8s.io/klog" |
| 43 |
+ "k8s.io/klog/v2" |
| 44 |
) |
| 45 |
|
| 46 |
var isArchivePath = archive.IsArchivePath |
| 47 |
diff --git a/dockerclient/client.go b/dockerclient/client.go |
| 48 |
index f404705..f15451b 100644 |
| 49 |
--- a/dockerclient/client.go |
| 50 |
+++ b/dockerclient/client.go |
| 51 |
@@ -18,7 +18,7 @@ import ( |
| 52 |
|
| 53 |
docker "github.com/fsouza/go-dockerclient" |
| 54 |
dockerregistrytypes "github.com/moby/moby/api/types/registry" |
| 55 |
- "k8s.io/klog" |
| 56 |
+ "k8s.io/klog/v2" |
| 57 |
|
| 58 |
"github.com/openshift/imagebuilder" |
| 59 |
"github.com/openshift/imagebuilder/dockerfile/parser" |
| 60 |
@@ -654,7 +654,7 @@ func (e *ClientExecutor) LoadImageWithPlatform(from string, platform string) (*d |
| 61 |
Platform: platform, |
| 62 |
RawJSONStream: true, |
| 63 |
} |
| 64 |
- if klog.V(5) { |
| 65 |
+ if klog.V(5).Enabled() { |
| 66 |
pullImageOptions.OutputStream = os.Stderr |
| 67 |
pullImageOptions.RawJSONStream = false |
| 68 |
} |
| 69 |
@@ -1167,7 +1167,7 @@ func (e *ClientExecutor) CopyContainer(container *docker.Container, excludes []s |
| 70 |
r = filtered |
| 71 |
} |
| 72 |
klog.V(5).Infof("Uploading to %s%s at %s", container.ID, asOwner, c.Dest) |
| 73 |
- if klog.V(6) { |
| 74 |
+ if klog.V(6).Enabled() { |
| 75 |
logArchiveOutput(r, "Archive file for %s") |
| 76 |
} |
| 77 |
// add a workaround allow us to notice if a |
| 78 |
diff --git a/dockerclient/directory.go b/dockerclient/directory.go |
| 79 |
index a354eea..19590ed 100644 |
| 80 |
--- a/dockerclient/directory.go |
| 81 |
+++ b/dockerclient/directory.go |
| 82 |
@@ -6,7 +6,7 @@ import ( |
| 83 |
"io" |
| 84 |
|
| 85 |
docker "github.com/fsouza/go-dockerclient" |
| 86 |
- "k8s.io/klog" |
| 87 |
+ "k8s.io/klog/v2" |
| 88 |
) |
| 89 |
|
| 90 |
type DirectoryCheck interface { |