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

helm mode install: Add --dry-run / --dry-run-helm-values flags #1502

Merged
merged 1 commit into from
Apr 11, 2023

Conversation

michi-covalent
Copy link
Contributor

  • --dry-run flag writes resources to stdout without actually installing them.
  • --dry-run-helm-values flag writes non-default Helm values to stdout without performing the actual installation.

- --dry-run flag writes resources to stdout without actually installing
  them.
- --dry-run-helm-values flag writes non-default Helm values to stdout
  without performing the actual installation.

Signed-off-by: Michi Mutsuzaki <[email protected]>
@michi-covalent michi-covalent temporarily deployed to ci April 11, 2023 21:58 — with GitHub Actions Inactive
@michi-covalent
Copy link
Contributor Author

sample output:

% ./cilium install --dry-run
---
# Source: cilium/templates/cilium-agent/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: "cilium"
  namespace: kube-system
---
# Source: cilium/templates/cilium-operator/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: "cilium-operator"
  namespace: kube-system
---
...
% ./cilium install --dry-run-helm-values --helm-set cluster.name=michi
cluster:
  name: michi
ipam:
  mode: kubernetes
operator:
  replicas: 1
serviceAccounts:
  cilium:
    name: cilium
  operator:
    name: cilium-operator
tunnel: vxlan

@michi-covalent michi-covalent marked this pull request as ready for review April 11, 2023 22:01
@michi-covalent michi-covalent requested a review from a team as a code owner April 11, 2023 22:01
@michi-covalent michi-covalent requested a review from asauber April 11, 2023 22:01
@@ -262,6 +263,10 @@ cilium install --context kind-cluster1 --helm-set cluster.id=1 --helm-set cluste
`,
RunE: func(cmd *cobra.Command, args []string) error {
params.Namespace = namespace
// Don't log anything if it's a dry run so that the dry run output can easily be piped to other commands.
if params.DryRun || params.DryRunHelmValues {
params.Writer = io.Discard
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about io.Stderr?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that's another option. still a bit too noisy for my taste 👀

@michi-covalent michi-covalent merged commit dc83a55 into master Apr 11, 2023
@michi-covalent michi-covalent deleted the pr/michi/dryrun branch April 11, 2023 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants