Skip to content

Commit 1e74520

Browse files
Merge pull request #1900 from awgreene/post-pending-operatorconditions
Bug 1910160: Create OperatorConditions for CSVs being installed
2 parents 427efa6 + 0919c12 commit 1e74520

File tree

3 files changed

+298
-219
lines changed

3 files changed

+298
-219
lines changed

Diff for: pkg/controller/operators/operatorcondition_controller.go

+8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"sigs.k8s.io/controller-runtime/pkg/source"
2020

2121
operatorsv1 "github.com/operator-framework/api/pkg/operators/v1"
22+
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
2223
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil"
2324
)
2425

@@ -201,6 +202,13 @@ func (r *OperatorConditionReconciler) ensureDeploymentEnvVars(operatorCondition
201202
if err != nil {
202203
return err
203204
}
205+
206+
// Check the deployment is owned by a CSV with the same name as the OperatorCondition.
207+
deploymentOwner := ownerutil.GetOwnerByKind(deployment, operatorsv1alpha1.ClusterServiceVersionKind)
208+
if deploymentOwner == nil || deploymentOwner.Name != operatorCondition.GetName() {
209+
continue
210+
}
211+
204212
deploymentNeedsUpdate := false
205213
for i := range deployment.Spec.Template.Spec.Containers {
206214
envVars, containedEnvVar := ensureEnvVarIsPresent(deployment.Spec.Template.Spec.Containers[i].Env, corev1.EnvVar{Name: OperatorConditionEnvVarKey, Value: operatorCondition.GetName()})

0 commit comments

Comments
 (0)