Skip to content

Commit 1b0a57f

Browse files
authored
Update README and add undeploy to Makefile (#76)
* Update README and add undeploy to Makefile
1 parent 11c53f8 commit 1b0a57f

File tree

182 files changed

+2080
-1660
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+2080
-1660
lines changed

Makefile

+33-16
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,57 @@ integration-tests:
1818
clean:
1919
./gradlew clean
2020

21-
deploy-demo:
22-
kubectl apply -f ./deploy/samples/demodb.yaml
21+
deploy-config:
22+
kubectl create configmap hoptimator-configmap --from-file=model.yaml=test-model.yaml --dry-run=client -o yaml | kubectl apply -f -
2323

2424
deploy: deploy-config
2525
kubectl apply -f ./hoptimator-k8s/src/main/resources/
2626
kubectl apply -f ./deploy
2727

28-
undeploy:
29-
kubectl delete -f ./deploy || echo "skipping"
30-
kubectl delete configmap hoptimator-configmap || echo "skipping"
31-
3228
quickstart: build deploy
3329

34-
deploy-dev-environment:
30+
deploy-demo: deploy
31+
kubectl apply -f ./deploy/samples/demodb.yaml
32+
33+
deploy-samples: deploy
34+
kubectl wait --for=condition=Established=True \
35+
crds/subscriptions.hoptimator.linkedin.com \
36+
crds/kafkatopics.hoptimator.linkedin.com \
37+
crds/sqljobs.hoptimator.linkedin.com
38+
kubectl apply -f ./deploy/samples
39+
40+
deploy-dev-environment: deploy-config
3541
kubectl create -f https://github.com/jetstack/cert-manager/releases/download/v1.8.2/cert-manager.yaml || echo "skipping"
3642
kubectl create namespace kafka || echo "skipping"
3743
helm repo add flink-operator-repo https://downloads.apache.org/flink/flink-kubernetes-operator-1.9.0/
3844
helm upgrade --install --atomic --set webhook.create=false flink-kubernetes-operator flink-operator-repo/flink-kubernetes-operator
3945
kubectl apply -f "https://strimzi.io/install/latest?namespace=kafka" -n kafka
4046
kubectl wait --for=condition=Established=True crds/kafkas.kafka.strimzi.io
47+
kubectl apply -f ./hoptimator-k8s/src/main/resources/
4148
kubectl apply -f ./deploy/dev
49+
kubectl apply -f ./deploy/samples/demodb.yaml
50+
kubectl apply -f ./deploy/samples/kafkadb.yaml
4251

43-
deploy-samples: deploy
44-
kubectl wait --for=condition=Established=True \
45-
crds/subscriptions.hoptimator.linkedin.com \
46-
crds/kafkatopics.hoptimator.linkedin.com \
47-
crds/sqljobs.hoptimator.linkedin.com
48-
kubectl apply -f ./deploy/samples
52+
undeploy-dev-environment:
53+
kubectl delete $(shell kubectl get kafkatopic.kafka.strimzi.io -o name -n kafka) -n kafka || echo "skipping"
54+
kubectl delete $(shell kubectl get strimzi -o name -n kafka) -n kafka || echo "skipping"
55+
kubectl delete pvc -l strimzi.io/name=one-kafka -n kafka || echo "skipping"
56+
kubectl delete -f "https://strimzi.io/install/latest?namespace=kafka" -n kafka || echo "skipping"
57+
kubectl delete -f ./deploy/samples/kafkadb.yaml || echo "skipping"
58+
kubectl delete -f ./deploy/samples/demodb.yaml || echo "skipping"
59+
kubectl delete -f ./deploy/dev || echo "skipping"
60+
kubectl delete -f ./hoptimator-k8s/src/main/resources/ || echo "skipping"
61+
kubectl delete namespace kafka || echo "skipping"
62+
helm uninstall flink-kubernetes-operator || echo "skipping"
63+
kubectl delete -f https://github.com/jetstack/cert-manager/releases/download/v1.8.2/cert-manager.yaml || echo "skipping"
4964

50-
deploy-config:
51-
kubectl create configmap hoptimator-configmap --from-file=model.yaml=test-model.yaml --dry-run=client -o yaml | kubectl apply -f -
65+
undeploy: undeploy-dev-environment
66+
kubectl delete -f ./deploy || echo "skipping"
67+
kubectl delete configmap hoptimator-configmap || echo "skipping"
5268

5369
generate-models:
54-
./models/generate-models.sh
70+
./generate-models.sh
71+
./hoptimator-models/generate-models.sh # <-- marked for deletion
5572

5673
release:
5774
test -n "$(VERSION)" # MISSING ARG: $$VERSION

README.md

+16-3
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,24 @@ Materialized views result in `pipelines`:
3939

4040
Hoptimator requires a Kubernetes cluster. To connect from outside a Kubernetes cluster, make sure your `kubectl` is properly configured.
4141

42+
The below setup will install two local demo DBs, ads and profiles.
43+
4244
```
4345
$ make install # build and install SQL CLI
44-
$ make deploy deploy-demo # install CRDs and K8s objects
45-
$ kubectl port-forward -n kafka svc/one-kafka-external-0 9092 &
46-
$ ./hoptimator
46+
$ make deploy deploy-demo # install demo DB CRDs and K8s objects
47+
$ ./hoptimator # start the SQL CLI
48+
> !intro
49+
```
50+
51+
## Set up Kafka & Flink clusters
52+
53+
The below setup will install a Kafka and Flink cluster within Kubernetes.
54+
55+
```
56+
$ make install # build and install SQL CLI
57+
$ make deploy-dev-environment # start local Kafka & Flink setups
58+
$ kubectl port-forward -n kafka svc/one-kafka-external-0 9092 & # forward external Kafka port for use by SQL CLI
59+
$ ./hoptimator # start the SQL CLI
4760
> !intro
4861
```
4962

build.gradle

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
1+
plugins {
2+
id("com.github.spotbugs") version "6.0.26"
3+
}
24

35
subprojects {
6+
apply plugin: 'checkstyle'
7+
apply plugin: 'com.github.spotbugs'
8+
49
tasks.withType(JavaCompile) {
510
options.release = 8
611
options.compilerArgs << '-Xlint:deprecation'
@@ -9,4 +14,12 @@ subprojects {
914
tasks.withType(Javadoc) {
1015
options.addStringOption('Xdoclint:none', '-quiet')
1116
}
17+
18+
spotbugs {
19+
ignoreFailures = true
20+
showProgress = true
21+
reportsDir = file("$buildDir/spotbugs")
22+
includeFilter = file("$rootDir/config/spotbugs/include.xml")
23+
excludeFilter = file("$rootDir/config/spotbugs/exclude.xml")
24+
}
1225
}

config/checkstyle/checkstyle.xml

+237
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
3+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
4+
5+
<!--
6+
Checkstyle-Configuration: LinkedIn Style
7+
Description:
8+
LinkedIn Java style.
9+
-->
10+
<module name="Checker">
11+
<property name="severity" value="warning"/>
12+
<property name="fileExtensions" value="java"/>
13+
14+
<module name="TreeWalker">
15+
<property name="tabWidth" value="2"/>
16+
<module name="SuppressWarningsHolder"/>
17+
18+
<!-- Allow Checkstyle warnings to be suppressed using trailing comments -->
19+
<module name="SuppressWithNearbyCommentFilter"/>
20+
<!-- Allow Checkstyle warnings to be suppressed using block comments -->
21+
<module name="SuppressionCommentFilter"/>
22+
23+
<!-- ANNOTATIONS -->
24+
25+
<!-- No trailing empty parenthesis or commas -->
26+
<module name="AnnotationUseStyle">
27+
<property name="elementStyle" value="ignore"/>
28+
</module>
29+
<!-- Ensure @Override is present when {@inheritDoc} Javadoc tag is present -->
30+
<module name="MissingOverride"/>
31+
<!-- Package level annotations belong in package-info.java -->
32+
<module name="PackageAnnotation"/>
33+
<!-- Do not allow references to internal tickets -->
34+
<module name="Regexp">
35+
<property name="format" value="(DDSDBUS|LISAMZA|DATAPIPES)-\d+"/>
36+
<property name="illegalPattern" value="true"/>
37+
<property name="message" value="Referencing internal ticket names is not allowed"/>
38+
</module>
39+
40+
<!-- BLOCKS -->
41+
42+
<!-- No empty while, try, finally, do, if, else, for, initializer, switch, or synchronized blocks -->
43+
<module name="EmptyBlock"/>
44+
<!-- Block opening brace on same line -->
45+
<module name="LeftCurly">
46+
<property name="option" value="eol"/>
47+
</module>
48+
<!-- Block closing brace for else, catch, finally on same line -->
49+
<module name="RightCurly">
50+
<property name="option" value="same"/>
51+
</module>
52+
<!-- Always use braces even if optional -->
53+
<module name="NeedBraces"/>
54+
55+
<!-- CLASS DESIGN -->
56+
57+
<!-- A class with only private constructors must be declared final -->
58+
<module name="FinalClass"/>
59+
<!-- Classes containing only static methods should not have a public constructor -->
60+
<module name="HideUtilityClassConstructor"/>
61+
62+
<!-- CODING -->
63+
64+
<!-- Use Java style array declarations (e.g. String[] names), not C style (e.g. String names[]) -->
65+
<module name="ArrayTypeStyle"/>
66+
<!-- If covariant equals defined, standard equals must also be defined -->
67+
<module name="CovariantEquals"/>
68+
<!-- Switch 'default' case must appear last -->
69+
<module name="DefaultComesLast"/>
70+
<!-- Call equals on string literals to avoid an NPE -->
71+
<module name="EqualsAvoidNull"/>
72+
<!-- Override equals and hashCode together -->
73+
<module name="EqualsHashCode"/>
74+
<!-- No fall through in switch cases, even the last one -->
75+
<module name="FallThrough">
76+
<property name="checkLastCaseGroup" value="true"/>
77+
</module>
78+
<!-- Do not perform assignments embedded within expressions -->
79+
<module name="InnerAssignment"/>
80+
<!-- Switch statements must have a 'default' case -->
81+
<module name="MissingSwitchDefault"/>
82+
<!-- Do not modify the 'for' loop control variable -->
83+
<module name="ModifiedControlVariable"/>
84+
<!-- Each variable declaration must be on a separate line -->
85+
<module name="MultipleVariableDeclarations"/>
86+
<!-- Do not use finalize -->
87+
<module name="NoFinalizer"/>
88+
<!-- Each statement (i.e. code terminated by a semicolon) must be on a separate line -->
89+
<module name="OneStatementPerLine"/>
90+
<!-- Classes must have an explicit package declaration -->
91+
<module name="PackageDeclaration"/>
92+
<!-- Do not reassign method parameters -->
93+
<module name="ParameterAssignment"/>
94+
<!-- Do not test boolean expressions against the values true or false -->
95+
<module name="SimplifyBooleanExpression"/>
96+
<!-- Do not test for boolean conditions and return the values true or false -->
97+
<module name="SimplifyBooleanReturn"/>
98+
<!-- Do not use '==' to compare string against a literal; use 'equals' -->
99+
<module name="StringLiteralEquality"/>
100+
<!-- Use 'L' with long literals -->
101+
<module name="UpperEll"/>
102+
103+
<!-- IMPORTS -->
104+
105+
<!-- No imports statements using '*' -->
106+
<module name="AvoidStarImport"/>
107+
<!-- Do not import 'sun' packages -->
108+
<module name="IllegalImport"/>
109+
<!-- Do not duplicate import statements -->
110+
<module name="RedundantImport"/>
111+
<!-- Eliminate unused imports -->
112+
<module name="UnusedImports"/>
113+
114+
<!-- Import ordering -->
115+
<module name="ImportOrder">
116+
<property name="groups" value="/^javax?\./,/^org\./,*,/^com\.linkedin\./"/>
117+
<property name="separated" value="true"/>
118+
<property name="ordered" value="true"/>
119+
<property name="caseSensitive" value="true"/>
120+
<property name="sortStaticImportsAlphabetically" value="true"/>
121+
<property name="option" value="bottom"/>
122+
</module>
123+
124+
<!-- JAVADOC COMMENTS -->
125+
126+
<!-- If you have a Javadoc comment, make sure it is properly formed -->
127+
<module name="JavadocStyle">
128+
<property name="checkFirstSentence" value="false"/>
129+
</module>
130+
131+
<!-- MISCELLANEOUS -->
132+
133+
<!-- Ensure filename matches outer class name -->
134+
<module name="OuterTypeFilename"/>
135+
136+
<!-- MODIFIERS -->
137+
138+
<!-- Avoid redundant modifiers such as public in interface method decls, per the Java Language spec -->
139+
<module name="RedundantModifier"/>
140+
141+
<!-- NAMING CONVENTIONS -->
142+
143+
<!-- Generic parameters for a class must be uppercase letters separated by underscores (e.g. <V>, <NEW>, <KEY_T>) -->
144+
<module name="ClassTypeParameterName">
145+
<property name="format" value="^[A-Z]+(_[A-Z]+)*$"/>
146+
</module>
147+
<!-- Constants must be all uppercase letters separated by underscores -->
148+
<module name="ConstantName">
149+
<property name="format" value="^(_?log)|([A-Z][A-Z0-9]*(_[A-Z0-9]+)*)$"/>
150+
</module>
151+
<!-- Local variables must be camel case starting with lowercase letter -->
152+
<module name="LocalFinalVariableName"/>
153+
<module name="LocalVariableName"/>
154+
<!-- Member variables must be camel case starting with an underscore or lowercase letter -->
155+
<module name="MemberName">
156+
<property name="format" value="^[_a-z][a-zA-Z0-9]*$"/>
157+
</module>
158+
<!-- Method name must be camel case starting with a lowercase letter -->
159+
<module name="MethodName"/>
160+
<!-- Generic parameters for a method must be uppercase letters separated by underscores (e.g. <V>, <NEW>, <KEY_T>) -->
161+
<module name="MethodTypeParameterName">
162+
<property name="format" value="^[A-Z]+(_[A-Z]+)*$"/>
163+
</module>
164+
<!-- Package name must be all lowercase letters separated by periods -->
165+
<module name="PackageName">
166+
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
167+
</module>
168+
<!-- Parameters must be camel case starting with a lowercase letter -->
169+
<module name="ParameterName"/>
170+
<!-- Static variables must be camel case starting with an underscore or lowercase letter -->
171+
<module name="StaticVariableName">
172+
<property name="format" value="^[_a-z][a-zA-Z0-9]*$"/>
173+
</module>
174+
<!-- Type names must be camel case starting with an uppercase letter -->
175+
<module name="TypeName"/>
176+
177+
<!-- WHITESPACE -->
178+
179+
<module name="GenericWhitespace"/>
180+
<module name="MethodParamPad"/>
181+
<!-- Do not wrap package and import declarations -->
182+
<module name="NoLineWrap"/>
183+
<module name="NoWhitespaceAfter">
184+
<property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
185+
</module>
186+
<module name="NoWhitespaceBefore"/>
187+
<module name="OperatorWrap"/>
188+
<module name="ParenPad"/>
189+
<module name="TypecastParenPad">
190+
<property name="tokens" value="RPAREN,TYPECAST"/>
191+
</module>
192+
<module name="WhitespaceAfter"/>
193+
<module name="WhitespaceAround"/>
194+
195+
<!-- Do not allow meaningless, IDE generated parameter names -->
196+
<module name="RegexpSinglelineJava">
197+
<property name="format" value="[\s]+arg[\d]+[,\)]"/>
198+
<property name="message" value="Replace argN with a meaningful parameter name"/>
199+
</module>
200+
</module>
201+
202+
<!-- LENGTHS -->
203+
204+
<!-- Desired line length is 120 but allow some overrun beyond that -->
205+
<module name="LineLength">
206+
<property name="max" value="160"/>
207+
<message key="maxLineLen"
208+
value="Line is longer than {0,number,integer} characters (found {1,number,integer}). Try to keep lines under 120 characters."/>
209+
</module>
210+
211+
<!-- Do not allow tab characters in source files -->
212+
<module name="FileTabCharacter"/>
213+
214+
<!-- Ensure parameter and exception names are present on @param and @throws tags -->
215+
<module name="RegexpSingleline">
216+
<property name="format" value="\*[\s]*@(throws|param)[\s]*$"/>
217+
<property name="message" value="Missing parameter or exception name"/>
218+
</module>
219+
<!-- IDE generated code must be reviewed by developer -->
220+
<module name="RegexpSingleline">
221+
<property name="format" value="\/\/[\s]*TODO[\s]+Auto-generated"/>
222+
<property name="message" value="Replace IDE generated code with real implementation"/>
223+
</module>
224+
<!-- Detect commonly misspelled Javadoc tags -->
225+
<module name="RegexpSingleline">
226+
<property name="format" value="\*[\s]*@(params|throw|returns)[\s]+"/>
227+
<property name="message" value="Correct misspelled Javadoc tag"/>
228+
</module>
229+
230+
<!-- Read checker suppressions from a file -->
231+
<module name="SuppressionFilter">
232+
<property name="file" value="${config_loc}/suppressions.xml"/>
233+
</module>
234+
235+
<!-- Allow SuppressWarnings annotation to suppress Checkstyle issues -->
236+
<module name="SuppressWarningsFilter"/>
237+
</module>

config/checkstyle/suppressions.xml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE suppressions PUBLIC
3+
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
4+
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
5+
<suppressions>
6+
<suppress files=".*models.*" checks=".*"/>
7+
</suppressions>

config/spotbugs/exclude.xml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- Yes, even though this exclusion filter file is used by SpotBugs, the top-level element is still "FindBugsFilter" -->
3+
<FindBugsFilter
4+
xmlns="https://github.com/spotbugs/filter/3.0.0"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd">
7+
<Match>
8+
<Class name="~.*models.*"/>
9+
</Match>
10+
</FindBugsFilter>

config/spotbugs/include.xml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<FindBugsFilter
3+
xmlns="https://github.com/spotbugs/filter/3.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd">
6+
<!-- Only process Java sources -->
7+
<Match>
8+
<Source name="~.*\.java"/>
9+
</Match>
10+
</FindBugsFilter>
11+

0 commit comments

Comments
 (0)