Skip to content

Commit

Permalink
fix: Rename controller_version to kluctl_version and fix snapshot det…
Browse files Browse the repository at this point in the history
…ection (#585)
  • Loading branch information
codablock committed Jun 15, 2023
1 parent acc6d97 commit 3d8a94c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
8 changes: 4 additions & 4 deletions cmd/kluctl/commands/cmd_controller_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ type controllerInstallCmd struct {
args.DryRunFlags
args.CommandResultFlags

Context string `group:"misc" help:"Override the context to use."`
ControllerVersion string `group:"misc" help:"Specify the controller version to install."`
Context string `group:"misc" help:"Override the context to use."`
KluctlVersion string `group:"misc" help:"Specify the controller version to install."`
}

func (cmd *controllerInstallCmd) Help() string {
Expand All @@ -29,8 +29,8 @@ func (cmd *controllerInstallCmd) Run(ctx context.Context) error {
}

var deployArgs []string
if cmd.ControllerVersion != "" {
deployArgs = append(deployArgs, fmt.Sprintf("controller_version=%s", cmd.ControllerVersion))
if cmd.KluctlVersion != "" {
deployArgs = append(deployArgs, fmt.Sprintf("kluctl_version=%s", cmd.KluctlVersion))
}

cmd2 := deployCmd{
Expand Down
2 changes: 1 addition & 1 deletion install/controller/.kluctl.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
discriminator: kluctl.io-controller

args:
- name: controller_version
- name: kluctl_version
default: v2.20.4
- name: controller_args
default: []
Expand Down
13 changes: 5 additions & 8 deletions install/controller/controller/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{% set controller_version = get_var("args.controller_version", "v2.20.4") %}
# TODO remove controller_version
{% set kluctl_version = get_var(["args.kluctl_version", "args.controller_version"], "v2.20.4") %}
{% set pull_policy = "Always" if ("-devel" in kluctl_version or "-snapshot" in kluctl_version) else "IfNotPresent" %}

resources:
- crd.yaml
Expand All @@ -12,19 +14,14 @@ patches:
patch: |-
- op: add
path: /spec/template/spec/containers/0/image
value: ghcr.io/kluctl/kluctl:{{ controller_version }}
value: ghcr.io/kluctl/kluctl:{{ kluctl_version }}
- target:
kind: Deployment
name: kluctl-controller
patch: |-
- op: test
path: /kind
value: Deployment # this is just a dummy test to avoid empty patches
{% if "-devel" in controller_version %}
- op: add
path: /spec/template/spec/containers/0/imagePullPolicy
value: Always
{% endif %}
value: {{ pull_policy }}
{% for a in get_var("args.controller_args", []) %}
- op: add
path: /spec/template/spec/containers/0/args/-
Expand Down

0 comments on commit 3d8a94c

Please sign in to comment.