Skip to content

Commit a014711

Browse files
author
OpenShift Bot
authored
Merge pull request #14436 from jim-minter/issue12224
Merged by openshift-bot
2 parents 1284263 + fc526b7 commit a014711

File tree

4 files changed

+88
-6
lines changed

4 files changed

+88
-6
lines changed

hack/test-end-to-end-docker.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ unset KUBECONFIG
1111
os::util::environment::use_sudo
1212
os::cleanup::tmpdir
1313
os::util::environment::setup_all_server_vars
14+
os::util::environment::setup_time_vars
1415
export HOME="${FAKE_HOME_DIR}"
1516

1617
# Allow setting $JUNIT_REPORT to toggle output behavior
@@ -61,7 +62,9 @@ oc cluster up --server-loglevel=4 --version="${TAG}" \
6162
--host-data-dir="${VOLUME_DIR}/etcd" \
6263
--host-volumes-dir="${VOLUME_DIR}"
6364

64-
oc cluster status
65+
os::test::junit::declare_suite_start "setup/start-oc_cluster_up"
66+
os::cmd::try_until_success "oc cluster status" "$((5*TIME_MIN))" "10"
67+
os::test::junit::declare_suite_end
6568

6669
IMAGE_WORKING_DIR=/var/lib/origin
6770
docker cp origin:${IMAGE_WORKING_DIR}/openshift.local.config ${BASETMPDIR}

pkg/bootstrap/docker/openshift/metrics.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func metricsDeployerJob(hostName, imagePrefix, imageVersion string) *kbatch.Job
211211

212212
func MetricsHost(routingSuffix, serverIP string) string {
213213
if len(routingSuffix) > 0 {
214-
return fmt.Sprintf("metrics-openshift-infra.%s", routingSuffix)
214+
return fmt.Sprintf("hawkular-metrics-openshift-infra.%s", routingSuffix)
215215
}
216-
return fmt.Sprintf("metrics-openshift-infra.%s.nip.io", serverIP)
216+
return fmt.Sprintf("hawkular-metrics-openshift-infra.%s.nip.io", serverIP)
217217
}

pkg/bootstrap/docker/status.go

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package docker
22

33
import (
4+
"crypto/tls"
45
"fmt"
56
"io"
7+
"net/http"
68
"os"
79
"strings"
810
"time"
@@ -13,6 +15,7 @@ import (
1315

1416
"github.com/openshift/origin/pkg/bootstrap/docker/dockerhelper"
1517
"github.com/openshift/origin/pkg/bootstrap/docker/errors"
18+
"github.com/openshift/origin/pkg/bootstrap/docker/exec"
1619
"github.com/openshift/origin/pkg/bootstrap/docker/openshift"
1720
"github.com/openshift/origin/pkg/cmd/server/api"
1821
"github.com/openshift/origin/pkg/cmd/templates"
@@ -48,7 +51,9 @@ func NewCmdStatus(name, fullName string, f *clientcmd.Factory, out io.Writer) *c
4851
Run: func(c *cobra.Command, args []string) {
4952
err := config.Status(f, out)
5053
if err != nil {
51-
PrintError(err, out)
54+
if err.Error() != "" {
55+
PrintError(err, out)
56+
}
5257
os.Exit(1)
5358
}
5459
},
@@ -92,7 +97,80 @@ func (c *ClientStatusConfig) Status(f *clientcmd.Factory, out io.Writer) error {
9297
return err
9398
}
9499

95-
fmt.Print(status(container, config))
100+
fmt.Fprint(out, status(container, config))
101+
102+
notReady := 0
103+
104+
eh := exec.NewExecHelper(dockerClient, openshift.OpenShiftContainer)
105+
106+
stdout, _, _ := eh.Command("oc", "get", "dc", "docker-registry", "-n", "default", "-o", "template", "--template", "{{.status.availableReplicas}}").Output()
107+
if stdout != "1" {
108+
fmt.Fprintln(out, "Notice: Docker registry is not yet ready")
109+
notReady++
110+
}
111+
112+
stdout, _, _ = eh.Command("oc", "get", "dc", "router", "-n", "default", "-o", "template", "--template", "{{.status.availableReplicas}}").Output()
113+
if stdout != "1" {
114+
fmt.Fprintln(out, "Notice: Router is not yet ready")
115+
notReady++
116+
}
117+
118+
stdout, _, _ = eh.Command("oc", "get", "job", "persistent-volume-setup", "-n", "default", "-o", "template", "--template", "{{.status.succeeded}}").Output()
119+
if stdout != "1" {
120+
fmt.Fprintln(out, "Notice: Persistent volumes are not yet ready")
121+
notReady++
122+
}
123+
124+
stdout, _, _ = eh.Command("oc", "get", "is", "-n", "openshift", "-o", "template", "--template", `{{range .items}}{{if not .status.tags}}notready{{end}}{{end}}`).Output()
125+
if len(stdout) > 0 {
126+
fmt.Fprintln(out, "Notice: Imagestreams are not yet ready")
127+
notReady++
128+
}
129+
130+
insecureCli := http.Client{
131+
Transport: &http.Transport{
132+
TLSClientConfig: &tls.Config{
133+
InsecureSkipVerify: true,
134+
},
135+
},
136+
Timeout: 10 * time.Second,
137+
}
138+
139+
ch := make(chan string)
140+
go func() {
141+
notice := ""
142+
if config.AssetConfig.LoggingPublicURL != "" {
143+
resp, _ := insecureCli.Get(config.AssetConfig.LoggingPublicURL)
144+
if resp == nil || resp.StatusCode != http.StatusFound {
145+
notice = "Notice: Logging component is not yet ready"
146+
}
147+
}
148+
ch <- notice
149+
}()
150+
151+
go func() {
152+
notice := ""
153+
if config.AssetConfig.MetricsPublicURL != "" {
154+
resp, _ := insecureCli.Get(config.AssetConfig.MetricsPublicURL + "/status")
155+
if resp == nil || resp.StatusCode != http.StatusOK {
156+
notice = "Notice: Metrics component is not yet ready"
157+
}
158+
}
159+
ch <- notice
160+
}()
161+
162+
for i := 0; i < 2; i++ {
163+
notice := <-ch
164+
if notice != "" {
165+
fmt.Fprintln(out, notice)
166+
notReady++
167+
}
168+
}
169+
170+
if notReady > 0 {
171+
fmt.Fprintf(out, "\nNotice: %d OpenShift component(s) are not yet ready (see above)\n", notReady)
172+
return fmt.Errorf("")
173+
}
96174

97175
return nil
98176
}
@@ -145,6 +223,7 @@ func status(container *docker.Container, config *api.MasterConfig) string {
145223
} else {
146224
status = status + fmt.Sprintf("Data will be discarded when cluster is destroyed\n")
147225
}
226+
status = status + fmt.Sprintf("\n")
148227

149228
return status
150229
}

pkg/bootstrap/docker/up.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ func (c *ClientStartConfig) ServerInfo(out io.Writer) error {
980980
metricsInfo := ""
981981
if c.ShouldInstallMetrics && c.ShouldInitializeData() {
982982
metricsInfo = fmt.Sprintf("The metrics service is available at:\n"+
983-
" https://%s\n\n", openshift.MetricsHost(c.RoutingSuffix, c.ServerIP))
983+
" https://%s/hawkular/metrics\n\n", openshift.MetricsHost(c.RoutingSuffix, c.ServerIP))
984984
}
985985
loggingInfo := ""
986986
if c.ShouldInstallLogging && c.ShouldInitializeData() {

0 commit comments

Comments
 (0)