diff --git a/hack/undeploy.sh b/hack/undeploy.sh index 62c54fa58..685a2a154 100755 --- a/hack/undeploy.sh +++ b/hack/undeploy.sh @@ -2,6 +2,6 @@ source "$(dirname $0)/common" -oc delete ns openshift-logging --force --ignore-not-found --grace-period=0 -oc delete -n openshift is origin-cluster-logging-operator --force --ignore-not-found --grace-period=0 -oc delete -n openshift bc cluster-logging-operator --force --ignore-not-found --grace-period=0 +oc delete ns openshift-logging --force --ignore-not-found --grace-period=0 ||: +oc delete -n openshift is origin-cluster-logging-operator --force --ignore-not-found --grace-period=0 ||: +oc delete -n openshift bc cluster-logging-operator --force --ignore-not-found --grace-period=0||: diff --git a/manifests/4.3/cluster-loggings.crd.yaml b/manifests/4.3/cluster-loggings.crd.yaml index 1296b6b42..46bab8e38 100644 --- a/manifests/4.3/cluster-loggings.crd.yaml +++ b/manifests/4.3/cluster-loggings.crd.yaml @@ -184,3 +184,5 @@ spec: - schedule required: - type + subresources: + status: {} diff --git a/manifests/4.3/collectors.crd.yaml b/manifests/4.3/collectors.crd.yaml index 0d8cccc48..b451701a0 100644 --- a/manifests/4.3/collectors.crd.yaml +++ b/manifests/4.3/collectors.crd.yaml @@ -42,3 +42,5 @@ spec: description: Define which Nodes the Pods are scheduled on. required: - type + subresources: + status: {} diff --git a/manifests/4.3/logforwardings.crd.yaml b/manifests/4.3/logforwardings.crd.yaml index 76bfe4e93..442c2bb23 100644 --- a/manifests/4.3/logforwardings.crd.yaml +++ b/manifests/4.3/logforwardings.crd.yaml @@ -57,7 +57,7 @@ spec: type: string outputRefs: description: The name of outputs to send the source logs - items: + items: type: string type: array inputType: @@ -71,8 +71,10 @@ spec: - name - source - outputRefs - type: array + type: array required: - outputs - pipelines - \ No newline at end of file + subresources: + status: {} + diff --git a/pkg/controller/forwarding/forwarding_controller.go b/pkg/controller/forwarding/forwarding_controller.go index c5af84b22..60aeb1080 100644 --- a/pkg/controller/forwarding/forwarding_controller.go +++ b/pkg/controller/forwarding/forwarding_controller.go @@ -7,6 +7,7 @@ import ( loggingv1 "github.com/openshift/cluster-logging-operator/pkg/apis/logging/v1" logforwarding "github.com/openshift/cluster-logging-operator/pkg/apis/logging/v1alpha1" "github.com/openshift/cluster-logging-operator/pkg/k8shandler" + "github.com/openshift/cluster-logging-operator/pkg/logger" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" @@ -76,10 +77,13 @@ var ( // The Controller will requeue the Request to be processed again if the returned error is non-nil or // Result.Requeue is true, otherwise upon completion it will remove the work from the queue. func (r *ReconcileForwarding) Reconcile(request reconcile.Request) (reconcile.Result, error) { + logger.Debugf("logforwarding-controller Reconciling: %v", request) // Fetch the LogForwarding instance instance := &logforwarding.LogForwarding{} + logger.Debug("logforwarding-controller fetching LF instance") err := r.client.Get(context.TODO(), request.NamespacedName, instance) if err != nil { + logger.Debugf("logforwarding-controller Error getting instance. It will be retried if other then 'NotFound': %v", err) if errors.IsNotFound(err) { // Request object not found, could have been deleted after reconcile request. // Owned objects are automatically garbage collected. For additional cleanup logic use finalizers. @@ -89,6 +93,7 @@ func (r *ReconcileForwarding) Reconcile(request reconcile.Request) (reconcile.Re // Error reading the object - requeue the request. return reconcile.Result{}, err } + logger.Debugf("logforwarding-controller fetched LF instance: %v", instance) //check for instancename and then update status var reconcileErr error = nil @@ -97,6 +102,7 @@ func (r *ReconcileForwarding) Reconcile(request reconcile.Request) (reconcile.Re } else { instance.Status = logforwarding.NewForwardingStatus(logforwarding.LogForwardingStateAccepted, logforwarding.LogForwardingReasonName, "") + logger.Debug("logforwarding-controller fetching ClusterLogging instance...") clInstance := &loggingv1.ClusterLogging{} clName := types.NamespacedName{Name: singletonName, Namespace: openshiftNS} err = r.client.Get(context.TODO(), clName, clInstance) @@ -104,15 +110,20 @@ func (r *ReconcileForwarding) Reconcile(request reconcile.Request) (reconcile.Re // Request object not found, could have been deleted after reconcile request. // Owned objects are automatically garbage collected. For additional cleanup logic use finalizers. // Return and don't requeue + logger.Debugf("logforwarding-controller error fetching ClusterLogging instance: %v") return reconcile.Result{}, err } + logger.Debug("logforwarding-controller calling ClusterLogging reconciler...") reconcileErr = k8shandler.Reconcile(clInstance, instance, r.client) } + logger.Debugf("logforwarding-controller updating status of instance: %v", instance) if err = r.client.Status().Update(context.TODO(), instance); err != nil { + logger.Debugf("logforwarding-controller error updating status: %v", err) return reconcile.Result{}, err } + logger.Debugf("logforwarding-controller returning %v, error: %v", reconcileResult, reconcileErr) return reconcileResult, reconcileErr } diff --git a/pkg/k8shandler/reconciler.go b/pkg/k8shandler/reconciler.go index d9dd4add9..0010bf440 100644 --- a/pkg/k8shandler/reconciler.go +++ b/pkg/k8shandler/reconciler.go @@ -10,7 +10,7 @@ import ( ) func Reconcile(requestCluster *logging.ClusterLogging, forwarding *logforwarding.LogForwarding, requestClient client.Client) (err error) { - logger.Debugf("Reconciling %v", requestCluster) + logger.Debugf("Reconciling cl: %v, forwarding: %v", requestCluster, forwarding) clusterLoggingRequest := ClusterLoggingRequest{ client: requestClient, cluster: requestCluster,