Skip to content

Commit

Permalink
Merge pull request #10774 from pravisankar/network-diagnostics
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot authored Oct 22, 2016
2 parents de9f453 + 5de5e70 commit 87f54d1
Show file tree
Hide file tree
Showing 38 changed files with 2,106 additions and 78 deletions.
2 changes: 2 additions & 0 deletions contrib/completions/bash/oadm
Original file line number Diff line number Diff line change
Expand Up @@ -1890,6 +1890,8 @@ _oadm_diagnostics()
local_nonpersistent_flags+=("--logspec=")
flags+=("--master-config=")
local_nonpersistent_flags+=("--master-config=")
flags+=("--network-logdir=")
local_nonpersistent_flags+=("--network-logdir=")
flags+=("--node-config=")
local_nonpersistent_flags+=("--node-config=")
flags+=("--prevent-modification")
Expand Down
2 changes: 2 additions & 0 deletions contrib/completions/bash/oc
Original file line number Diff line number Diff line change
Expand Up @@ -1985,6 +1985,8 @@ _oc_adm_diagnostics()
local_nonpersistent_flags+=("--logspec=")
flags+=("--master-config=")
local_nonpersistent_flags+=("--master-config=")
flags+=("--network-logdir=")
local_nonpersistent_flags+=("--network-logdir=")
flags+=("--node-config=")
local_nonpersistent_flags+=("--node-config=")
flags+=("--prevent-modification")
Expand Down
29 changes: 29 additions & 0 deletions contrib/completions/bash/openshift
Original file line number Diff line number Diff line change
Expand Up @@ -1890,6 +1890,8 @@ _openshift_admin_diagnostics()
local_nonpersistent_flags+=("--logspec=")
flags+=("--master-config=")
local_nonpersistent_flags+=("--master-config=")
flags+=("--network-logdir=")
local_nonpersistent_flags+=("--network-logdir=")
flags+=("--node-config=")
local_nonpersistent_flags+=("--node-config=")
flags+=("--prevent-modification")
Expand Down Expand Up @@ -6485,6 +6487,8 @@ _openshift_cli_adm_diagnostics()
local_nonpersistent_flags+=("--logspec=")
flags+=("--master-config=")
local_nonpersistent_flags+=("--master-config=")
flags+=("--network-logdir=")
local_nonpersistent_flags+=("--network-logdir=")
flags+=("--node-config=")
local_nonpersistent_flags+=("--node-config=")
flags+=("--prevent-modification")
Expand Down Expand Up @@ -19842,6 +19846,30 @@ _openshift_infra_f5-router()
noun_aliases=()
}

_openshift_infra_network-diagnostic-pod()
{
last_command="openshift_infra_network-diagnostic-pod"
commands=()

flags=()
two_word_flags=()
local_nonpersistent_flags=()
flags_with_completion=()
flags_completion=()

flags+=("--diaglevel=")
two_word_flags+=("-l")
local_nonpersistent_flags+=("--diaglevel=")
flags+=("--google-json-key=")
flags+=("--log-flush-frequency=")
flags+=("--loglevel=")
flags+=("--logspec=")

must_have_one_flag=()
must_have_one_noun=()
noun_aliases=()
}

_openshift_infra_recycle()
{
last_command="openshift_infra_recycle"
Expand Down Expand Up @@ -20036,6 +20064,7 @@ _openshift_infra()
commands+=("diagnostic-pod")
commands+=("docker-build")
commands+=("f5-router")
commands+=("network-diagnostic-pod")
commands+=("recycle")
commands+=("router")
commands+=("sti-build")
Expand Down
2 changes: 2 additions & 0 deletions contrib/completions/zsh/oadm
Original file line number Diff line number Diff line change
Expand Up @@ -2051,6 +2051,8 @@ _oadm_diagnostics()
local_nonpersistent_flags+=("--logspec=")
flags+=("--master-config=")
local_nonpersistent_flags+=("--master-config=")
flags+=("--network-logdir=")
local_nonpersistent_flags+=("--network-logdir=")
flags+=("--node-config=")
local_nonpersistent_flags+=("--node-config=")
flags+=("--prevent-modification")
Expand Down
2 changes: 2 additions & 0 deletions contrib/completions/zsh/oc
Original file line number Diff line number Diff line change
Expand Up @@ -2146,6 +2146,8 @@ _oc_adm_diagnostics()
local_nonpersistent_flags+=("--logspec=")
flags+=("--master-config=")
local_nonpersistent_flags+=("--master-config=")
flags+=("--network-logdir=")
local_nonpersistent_flags+=("--network-logdir=")
flags+=("--node-config=")
local_nonpersistent_flags+=("--node-config=")
flags+=("--prevent-modification")
Expand Down
29 changes: 29 additions & 0 deletions contrib/completions/zsh/openshift
Original file line number Diff line number Diff line change
Expand Up @@ -2051,6 +2051,8 @@ _openshift_admin_diagnostics()
local_nonpersistent_flags+=("--logspec=")
flags+=("--master-config=")
local_nonpersistent_flags+=("--master-config=")
flags+=("--network-logdir=")
local_nonpersistent_flags+=("--network-logdir=")
flags+=("--node-config=")
local_nonpersistent_flags+=("--node-config=")
flags+=("--prevent-modification")
Expand Down Expand Up @@ -6646,6 +6648,8 @@ _openshift_cli_adm_diagnostics()
local_nonpersistent_flags+=("--logspec=")
flags+=("--master-config=")
local_nonpersistent_flags+=("--master-config=")
flags+=("--network-logdir=")
local_nonpersistent_flags+=("--network-logdir=")
flags+=("--node-config=")
local_nonpersistent_flags+=("--node-config=")
flags+=("--prevent-modification")
Expand Down Expand Up @@ -20003,6 +20007,30 @@ _openshift_infra_f5-router()
noun_aliases=()
}

_openshift_infra_network-diagnostic-pod()
{
last_command="openshift_infra_network-diagnostic-pod"
commands=()

flags=()
two_word_flags=()
local_nonpersistent_flags=()
flags_with_completion=()
flags_completion=()

flags+=("--diaglevel=")
two_word_flags+=("-l")
local_nonpersistent_flags+=("--diaglevel=")
flags+=("--google-json-key=")
flags+=("--log-flush-frequency=")
flags+=("--loglevel=")
flags+=("--logspec=")

must_have_one_flag=()
must_have_one_noun=()
noun_aliases=()
}

