@@ -80,21 +80,11 @@ func (c OperatorClient) ApplyOperatorSpec(ctx context.Context, fieldManager stri
80
80
81
81
func (c OperatorClient ) ApplyOperatorStatus (ctx context.Context , fieldManager string , applyConfiguration * applyoperatorv1.OperatorStatusApplyConfiguration ) (err error ) {
82
82
if applyConfiguration == nil {
83
-
84
83
return fmt .Errorf ("applyConfiguration must have a value" )
85
84
}
86
85
87
86
desired := applyconfig .CertManager ("cluster" )
88
- //desired.Status.Conditions = make([]operatorv1.OperatorCondition, len(applyConfiguration.Conditions))
89
- //for i := range applyConfiguration.Conditions {
90
- // desired.Status.Conditions[i] = operatorv1.OperatorCondition{
91
- // Type: *applyConfiguration.Conditions[i].Type,
92
- // Status: *applyConfiguration.Conditions[i].Status,
93
- // LastTransitionTime: *applyConfiguration.Conditions[i].LastTransitionTime,
94
- // Reason: *applyConfiguration.Conditions[i].Reason,
95
- // Message: *applyConfiguration.Conditions[i].Message,
96
- // }
97
- //}
87
+ desired .Status = & applyconfig.CertManagerStatusApplyConfiguration {}
98
88
99
89
desired .Status .Conditions = applyConfiguration .Conditions
100
90
desired .Status .ObservedGeneration = applyConfiguration .ObservedGeneration
@@ -108,59 +98,21 @@ func (c OperatorClient) ApplyOperatorStatus(ctx context.Context, fieldManager st
108
98
v1helpers .SetApplyConditionsLastTransitionTime (c .clock , & applyConfiguration .Conditions , nil )
109
99
ts := c .clock .Now ()
110
100
for i := range desired .Status .Conditions {
111
- desired .Status .Conditions [i ].LastTransitionTime = & metav1.Time {Time : ts }
101
+ if desired .Status .Conditions [i ].LastTransitionTime == nil {
102
+ desired .Status .Conditions [i ].LastTransitionTime = & metav1.Time {Time : ts }
103
+ }
112
104
}
113
105
114
106
case err != nil :
115
107
return fmt .Errorf ("unable to get operator configuration: %w" , err )
116
108
default :
117
- //previous, err := v1.ExtractOpenShiftControllerManagerStatus(instance, fieldManager)
118
- //if err != nil {
119
- // return fmt.Errorf("unable to extract operator configuration: %w", err)
120
- //}
121
-
122
- //operatorStatus := &v1.OperatorStatusApplyConfiguration{}
123
- //if previous.Status != nil {
124
- // jsonBytes, err := json.Marshal(previous.Status)
125
- // if err != nil {
126
- // return fmt.Errorf("unable to serialize operator configuration: %w", err)
127
- // }
128
- // if err := json.Unmarshal(jsonBytes, operatorStatus); err != nil {
129
- // return fmt.Errorf("unable to deserialize operator configuration: %w", err)
130
- // }
131
- //}
132
-
133
- //switch {
134
- //case applyConfiguration.Conditions != nil && operatorStatus != nil:
135
- // v1helpers.SetApplyConditionsLastTransitionTime(c.clock, &applyConfiguration.Conditions, operatorStatus.Conditions)
136
- //case applyConfiguration.Conditions != nil && operatorStatus == nil:
137
- // v1helpers.SetApplyConditionsLastTransitionTime(c.clock, &applyConfiguration.Conditions, nil)
138
- //}
139
109
140
- //v1helpers.CanonicalizeOperatorStatus(applyConfiguration)
141
- //v1helpers.CanonicalizeOperatorStatus(operatorStatus)
142
110
original := & applyconfig.CertManagerApplyConfiguration {}
143
111
original .WithName (instance .Name )
144
112
145
113
original .WithKind (instance .Kind )
146
114
original .WithAPIVersion (instance .APIVersion )
147
115
148
- //if equality.Semantic.DeepEqual(original, desired) {
149
- // return nil
150
- //}
151
- //original := v1.OpenShiftControllerManager("cluster")
152
- //if operatorStatus != nil {
153
- // originalStatus := &v1.OpenShiftControllerManagerStatusApplyConfiguration{
154
- // OperatorStatusApplyConfiguration: *operatorStatus,
155
- // }
156
- // original.WithStatus(originalStatus)
157
- //}
158
- //
159
- //desiredStatus := &v1.OpenShiftControllerManagerStatusApplyConfiguration{
160
- // OperatorStatusApplyConfiguration: *applyConfiguration,
161
- //}
162
- //desired.WithStatus(desiredStatus)
163
-
164
116
if equality .Semantic .DeepEqual (original , desired ) {
165
117
return nil
166
118
}
0 commit comments