Skip to content

Commit

Permalink
Merge pull request #85 from deviceinsight/feature/docker-entrypoint
Browse files Browse the repository at this point in the history
Feature/docker entrypoint
  • Loading branch information
d-rk authored May 17, 2021
2 parents 3fc7c38 + 18cbc5b commit 0c733e0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.Scratch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

FROM alpine:latest as certs
RUN apk --update --no-cache add ca-certificates && update-ca-certificates

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.Ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ WORKDIR /home/kafkactl
RUN chown -R kafkactl:kafkactl /home/kafkactl

USER kafkactl
CMD ["kafkactl"]
ENTRYPOINT ["kafkactl"]
4 changes: 2 additions & 2 deletions operations/k8s/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions operations/k8s/k8s-operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 0c733e0

Please sign in to comment.