Skip to content

Commit d5c4edd

Browse files
authored
Drop SqlJob and FlinkSqlJobReconciler (#35)
* Drop SqlJob and FlinkSqlJobReconciler * Change name of Resource templates back to 'template' * Enable flink adapter in CLI * Update readme
1 parent 0285d7b commit d5c4edd

File tree

25 files changed

+27
-1508
lines changed

25 files changed

+27
-1508
lines changed

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ deploy-dev-environment:
3636
deploy-samples: deploy
3737
kubectl wait --for=condition=Established=True \
3838
crds/subscriptions.hoptimator.linkedin.com \
39-
crds/kafkatopics.hoptimator.linkedin.com \
40-
crds/sqljobs.hoptimator.linkedin.com
39+
crds/kafkatopics.hoptimator.linkedin.com
4140
kubectl apply -f ./deploy/samples
4241

4342
deploy-config:

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ In response, the operator will deploy a Flink job and other resources:
5959

6060
```
6161
$ kubectl get subscriptions
62-
$ kubectl get sqljobs
6362
$ kubectl get flinkdeployments
6463
$ kubectl get kafkatopics
6564
```

deploy/rbac.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
name: hoptimator-controller
66
rules:
77
- apiGroups: ["hoptimator.linkedin.com"]
8-
resources: ["sqljobs", "kafkatopics", "subscriptions"]
8+
resources: ["kafkatopics", "subscriptions"]
99
verbs: ["get", "watch", "list", "update", "create"]
1010
- apiGroups: ["flink.apache.org"]
1111
resources: ["flinkdeployments"]

deploy/sqljobs.crd.yaml

Lines changed: 0 additions & 53 deletions
This file was deleted.

hoptimator-catalog/src/main/java/com/linkedin/hoptimator/catalog/Resource.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,23 @@
3333
* for informational/debugging purposes.
3434
*/
3535
public abstract class Resource {
36-
private final String kind;
36+
private final String template;
3737
private final SortedMap<String, Supplier<String>> properties = new TreeMap<>();
3838
private final List<Resource> inputs = new ArrayList<>();
3939

40-
/** A Resource of some kind. */
41-
public Resource(String kind) {
42-
this.kind = kind;
40+
public Resource(String template) {
41+
this.template = template;
4342
}
4443

4544
/** Copy constructor */
4645
public Resource(Resource other) {
47-
this.kind = other.kind;
46+
this.template = other.template;
4847
this.properties.putAll(other.properties);
4948
this.inputs.addAll(other.inputs);
5049
}
5150

52-
public String kind() {
53-
return kind;
51+
public String template() {
52+
return template;
5453
}
5554

5655
/** Export a computed value to the template */
@@ -109,7 +108,7 @@ public int hashCode() {
109108
@Override
110109
public String toString() {
111110
StringBuilder sb = new StringBuilder();
112-
sb.append("[ kind: " + kind() + " ");
111+
sb.append("[ template: " + template() + " ");
113112
for (Map.Entry<String, Supplier<String>> entry : properties.entrySet()) {
114113
String value = entry.getValue().get();
115114
if (value != null && !value.isEmpty()) {
@@ -280,10 +279,10 @@ public SimpleTemplateFactory(Environment env) {
280279

281280
@Override
282281
public Template get(Resource resource) {
283-
String kind = resource.kind();
284-
InputStream in = getClass().getClassLoader().getResourceAsStream(kind + ".yaml.template");
282+
String template = resource.template();
283+
InputStream in = getClass().getClassLoader().getResourceAsStream(template + ".yaml.template");
285284
if (in == null) {
286-
throw new IllegalArgumentException("No template '" + kind + "' found in jar resources");
285+
throw new IllegalArgumentException("No template '" + template + "' found in jar resources");
287286
}
288287
StringBuilder sb = new StringBuilder();
289288
Scanner scanner = new Scanner(in);

hoptimator-cli/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dependencies {
1717
// include adapters for integration tests
1818
integration project(':hoptimator-kafka-adapter')
1919
integration project(':hoptimator-mysql-adapter')
20+
integration project(':hoptimator-flink-adapter')
2021
integration libs.flinkCsv
2122
integration libs.flinkConnectorKafka
2223
integration libs.slf4jSimple

hoptimator-cli/src/main/resources/SqlJob.yaml.template

Lines changed: 0 additions & 8 deletions
This file was deleted.

hoptimator-flink-adapter/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ plugins {
66

77
dependencies {
88
implementation project(':hoptimator-catalog')
9-
implementation project(':hoptimator-models')
109
implementation project(':hoptimator-operator')
1110
implementation libs.kubernetesClient
1211
implementation libs.kubernetesExtendedClient

hoptimator-flink-adapter/src/main/java/com/linkedin/hoptimator/operator/flink/FlinkControllerProvider.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,21 @@
22

33
import com.linkedin.hoptimator.operator.ControllerProvider;
44
import com.linkedin.hoptimator.operator.Operator;
5-
import com.linkedin.hoptimator.models.V1alpha1SqlJob;
65

76
import io.kubernetes.client.extended.controller.Controller;
8-
import io.kubernetes.client.extended.controller.builder.ControllerBuilder;
9-
import io.kubernetes.client.extended.controller.reconciler.Reconciler;
107

118
import java.util.Collection;
129
import java.util.Collections;
1310

14-
/** Provides a Controller plugin for FlinkDeployments. */
11+
/** A bridge to flink-kubernetes-operator */
1512
public class FlinkControllerProvider implements ControllerProvider {
1613

1714
@Override
1815
public Collection<Controller> controllers(Operator operator) {
1916
operator.registerApi("FlinkDeployment", "flinkdeployment", "flinkdeployments",
2017
"flink.apache.org", "v1beta1");
2118

22-
Reconciler reconciler = new FlinkSqlJobReconciler(operator);
23-
Controller controller = ControllerBuilder.defaultBuilder(operator.informerFactory())
24-
.withReconciler(reconciler)
25-
.withName("flink-deployment-controller")
26-
.withWorkerCount(1)
27-
.watch(x -> ControllerBuilder.controllerWatchBuilder(V1alpha1SqlJob.class, x).build())
28-
.build();
29-
30-
return Collections.singleton(controller);
19+
// We don't need a controller
20+
return Collections.emptyList();
3121
}
3222
}

hoptimator-flink-adapter/src/main/java/com/linkedin/hoptimator/operator/flink/FlinkDeployment.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)