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

Support optional args in diagnostics #14640

Closed
smarterclayton opened this issue Jun 14, 2017 · 2 comments
Closed

Support optional args in diagnostics #14640

smarterclayton opened this issue Jun 14, 2017 · 2 comments

Comments

@smarterclayton
Copy link
Contributor

It should be possible for some diagnostics to have optional arguments that parameterize checks that may run too long or too short. Exposed by #14604 and suggested by @eparis. I temporarily used an env var for a variable that only 10-20% of people may need to customize.

@sosiouxme
Copy link
Member

sosiouxme commented Jun 15, 2017

The command has a few flags directed at specific diagnostics, like --network-pod-image. More could be added, of course, but I don't really like proliferating flags for what are really sort of subcommands (did not really like those flags being added to begin with).

So would this imply there should be a generic parameter specifically for passing parameters for specific diagnostics? Something like:
--param EtcdWriteVolume.write-volume-duration=10s

This would have the disadvantage of not being discoverable via the usual -h flag (we could introduce a flag specifically for listing them, though) and not being name-checked or type-checked/converted by pflag. Obviously this is just as true for env vars and probably any solution we could come up with that's not formal flags.

sosiouxme added a commit to sosiouxme/origin that referenced this issue Sep 27, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Sep 27, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Oct 3, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Nov 24, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Nov 30, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Dec 13, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Dec 13, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Dec 14, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Dec 14, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Dec 14, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Dec 14, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Dec 14, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Dec 15, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Dec 16, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Dec 18, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Dec 18, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Dec 19, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Dec 19, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Dec 20, 2017
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Jan 1, 2018
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Jan 10, 2018
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Jan 10, 2018
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Jan 10, 2018
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Jan 10, 2018
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Jan 19, 2018
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
sosiouxme added a commit to sosiouxme/origin that referenced this issue Jan 19, 2018
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
openshift-merge-robot added a commit that referenced this issue Jan 23, 2018
Automatic merge from submit-queue.

diagnostics: individual parameters

Updated version of #16589 based on feedback.

This addresses #14640 by making individual diagnostics into subcommands that can have their own flags. Existing top-level flags for `NetworkCheck` are removed and the config envvar for `EtcdWriteVolume` is deprecated in favor of a flag. All individual flags are available underneath the `all` subcommand.

This required rather more refactoring as the flags had to be known in order to define the command, not just at runtime. Usages are given below:

```
$ oc adm diagnostics --help
This utility helps troubleshoot and diagnose known problems for an OpenShift cluster and/or local host. The base command
runs a standard set of diagnostics: 

  oc adm diagnostics
  
[...]

An individual diagnostic may be run as a subcommand which may have flags for specifying options specific to that
diagnostic. 

Finally, the "all" subcommand runs all available diagnostics (including heavyweight ones skipped in the standard set)
and provides all individual diagnostic flags.

Usage:
  oc adm diagnostics [options]

Available Commands:
  aggregatedlogging          Check aggregated logging integration for proper configuration
  all                        Diagnose common cluster problems
[...]
  unitstatus                 Check status for related systemd units

Options:
      --cluster-context='': Client context to use for cluster administrator
      --config='': Path to the config file to use for CLI requests.
      --context='': The name of the kubeconfig context to use
  -l, --diaglevel=1: Level of diagnostic output: 4: Error, 3: Warn, 2: Notice, 1: Info, 0: Debug
      --host=false: If true, look for systemd and journald units even without master/node config
      --loglevel=0: Set the level of log output (0-10)
      --logspec='': Set per module logging with file|pattern=LEVEL,...
      --master-config='': Path to master config file (implies --host)
      --node-config='': Path to node config file (implies --host)
      --prevent-modification=false: If true, may be set to prevent diagnostics making any changes via the API
```

(Note `all` is now intermingled with the individual subcommands.)

