Skip to content

Error in GenericKubernetesResourceMatcher when reconciling resources with no spec #1715

Closed
@harveyelsom

Description

@harveyelsom

Bug Report

What did you do?

created a ServiceAccount as a dependent resource.

What did you expect to see?

The Service account being correctly reconciled

What did you see instead? Under which circumstances?

Caused by: java.lang.NoSuchMethodException: io.fabric8.kubernetes.api.model.ServiceAccount.getSpec()
at java.base/java.lang.Class.getMethod(Class.java:2277)
at io.javaoperatorsdk.operator.ReconcilerUtils.getSpec(ReconcilerUtils.java:98)
... 25 more

Possible Solution

Stack trace suggests this is the problem https://github.com/java-operator-sdk/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/GenericKubernetesResourceMatcher.java#L61
A kubernetes ServiceAccount does not have a spec but this generic matcher will always try to getSpec().

I expect this would fail for other resources that don't have a Spec.

I suspect I can override the matcher to get past this but the GenericKubernetesResourceMatcher shouldn't be failing like this.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions