`kops env` should show up current configuration and environment settings
/kind feature
1. Describe IN DETAIL the feature/behavior/change you would like to see.
I would like to have a command such as kops env or kops config that would show up all the configuration environment variables used by kops.
2. Feel free to provide a design supporting your feature request.
I was thinking about leveraging viper to be sure to catch all configurations options.
package main
import (
"context"
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"io"
"k8s.io/kops/cmd/kops/util"
"k8s.io/kops/pkg/commands/commandutils"
"k8s.io/kubectl/pkg/util/i18n"
)
func NewCmdEnv(f *util.Factory, out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "env",
Short: i18n.T(`Get all environment variables.`),
RunE: func(cmd *cobra.Command, args []string) error {
return RunEnv(cmd.Context(), f, out)
},
}
return cmd
}
func RunEnv(ctx context.Context, f commandutils.Factory, out io.Writer) error {
viper.AllSettings()
for k, v := range viper.AllSettings() {
fmt.Fprintf(out, "%s: %s\n", k, v)
}
return nil
}
What do you think of it? Is there a different configuration/settings store that I could use and iterate over?
Related to https://github.com/kubernetes/kops/issues/1764
In complement to this function I would like to have an env package that would bind all the environment variables used across kops. This binding function should be called as early as possible to ensure that we are able to access the string using viper.GetString.
/kind office-hours
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle stale - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle rotten - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Reopen this issue with
/reopen - Mark this issue as fresh with
/remove-lifecycle rotten - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied- After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied- After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closedYou can:
- Reopen this issue with
/reopen- Mark this issue as fresh with
/remove-lifecycle rotten- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.