redhat-openshift-ecosystem/operator-certification-operator

Suppress Errors for Resources Which are Optional

acornett21 opened this issue · 1 comments

Is your feature request related to a problem? Please describe.

When creating a CR, seeing errors for optional resources is confusing.

Describe the solution you'd like.

I'd like all errors for optional resources to be suppressed, for now this would be

  • registry-dockerconfig-secret
  • github-ssh-credentials

I think we should only check for the secret in the cluster if the user has provided a name in the CR. IE this code should be changed. As well as any other optional checks.

	if operatorPipeline.Spec.GithubSSHSecretName != "" {
		if err := r.ensureSecret(ctx, operatorPipeline.Spec.GithubSSHSecretName, defaultGithubSSHSecretKeyName, meta); err !=nil {
			return err
		}
	}
	
	return nil

We could then get rid of the default constants.

Describe alternatives you've considered.

N/A

Additional context.

Confusing stack trace.

2021-12-08T15:06:46.701Z	ERROR	controller_operatorpipeline	could not find existing secret oco/registry-dockerconfig-secret	{"error": "could not find existing secret"}
github.com/redhat-openshift-ecosystem/operator-certification-operator/controllers.(*OperatorPipelineReconciler).ensureSecret
	/workspace/controllers/secret.go:193
github.com/redhat-openshift-ecosystem/operator-certification-operator/controllers.(*OperatorPipelineReconciler).ensureDockerRegistrySecret
	/workspace/controllers/secret.go:171
github.com/redhat-openshift-ecosystem/operator-certification-operator/controllers.(*OperatorPipelineReconciler).reconcileResources
	/workspace/controllers/resource.go:67
github.com/redhat-openshift-ecosystem/operator-certification-operator/controllers.(*OperatorPipelineReconciler).Reconcile
	/workspace/controllers/operatorpipeline_controller.go:66
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.9.2/pkg/internal/controller/controller.go:298
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.9.2/pkg/internal/controller/controller.go:253
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.9.2/pkg/internal/controller/controller.go:214
2021-12-08T15:06:46.714Z	INFO	controller_operatorpipeline	Docker Registry Secret not present or correct. Create it to use a private repository.
2021-12-08T15:06:46.714Z	ERROR	controller_operatorpipeline	could not find existing secret oco/github-ssh-credentials	{"error": "could not find existing secret"}
github.com/redhat-openshift-ecosystem/operator-certification-operator/controllers.(*OperatorPipelineReconciler).ensureSecret
	/workspace/controllers/secret.go:193
github.com/redhat-openshift-ecosystem/operator-certification-operator/controllers.(*OperatorPipelineReconciler).ensureGithubSSHSecret
	/workspace/controllers/secret.go:185
github.com/redhat-openshift-ecosystem/operator-certification-operator/controllers.(*OperatorPipelineReconciler).reconcileResources
	/workspace/controllers/resource.go:71
github.com/redhat-openshift-ecosystem/operator-certification-operator/controllers.(*OperatorPipelineReconciler).Reconcile
	/workspace/controllers/operatorpipeline_controller.go:66
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.9.2/pkg/internal/controller/controller.go:298
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.9.2/pkg/internal/controller/controller.go:253
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.9.2/pkg/internal/controller/controller.go:214
2021-12-08T15:06:46.714Z	INFO	controller_operatorpipeline	Github SSH Secret not present or correct. Create it to enable digest pinning.

/assign