From 1bf8485cdf5377f64ead311ee8e04284fd0414f2 Mon Sep 17 00:00:00 2001 From: Justin SB Date: Sat, 23 Apr 2022 18:21:29 -0400 Subject: [PATCH] Recognize kops-controller in registry.k8s.io We had hard-coded k8s.gcr.io, but this is also available in registry.k8s.io Also cleanup a few comments --- pkg/assets/builder.go | 4 ++-- pkg/truncate/truncate.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/assets/builder.go b/pkg/assets/builder.go index 0de4ec2ab2745..c8eccc6702e96 100644 --- a/pkg/assets/builder.go +++ b/pkg/assets/builder.go @@ -156,8 +156,8 @@ func (a *AssetBuilder) RemapImage(image string) (string, error) { } } - if strings.HasPrefix(image, "registry.k8s.io/kops/kops-controller:") { - // To use user-defined DNS Controller: + if strings.HasPrefix(image, "k8s.gcr.io/kops/kops-controller:") || strings.HasPrefix(image, "registry.k8s.io/kops/kops-controller:") { + // To use user-defined kops Controller: // 1. DOCKER_REGISTRY=[your docker hub repo] make kops-controller-push // 2. export KOPSCONTROLLER_IMAGE=[your docker hub repo] // 3. make kops and create/apply cluster diff --git a/pkg/truncate/truncate.go b/pkg/truncate/truncate.go index 77e6552ea31f6..a27fc5eada633 100644 --- a/pkg/truncate/truncate.go +++ b/pkg/truncate/truncate.go @@ -37,7 +37,7 @@ type TruncateStringOptions struct { HashLength int } -// TruncateString will attempt to truncate a string to a max, adding a prefix to avoid collisions. +// TruncateString will attempt to truncate a string to a max length, adding a suffix to avoid collisions. // Will never return a string longer than maxLength chars func TruncateString(s string, opt TruncateStringOptions) string { if opt.MaxLength == 0 {