Skip to content

rmk cluster capi create should be idempotent and always exit with 0 #52

Description

@anovikov-el

Description

rmk cluster capi create should be idempotent and always exit with 0, even when a k3d cluster already created.
E.g., the command can be executed multiple times in a row on a CI/CD machine.

At the same time, currently, the logic rmk cluster capi delete is idempotent and works consistent, always exits with 0.
It is because the inconsistencies inside the k3d tool itself.

Steps to reproduce

Run rmk cluster capi create multiple times.

Expected behaviour

The first time:

rmk cluster capi create
INFO[0000] Using config file /tmp/capi-config.1372334668.yaml (k3d.io/v1alpha5#simple)
INFO[0000] Prep: Network
INFO[0000] Created network 'k3d-capi'
INFO[0000] Created image volume k3d-capi-images
INFO[0000] Starting new tools node...

The next times:

rmk cluster capi create
INFO[0000] Using config file /tmp/capi-config.4236823231.yaml (k3d.io/v1alpha5#simple)
INFO[0000] Cluster 'capi' already exists

Actual behaviour

The first time:

rmk cluster capi create
INFO[0000] Using config file /tmp/capi-config.1372334668.yaml (k3d.io/v1alpha5#simple)
INFO[0000] Prep: Network
INFO[0000] Created network 'k3d-capi'
INFO[0000] Created image volume k3d-capi-images
INFO[0000] Starting new tools node...

The next times:

rmk cluster capi create
INFO[0000] Using config file /tmp/capi-config.4236823231.yaml (k3d.io/v1alpha5#simple)
FATA[0000] Failed to create cluster 'capi' because a cluster with that name already exists
exit status 1

Environment info

RMK: v0.45.0+ (with the Cluster API support)
OS: any
Shell: any
Terminal: any

Agree to the Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions