Skip to content

Commit

Permalink
diagnostics: enable per-diagnostic parameters
Browse files Browse the repository at this point in the history
Adds the ability to specify parameters for individual diagnostics on the
command line (without proliferating flags).

Addresses openshift#14640
  • Loading branch information
sosiouxme committed Dec 14, 2017
1 parent a2ec324 commit af825ea
Show file tree
Hide file tree
Showing 76 changed files with 3,223 additions and 385 deletions.
1,223 changes: 1,209 additions & 14 deletions contrib/completions/bash/oc

Large diffs are not rendered by default.

1,223 changes: 1,209 additions & 14 deletions contrib/completions/zsh/oc

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions docs/man/man1/.files_generated_oc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,25 @@ oc-adm-create-node-config.1
oc-adm-create-provider-selection-template.1
oc-adm-create-server-cert.1
oc-adm-create-signer-cert.1
oc-adm-diagnostics-AggregatedLogging.1
oc-adm-diagnostics-AnalyzeLogs.1
oc-adm-diagnostics-ClusterRegistry.1
oc-adm-diagnostics-ClusterRoleBindings.1
oc-adm-diagnostics-ClusterRoles.1
oc-adm-diagnostics-ClusterRouter.1
oc-adm-diagnostics-ConfigContexts.1
oc-adm-diagnostics-DiagnosticPod.1
oc-adm-diagnostics-EtcdWriteVolume.1
oc-adm-diagnostics-MasterConfigCheck.1
oc-adm-diagnostics-MasterNode.1
oc-adm-diagnostics-MetricsApiProxy.1
oc-adm-diagnostics-NetworkCheck.1
oc-adm-diagnostics-NodeConfigCheck.1
oc-adm-diagnostics-NodeDefinitions.1
oc-adm-diagnostics-RouteCertificateValidation.1
oc-adm-diagnostics-ServiceExternalIPs.1
oc-adm-diagnostics-UnitStatus.1
oc-adm-diagnostics-all.1
oc-adm-diagnostics.1
oc-adm-drain.1
oc-adm-groups-add-users.1
Expand Down Expand Up @@ -171,6 +190,25 @@ oc-env.1
oc-ex-build-chain.1
oc-ex-config-patch.1
oc-ex-config.1
oc-ex-diagnostics-AggregatedLogging.1
oc-ex-diagnostics-AnalyzeLogs.1
oc-ex-diagnostics-ClusterRegistry.1
oc-ex-diagnostics-ClusterRoleBindings.1
oc-ex-diagnostics-ClusterRoles.1
oc-ex-diagnostics-ClusterRouter.1
oc-ex-diagnostics-ConfigContexts.1
oc-ex-diagnostics-DiagnosticPod.1
oc-ex-diagnostics-EtcdWriteVolume.1
oc-ex-diagnostics-MasterConfigCheck.1
oc-ex-diagnostics-MasterNode.1
oc-ex-diagnostics-MetricsApiProxy.1
oc-ex-diagnostics-NetworkCheck.1
oc-ex-diagnostics-NodeConfigCheck.1
oc-ex-diagnostics-NodeDefinitions.1
oc-ex-diagnostics-RouteCertificateValidation.1
oc-ex-diagnostics-ServiceExternalIPs.1
oc-ex-diagnostics-UnitStatus.1
oc-ex-diagnostics-all.1
oc-ex-diagnostics.1
oc-ex-dockergc.1
oc-ex-ipfailover.1
Expand Down
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-AggregatedLogging.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-AnalyzeLogs.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-ClusterRegistry.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-ClusterRoleBindings.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-ClusterRoles.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-ClusterRouter.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-ConfigContexts.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-DiagnosticPod.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-EtcdWriteVolume.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-MasterConfigCheck.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-MasterNode.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-MetricsApiProxy.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-NetworkCheck.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-NodeConfigCheck.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-NodeDefinitions.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-RouteCertificateValidation.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-ServiceExternalIPs.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-UnitStatus.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-adm-diagnostics-all.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-AggregatedLogging.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-AnalyzeLogs.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-ClusterRegistry.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-ClusterRoleBindings.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-ClusterRoles.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-ClusterRouter.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-ConfigContexts.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-DiagnosticPod.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-EtcdWriteVolume.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-MasterConfigCheck.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-MasterNode.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-MetricsApiProxy.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-NetworkCheck.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-NodeConfigCheck.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-NodeDefinitions.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-RouteCertificateValidation.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-ServiceExternalIPs.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-UnitStatus.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
3 changes: 3 additions & 0 deletions docs/man/man1/oc-ex-diagnostics-all.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
42 changes: 19 additions & 23 deletions pkg/oc/admin/diagnostics/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"

