Skip to content

Commit a2785c7

Browse files
committed
fix: initFromAnnotation now properly inits the current instance
1 parent 9af9304 commit a2785c7

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/InformerConfigHolder.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -145,46 +145,45 @@ public InformerConfigHolder<R> buildForInformerEventSource() {
145145
@SuppressWarnings({"unchecked"})
146146
public InformerConfigHolder<R>.Builder initFromAnnotation(InformerConfig informerConfig,
147147
String context) {
148-
final var config = InformerConfigHolder.builder();
149148
if (informerConfig != null) {
150149

151150
// override default name if more specific one is provided
152151
if (!Constants.NO_VALUE_SET.equals(informerConfig.name())) {
153-
config.withName(informerConfig.name());
152+
withName(informerConfig.name());
154153
}
155154

156155
var namespaces = Set.of(informerConfig.namespaces());
157-
config.withNamespaces(namespaces);
156+
withNamespaces(namespaces);
158157

159158
final var fromAnnotation = informerConfig.labelSelector();
160159
var labelSelector = Constants.NO_VALUE_SET.equals(fromAnnotation) ? null : fromAnnotation;
161-
config.withLabelSelector(labelSelector);
160+
withLabelSelector(labelSelector);
162161

163-
config.withOnAddFilter(Utils.instantiate(informerConfig.onAddFilter(),
162+
withOnAddFilter(Utils.instantiate(informerConfig.onAddFilter(),
164163
OnAddFilter.class, context));
165164

166-
config.withOnUpdateFilter(Utils.instantiate(informerConfig.onUpdateFilter(),
165+
withOnUpdateFilter(Utils.instantiate(informerConfig.onUpdateFilter(),
167166
OnUpdateFilter.class, context));
168167

169-
config.withOnDeleteFilter(Utils.instantiate(informerConfig.onDeleteFilter(),
168+
withOnDeleteFilter(Utils.instantiate(informerConfig.onDeleteFilter(),
170169
OnDeleteFilter.class, context));
171170

172-
config.withGenericFilter(Utils.instantiate(informerConfig.genericFilter(),
171+
withGenericFilter(Utils.instantiate(informerConfig.genericFilter(),
173172
GenericFilter.class,
174173
context));
175174

176-
config.withFollowControllerNamespacesOnChange(
175+
withFollowControllerNamespacesOnChange(
177176
informerConfig.followControllerNamespacesOnChange());
178177

179-
config.withItemStore(Utils.instantiate(informerConfig.itemStore(),
178+
withItemStore(Utils.instantiate(informerConfig.itemStore(),
180179
ItemStore.class, context));
181180

182181
final var informerListLimitValue = informerConfig.informerListLimit();
183182
final var informerListLimit =
184183
informerListLimitValue == Constants.NO_LONG_VALUE_SET ? null : informerListLimitValue;
185-
config.withInformerListLimit(informerListLimit);
184+
withInformerListLimit(informerListLimit);
186185
}
187-
return (InformerConfigHolder<R>.Builder) config;
186+
return this;
188187
}
189188

190189
public Builder withName(String name) {

0 commit comments

Comments
 (0)