Commit 2651c721 authored by Humble Devassy Chirammal's avatar Humble Devassy Chirammal Committed by Kubernetes Prow Robot

This patch consists of various corrections. (#73060)

* This patch consists of various corrections. *) Remove unwanted `else` code block *) Adjust variable intialization. *) Correct error strings. *) Use recommended variable increment method. Signed-off-by: 's avatarhchiramm <hchiramm@redhat.com> * Remove cluster/images/cluster-version-monitor from hack/.golint_failures. Signed-off-by: 's avatarHumble Chirammal <hchiramm@redhat.com>
parent e1e85f94
...@@ -191,7 +191,7 @@ func (m *monitorGatherer) rewriteExportedMetrics(metrics map[string]*dto.MetricF ...@@ -191,7 +191,7 @@ func (m *monitorGatherer) rewriteExportedMetrics(metrics map[string]*dto.MetricF
return results, nil return results, nil
} }
// Struct for unmarshalling the json response from etcd's /version endpoint. // EtcdVersion struct for unmarshalling the json response from etcd's /version endpoint.
type EtcdVersion struct { type EtcdVersion struct {
BinaryVersion string `json:"etcdserver"` BinaryVersion string `json:"etcdserver"`
ClusterVersion string `json:"etcdcluster"` ClusterVersion string `json:"etcdcluster"`
......
cluster/images/etcd-version-monitor
cmd/cloud-controller-manager/app/apis/config/v1alpha1 cmd/cloud-controller-manager/app/apis/config/v1alpha1
cmd/hyperkube cmd/hyperkube
cmd/kube-apiserver/app cmd/kube-apiserver/app
......
...@@ -593,9 +593,9 @@ func (r RealPodControl) DeletePod(namespace string, podID string, object runtime ...@@ -593,9 +593,9 @@ func (r RealPodControl) DeletePod(namespace string, podID string, object runtime
if err := r.KubeClient.CoreV1().Pods(namespace).Delete(podID, nil); err != nil && !apierrors.IsNotFound(err) { if err := r.KubeClient.CoreV1().Pods(namespace).Delete(podID, nil); err != nil && !apierrors.IsNotFound(err) {
r.Recorder.Eventf(object, v1.EventTypeWarning, FailedDeletePodReason, "Error deleting: %v", err) r.Recorder.Eventf(object, v1.EventTypeWarning, FailedDeletePodReason, "Error deleting: %v", err)
return fmt.Errorf("unable to delete pods: %v", err) return fmt.Errorf("unable to delete pods: %v", err)
} else {
r.Recorder.Eventf(object, v1.EventTypeNormal, SuccessfulDeletePodReason, "Deleted pod: %v", podID)
} }
r.Recorder.Eventf(object, v1.EventTypeNormal, SuccessfulDeletePodReason, "Deleted pod: %v", podID)
return nil return nil
} }
......
...@@ -36,8 +36,8 @@ import ( ...@@ -36,8 +36,8 @@ import (
var ( var (
// schedule is hourly on the hour // schedule is hourly on the hour
onTheHour string = "0 * * * ?" onTheHour = "0 * * * ?"
errorSchedule string = "obvious error schedule" errorSchedule = "obvious error schedule"
) )
func justBeforeTheHour() time.Time { func justBeforeTheHour() time.Time {
...@@ -160,8 +160,8 @@ var ( ...@@ -160,8 +160,8 @@ var (
A batchV1beta1.ConcurrencyPolicy = batchV1beta1.AllowConcurrent A batchV1beta1.ConcurrencyPolicy = batchV1beta1.AllowConcurrent
f batchV1beta1.ConcurrencyPolicy = batchV1beta1.ForbidConcurrent f batchV1beta1.ConcurrencyPolicy = batchV1beta1.ForbidConcurrent
R batchV1beta1.ConcurrencyPolicy = batchV1beta1.ReplaceConcurrent R batchV1beta1.ConcurrencyPolicy = batchV1beta1.ReplaceConcurrent
T bool = true T = true
F bool = false F = false
) )
func TestSyncOne_RunOrNot(t *testing.T) { func TestSyncOne_RunOrNot(t *testing.T) {
...@@ -347,7 +347,7 @@ func TestSyncOne_RunOrNot(t *testing.T) { ...@@ -347,7 +347,7 @@ func TestSyncOne_RunOrNot(t *testing.T) {
for i := 1; i <= len(recorder.Events); i++ { for i := 1; i <= len(recorder.Events); i++ {
e := <-recorder.Events e := <-recorder.Events
if strings.HasPrefix(e, v1.EventTypeWarning) { if strings.HasPrefix(e, v1.EventTypeWarning) {
numWarnings += 1 numWarnings++
} }
} }
if numWarnings != tc.expectedWarnings { if numWarnings != tc.expectedWarnings {
......
...@@ -108,9 +108,9 @@ func TestPodTemplateSpecHash(t *testing.T) { ...@@ -108,9 +108,9 @@ func TestPodTemplateSpecHash(t *testing.T) {
seenHashes := make(map[string]int) seenHashes := make(map[string]int)
for i := 0; i < 1000; i++ { for i := 0; i < 1000; i++ {
specJson := strings.Replace(podSpec, "@@VERSION@@", strconv.Itoa(i), 1) specJSON := strings.Replace(podSpec, "@@VERSION@@", strconv.Itoa(i), 1)
spec := v1.PodTemplateSpec{} spec := v1.PodTemplateSpec{}
json.Unmarshal([]byte(specJson), &spec) json.Unmarshal([]byte(specJSON), &spec)
hash := controller.ComputeHash(&spec, nil) hash := controller.ComputeHash(&spec, nil)
if v, ok := seenHashes[hash]; ok { if v, ok := seenHashes[hash]; ok {
t.Errorf("Hash collision, old: %d new: %d", v, i) t.Errorf("Hash collision, old: %d new: %d", v, i)
......
...@@ -14,5 +14,5 @@ See the License for the specific language governing permissions and ...@@ -14,5 +14,5 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
// namespace contains a controller that handles namespace lifecycle // Package namespace contains a controller that handles namespace lifecycle
package namespace // import "k8s.io/kubernetes/pkg/controller/namespace" package namespace // import "k8s.io/kubernetes/pkg/controller/namespace"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment