Skip to content

Commit

Permalink
Remove --generator flag, as its been deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
Renato Correa committed Apr 16, 2021
1 parent b02e160 commit fc7674e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## 1.17.0 - 2021-04-06

### Fixed
- Compatibility with new versions of `kubectl` by removing deprecated parameter from the command

### Fixed
- SASL mechanism support now also implemented for cluster admin
- process no longer gets stuck when deserialization error occurs
Expand Down
14 changes: 7 additions & 7 deletions operations/k8s/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package k8s

import (
"fmt"
"github.com/deviceinsight/kafkactl/operations"
"github.com/deviceinsight/kafkactl/output"
"math/rand"
"regexp"
"strconv"
"strings"

"github.com/deviceinsight/kafkactl/operations"
"github.com/deviceinsight/kafkactl/output"
)

type Version struct {
Expand Down Expand Up @@ -37,7 +38,6 @@ func randomString(n int) string {
}

func getKubectlVersion(kubectlBinary string, runner Runner) Version {

bytes, err := runner.ExecuteAndReturn(kubectlBinary, []string{"version", "--client", "--short"})
if err != nil {
output.Fail(err)
Expand Down Expand Up @@ -97,16 +97,17 @@ func (kubectl *executor) SetKubectlBinary(bin string) {
}

func (kubectl *executor) Run(dockerImageType string, kafkactlArgs []string, podEnvironment []string) error {

if KafkaCtlVersion == "" {
KafkaCtlVersion = "latest"
}
dockerImage := "deviceinsight/kafkactl:" + KafkaCtlVersion + "-" + dockerImageType

podName := "kafkactl-" + randomString(10)

kubectlArgs := []string{"run", "--generator=run-pod/v1", "--rm", "-i", "--tty", "--restart=Never", podName,
"--image", dockerImage}
kubectlArgs := []string{
"run", "--rm", "-i", "--tty", "--restart=Never", podName,
"--image", dockerImage,
}

if kubectl.kubeConfig != "" {
kubectlArgs = append(kubectlArgs, "--kubeconfig", kubectl.kubeConfig)
Expand All @@ -130,7 +131,6 @@ func (kubectl *executor) Run(dockerImageType string, kafkactlArgs []string, podE
}

func (kubectl *executor) exec(args []string) error {

cmd := fmt.Sprintf("exec: %s %s", kubectl.kubectlBinary, join(args))
output.Debugf("kubectl version: %d.%d.%d", kubectl.version.Major, kubectl.version.Minor, kubectl.version.Patch)
output.Debugf(cmd)
Expand Down

0 comments on commit fc7674e

Please sign in to comment.