Skip to content

Commit

Permalink
Bunch of small improvements to ease debugging (#592)
Browse files Browse the repository at this point in the history
  • Loading branch information
alenkacz committed Jul 23, 2019
1 parent 2bc1cb6 commit a5d4b16
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 24 deletions.
5 changes: 4 additions & 1 deletion pkg/controller/instance/instance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,22 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
})
}
}
log.Printf("Found %v instances to reconcile", len(requests))
log.Printf("InstanceController: Found %v instances to reconcile for operator %v", len(requests), a.Meta.GetName())
return requests
})

// This map function makes sure that we *ONLY* handle created operatorVersion
ovPredicate := predicate.Funcs{
CreateFunc: func(e event.CreateEvent) bool {
log.Printf("InstanceController: Received create event for: %v", e.Meta.GetName())
return true
},
UpdateFunc: func(e event.UpdateEvent) bool {
log.Printf("InstanceController: Received update event for: %v", e.MetaNew.GetName())
return false
},
DeleteFunc: func(e event.DeleteEvent) bool {
log.Printf("InstanceController: Received delete event for: %v", e.Meta.GetName())
return false
},
}
Expand Down
14 changes: 5 additions & 9 deletions pkg/controller/planexecution/planexecution_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,16 +367,12 @@ func (r *ReconcilePlanExecution) Reconcile(request reconcile.Request) (reconcile
log.Printf("PlanExecutionController: Object %v does not exist, going to create new object for instance %v", key, instance.Name)
err = r.Client.Create(context.TODO(), obj)
if err != nil {
log.Printf("PlanExecutionController: Error when creating object %v: %v", key, err)
}
}

if err != nil {
log.Printf("PlanExecutionController: Error CreateOrUpdate Object in step \"%v\": %v", s.Name, err)
planExecution.Status.Phases[i].State = kudov1alpha1.PhaseStateError
planExecution.Status.Phases[i].Steps[j].State = kudov1alpha1.PhaseStateError
log.Printf("PlanExecutionController: Error when creating object %v: %v", s.Name, err)
planExecution.Status.Phases[i].State = kudov1alpha1.PhaseStateError
planExecution.Status.Phases[i].Steps[j].State = kudov1alpha1.PhaseStateError

return reconcile.Result{}, err
return reconcile.Result{}, err
}
}

err = health.IsHealthy(r.Client, obj)
Expand Down
4 changes: 2 additions & 2 deletions test/integration/immutable-client-ip/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apiVersion: kudo.k8s.io/v1alpha1
kind: Instance
metadata:
name: my-instance
name: immutable-client-ip-instance
status:
status: COMPLETE
---
apiVersion: v1
kind: Service
metadata:
name: my-instance-svc
name: immutable-client-ip-instance-svc
spec:
type: ClusterIP
ports:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: kudo.k8s.io/v1alpha1
kind: Instance
metadata:
name: my-instance
name: immutable-client-ip-instance
labels:
kudo.dev/operator: service-operator
spec:
Expand Down
4 changes: 2 additions & 2 deletions test/integration/immutable-client-ip/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apiVersion: kudo.k8s.io/v1alpha1
kind: Instance
metadata:
name: my-instance
name: immutable-client-ip-instance
status:
status: COMPLETE
---
apiVersion: v1
kind: Service
metadata:
name: my-instance-svc
name: immutable-client-ip-instance-svc
spec:
type: ClusterIP
ports:
Expand Down
2 changes: 1 addition & 1 deletion test/integration/immutable-client-ip/01-upgrade.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: kudo.k8s.io/v1alpha1
kind: Instance
metadata:
name: my-instance
name: immutable-client-ip-instance
labels:
operator: service-operator
spec:
Expand Down
2 changes: 1 addition & 1 deletion test/integration/operator-test/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-instance-nginx
name: operator-test-instance-nginx
spec:
replicas: 3
template:
Expand Down
2 changes: 1 addition & 1 deletion test/integration/operator-test/00-install.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: kudo.k8s.io/v1alpha1
kind: Instance
metadata:
name: my-instance
name: operator-test-instance
spec:
operatorVersion:
name: test-operator-1.0
Expand Down
2 changes: 1 addition & 1 deletion test/integration/operator-test/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-instance-nginx
name: operator-test-instance-nginx
spec:
replicas: 4
2 changes: 1 addition & 1 deletion test/integration/operator-test/01-upgrade.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: kudo.k8s.io/v1alpha1
kind: Instance
metadata:
name: my-instance
name: operator-test-instance
spec:
operatorVersion:
name: test-operator-1.0
Expand Down
2 changes: 1 addition & 1 deletion test/integration/step-delete/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
apiVersion: kudo.k8s.io/v1alpha1
kind: Instance
metadata:
name: my-instance
name: step-delete-instance
status:
status: COMPLETE
2 changes: 1 addition & 1 deletion test/integration/step-delete/00-install-instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
apiVersion: kudo.k8s.io/v1alpha1
kind: Instance
metadata:
name: my-instance
name: step-delete-instance
spec:
operatorVersion:
name: job-operator
Expand Down
2 changes: 1 addition & 1 deletion test/integration/step-delete/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
apiVersion: kudo.k8s.io/v1alpha1
kind: Instance
metadata:
name: my-instance
name: step-delete-instance
status:
status: COMPLETE
2 changes: 1 addition & 1 deletion test/integration/step-delete/01-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: kudo.k8s.io/v1alpha1
kind: Instance
metadata:
name: my-instance
name: step-delete-instance
spec:
operatorVersion:
name: job-operator
Expand Down

0 comments on commit a5d4b16

Please sign in to comment.