use of org.apache.flink.kubernetes.operator.service.FlinkService in project flink-kubernetes-operator by apache.
the class ObserverTest method observeSessionCluster.
@Test
public void observeSessionCluster() {
FlinkService flinkService = new TestingFlinkService();
Observer observer = new Observer(flinkService, FlinkOperatorConfiguration.fromConfiguration(new Configuration()));
FlinkDeployment deployment = TestUtils.buildSessionCluster();
deployment.getStatus().getReconciliationStatus().setLastReconciledSpec(deployment.getSpec());
observer.observe(deployment, readyContext, FlinkUtils.getEffectiveConfig(deployment, new Configuration()));
assertEquals(JobManagerDeploymentStatus.DEPLOYED_NOT_READY, deployment.getStatus().getJobManagerDeploymentStatus());
observer.observe(deployment, readyContext, FlinkUtils.getEffectiveConfig(deployment, new Configuration()));
assertEquals(JobManagerDeploymentStatus.READY, deployment.getStatus().getJobManagerDeploymentStatus());
}
use of org.apache.flink.kubernetes.operator.service.FlinkService in project flink-kubernetes-operator by apache.
the class FlinkOperator method main.
public static void main(String... args) {
LOG.info("Starting Flink Kubernetes Operator");
DefaultConfig defaultConfig = FlinkUtils.loadDefaultConfig();
OperatorMetricUtils.initOperatorMetrics(defaultConfig.getOperatorConfig());
DefaultKubernetesClient client = new DefaultKubernetesClient();
String namespace = client.getNamespace();
if (namespace == null) {
namespace = "default";
}
DefaultConfigurationService configurationService = DefaultConfigurationService.instance();
Operator operator = new Operator(client, configurationService);
FlinkService flinkService = new FlinkService(client);
FlinkOperatorConfiguration operatorConfiguration = FlinkOperatorConfiguration.fromConfiguration(defaultConfig.getOperatorConfig());
Observer observer = new Observer(flinkService, operatorConfiguration);
FlinkDeploymentValidator validator = new DefaultDeploymentValidator();
ReconcilerFactory factory = new ReconcilerFactory(client, flinkService, operatorConfiguration);
FlinkDeploymentController controller = new FlinkDeploymentController(defaultConfig, operatorConfiguration, client, namespace, validator, observer, factory);
FlinkControllerConfig controllerConfig = new FlinkControllerConfig(controller);
controller.setControllerConfig(controllerConfig);
controllerConfig.setConfigurationService(configurationService);
operator.register(controller, controllerConfig);
operator.installShutdownHook();
operator.start();
}
Aggregations