use of com.redhat.service.smartevents.shard.operator.resources.BridgeExecutor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeExecutorServiceImpl method createBridgeExecutor.
@Override
public void createBridgeExecutor(ProcessorDTO processorDTO) {
final Namespace namespace = customerNamespaceProvider.fetchOrCreateCustomerNamespace(processorDTO.getCustomerId());
BridgeExecutor expected = BridgeExecutor.fromDTO(processorDTO, namespace.getMetadata().getName(), executorImage);
BridgeExecutor existing = kubernetesClient.resources(BridgeExecutor.class).inNamespace(namespace.getMetadata().getName()).withName(BridgeExecutor.resolveResourceName(processorDTO.getId())).get();
if (existing == null || !expected.getSpec().equals(existing.getSpec())) {
BridgeExecutor bridgeExecutor = kubernetesClient.resources(BridgeExecutor.class).inNamespace(namespace.getMetadata().getName()).createOrReplace(expected);
// create or update the secrets for the bridgeExecutor
createOrUpdateBridgeExecutorSecret(bridgeExecutor, processorDTO);
}
}
use of com.redhat.service.smartevents.shard.operator.resources.BridgeExecutor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeExecutorSteps method deployBridgeIngressWithDefaultSecrets.
@When("^deploy BridgeExecutor with default secret:$")
public void deployBridgeIngressWithDefaultSecrets(String bridgeExecutorYaml) {
InputStream resourceStream = new ByteArrayInputStream(bridgeExecutorYaml.getBytes(StandardCharsets.UTF_8));
BridgeExecutor bridgeExecutor = context.getClient().resources(BridgeExecutor.class).inNamespace(context.getNamespace()).load(resourceStream).create();
Secret secret = new SecretBuilder().withMetadata(new ObjectMetaBuilder().withLabels(new LabelsBuilder().withManagedByOperator().withComponent(BridgeExecutor.COMPONENT_NAME).build()).withNamespace(bridgeExecutor.getMetadata().getNamespace()).withName(bridgeExecutor.getMetadata().getName()).build()).build();
context.getClient().secrets().inNamespace(bridgeExecutor.getMetadata().getNamespace()).withName(bridgeExecutor.getMetadata().getName()).createOrReplace(secret);
}
use of com.redhat.service.smartevents.shard.operator.resources.BridgeExecutor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeExecutorControllerTest method testCreateNewBridgeExecutor.
@Test
void testCreateNewBridgeExecutor() {
// Given
BridgeExecutor bridgeExecutor = buildBridgeExecutor();
deployBridgeExecutorSecret(bridgeExecutor);
// When
UpdateControl<BridgeExecutor> updateControl = bridgeExecutorController.reconcile(bridgeExecutor, null);
// Then
assertThat(updateControl.isUpdateStatus()).isTrue();
assertThat(bridgeExecutor.getStatus()).isNotNull();
assertThat(bridgeExecutor.getStatus().isReady()).isFalse();
assertThat(bridgeExecutor.getStatus().getConditionByType(ConditionType.Augmentation)).isPresent().hasValueSatisfying(c -> {
assertThat(c.getStatus()).isEqualTo(ConditionStatus.False);
});
assertThat(bridgeExecutor.getStatus().getConditionByType(ConditionType.Ready)).isPresent().hasValueSatisfying(c -> {
assertThat(c.getStatus()).isEqualTo(ConditionStatus.False);
assertThat(c.getReason()).isEqualTo(ConditionReason.DeploymentNotAvailable);
});
}
use of com.redhat.service.smartevents.shard.operator.resources.BridgeExecutor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeExecutorControllerTest method testBridgeExecutorDeployment_deploymentReplicaFailure.
@Test
void testBridgeExecutorDeployment_deploymentReplicaFailure() {
// Given
BridgeExecutor bridgeExecutor = buildBridgeExecutor();
deployBridgeExecutorSecret(bridgeExecutor);
// When
bridgeExecutorController.reconcile(bridgeExecutor, null);
Deployment deployment = getDeploymentFor(bridgeExecutor);
// Then
kubernetesResourcePatcher.patchDeploymentAsReplicaFailed(deployment.getMetadata().getName(), deployment.getMetadata().getNamespace());
UpdateControl<BridgeExecutor> updateControl = bridgeExecutorController.reconcile(bridgeExecutor, null);
assertThat(updateControl.isUpdateStatus()).isTrue();
assertThat(updateControl.getResource().getStatus().getConditionByType(ConditionType.Ready).get().getReason()).isEqualTo(ConditionReason.DeploymentFailed);
assertThat(updateControl.getResource().getStatus().getConditionByType(ConditionType.Augmentation).get().getStatus()).isEqualTo(ConditionStatus.False);
}
use of com.redhat.service.smartevents.shard.operator.resources.BridgeExecutor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeExecutorControllerTest method testBridgeExecutorDeployment_deploymentTimeoutFailure.
@Test
void testBridgeExecutorDeployment_deploymentTimeoutFailure() {
// Given
BridgeExecutor bridgeExecutor = buildBridgeExecutor();
deployBridgeExecutorSecret(bridgeExecutor);
// When
bridgeExecutorController.reconcile(bridgeExecutor, null);
Deployment deployment = getDeploymentFor(bridgeExecutor);
// Then
kubernetesResourcePatcher.patchDeploymentAsTimeoutFailed(deployment.getMetadata().getName(), deployment.getMetadata().getNamespace());
UpdateControl<BridgeExecutor> updateControl = bridgeExecutorController.reconcile(bridgeExecutor, null);
assertThat(updateControl.isUpdateStatus()).isTrue();
assertThat(updateControl.getResource().getStatus().getConditionByType(ConditionType.Ready).get().getReason()).isEqualTo(ConditionReason.DeploymentFailed);
assertThat(updateControl.getResource().getStatus().getConditionByType(ConditionType.Augmentation).get().getStatus()).isEqualTo(ConditionStatus.False);
}
Aggregations