Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

operator throws exceptions when labels don't match #153

Open
pgier opened this issue Sep 7, 2023 · 0 comments
Open

operator throws exceptions when labels don't match #153

pgier opened this issue Sep 7, 2023 · 0 comments

Comments

@pgier
Copy link
Collaborator

pgier commented Sep 7, 2023

Configuring custom pod labels I ran into a situation where the labels I set don't match the selectors. This type of mismatch should be prevented by the operator. In other words, the operator should only allow valid configuration, I'm not sure why there are separate config fields for "labels, podLabels, and matchLabels".

01:31:26 ERROR [com.dat.oss.kaa.con.AbstractController] (ReconcilerExecutor-pulsar-bk-controller-103) Error during reconciliation for resource bookkeepers.kaap.oss.datastax.com with name pulsar-bookkeeper: Failure executing: POST at: https://172.20.0.1:443/apis/apps/v1/namespaces/pulsar/statefulsets. Message: StatefulSet.apps "pulsar-bookkeeper" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"app":"pulsar", "cluster":"pulsar-aws-apsoutheast1", "component":"bookkeeper", "resource-set":"bookkeeper"}: `selector` does not match template `labels`. Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=spec.template.metadata.labels, message=Invalid value: map[string]string{"app":"pulsar", "cluster":"pulsar-aws-apsoutheast1", "component":"bookkeeper", "resource-set":"bookkeeper"}: `selector` does not match template `labels`, reason=FieldValueInvalid, additionalProperties={})], group=apps, kind=StatefulSet, name=pulsar-bookkeeper, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=StatefulSet.apps "pulsar-bookkeeper" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"app":"pulsar", "cluster":"pulsar-aws-apsoutheast1", "component":"bookkeeper", "resource-set":"bookkeeper"}: `selector` does not match template `labels`, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}).: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://172.20.0.1:443/apis/apps/v1/namespaces/pulsar/statefulsets. Message: StatefulSet.apps "pulsar-bookkeeper" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"app":"pulsar", "cluster":"pulsar-aws-apsoutheast1", "component":"bookkeeper", "resource-set":"bookkeeper"}: `selector` does not match template `labels`. Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=spec.template.metadata.labels, message=Invalid value: map[string]string{"app":"pulsar", "cluster":"pulsar-aws-apsoutheast1", "component":"bookkeeper", "resource-set":"bookkeeper"}: `selector` does not match template `labels`, reason=FieldValueInvalid, additionalProperties={})], group=apps, kind=StatefulSet, name=pulsar-bookkeeper, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=StatefulSet.apps "pulsar-bookkeeper" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"app":"pulsar", "cluster":"pulsar-aws-apsoutheast1", "component":"bookkeeper", "resource-set":"bookkeeper"}: `selector` does not match template `labels`, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}).
        at io.fabric8.kubernetes.client.KubernetesClientException.copyAsCause(KubernetesClientException.java:238)
        at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.waitForResult(OperationSupport.java:536)
        at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.handleResponse(OperationSupport.java:570)
        at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.handleResponse(OperationSupport.java:554)
        at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.handleCreate(OperationSupport.java:347)
        at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.handleCreate(BaseOperation.java:704)
        at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.handleCreate(BaseOperation.java:93)
        at io.fabric8.kubernetes.client.dsl.internal.CreateOnlyResourceOperation.create(CreateOnlyResourceOperation.java:42)
        at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.create(BaseOperation.java:1107)
        at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.create(BaseOperation.java:93)
        at com.datastax.oss.kaap.controllers.BaseResourcesFactory.patchResource(BaseResourcesFactory.java:150)
        at com.datastax.oss.kaap.controllers.bookkeeper.BookKeeperResourcesFactory.patchStatefulSet(BookKeeperResourcesFactory.java:212)
        at com.datastax.oss.kaap.controllers.bookkeeper.BookKeeperController.patchResourceSet(BookKeeperController.java:115)
        at com.datastax.oss.kaap.controllers.AbstractResourceSetsController.patchResources(AbstractResourceSetsController.java:143)
        at com.datastax.oss.kaap.controllers.AbstractController.reconcile(AbstractController.java:139)
        at com.datastax.oss.kaap.controllers.AbstractController.reconcile(AbstractController.java:62)
        at com.datastax.oss.kaap.controllers.bookkeeper.BookKeeperController_ClientProxy.reconcile(Unknown Source)
        at io.javaoperatorsdk.operator.processing.Controller$1.execute(Controller.java:145)
        at io.javaoperatorsdk.operator.processing.Controller$1.execute(Controller.java:103)
        at io.javaoperatorsdk.operator.monitoring.micrometer.MicrometerMetrics.lambda$timeControllerExecution$0(MicrometerMetrics.java:86)
        at io.micrometer.core.instrument.composite.CompositeTimer.record(CompositeTimer.java:69)
        at io.javaoperatorsdk.operator.monitoring.micrometer.MicrometerMetrics.timeControllerExecution(MicrometerMetrics.java:84)
        at io.javaoperatorsdk.operator.processing.Controller.reconcile(Controller.java:102)
        at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.reconcileExecution(ReconciliationDispatcher.java:139)
        at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.handleReconcile(ReconciliationDispatcher.java:119)
        at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.handleDispatch(ReconciliationDispatcher.java:89)
        at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.handleExecution(ReconciliationDispatcher.java:62)
        at io.javaoperatorsdk.operator.processing.event.EventProcessor$ReconcilerExecutor.run(EventProcessor.java:406)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant