Skip to content

Commit e7fa683

Browse files
committed
fix: only add PATCH verb if resource is creatable
Signed-off-by: Chris Laprun <claprun@redhat.com>
1 parent 8109ab8 commit e7fa683

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/AddClusterRolesDecorator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ private static Set<PolicyRule> getClusterRolePolicyRulesFromDependentResources(Q
122122
if (Deleter.class.isAssignableFrom(dependentResourceClass)) {
123123
verbs.add(RBACVerbs.DELETE);
124124
}
125-
if (Creator.class.isAssignableFrom(dependentResourceClass)) {
125+
final var isCreator = Creator.class.isAssignableFrom(dependentResourceClass);
126+
if (isCreator) {
126127
verbs.add(RBACVerbs.CREATE);
127128
}
128129

@@ -140,8 +141,8 @@ private static Set<PolicyRule> getClusterRolePolicyRulesFromDependentResources(Q
140141
resourcePlural = gvk.getPluralOrDefault();
141142
}
142143

143-
// if we use SSA and the dependent resource class is not excluded from using SSA, we also need PATCH permissions for finalizer
144-
if (cri.getConfigurationService().shouldUseSSA(kubeResource)) {
144+
// if we use SSA and the dependent resource class is not excluded from using SSA, we also need PATCH permissions for finalizer when the dependent resource is creatable
145+
if (isCreator && cri.getConfigurationService().shouldUseSSA(kubeResource)) {
145146
verbs.add(RBACVerbs.PATCH);
146147
}
147148
} catch (Exception e) {

core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/OperatorSDKProcessor.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,10 @@ AnnotationConfigurablesBuildItem gatherAnnotationConfigurables(
183183
* Gathers the CustomResource implementations that are not part of the application index because they are part of an
184184
* external, reusable module for example.
185185
*
186+
* <p>
186187
* Note that this will be obsolete once <a href="https://github.com/quarkusio/quarkus/pull/38586">Quarkus #38586</a> is
187188
* usable
188-
*
189-
* @param combinedIndexBuildItem
190-
* @param applicationIndexBuildItem
191-
* @param reflectiveClassProducer
189+
* </p>
192190
*/
193191
@BuildStep
194192
void gatherOutOfAppCustomResourceImplementations(CombinedIndexBuildItem combinedIndexBuildItem,
@@ -250,7 +248,6 @@ void initializeRuntimeNamespacesFromBuildTimeValues(
250248
ControllerConfigurationsBuildItem configurations,
251249
BuildProducer<RunTimeConfigurationDefaultBuildItem> runtimeConfig) {
252250
configurations.getControllerConfigs().forEach((name, configuration) -> {
253-
@SuppressWarnings("unchecked")
254251
final var namespaces = String.join(",", configuration.getNamespaces());
255252
runtimeConfig.produce(new RunTimeConfigurationDefaultBuildItem(
256253
"quarkus.operator-sdk.controllers." + configuration.getName() + ".namespaces",
@@ -263,7 +260,11 @@ void initializeRuntimeNamespacesFromBuildTimeValues(
263260
* Ignore warnings related to non-indexed classes in the reflective hierarchy. At this point, we cannot know
264261
* if they are actually needed for native compilation.
265262
*
266-
* This could probably be removed once https://github.com/quarkiverse/quarkus-operator-sdk/issues/941 is resolved.
263+
* <p>
264+
* This could probably be removed once <a href=
265+
* "https://github.com/quarkiverse/quarkus-operator-sdk/issues/941">https://github.com/quarkiverse/quarkus-operator-sdk/issues/941</a>
266+
* is resolved.
267+
* </p>
267268
*
268269
*/
269270
@BuildStep

core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/QuarkusControllerConfigurationBuildStep.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static QuarkusControllerConfiguration createConfiguration(
186186
final var interval = ConfigurationUtils.annotationValueOrDefault(
187187
intervalFromAnnotation, "interval", AnnotationValue::asLong,
188188
() -> MaxReconciliationInterval.DEFAULT_INTERVAL);
189-
final var timeUnit = (TimeUnit) ConfigurationUtils.annotationValueOrDefault(
189+
final var timeUnit = ConfigurationUtils.annotationValueOrDefault(
190190
intervalFromAnnotation,
191191
"timeUnit",
192192
av -> TimeUnit.valueOf(av.asEnum()),

0 commit comments

Comments
 (0)