diff --git a/README.md b/README.md index ab77ff5d0..72a72e1ee 100644 --- a/README.md +++ b/README.md @@ -50,14 +50,19 @@ Kompose is released via GitHub on a three-week cycle, you can see all current re **Linux and macOS:** ```sh +<<<<<<< HEAD # Linux (Debian) curl -L https://github.com/kubernetes/kompose/releases/download/v1.31.1/kompose-linux-amd64 -o kompose +======= +# Linux +curl -L https://github.com/kubernetes/kompose/releases/download/v1.31.2/kompose-linux-amd64 -o kompose +>>>>>>> 68443971f3bdc681a93ab4d20d0862ddb7c7f94c # Linux (Mint) curl -L -o kompose https://github.com/kubernetes/kompose/releases/download/v1.31.1/kompose-linux-amd64 # macOS -curl -L https://github.com/kubernetes/kompose/releases/download/v1.31.1/kompose-darwin-amd64 -o kompose +curl -L https://github.com/kubernetes/kompose/releases/download/v1.31.2/kompose-darwin-amd64 -o kompose chmod +x kompose sudo mv ./kompose /usr/local/bin/kompose @@ -65,7 +70,7 @@ sudo mv ./kompose /usr/local/bin/kompose **Windows:** -Download from [GitHub](https://github.com/kubernetes/kompose/releases/download/v1.31.1/kompose-windows-amd64.exe) and add the binary to your PATH. +Download from [GitHub](https://github.com/kubernetes/kompose/releases/download/v1.31.2/kompose-windows-amd64.exe) and add the binary to your PATH. ## Shell autocompletion diff --git a/build/VERSION b/build/VERSION index 6bae54024..3492b09b4 100644 --- a/build/VERSION +++ b/build/VERSION @@ -1 +1 @@ -1.31.1 +1.31.2 diff --git a/docs/installation.md b/docs/installation.md index 194fd82b0..ee18aa896 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -18,14 +18,22 @@ We have multiple ways to install Kompose. Our preferred (and most up-to-date) me Kompose is released via GitHub, you can see all current releases on the [GitHub release page](https://github.com/kubernetes/kompose/releases). +This is the **recommended** way of installing Kompose. + **Linux and macOS:** ```sh # Linux -curl -L https://github.com/kubernetes/kompose/releases/download/v1.31.1/kompose-linux-amd64 -o kompose +curl -L https://github.com/kubernetes/kompose/releases/download/v1.31.2/kompose-linux-amd64 -o kompose + +# Linux ARM64 +curl -L https://github.com/kubernetes/kompose/releases/download/v1.31.2/kompose-linux-arm64 -o kompose # macOS -curl -L https://github.com/kubernetes/kompose/releases/download/v1.31.1/kompose-darwin-amd64 -o kompose +curl -L https://github.com/kubernetes/kompose/releases/download/v1.31.2/kompose-darwin-amd64 -o kompose + +# macOS ARM64 +curl -L https://github.com/kubernetes/kompose/releases/download/v1.31.2/kompose-darwin-arm64 -o kompose chmod +x kompose sudo mv ./kompose /usr/local/bin/kompose @@ -33,7 +41,7 @@ sudo mv ./kompose /usr/local/bin/kompose **Windows:** -Download from [GitHub](https://github.com/kubernetes/kompose/releases/download/v1.31.1/kompose-windows-amd64.exe) and add the binary to your PATH. +Download from [GitHub](https://github.com/kubernetes/kompose/releases/download/v1.31.2/kompose-windows-amd64.exe) and add the binary to your PATH. ## Go diff --git a/pkg/transformer/kubernetes/kubernetes.go b/pkg/transformer/kubernetes/kubernetes.go index faf98bd75..57e8ee18a 100644 --- a/pkg/transformer/kubernetes/kubernetes.go +++ b/pkg/transformer/kubernetes/kubernetes.go @@ -1601,7 +1601,11 @@ func (k *Kubernetes) Transform(komposeObject kobject.KomposeObject, opt kobject. // sort all object so Services are first k.SortServicesFirst(&allobjects) k.RemoveDupObjects(&allobjects) - transformer.AssignNamespaceToObjects(&allobjects, komposeObject.Namespace) + + // Only append namespaces if --namespace has been passed in + if komposeObject.Namespace != "" { + transformer.AssignNamespaceToObjects(&allobjects, komposeObject.Namespace) + } // k.FixWorkloadVersion(&allobjects) return allobjects, nil } diff --git a/pkg/transformer/kubernetes/kubernetes_test.go b/pkg/transformer/kubernetes/kubernetes_test.go index dd3fe4481..ef1a0053f 100644 --- a/pkg/transformer/kubernetes/kubernetes_test.go +++ b/pkg/transformer/kubernetes/kubernetes_test.go @@ -1119,3 +1119,29 @@ func TestNamespaceGeneration(t *testing.T) { } } } + +// Test namespace generation with namespace being blank / "" +func TestNamespaceGenerationBlank(t *testing.T) { + ns := "" + komposeObject := kobject.KomposeObject{ + ServiceConfigs: map[string]kobject.ServiceConfig{"app": newServiceConfig()}, + Namespace: ns, + } + k := Kubernetes{} + objs, err := k.Transform(komposeObject, kobject.ConvertOptions{}) + if err != nil { + t.Error(errors.Wrap(err, "k.Transform failed")) + } + for _, obj := range objs { + if namespace, ok := obj.(*api.Namespace); ok { + if strings.ToLower(ns) != strings.ToLower(namespace.ObjectMeta.Name) { + t.Errorf("Expected namespace name %v, got %v", ns, namespace.ObjectMeta.Name) + } + } + if dep, ok := obj.(*appsv1.Deployment); ok { + if dep.ObjectMeta.Namespace != ns { + t.Errorf("Expected deployment namespace %v, got %v", ns, dep.ObjectMeta.Namespace) + } + } + } +} diff --git a/pkg/version/version.go b/pkg/version/version.go index bdc2e8860..d0c225d59 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -2,7 +2,7 @@ package version var ( // VERSION is version number that will be displayed when running ./kompose version - VERSION = "1.31.1" + VERSION = "1.31.2" // GITCOMMIT is hash of the commit that will be displayed when running ./kompose version // this will be overwritten when running build like this: go build -ldflags="-X github.com/kubernetes/kompose/pkg/version.GITCOMMIT=$(GITCOMMIT)" // HEAD is default indicating that this was not set during build diff --git a/script/release.sh b/script/release.sh index 2c846f756..e30d76a35 100755 --- a/script/release.sh +++ b/script/release.sh @@ -133,9 +133,15 @@ __Linux and macOS:__ # Linux curl -L https://github.com/kubernetes/kompose/releases/download/v$1/kompose-linux-amd64 -o kompose +# Linux ARM64 +curl -L https://github.com/kubernetes/kompose/releases/download/v$1/kompose-linux-arm64 -o kompose + # macOS curl -L https://github.com/kubernetes/kompose/releases/download/v$1/kompose-darwin-amd64 -o kompose +# macOS ARM64 +curl -L https://github.com/kubernetes/kompose/releases/download/v$1/kompose-darwin-arm64 -o kompose + chmod +x kompose sudo mv ./kompose /usr/local/bin/kompose \`\`\`