Skip to content

Commit 9d3d355

Browse files
author
OpenShift Bot
authored
Merge pull request #11295 from sosiouxme/20161010-diagnostics-fixes
Merged by openshift-bot
2 parents ea2c8f5 + 9b82a96 commit 9d3d355

File tree

7 files changed

+52
-22
lines changed

7 files changed

+52
-22
lines changed

pkg/diagnostics/cluster/aggregated_logging/clusterrolebindings.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ is required to enable Fluentd to look up pod metadata for the logs it gathers.
1717
As a user with a cluster-admin role, you can grant the permissions by running
1818
the following:
1919
20-
oadm policy add-cluster-role-to-user cluster-reader system:serviceaccount:%[2]s:%[1]s
20+
$ oadm policy add-cluster-role-to-user cluster-reader system:serviceaccount:%[2]s:%[1]s
2121
`
2222

2323
func checkClusterRoleBindings(r diagnosticReporter, adapter clusterRoleBindingsAdapter, project string) {

pkg/diagnostics/cluster/aggregated_logging/daemonsets.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ There are no nodes that match the selector for DaemonSet '%[1]s'. This
1313
means Fluentd is not running and is not gathering logs from any nodes.
1414
An example of a command to target a specific node for this DaemonSet:
1515
16-
oc label node/node1.example.com %[2]s
16+
$ oc label node/node1.example.com %[2]s
1717
1818
or to label them all:
1919
20-
oc label node --all %[2]s
20+
$ oc label node --all %[2]s
2121
`
2222

2323
const daemonSetPartialNodesLabeled = `
2424
There are some nodes that match the selector for DaemonSet '%s'.
2525
A list of matching nodes can be discovered by running:
2626
27-
oc get nodes -l %s
27+
$ oc get nodes -l %s
2828
`
2929
const daemonSetNoPodsFound = `
3030
There were no pods found that match DaemonSet '%s' with matchLabels '%s'
@@ -36,9 +36,9 @@ Depending upon the state, this could mean there is an error running the image
3636
for one or more pod containers, the node could be pulling images, etc. Try running
3737
the following commands to get additional information:
3838
39-
oc describe pod %[1]s -n %[5]s
40-
oc logs %[1]s -n %[5]s
41-
oc get events -n %[5]s
39+
$ oc describe pod %[1]s -n %[5]s
40+
$ oc logs %[1]s -n %[5]s
41+
$ oc get events -n %[5]s
4242
`
4343
const daemonSetNotFound = `
4444
There were no DaemonSets in project '%s' that included label '%s'. This implies

pkg/diagnostics/cluster/aggregated_logging/deploymentconfigs.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ const deploymentConfigZeroPodsFound = `
3333
There were no Pods found that support logging. Try running
3434
the following commands for additional information:
3535
36-
oc describe dc -n %[1]s
37-
oc get events -n %[1]s
36+
$ oc describe dc -n %[1]s
37+
$ oc get events -n %[1]s
3838
`
3939
const deploymentConfigNoPodsFound = `
4040
There were no Pods found for DeploymentConfig '%[1]s'. Try running
4141
the following commands for additional information:
4242
43-
oc describe dc %[1]s -n %[2]s
44-
oc get events -n %[2]s
43+
$ oc describe dc %[1]s -n %[2]s
44+
$ oc get events -n %[2]s
4545
`
4646
const deploymentConfigPodsNotRunning = `
4747
The Pod '%[1]s' matched by DeploymentConfig '%[2]s' is not in '%[3]s' status: %[4]s.
@@ -50,9 +50,9 @@ Depending upon the state, this could mean there is an error running the image
5050
for one or more pod containers, the node could be pulling images, etc. Try running
5151
the following commands for additional information:
5252
53-
oc describe pod %[1]s -n %[5]s
54-
oc logs %[1]s -n %[5]s
55-
oc get events -n %[5]s
53+
$ oc describe pod %[1]s -n %[5]s
54+
$ oc logs %[1]s -n %[5]s
55+
$ oc get events -n %[5]s
5656
`
5757

5858
func checkDeploymentConfigs(r diagnosticReporter, adapter deploymentConfigAdapter, project string) {

pkg/diagnostics/cluster/aggregated_logging/diagnostic.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ func (d *AggregatedLogging) CanRun() (bool, error) {
125125
var err error
126126
d.masterConfig, err = hostdiag.GetMasterConfig(d.result, d.MasterConfigFile)
127127
if err != nil {
128-
return false, errors.New("Unreadable master config; skipping this diagnostic.")
128+
return false, errors.New("Master configuration is unreadable")
129+
}
130+
if d.masterConfig.AssetConfig.LoggingPublicURL == "" {
131+
return false, errors.New("No LoggingPublicURL is defined in the master configuration")
129132
}
130133
return true, nil
131134
}
@@ -150,7 +153,7 @@ The project '%[1]s' was found with either a missing or non-empty node selector a
150153
This could keep Fluentd from running on certain nodes and collecting logs from the entire cluster.
151154
You can correct it by editing the project:
152155
153-
oc edit namespace %[1]s
156+
$ oc edit namespace %[1]s
154157
155158
and updating the annotation:
156159

pkg/diagnostics/cluster/aggregated_logging/routes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ An unaccepted route is most likely due to one of the following reasons:
2121
If a router has been deployed, look for duplicate matching routes by
2222
running the following:
2323
24-
oc get --all-namespaces routes --template='{{range .items}}{{if eq .spec.host "%[2]s"}}{{println .metadata.name "in" .metadata.namespace}}{{end}}{{end}}'
24+
$ oc get --all-namespaces routes --template='{{range .items}}{{if eq .spec.host "%[2]s"}}{{println .metadata.name "in" .metadata.namespace}}{{end}}{{end}}'
2525
2626
`
2727
const routeCertMissingHostName = `

pkg/diagnostics/cluster/aggregated_logging/scc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The ServiceAccount '%[1]s' does not have a privileged SecurityContextConstraint
1515
user with a cluster-admin role, you can grant the permissions by running
1616
the following:
1717
18-
oadm policy add-scc-to-user privileged system:serviceaccount:%[2]s:%[1]s
18+
$ oadm policy add-scc-to-user privileged system:serviceaccount:%[2]s:%[1]s
1919
`
2020

