Skip to content

Commit 931493a

Browse files
authored
Update status remove bundle path (#106)
* remove bundle path from Operator.Status * reconciler: only update the resource being reconciled after resolution * update condition reasons and conditions types lists Signed-off-by: perdasilva <[email protected]>
1 parent edca8be commit 931493a

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

api/v1alpha1/operator_types.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func init() {
4444
)
4545
// TODO(user): add Reasons from above
4646
operatorutil.ConditionReasons = append(operatorutil.ConditionReasons,
47-
ReasonNotImplemented,
47+
ReasonNotImplemented, ReasonResolutionSucceeded, ReasonResolutionFailed,
4848
)
4949
}
5050

@@ -55,7 +55,6 @@ type OperatorStatus struct {
5555
// +listType=map
5656
// +listMapKey=type
5757
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
58-
BundlePath string `json:"BundlePath,omitempty"`
5958
}
6059

6160
//+kubebuilder:object:root=true

config/crd/bases/operators.operatorframework.io_operators.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ spec:
4545
status:
4646
description: OperatorStatus defines the observed state of Operator
4747
properties:
48-
BundlePath:
49-
type: string
5048
conditions:
5149
items:
5250
description: "Condition contains details for one aspect of the current

controllers/operator_controller.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ package controllers
1919
import (
2020
"context"
2121

22-
operatorsv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
23-
"github.com/operator-framework/operator-controller/internal/resolution"
24-
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/bundles_and_dependencies"
2522
"k8s.io/apimachinery/pkg/api/equality"
2623
apimeta "k8s.io/apimachinery/pkg/api/meta"
2724
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -30,6 +27,10 @@ import (
3027
ctrl "sigs.k8s.io/controller-runtime"
3128
"sigs.k8s.io/controller-runtime/pkg/client"
3229
"sigs.k8s.io/controller-runtime/pkg/log"
30+
31+
operatorsv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
32+
"github.com/operator-framework/operator-controller/internal/resolution"
33+
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/bundles_and_dependencies"
3334
)
3435

3536
// OperatorReconciler reconciles a Operator object
@@ -112,7 +113,6 @@ func (r *OperatorReconciler) reconcile(ctx context.Context, op *operatorsv1alpha
112113
message = err.Error()
113114
} else {
114115
// extract package bundle path from resolved variable
115-
var bundlePath = ""
116116
for _, variable := range solution.SelectedVariables() {
117117
switch v := variable.(type) {
118118
case *bundles_and_dependencies.BundleVariable:
@@ -121,15 +121,16 @@ func (r *OperatorReconciler) reconcile(ctx context.Context, op *operatorsv1alpha
121121
return ctrl.Result{}, err
122122
}
123123
if packageName == op.Spec.PackageName {
124-
bundlePath, err = v.BundleEntity().BundlePath()
124+
bundlePath, err := v.BundleEntity().BundlePath()
125125
if err != nil {
126126
return ctrl.Result{}, err
127127
}
128+
// TODO(perdasilva): use bundlePath to stamp out bundle deployment
129+
_ = bundlePath
128130
break
129131
}
130132
}
131133
}
132-
op.Status.BundlePath = bundlePath
133134
}
134135

135136
// update operator status

controllers/suite_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ import (
2525

2626
. "github.com/onsi/ginkgo/v2"
2727
. "github.com/onsi/gomega"
28-
operatorsv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
29-
"github.com/operator-framework/operator-controller/controllers"
30-
operatorutil "github.com/operator-framework/operator-controller/internal/util"
3128
apimeta "k8s.io/apimachinery/pkg/api/meta"
3229
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3330
"k8s.io/apimachinery/pkg/util/rand"
@@ -38,6 +35,10 @@ import (
3835
"sigs.k8s.io/controller-runtime/pkg/envtest"
3936
logf "sigs.k8s.io/controller-runtime/pkg/log"
4037
"sigs.k8s.io/controller-runtime/pkg/log/zap"
38+
39+
operatorsv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
40+
"github.com/operator-framework/operator-controller/controllers"
41+
operatorutil "github.com/operator-framework/operator-controller/internal/util"
4142
//+kubebuilder:scaffold:imports
4243
)
4344

0 commit comments

Comments
 (0)