Skip to content

Commit

Permalink
Update README and add undeploy to Makefile (#76)
Browse files Browse the repository at this point in the history
* Update README and add undeploy to Makefile
  • Loading branch information
jogrogan authored Dec 9, 2024
1 parent 11c53f8 commit 1b0a57f
Show file tree
Hide file tree
Showing 182 changed files with 2,080 additions and 1,660 deletions.
49 changes: 33 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,57 @@ integration-tests:
clean:
./gradlew clean

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

deploy: deploy-config
kubectl apply -f ./hoptimator-k8s/src/main/resources/
kubectl apply -f ./deploy

undeploy:
kubectl delete -f ./deploy || echo "skipping"
kubectl delete configmap hoptimator-configmap || echo "skipping"

quickstart: build deploy

deploy-dev-environment:
deploy-demo: deploy
kubectl apply -f ./deploy/samples/demodb.yaml

deploy-samples: deploy
kubectl wait --for=condition=Established=True \
crds/subscriptions.hoptimator.linkedin.com \
crds/kafkatopics.hoptimator.linkedin.com \
crds/sqljobs.hoptimator.linkedin.com
kubectl apply -f ./deploy/samples

deploy-dev-environment: deploy-config
kubectl create -f https://github.com/jetstack/cert-manager/releases/download/v1.8.2/cert-manager.yaml || echo "skipping"
kubectl create namespace kafka || echo "skipping"
helm repo add flink-operator-repo https://downloads.apache.org/flink/flink-kubernetes-operator-1.9.0/
helm upgrade --install --atomic --set webhook.create=false flink-kubernetes-operator flink-operator-repo/flink-kubernetes-operator
kubectl apply -f "https://strimzi.io/install/latest?namespace=kafka" -n kafka
kubectl wait --for=condition=Established=True crds/kafkas.kafka.strimzi.io
kubectl apply -f ./hoptimator-k8s/src/main/resources/
kubectl apply -f ./deploy/dev
kubectl apply -f ./deploy/samples/demodb.yaml
kubectl apply -f ./deploy/samples/kafkadb.yaml

deploy-samples: deploy
kubectl wait --for=condition=Established=True \
crds/subscriptions.hoptimator.linkedin.com \
crds/kafkatopics.hoptimator.linkedin.com \
crds/sqljobs.hoptimator.linkedin.com
kubectl apply -f ./deploy/samples
undeploy-dev-environment:
kubectl delete $(shell kubectl get kafkatopic.kafka.strimzi.io -o name -n kafka) -n kafka || echo "skipping"
kubectl delete $(shell kubectl get strimzi -o name -n kafka) -n kafka || echo "skipping"
kubectl delete pvc -l strimzi.io/name=one-kafka -n kafka || echo "skipping"
kubectl delete -f "https://strimzi.io/install/latest?namespace=kafka" -n kafka || echo "skipping"
kubectl delete -f ./deploy/samples/kafkadb.yaml || echo "skipping"
kubectl delete -f ./deploy/samples/demodb.yaml || echo "skipping"
kubectl delete -f ./deploy/dev || echo "skipping"
kubectl delete -f ./hoptimator-k8s/src/main/resources/ || echo "skipping"
kubectl delete namespace kafka || echo "skipping"
helm uninstall flink-kubernetes-operator || echo "skipping"
kubectl delete -f https://github.com/jetstack/cert-manager/releases/download/v1.8.2/cert-manager.yaml || echo "skipping"

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

generate-models:
./models/generate-models.sh
./generate-models.sh
./hoptimator-models/generate-models.sh # <-- marked for deletion

release:
test -n "$(VERSION)" # MISSING ARG: $$VERSION
Expand Down
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,24 @@ Materialized views result in `pipelines`:

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

The below setup will install two local demo DBs, ads and profiles.

```
$ make install # build and install SQL CLI
$ make deploy deploy-demo # install CRDs and K8s objects
$ kubectl port-forward -n kafka svc/one-kafka-external-0 9092 &
$ ./hoptimator
$ make deploy deploy-demo # install demo DB CRDs and K8s objects
$ ./hoptimator # start the SQL CLI
> !intro
```

## Set up Kafka & Flink clusters

The below setup will install a Kafka and Flink cluster within Kubernetes.

```
$ make install # build and install SQL CLI
$ make deploy-dev-environment # start local Kafka & Flink setups
$ kubectl port-forward -n kafka svc/one-kafka-external-0 9092 & # forward external Kafka port for use by SQL CLI
$ ./hoptimator # start the SQL CLI
> !intro
```

Expand Down
15 changes: 14 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@

plugins {
id("com.github.spotbugs") version "6.0.26"
}

subprojects {
apply plugin: 'checkstyle'
apply plugin: 'com.github.spotbugs'

tasks.withType(JavaCompile) {
options.release = 8
options.compilerArgs << '-Xlint:deprecation'
Expand All @@ -9,4 +14,12 @@ subprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}

spotbugs {
ignoreFailures = true
showProgress = true
reportsDir = file("$buildDir/spotbugs")
includeFilter = file("$rootDir/config/spotbugs/include.xml")
excludeFilter = file("$rootDir/config/spotbugs/exclude.xml")
}
}
237 changes: 237 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<!--
Checkstyle-Configuration: LinkedIn Style
Description:
LinkedIn Java style.
-->
<module name="Checker">
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java"/>

<module name="TreeWalker">
<property name="tabWidth" value="2"/>
<module name="SuppressWarningsHolder"/>

<!-- Allow Checkstyle warnings to be suppressed using trailing comments -->
<module name="SuppressWithNearbyCommentFilter"/>
<!-- Allow Checkstyle warnings to be suppressed using block comments -->
<module name="SuppressionCommentFilter"/>

<!-- ANNOTATIONS -->

<!-- No trailing empty parenthesis or commas -->
<module name="AnnotationUseStyle">
<property name="elementStyle" value="ignore"/>
</module>
<!-- Ensure @Override is present when {@inheritDoc} Javadoc tag is present -->
<module name="MissingOverride"/>
<!-- Package level annotations belong in package-info.java -->
<module name="PackageAnnotation"/>
<!-- Do not allow references to internal tickets -->
<module name="Regexp">
<property name="format" value="(DDSDBUS|LISAMZA|DATAPIPES)-\d+"/>
<property name="illegalPattern" value="true"/>
<property name="message" value="Referencing internal ticket names is not allowed"/>
</module>

<!-- BLOCKS -->

<!-- No empty while, try, finally, do, if, else, for, initializer, switch, or synchronized blocks -->
<module name="EmptyBlock"/>
<!-- Block opening brace on same line -->
<module name="LeftCurly">
<property name="option" value="eol"/>
</module>
<!-- Block closing brace for else, catch, finally on same line -->
<module name="RightCurly">
<property name="option" value="same"/>
</module>
<!-- Always use braces even if optional -->
<module name="NeedBraces"/>

<!-- CLASS DESIGN -->

<!-- A class with only private constructors must be declared final -->
<module name="FinalClass"/>
<!-- Classes containing only static methods should not have a public constructor -->
<module name="HideUtilityClassConstructor"/>

<!-- CODING -->

<!-- Use Java style array declarations (e.g. String[] names), not C style (e.g. String names[]) -->
<module name="ArrayTypeStyle"/>
<!-- If covariant equals defined, standard equals must also be defined -->
<module name="CovariantEquals"/>
<!-- Switch 'default' case must appear last -->
<module name="DefaultComesLast"/>
<!-- Call equals on string literals to avoid an NPE -->
<module name="EqualsAvoidNull"/>
<!-- Override equals and hashCode together -->
<module name="EqualsHashCode"/>
<!-- No fall through in switch cases, even the last one -->
<module name="FallThrough">
<property name="checkLastCaseGroup" value="true"/>
</module>
<!-- Do not perform assignments embedded within expressions -->
<module name="InnerAssignment"/>
<!-- Switch statements must have a 'default' case -->
<module name="MissingSwitchDefault"/>
<!-- Do not modify the 'for' loop control variable -->
<module name="ModifiedControlVariable"/>
<!-- Each variable declaration must be on a separate line -->
<module name="MultipleVariableDeclarations"/>
<!-- Do not use finalize -->
<module name="NoFinalizer"/>
<!-- Each statement (i.e. code terminated by a semicolon) must be on a separate line -->
<module name="OneStatementPerLine"/>
<!-- Classes must have an explicit package declaration -->
<module name="PackageDeclaration"/>
<!-- Do not reassign method parameters -->
<module name="ParameterAssignment"/>
<!-- Do not test boolean expressions against the values true or false -->
<module name="SimplifyBooleanExpression"/>
<!-- Do not test for boolean conditions and return the values true or false -->
<module name="SimplifyBooleanReturn"/>
<!-- Do not use '==' to compare string against a literal; use 'equals' -->
<module name="StringLiteralEquality"/>
<!-- Use 'L' with long literals -->
<module name="UpperEll"/>

<!-- IMPORTS -->

<!-- No imports statements using '*' -->
<module name="AvoidStarImport"/>
<!-- Do not import 'sun' packages -->
<module name="IllegalImport"/>
<!-- Do not duplicate import statements -->
<module name="RedundantImport"/>
<!-- Eliminate unused imports -->
<module name="UnusedImports"/>

<!-- Import ordering -->
<module name="ImportOrder">
<property name="groups" value="/^javax?\./,/^org\./,*,/^com\.linkedin\./"/>
<property name="separated" value="true"/>
<property name="ordered" value="true"/>
<property name="caseSensitive" value="true"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
<property name="option" value="bottom"/>
</module>

<!-- JAVADOC COMMENTS -->

<!-- If you have a Javadoc comment, make sure it is properly formed -->
<module name="JavadocStyle">
<property name="checkFirstSentence" value="false"/>
</module>

<!-- MISCELLANEOUS -->

<!-- Ensure filename matches outer class name -->
<module name="OuterTypeFilename"/>

<!-- MODIFIERS -->

<!-- Avoid redundant modifiers such as public in interface method decls, per the Java Language spec -->
<module name="RedundantModifier"/>

<!-- NAMING CONVENTIONS -->

<!-- Generic parameters for a class must be uppercase letters separated by underscores (e.g. <V>, <NEW>, <KEY_T>) -->
<module name="ClassTypeParameterName">
<property name="format" value="^[A-Z]+(_[A-Z]+)*$"/>
</module>
<!-- Constants must be all uppercase letters separated by underscores -->
<module name="ConstantName">
<property name="format" value="^(_?log)|([A-Z][A-Z0-9]*(_[A-Z0-9]+)*)$"/>
</module>
<!-- Local variables must be camel case starting with lowercase letter -->
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<!-- Member variables must be camel case starting with an underscore or lowercase letter -->
<module name="MemberName">
<property name="format" value="^[_a-z][a-zA-Z0-9]*$"/>
</module>
<!-- Method name must be camel case starting with a lowercase letter -->
<module name="MethodName"/>
<!-- Generic parameters for a method must be uppercase letters separated by underscores (e.g. <V>, <NEW>, <KEY_T>) -->
<module name="MethodTypeParameterName">
<property name="format" value="^[A-Z]+(_[A-Z]+)*$"/>
</module>
<!-- Package name must be all lowercase letters separated by periods -->
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
</module>
<!-- Parameters must be camel case starting with a lowercase letter -->
<module name="ParameterName"/>
<!-- Static variables must be camel case starting with an underscore or lowercase letter -->
<module name="StaticVariableName">
<property name="format" value="^[_a-z][a-zA-Z0-9]*$"/>
</module>
<!-- Type names must be camel case starting with an uppercase letter -->
<module name="TypeName"/>

<!-- WHITESPACE -->

<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<!-- Do not wrap package and import declarations -->
<module name="NoLineWrap"/>
<module name="NoWhitespaceAfter">
<property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
</module>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad">
<property name="tokens" value="RPAREN,TYPECAST"/>
</module>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>

<!-- Do not allow meaningless, IDE generated parameter names -->
<module name="RegexpSinglelineJava">
<property name="format" value="[\s]+arg[\d]+[,\)]"/>
<property name="message" value="Replace argN with a meaningful parameter name"/>
</module>
</module>

<!-- LENGTHS -->

<!-- Desired line length is 120 but allow some overrun beyond that -->
<module name="LineLength">
<property name="max" value="160"/>
<message key="maxLineLen"
value="Line is longer than {0,number,integer} characters (found {1,number,integer}). Try to keep lines under 120 characters."/>
</module>

<!-- Do not allow tab characters in source files -->
<module name="FileTabCharacter"/>

<!-- Ensure parameter and exception names are present on @param and @throws tags -->
<module name="RegexpSingleline">
<property name="format" value="\*[\s]*@(throws|param)[\s]*$"/>
<property name="message" value="Missing parameter or exception name"/>
</module>
<!-- IDE generated code must be reviewed by developer -->
<module name="RegexpSingleline">
<property name="format" value="\/\/[\s]*TODO[\s]+Auto-generated"/>
<property name="message" value="Replace IDE generated code with real implementation"/>
</module>
<!-- Detect commonly misspelled Javadoc tags -->
<module name="RegexpSingleline">
<property name="format" value="\*[\s]*@(params|throw|returns)[\s]+"/>
<property name="message" value="Correct misspelled Javadoc tag"/>
</module>

<!-- Read checker suppressions from a file -->
<module name="SuppressionFilter">
<property name="file" value="${config_loc}/suppressions.xml"/>
</module>

<!-- Allow SuppressWarnings annotation to suppress Checkstyle issues -->
<module name="SuppressWarningsFilter"/>
</module>
7 changes: 7 additions & 0 deletions config/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress files=".*models.*" checks=".*"/>
</suppressions>
10 changes: 10 additions & 0 deletions config/spotbugs/exclude.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Yes, even though this exclusion filter file is used by SpotBugs, the top-level element is still "FindBugsFilter" -->
<FindBugsFilter
xmlns="https://github.com/spotbugs/filter/3.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd">
<Match>
<Class name="~.*models.*"/>
</Match>
</FindBugsFilter>
11 changes: 11 additions & 0 deletions config/spotbugs/include.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter
xmlns="https://github.com/spotbugs/filter/3.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd">
<!-- Only process Java sources -->
<Match>
<Source name="~.*\.java"/>
</Match>
</FindBugsFilter>

Loading

0 comments on commit 1b0a57f

Please sign in to comment.