2121
func checkSccs(r diagnosticReporter, adapter sccAdapter, project string) {

pkg/diagnostics/cluster/roles.go

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,34 @@ type ClusterRoles struct {
2020
}
2121

2222
const (
23-
ClusterRolesName = "ClusterRoles"
23+
ClusterRolesName = "ClusterRoles"
24+
clusterRoleMissing = `
25+
clusterrole/%s is missing.
26+
27+
Use the 'oadm policy reconcile-cluster-roles' command to create the role. For example,
28+
29+
$ oadm policy reconcile-cluster-roles \
30+
--additive-only=true --confirm
31+
`
32+
clusterRoleReduced = `
33+
clusterrole/%s has changed, but the existing role has more permissions than the new role.
34+
35+
If you can confirm that the extra permissions are not required, you may use the
36+
'oadm policy reconcile-cluster-roles' command to update the role to reduce permissions.
37+
For example,
38+
39+
$ oadm policy reconcile-cluster-roles \
40+
--additive-only=false --confirm
41+
`
42+
clusterRoleChanged = `
43+
clusterrole/%s has changed and the existing role does not have enough permissions.
44+
45+
Use the 'oadm policy reconcile-cluster-roles' command to update the role.
46+
For example,
47+
48+
$ oadm policy reconcile-cluster-roles \
49+
--additive-only=true --confirm
50+
`
2451
)
2552

2653
func (d *ClusterRoles) Name() string {
@@ -70,7 +97,7 @@ func (d *ClusterRoles) Check() types.DiagnosticResult {
7097
for _, changedClusterRole := range changedClusterRoles {
7198
actualClusterRole, err := d.ClusterRolesClient.ClusterRoles().Get(changedClusterRole.Name)
7299
if kerrs.IsNotFound(err) {
73-
r.Error("CRD1002", nil, fmt.Sprintf("clusterrole/%s is missing.\n\nUse the `oadm policy reconcile-cluster-roles` command to create the role.", changedClusterRole.Name))
100+
r.Error("CRD1002", nil, fmt.Sprintf(clusterRoleMissing, changedClusterRole.Name))
74101
continue
75102
}
76103
if err != nil {
@@ -79,15 +106,15 @@ func (d *ClusterRoles) Check() types.DiagnosticResult {
79106

80107
_, missingRules := rulevalidation.Covers(actualClusterRole.Rules, changedClusterRole.Rules)
81108
if len(missingRules) == 0 {
82-
r.Warn("CRD1003", nil, fmt.Sprintf("clusterrole/%s has changed, but the existing role has more permissions than the new role.\n\nUse the `oadm policy reconcile-cluster-roles` command to update the role to reduce permissions.", changedClusterRole.Name))
109+
r.Info("CRD1003", fmt.Sprintf(clusterRoleReduced, changedClusterRole.Name))
83110
_, extraRules := rulevalidation.Covers(changedClusterRole.Rules, actualClusterRole.Rules)
84111
for _, extraRule := range extraRules {
85112
r.Info("CRD1008", fmt.Sprintf("clusterrole/%s has extra permission %v.", changedClusterRole.Name, extraRule))
86113
}
87114
continue
88115
}
89116

90-
r.Error("CRD1005", nil, fmt.Sprintf("clusterrole/%s has changed and the existing role does not have enough permissions.\n\nUse the `oadm policy reconcile-cluster-roles` command to update the role.", changedClusterRole.Name))
117+
r.Error("CRD1005", nil, fmt.Sprintf(clusterRoleChanged, changedClusterRole.Name))
91118
for _, missingRule := range missingRules {
92119
r.Info("CRD1007", fmt.Sprintf("clusterrole/%s is missing permission %v.", changedClusterRole.Name, missingRule))
93120
}

0 commit comments

Comments
 (0)