From 48a913b1d9e96d7ce88e72c0a2ae79fb81091e40 Mon Sep 17 00:00:00 2001 From: Wolfgang Hackenberg Date: Wed, 5 May 2021 11:03:35 +0200 Subject: [PATCH 1/3] replace cmd with entrypoint to preserve kubectl call when providing cmd in docker run --- CHANGELOG.md | 1 + Dockerfile.Ubuntu | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 023b86a..c89425c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Compatibility with new versions of `kubectl` by removing deprecated parameter from the command +- Replace `CMD` with `ENTRYPOINT` in Ubuntu Dockerfile to restore behavior documented in readme ## 1.17.0 - 2021-04-06 diff --git a/Dockerfile.Ubuntu b/Dockerfile.Ubuntu index 6ef1c53..20a0230 100644 --- a/Dockerfile.Ubuntu +++ b/Dockerfile.Ubuntu @@ -26,4 +26,4 @@ WORKDIR /home/kafkactl RUN chown -R kafkactl:kafkactl /home/kafkactl USER kafkactl -CMD ["kafkactl"] +ENTRYPOINT ["kafkactl"] From d422cb1c4ee1178ca240df82d02a0221cc3dffd2 Mon Sep 17 00:00:00 2001 From: Dirk Wilden Date: Mon, 17 May 2021 10:46:13 +0200 Subject: [PATCH 2/3] always overwrite the docker entrypoint when running kubectl commands --- Dockerfile.Scratch | 2 +- operations/k8s/executor.go | 4 ++-- operations/k8s/k8s-operation.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile.Scratch b/Dockerfile.Scratch index 3ae2f51..99613c6 100644 --- a/Dockerfile.Scratch +++ b/Dockerfile.Scratch @@ -1,4 +1,4 @@ - + FROM alpine:latest as certs RUN apk --update --no-cache add ca-certificates && update-ca-certificates diff --git a/operations/k8s/executor.go b/operations/k8s/executor.go index e92d1c3..6d7c821 100644 --- a/operations/k8s/executor.go +++ b/operations/k8s/executor.go @@ -96,7 +96,7 @@ func (kubectl *executor) SetKubectlBinary(bin string) { kubectl.kubectlBinary = bin } -func (kubectl *executor) Run(dockerImageType string, kafkactlArgs []string, podEnvironment []string) error { +func (kubectl *executor) Run(dockerImageType, entryPoint string, kafkactlArgs []string, podEnvironment []string) error { if KafkaCtlVersion == "" { KafkaCtlVersion = "latest" } @@ -124,7 +124,7 @@ func (kubectl *executor) Run(dockerImageType string, kafkactlArgs []string, podE kubectlArgs = append(kubectlArgs, kubectl.extra...) } - kubectlArgs = append(kubectlArgs, "--") + kubectlArgs = append(kubectlArgs, "--command", "--", entryPoint) kubectlArgs = append(kubectlArgs, kafkactlArgs...) return kubectl.exec(kubectlArgs) diff --git a/operations/k8s/k8s-operation.go b/operations/k8s/k8s-operation.go index 4ef52c8..6d30a0b 100644 --- a/operations/k8s/k8s-operation.go +++ b/operations/k8s/k8s-operation.go @@ -51,7 +51,7 @@ func (operation *K8sOperation) Attach() error { podEnvironment := parsePodEnvironment(operation.context) - return exec.Run("ubuntu", []string{"bash"}, podEnvironment) + return exec.Run("ubuntu", "bash", nil, podEnvironment) } func (operation *K8sOperation) TryRun(cmd *cobra.Command, args []string) bool { @@ -91,7 +91,7 @@ func (operation *K8sOperation) Run(cmd *cobra.Command, args []string) error { kafkaCtlCommand = append(kafkaCtlCommand, args...) kafkaCtlCommand = append(kafkaCtlCommand, kafkaCtlFlags...) - return exec.Run("scratch", kafkaCtlCommand, podEnvironment) + return exec.Run("scratch", "/kafkactl", kafkaCtlCommand, podEnvironment) } func parseFlags(cmd *cobra.Command) ([]string, error) { From 18cbc5b27666a72e2c6a6a5d53330f3485a39ea7 Mon Sep 17 00:00:00 2001 From: Dirk Wilden Date: Mon, 17 May 2021 10:56:15 +0200 Subject: [PATCH 3/3] change golangci-lint action --- .github/workflows/lint_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint_test.yml b/.github/workflows/lint_test.yml index ba4a8d1..9d561e5 100644 --- a/.github/workflows/lint_test.yml +++ b/.github/workflows/lint_test.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Run golangci-lint - uses: actions-contrib/golangci-lint@v1 + uses: golangci/golangci-lint-action@v2 test: name: Test