Skip to content

Commit 189d01b

Browse files
Merge pull request #18186 from sosiouxme/20180117-openshift-diagnostics-unify
Automatic merge from submit-queue. openshift-diagnostics => diagnostics subcommands Builds on commit from #17773 (diagnostics: individual parameters). Removes `openshift-diagnostics` in favor of hidden `oc adm diagnostics` subcommands as proposed with #18149 (comment). Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1534513 and #18141
2 parents 82fe749 + 776865b commit 189d01b

File tree

15 files changed

+47
-69
lines changed

15 files changed

+47
-69
lines changed

cmd/openshift-diagnostics/main.go

Lines changed: 0 additions & 46 deletions
This file was deleted.

contrib/vagrant/provision-util.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ os::provision::install-cmds() {
5757
local deployed_root=$1
5858

5959
local output_path="$(os::build::get-bin-output-path "${deployed_root}")"
60-
cp ${output_path}/{openshift,openshift-diagnostics,oc} /usr/bin
60+
cp ${output_path}/{openshift,oc} /usr/bin
6161
}
6262

6363
os::provision::add-to-hosts-file() {

docs/man/man1/.files_generated_oc

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/man/man1/oc-adm-diagnostics-inpod-networkcheck.1

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/man/man1/oc-adm-diagnostics-inpod-poddiagnostic.1

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/man/man1/oc-ex-diagnostics-inpod-networkcheck.1

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/man/man1/oc-ex-diagnostics-inpod-poddiagnostic.1

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hack/dind-cluster.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,6 @@ function copy-runtime() {
566566
local target=$2
567567

568568
cp "$(os::util::find::built_binary openshift)" "${target}"
569-
cp "$(os::util::find::built_binary openshift-diagnostics)" "${target}"
570569
cp "$(os::util::find::built_binary oc)" "${target}"
571570
cp "$(os::util::find::built_binary host-local)" "${target}"
572571
cp "$(os::util::find::built_binary loopback)" "${target}"

hack/lib/constants.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ readonly OS_CROSS_COMPILE_TARGETS=(
4545
cmd/openshift
4646
cmd/oc
4747
cmd/oadm
48-
cmd/openshift-diagnostics
4948
cmd/template-service-broker
5049
vendor/k8s.io/kubernetes/cmd/hyperkube
5150
)

images/dind/node/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ RUN mkdir -p /opt/cni/bin
7070
# make reloading easy. Revisit if/when dind becomes useful for more
7171
# than dev/test.
7272
RUN ln -sf /data/openshift /usr/local/bin/ && \
73-
ln -sf /data/openshift-diagnostics /usr/local/bin/ && \
7473
ln -sf /data/oc /usr/local/bin/ && \
7574
ln -sf /data/openshift /usr/local/bin/openshift-deploy && \
7675
ln -sf /data/openshift /usr/local/bin/openshift-docker-build && \

pkg/oc/admin/diagnostics/diagnostics.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ import (
1717

1818
"github.com/openshift/origin/pkg/client/config"
1919
"github.com/openshift/origin/pkg/cmd/flagtypes"
20+
clientdiag "github.com/openshift/origin/pkg/oc/admin/diagnostics/diagnostics/client"
2021
"github.com/openshift/origin/pkg/oc/admin/diagnostics/diagnostics/log"
22+
networkdiag "github.com/openshift/origin/pkg/oc/admin/diagnostics/diagnostics/network"
2123
"github.com/openshift/origin/pkg/oc/admin/diagnostics/diagnostics/types"
2224
"github.com/openshift/origin/pkg/oc/admin/diagnostics/options"
2325
"github.com/openshift/origin/pkg/oc/admin/diagnostics/util"
@@ -131,6 +133,11 @@ func NewCmdDiagnostics(name string, fullName string, out io.Writer) *cobra.Comma
131133
for _, diag := range available {
132134
cmd.AddCommand(NewCmdDiagnosticsIndividual(strings.ToLower(diag.Name()), fullName+" "+strings.ToLower(diag.Name()), out, diag))
133135
}
136+
// add hidden in-pod subcommands
137+
cmd.AddCommand(
138+
NewCommandPodDiagnostics(clientdiag.InPodDiagnosticRecommendedName, out),
139+
NewCommandNetworkPodDiagnostics(networkdiag.InPodNetworkCheckRecommendedName, out),
140+
)
134141

135142
return cmd
136143
}

pkg/oc/admin/diagnostics/diagnostics/client/run_diagnostics_pod.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ import (
2020
)
2121

2222
const (
23-
DiagnosticPodName = "DiagnosticPod"
24-
ImageTemplateParam = "images"
25-
LatestImageParam = "latest-images"
23+
InPodDiagnosticRecommendedName = "inpod-poddiagnostic"
24+
DiagnosticPodName = "DiagnosticPod"
25+
ImageTemplateParam = "images"
26+
LatestImageParam = "latest-images"
2627
)
2728

2829
// DiagnosticPod is a diagnostic that runs a diagnostic pod and relays the results.
@@ -87,7 +88,7 @@ func (d *DiagnosticPod) runDiagnosticPod(r types.DiagnosticResult) {
8788
{
8889
Name: "pod-diagnostics",
8990
Image: imageName,
90-
Command: []string{"openshift-diagnostics", "diagnostic-pod", "-l", strconv.Itoa(loglevel)},
91+
Command: []string{"oc", "adm", "diagnostics", InPodDiagnosticRecommendedName, "-l", strconv.Itoa(loglevel)},
9192
},
9293
},
9394
},

pkg/oc/admin/diagnostics/diagnostics/network/run_pod.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ import (
2727
)
2828

2929
const (
30-
NetworkDiagnosticName = "NetworkCheck"
31-
FlagNetworkDiagLogDir = "logdir"
32-
FlagNetworkDiagPodImage = "pod-image"
33-
FlagNetworkDiagTestPodImage = "test-pod-image"
34-
FlagNetworkDiagTestPodProtocol = "test-pod-protocol"
35-
FlagNetworkDiagTestPodPort = "test-pod-port"
30+
InPodNetworkCheckRecommendedName = "inpod-networkcheck"
31+
NetworkDiagnosticName = "NetworkCheck"
32+
FlagNetworkDiagLogDir = "logdir"
33+
FlagNetworkDiagPodImage = "pod-image"
34+
FlagNetworkDiagTestPodImage = "test-pod-image"
35+
FlagNetworkDiagTestPodProtocol = "test-pod-protocol"
36+
FlagNetworkDiagTestPodPort = "test-pod-port"
3637
)
3738

3839
// NetworkDiagnostic is a diagnostic that runs a network diagnostic pod and relays the results.
@@ -181,7 +182,7 @@ func (d *NetworkDiagnostic) runNetworkDiagnostic() {
181182
// In Collection phase, results from each node are moved to the user machine where the CLI cmd is executed.
182183

183184
// TEST Phase: Run network diagnostic pod on all valid nodes in parallel
184-
command := fmt.Sprintf("openshift-diagnostics network-diagnostic-pod -l %d", loglevel)
185+
command := fmt.Sprintf("oc adm diagnostics %s -l %d", InPodNetworkCheckRecommendedName, loglevel)
185186
if err := d.runNetworkPod(command); err != nil {
186187
d.res.Error("DNet2006", err, err.Error())
187188
return

pkg/oc/admin/diagnostics/network_pod.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ func NewCommandNetworkPodDiagnostics(name string, out io.Writer) *cobra.Command
4949
}
5050

5151
cmd := &cobra.Command{
52-
Use: name,
53-
Short: "Within a privileged pod, run network diagnostics",
54-
Long: fmt.Sprintf(longNetworkPodDiagDescription),
55-
Run: commandRunFunc(o),
52+
Use: name,
53+
Short: "Within a privileged pod, run network diagnostics",
54+
Long: fmt.Sprintf(longNetworkPodDiagDescription),
55+
Run: commandRunFunc(o),
56+
Hidden: true,
5657
}
5758
cmd.SetOutput(out) // for output re: usage / help
5859

pkg/oc/admin/diagnostics/pod.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ func NewCommandPodDiagnostics(name string, out io.Writer) *cobra.Command {
5252
}
5353

5454
cmd := &cobra.Command{
55-
Use: name,
56-
Short: "Within a pod, run pod diagnostics",
57-
Long: fmt.Sprintf(longPodDiagDescription),
58-
Run: commandRunFunc(o),
55+
Use: name,
56+
Short: "Within a pod, run pod diagnostics",
57+
Long: fmt.Sprintf(longPodDiagDescription),
58+
Run: commandRunFunc(o),
59+
Hidden: true,
5960
}
6061
cmd.SetOutput(out) // for output re: usage / help
6162

0 commit comments

Comments
 (0)