_openshift_infra_recycle()
{
last_command="openshift_infra_recycle"
Expand Down Expand Up @@ -20197,6 +20225,7 @@ _openshift_infra()
commands+=("diagnostic-pod")
commands+=("docker-build")
commands+=("f5-router")
commands+=("network-diagnostic-pod")
commands+=("recycle")
commands+=("router")
commands+=("sti-build")
Expand Down
1 change: 1 addition & 0 deletions docs/man/man1/.files_generated_openshift
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ openshift-infra-docker-build-version.1
openshift-infra-docker-build.1
openshift-infra-f5-router-version.1
openshift-infra-f5-router.1
openshift-infra-network-diagnostic-pod.1
openshift-infra-recycle.1
openshift-infra-router-version.1
openshift-infra-router.1
Expand Down
6 changes: 5 additions & 1 deletion docs/man/man1/oadm-diagnostics.1
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Diagnostics may be individually run by passing diagnostic name as arguments.
oadm diagnostics <DiagnosticName>

.PP
The available diagnostic names are: AggregatedLogging, AnalyzeLogs, ClusterRegistry, ClusterRoleBindings, ClusterRoles, ClusterRouter, ConfigContexts, DiagnosticPod, MasterConfigCheck, MasterNode, MetricsApiProxy, NodeConfigCheck, NodeDefinitions, ServiceExternalIPs, UnitStatus.
The available diagnostic names are: AggregatedLogging, AnalyzeLogs, ClusterRegistry, ClusterRoleBindings, ClusterRoles, ClusterRouter, ConfigContexts, DiagnosticPod, MasterConfigCheck, MasterNode, MetricsApiProxy, NetworkCheck, NodeConfigCheck, NodeDefinitions, ServiceExternalIPs, UnitStatus.


.SH OPTIONS
Expand Down Expand Up @@ -85,6 +85,10 @@ The available diagnostic names are: AggregatedLogging, AnalyzeLogs, ClusterRegis
\fB\-\-master\-config\fP=""
Path to master config file (implies \-\-host)

.PP
\fB\-\-network\-logdir\fP="/tmp/openshift/"
Path to store network diagnostic results

.PP
\fB\-\-node\-config\fP=""
Path to node config file (implies \-\-host)
Expand Down
6 changes: 5 additions & 1 deletion docs/man/man1/oc-adm-diagnostics.1
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Diagnostics may be individually run by passing diagnostic name as arguments.
oc adm diagnostics <DiagnosticName>

.PP
The available diagnostic names are: AggregatedLogging, AnalyzeLogs, ClusterRegistry, ClusterRoleBindings, ClusterRoles, ClusterRouter, ConfigContexts, DiagnosticPod, MasterConfigCheck, MasterNode, MetricsApiProxy, NodeConfigCheck, NodeDefinitions, ServiceExternalIPs, UnitStatus.
The available diagnostic names are: AggregatedLogging, AnalyzeLogs, ClusterRegistry, ClusterRoleBindings, ClusterRoles, ClusterRouter, ConfigContexts, DiagnosticPod, MasterConfigCheck, MasterNode, MetricsApiProxy, NetworkCheck, NodeConfigCheck, NodeDefinitions, ServiceExternalIPs, UnitStatus.


.SH OPTIONS
Expand Down Expand Up @@ -85,6 +85,10 @@ The available diagnostic names are: AggregatedLogging, AnalyzeLogs, ClusterRegis
\fB\-\-master\-config\fP=""
Path to master config file (implies \-\-host)

.PP
\fB\-\-network\-logdir\fP="/tmp/openshift/"
Path to store network diagnostic results

.PP
\fB\-\-node\-config\fP=""
Path to node config file (implies \-\-host)
Expand Down
6 changes: 5 additions & 1 deletion docs/man/man1/openshift-admin-diagnostics.1
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Diagnostics may be individually run by passing diagnostic name as arguments.
openshift admin diagnostics <DiagnosticName>

.PP
The available diagnostic names are: AggregatedLogging, AnalyzeLogs, ClusterRegistry, ClusterRoleBindings, ClusterRoles, ClusterRouter, ConfigContexts, DiagnosticPod, MasterConfigCheck, MasterNode, MetricsApiProxy, NodeConfigCheck, NodeDefinitions, ServiceExternalIPs, UnitStatus.
The available diagnostic names are: AggregatedLogging, AnalyzeLogs, ClusterRegistry, ClusterRoleBindings, ClusterRoles, ClusterRouter, ConfigContexts, DiagnosticPod, MasterConfigCheck, MasterNode, MetricsApiProxy, NetworkCheck, NodeConfigCheck, NodeDefinitions, ServiceExternalIPs, UnitStatus.


.SH OPTIONS
Expand Down Expand Up @@ -85,6 +85,10 @@ The available diagnostic names are: AggregatedLogging, AnalyzeLogs, ClusterRegis
\fB\-\-master\-config\fP=""
Path to master config file (implies \-\-host)

.PP
\fB\-\-network\-logdir\fP="/tmp/openshift/"
Path to store network diagnostic results

.PP
\fB\-\-node\-config\fP=""
Path to node config file (implies \-\-host)
Expand Down
6 changes: 5 additions & 1 deletion docs/man/man1/openshift-cli-adm-diagnostics.1
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Diagnostics may be individually run by passing diagnostic name as arguments.
openshift cli adm diagnostics <DiagnosticName>

.PP
The available diagnostic names are: AggregatedLogging, AnalyzeLogs, ClusterRegistry, ClusterRoleBindings, ClusterRoles, ClusterRouter, ConfigContexts, DiagnosticPod, MasterConfigCheck, MasterNode, MetricsApiProxy, NodeConfigCheck, NodeDefinitions, ServiceExternalIPs, UnitStatus.
The available diagnostic names are: AggregatedLogging, AnalyzeLogs, ClusterRegistry, ClusterRoleBindings, ClusterRoles, ClusterRouter, ConfigContexts, DiagnosticPod, MasterConfigCheck, MasterNode, MetricsApiProxy, NetworkCheck, NodeConfigCheck, NodeDefinitions, ServiceExternalIPs, UnitStatus.


.SH OPTIONS
Expand Down Expand Up @@ -85,6 +85,10 @@ The available diagnostic names are: AggregatedLogging, AnalyzeLogs, ClusterRegis
\fB\-\-master\-config\fP=""
Path to master config file (implies \-\-host)

.PP
\fB\-\-network\-logdir\fP="/tmp/openshift/"
Path to store network diagnostic results

.PP
\fB\-\-node\-config\fP=""
Path to node config file (implies \-\-host)
Expand Down
6 changes: 5 additions & 1 deletion docs/man/man1/openshift-ex-diagnostics.1
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Diagnostics may be individually run by passing diagnostic name as arguments.
openshift ex diagnostics <DiagnosticName>

.PP
The available diagnostic names are: AggregatedLogging, AnalyzeLogs, ClusterRegistry, ClusterRoleBindings, ClusterRoles, ClusterRouter, ConfigContexts, DiagnosticPod, MasterConfigCheck, MasterNode, MetricsApiProxy, NodeConfigCheck, NodeDefinitions, ServiceExternalIPs, UnitStatus.
The available diagnostic names are: AggregatedLogging, AnalyzeLogs, ClusterRegistry, ClusterRoleBindings, ClusterRoles, ClusterRouter, ConfigContexts, DiagnosticPod, MasterConfigCheck, MasterNode, MetricsApiProxy, NetworkCheck, NodeConfigCheck, NodeDefinitions, ServiceExternalIPs, UnitStatus.


.SH OPTIONS
Expand Down Expand Up @@ -85,6 +85,10 @@ The available diagnostic names are: AggregatedLogging, AnalyzeLogs, ClusterRegis
\fB\-\-master\-config\fP=""
Path to master config file (implies \-\-host)

.PP
\fB\-\-network\-logdir\fP="/tmp/openshift/"
Path to store network diagnostic results

.PP
\fB\-\-node\-config\fP=""
Path to node config file (implies \-\-host)
Expand Down
42 changes: 42 additions & 0 deletions docs/man/man1/openshift-infra-network-diagnostic-pod.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.TH "OPENSHIFT INFRA" "1" " Openshift CLI User Manuals" "Openshift" "June 2016" ""


.SH NAME
.PP
openshift infra network\-diagnostic\-pod \- Within a privileged pod, run network diagnostics


.SH SYNOPSIS
.PP
\fBopenshift infra network\-diagnostic\-pod\fP [OPTIONS]


.SH DESCRIPTION
.PP
This utility is intended to run network diagnostics inside a privileged container and log the results so that the calling diagnostic can report them.


.SH OPTIONS
.PP
\fB\-l\fP, \fB\-\-diaglevel\fP=1
Level of diagnostic output: 4: Error, 3: Warn, 2: Notice, 1: Info, 0: Debug


.SH OPTIONS INHERITED FROM PARENT COMMANDS
.PP
\fB\-\-google\-json\-key\fP=""
The Google Cloud Platform Service Account JSON Key to use for authentication.

.PP
\fB\-\-log\-flush\-frequency\fP=0
Maximum number of seconds between log flushes


.SH SEE ALSO
.PP
\fBopenshift\-infra(1)\fP,


.SH HISTORY
.PP
June 2016, Ported from the Kubernetes man\-doc generator
2 changes: 1 addition & 1 deletion docs/man/man1/openshift-infra.1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ openshift infra \-

.SH SEE ALSO
.PP
\fBopenshift(1)\fP, \fBopenshift\-infra\-deploy(1)\fP, \fBopenshift\-infra\-diagnostic\-pod(1)\fP, \fBopenshift\-infra\-docker\-build(1)\fP, \fBopenshift\-infra\-f5\-router(1)\fP, \fBopenshift\-infra\-recycle(1)\fP, \fBopenshift\-infra\-router(1)\fP, \fBopenshift\-infra\-sti\-build(1)\fP,
\fBopenshift(1)\fP, \fBopenshift\-infra\-deploy(1)\fP, \fBopenshift\-infra\-diagnostic\-pod(1)\fP, \fBopenshift\-infra\-docker\-build(1)\fP, \fBopenshift\-infra\-f5\-router(1)\fP, \fBopenshift\-infra\-network\-diagnostic\-pod(1)\fP, \fBopenshift\-infra\-recycle(1)\fP, \fBopenshift\-infra\-router(1)\fP, \fBopenshift\-infra\-sti\-build(1)\fP,


.SH HISTORY
Expand Down
16 changes: 13 additions & 3 deletions pkg/cmd/admin/diagnostics/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ import (
"k8s.io/kubernetes/pkg/util/sets"

clientdiags "github.com/openshift/origin/pkg/diagnostics/client"
networkdiags "github.com/openshift/origin/pkg/diagnostics/network"
"github.com/openshift/origin/pkg/diagnostics/types"
)

var (
// availableClientDiagnostics contains the names of client diagnostics that can be executed
// during a single run of diagnostics. Add more diagnostics to the list as they are defined.
availableClientDiagnostics = sets.NewString(clientdiags.ConfigContextsName, clientdiags.DiagnosticPodName)
availableClientDiagnostics = sets.NewString(clientdiags.ConfigContextsName, clientdiags.DiagnosticPodName, networkdiags.NetworkDiagnosticName)
)

// buildClientDiagnostics builds client Diagnostic objects based on the rawConfig passed in.
// Returns the Diagnostics built, "ok" bool for whether to proceed or abort, and an error if any was encountered during the building of diagnostics.) {
func (o DiagnosticsOptions) buildClientDiagnostics(rawConfig *clientcmdapi.Config) ([]types.Diagnostic, bool, error) {
available := availableClientDiagnostics

// osClient, kubeClient, clientErr := o.Factory.Clients() // use with a diagnostic that needs OpenShift/Kube client
_, kubeClient, clientErr := o.Factory.Clients()
osClient, kubeClient, clientErr := o.Factory.Clients()
if clientErr != nil {
o.Logger.Notice("CED0001", "Could not configure a client, so client diagnostics are limited to testing configuration and connection")
available = sets.NewString(clientdiags.ConfigContextsName)
Expand Down Expand Up @@ -53,6 +53,16 @@ func (o DiagnosticsOptions) buildClientDiagnostics(rawConfig *clientcmdapi.Confi
PreventModification: o.PreventModification,
ImageTemplate: o.ImageTemplate,
})
case networkdiags.NetworkDiagnosticName:
diagnostics = append(diagnostics, &networkdiags.NetworkDiagnostic{
KubeClient: kubeClient,
OSClient: osClient,
ClientFlags: o.ClientFlags,
Level: o.LogOptions.Level,
Factory: o.Factory,
PreventModification: o.PreventModification,
LogDir: o.NetworkDiagLogDir,
})
default:
return nil, false, fmt.Errorf("unknown diagnostic: %v", diagnosticName)
}
Expand Down
Loading

0 comments on commit 87f54d1

Please sign in to comment.