```
$ oc adm diagnostics all --help
This utility helps troubleshoot and diagnose known problems for an OpenShift cluster and/or local host. This subcommand
exists to run all available diagnostics: 

  oc adm diagnostics all
  
Available diagnostics vary based on client config and local OpenShift host config. All flags from the base command work
similarly here, but all possible flags for individual diagnostics are also available.

Usage:
  oc adm diagnostics all [options]

Options:
      --cluster-context='': Client context to use for cluster administrator
      --config='': Path to the config file to use for CLI requests.
      --context='': The name of the kubeconfig context to use
  -l, --diaglevel=1: Level of diagnostic output: 4: Error, 3: Warn, 2: Notice, 1: Info, 0: Debug
      --diagnosticpod-images='openshift/origin-${component}:${version}': Image template to use in creating a pod
      --diagnosticpod-latest-images=false: If true, when expanding the image template, use latest version, not release
version
      --etcdwritevolume-duration='1m': How long to perform the write test
      --host=false: If true, look for systemd and journald units even without master/node config
      --loglevel=0: Set the level of log output (0-10)
      --logspec='': Set per module logging with file|pattern=LEVEL,...
      --master-config='': Path to master config file (implies --host)
      --networkcheck-logdir='/tmp/openshift/': Path to store diagnostic results in case of errors
      --networkcheck-pod-image='openshift/origin:v3.9.0-alpha.0': Image to use for diagnostic pod
      --networkcheck-test-pod-image='openshift/origin-deployer:v3.9.0-alpha.0': Image to use for diagnostic test pod
      --networkcheck-test-pod-port=8080: Serving port on the diagnostic test pod
      --networkcheck-test-pod-protocol='TCP': Protocol used to connect to diagnostic test pod
      --node-config='': Path to node config file (implies --host)
      --prevent-modification=false: If true, may be set to prevent diagnostics making any changes via the API
```

```
$ oc adm diagnostics EtcdWriteVolume --help
Runs the EtcdWriteVolume diagnostic. 

Check the volume of writes against etcd over a time period and classify them by operation and key

Aliases:
etcdwritevolume, EtcdWriteVolume

Usage:
  oc adm diagnostics etcdwritevolume [options]

Options:
  -l, --diaglevel=1: Level of diagnostic output: 4: Error, 3: Warn, 2: Notice, 1: Info, 0: Debug
      --duration='1m': How long to perform the write test
      --host=false: If true, look for systemd and journald units even without master/node config
      --loglevel=0: Set the level of log output (0-10)
      --logspec='': Set per module logging with file|pattern=LEVEL,...
      --master-config='': Path to master config file (implies --host)
      --node-config='': Path to node config file (implies --host)
```

```
$ oc adm diagnostics NetworkCheck --help
Runs the NetworkCheck diagnostic. 

Create a pod on all schedulable nodes and run network diagnostics from the application standpoint

Aliases:
networkcheck, NetworkCheck

Usage:
  oc adm diagnostics networkcheck [options]

Options:
      --cluster-context='': Client context to use for cluster administrator
      --config='': Path to the config file to use for CLI requests.
      --context='': The name of the kubeconfig context to use
  -l, --diaglevel=1: Level of diagnostic output: 4: Error, 3: Warn, 2: Notice, 1: Info, 0: Debug
      --logdir='/tmp/openshift/': Path to store diagnostic results in case of errors
      --loglevel=0: Set the level of log output (0-10)
      --logspec='': Set per module logging with file|pattern=LEVEL,...
      --pod-image='openshift/origin:v3.9.0-alpha.0': Image to use for diagnostic pod
      --prevent-modification=false: If true, may be set to prevent diagnostics making any changes via the API
      --test-pod-image='openshift/origin-deployer:v3.9.0-alpha.0': Image to use for diagnostic test pod
      --test-pod-port=8080: Serving port on the diagnostic test pod
      --test-pod-protocol='TCP': Protocol used to connect to diagnostic test pod
```
@sosiouxme
Copy link
Member

Resolved with #17773

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants