Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: ability to load configuration from stdin #1126

Merged
merged 3 commits into from
Aug 24, 2022

Conversation

kameshsampath
Copy link
Contributor

Honor stdin for passing configuration when doing k3d cluster create -c

What

With this PR we can create k3d clusters with configuration from CLI

e.g.

cat <<EOF | $EXE cluster create "test-stdin" --config=-
apiVersion: k3d.io/v1alpha4
kind: Simple
metadata:
  name: test-stdin
servers: 1
agents: 1
image: rancher/k3s:v1.24.3-k3s1
EOF

Why

#1123

Implications

It only updates the cmd package with extra logic to check if the config is from stdin or from file. It also added extra iostreams helper under cmd/util

@all-contributors please add @kameshsampath for ideas and code

fixes: [BUG] Honor stdin for config k3d cluster create -c k3d-io#1123
@kameshsampath
Copy link
Contributor Author

@iwilltry42 - I added a test script in the tests inline with others, LMK if that looks good or needs change. Happy to update

@iwilltry42 iwilltry42 self-requested a review August 24, 2022 14:50
@iwilltry42 iwilltry42 self-assigned this Aug 24, 2022
@iwilltry42 iwilltry42 added the enhancement New feature or request label Aug 24, 2022
@iwilltry42 iwilltry42 added this to the v5.5.0 milestone Aug 24, 2022
@iwilltry42 iwilltry42 linked an issue Aug 24, 2022 that may be closed by this pull request
@iwilltry42
Copy link
Member

Fixed some details so that tests and linting pass.

Thanks a lot for your contribution @kameshsampath :)

@iwilltry42 iwilltry42 changed the title fix: ability to load configuration from stdin add: ability to load configuration from stdin Aug 24, 2022
@iwilltry42 iwilltry42 merged commit 1dc49a2 into k3d-io:main Aug 24, 2022
@kameshsampath kameshsampath deleted the issues/1123 branch August 24, 2022 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Honor stdin for config k3d cluster create -c
2 participants