"github.com/openshift/origin/pkg/cmd/util/variable"
clientdiags "github.com/openshift/origin/pkg/oc/admin/diagnostics/diagnostics/client"
networkdiags "github.com/openshift/origin/pkg/oc/admin/diagnostics/diagnostics/network"
"github.com/openshift/origin/pkg/oc/admin/diagnostics/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, networkdiags.NetworkDiagnosticName)
)
// availableClientDiagnostics returns definitions of client diagnostics that can be executed
// during a single run of diagnostics. Add more diagnostics to the list as they are defined.
func availableClientDiagnostics() types.DiagnosticList {
return types.DiagnosticList{clientdiags.ConfigContext{}, &clientdiags.DiagnosticPod{}, &networkdiags.NetworkDiagnostic{}}
}

// 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
func (o DiagnosticsConfig) buildClientDiagnostics(rawConfig *clientcmdapi.Config) ([]types.Diagnostic, bool, error) {
available := availableClientDiagnostics().Names()

networkClient, err := o.Factory.OpenshiftInternalNetworkClient()
kubeClient, clientErr := o.Factory.ClientSet()
Expand All @@ -30,7 +31,7 @@ func (o DiagnosticsOptions) buildClientDiagnostics(rawConfig *clientcmdapi.Confi
}

diagnostics := []types.Diagnostic{}
requestedDiagnostics := available.Intersection(sets.NewString(o.RequestedDiagnostics...)).List()
requestedDiagnostics := available.Intersection(sets.NewString(o.RequestedDiagnostics.List()...)).List()
for _, diagnosticName := range requestedDiagnostics {
switch diagnosticName {
case clientdiags.ConfigContextsName:
Expand All @@ -52,23 +53,18 @@ func (o DiagnosticsOptions) buildClientDiagnostics(rawConfig *clientcmdapi.Confi
Level: o.LogOptions.Level,
Factory: o.Factory,
PreventModification: o.PreventModification,
ImageTemplate: o.ImageTemplate,
ImageTemplate: variable.NewDefaultImageTemplate(),
})
case networkdiags.NetworkDiagnosticName:
diagnostics = append(diagnostics, &networkdiags.NetworkDiagnostic{
KubeClient: kubeClient,
NetNamespacesClient: networkClient.Network(),
ClusterNetworkClient: networkClient.Network(),
ClientFlags: o.ClientFlags,
Level: o.LogOptions.Level,
Factory: o.Factory,
PreventModification: o.PreventModification,
LogDir: o.NetworkOptions.LogDir,
PodImage: o.NetworkOptions.PodImage,
TestPodImage: o.NetworkOptions.TestPodImage,
TestPodProtocol: o.NetworkOptions.TestPodProtocol,
TestPodPort: o.NetworkOptions.TestPodPort,
})
nd := o.ParameterizedDiagnostics[diagnosticName].(*networkdiags.NetworkDiagnostic)
nd.KubeClient = kubeClient
nd.NetNamespacesClient = networkClient.Network()
nd.ClusterNetworkClient = networkClient.Network()
nd.ClientFlags = o.ClientFlags
nd.Level = o.LogOptions.Level
nd.Factory = o.Factory
nd.PreventModification = o.PreventModification
diagnostics = append(diagnostics, nd)
default:
return nil, false, fmt.Errorf("unknown diagnostic: %v", diagnosticName)
}
Expand Down
40 changes: 20 additions & 20 deletions pkg/oc/admin/diagnostics/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,27 @@ import (
"k8s.io/kubernetes/pkg/apis/authorization"
)

var (
// availableClusterDiagnostics contains the names of cluster diagnostics that can be executed
// during a single run of diagnostics. Add more diagnostics to the list as they are defined.
availableClusterDiagnostics = sets.NewString(
agldiags.AggregatedLoggingName,
clustdiags.ClusterRegistryName,
clustdiags.ClusterRouterName,
clustdiags.ClusterRolesName,
clustdiags.ClusterRoleBindingsName,
clustdiags.MasterNodeName,
clustdiags.MetricsApiProxyName,
clustdiags.NodeDefinitionsName,
clustdiags.RouteCertificateValidationName,
clustdiags.ServiceExternalIPsName,
)
)
// availableClusterDiagnostics contains the names of cluster diagnostics that can be executed
// during a single run of diagnostics. Add more diagnostics to the list as they are defined.
func availableClusterDiagnostics() types.DiagnosticList {
return types.DiagnosticList{
&agldiags.AggregatedLogging{},
&clustdiags.ClusterRegistry{},
&clustdiags.ClusterRouter{},
&clustdiags.ClusterRoles{},
&clustdiags.ClusterRoleBindings{},
&clustdiags.MasterNode{},
&clustdiags.MetricsApiProxy{},
&clustdiags.NodeDefinitions{},
&clustdiags.RouteCertificateValidation{},
&clustdiags.ServiceExternalIPs{},
}
}

// buildClusterDiagnostics builds cluster Diagnostic objects if a cluster-admin client can be extracted from 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) buildClusterDiagnostics(rawConfig *clientcmdapi.Config) ([]types.Diagnostic, bool, error) {
requestedDiagnostics := availableClusterDiagnostics.Intersection(sets.NewString(o.RequestedDiagnostics...)).List()
func (o DiagnosticsConfig) buildClusterDiagnostics(rawConfig *clientcmdapi.Config) ([]types.Diagnostic, bool, error) {
requestedDiagnostics := availableClusterDiagnostics().Names().Intersection(sets.NewString(o.RequestedDiagnostics.List()...)).List()
if len(requestedDiagnostics) == 0 { // no diagnostics to run here
return nil, true, nil // don't waste time on discovery
}
Expand Down Expand Up @@ -124,7 +124,7 @@ func (o DiagnosticsOptions) buildClusterDiagnostics(rawConfig *clientcmdapi.Conf
}

// attempts to find which context in the config might be a cluster-admin for the server in the current context.
func (o DiagnosticsOptions) findClusterClients(rawConfig *clientcmdapi.Config) (*rest.Config, kclientset.Interface, bool, string, error) {
func (o DiagnosticsConfig) findClusterClients(rawConfig *clientcmdapi.Config) (*rest.Config, kclientset.Interface, bool, string, error) {
if o.ClientClusterContext != "" { // user has specified cluster context to use
if context, exists := rawConfig.Contexts[o.ClientClusterContext]; exists {
configErr := fmt.Errorf("Specified '%s' as cluster-admin context, but it was not found in your client configuration.", o.ClientClusterContext)
Expand Down Expand Up @@ -160,7 +160,7 @@ func (o DiagnosticsOptions) findClusterClients(rawConfig *clientcmdapi.Config) (
}

// makes the client from the specified context and determines whether it is a cluster-admin.
func (o DiagnosticsOptions) makeClusterClients(rawConfig *clientcmdapi.Config, contextName string, context *clientcmdapi.Context) (*rest.Config, kclientset.Interface, bool, string, error) {
func (o DiagnosticsConfig) makeClusterClients(rawConfig *clientcmdapi.Config, contextName string, context *clientcmdapi.Context) (*rest.Config, kclientset.Interface, bool, string, error) {
overrides := &clientcmd.ConfigOverrides{Context: *context}
clientConfig := clientcmd.NewDefaultClientConfig(*rawConfig, overrides)
serverUrl := rawConfig.Clusters[context.Cluster].Server
Expand Down
9 changes: 6 additions & 3 deletions pkg/oc/admin/diagnostics/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,21 @@ import (
)

// determine if we even have a client config
func (o DiagnosticsOptions) detectClientConfig() (bool, []types.DiagnosticError, []types.DiagnosticError) {
func (o DiagnosticsConfig) detectClientConfig() (bool, bool, []types.DiagnosticError, []types.DiagnosticError) {
if o.ClientFlags == nil {
return false, false, []types.DiagnosticError{}, []types.DiagnosticError{}
}
diagnostic := &clientdiagnostics.ConfigLoading{ConfFlagName: config.OpenShiftConfigFlagName, ClientFlags: o.ClientFlags}
o.Logger.Notice("CED2011", "Determining if client configuration exists for client/cluster diagnostics")
result := diagnostic.Check()
for _, entry := range result.Logs() {
o.Logger.LogEntry(entry)
}
return diagnostic.SuccessfulLoad(), result.Warnings(), result.Errors()
return true, diagnostic.SuccessfulLoad(), result.Warnings(), result.Errors()
}

// use the base factory to return a raw config (not specific to a context)
func (o DiagnosticsOptions) buildRawConfig() (*clientcmdapi.Config, error) {
func (o DiagnosticsConfig) buildRawConfig() (*clientcmdapi.Config, error) {
kubeConfig, configErr := o.Factory.OpenShiftClientConfig().RawConfig()
if configErr != nil {
return nil, configErr
Expand Down
Loading

0 comments on commit af825ea

Please sign in to comment.