Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Java UDx #248

Merged
merged 34 commits into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ff9e1bb
Fix one command-line option in push-to-kind.sh
jizhuoyu Jun 28, 2022
e92a246
Change KUBEVER
jizhuoyu Jul 1, 2022
fef8181
Vertica image with jre included
jizhuoyu Jul 4, 2022
67a7227
Merge branch 'vertica:main' into main
jizhuoyu Jul 6, 2022
972523d
Implementation
jizhuoyu Jul 7, 2022
ac580d5
reverse the udx implementation
jizhuoyu Jul 7, 2022
6036bb0
fix builder.go
jizhuoyu Jul 7, 2022
431e3e5
Merge branch 'main' into udx
jizhuoyu Jul 12, 2022
551a0b2
implementation works and tested with single java udx init container
jizhuoyu Jul 15, 2022
9062007
for demo purpose, 2 flags (MINIMAL_VERTICA_IMG and USING_INIT)
jizhuoyu Aug 12, 2022
ec3b0a0
java udx e2e test working; vertica image updated
jizhuoyu Aug 15, 2022
a757f36
revert types
jizhuoyu Aug 16, 2022
2566d88
revert builder
jizhuoyu Aug 16, 2022
e7f47d2
discard docker-udx-java
jizhuoyu Aug 16, 2022
716c2c3
revert Makefile
jizhuoyu Aug 16, 2022
fc84201
revert .gitignore
jizhuoyu Aug 16, 2022
75b3391
cleanup Dockerfile
jizhuoyu Aug 16, 2022
859fae1
install python symlink in entrypoint
jizhuoyu Aug 16, 2022
6c1db22
delete unnecessary tests
jizhuoyu Aug 17, 2022
e860bb1
add python udx tests
jizhuoyu Aug 17, 2022
677941c
Merge branch 'main' into local-e2e-test
jizhuoyu Aug 17, 2022
652b677
temporarily remove python udx tests
jizhuoyu Aug 17, 2022
336af93
Add changie
Aug 18, 2022
2c3559c
Update tests/e2e-udx/udx-java/README.txt
jizhuoyu Aug 18, 2022
2d6125a
Update tests/e2e-udx/udx-java/setup-vdb/base/setup-vdb.yaml
jizhuoyu Aug 18, 2022
b833edf
Update tests/e2e-udx/udx-java/52-verify-java-udl.yaml
jizhuoyu Aug 18, 2022
314c782
Update tests/e2e-udx/udx-java/50-verify-java-scalar-transform.yaml
jizhuoyu Aug 18, 2022
9afba3d
Update tests/e2e-udx/udx-java/51-verify-java-uda.yaml
jizhuoyu Aug 18, 2022
5703d45
Update tests/e2e-udx/udx-java/50-verify-java-scalar-transform.yaml
jizhuoyu Aug 18, 2022
af62c3c
Update tests/e2e-udx/udx-java/50-verify-java-scalar-transform.yaml
jizhuoyu Aug 18, 2022
2ddcc91
Update scripts/setup-kustomize.sh
jizhuoyu Aug 18, 2022
8761e44
Update docker-vertica/docker-entrypoint.sh
jizhuoyu Aug 18, 2022
e6a073d
change according to review comments
jizhuoyu Aug 18, 2022
d7cc2b3
Merge branch 'main' into local-e2e-test
Aug 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changes/unreleased/Added-20220818-094450.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: Added
body: Support for Java, C++ and Python UDx's
time: 2022-08-18T09:44:50.678890201-03:00
custom:
Issue: "248"
24 changes: 20 additions & 4 deletions docker-vertica/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

ARG BASE_OS_VERSION="focal-20220801"
ARG BUILDER_OS_VERSION="7.9.2009"
ARG MINIMAL=""
FROM centos:centos${BUILDER_OS_VERSION} as builder

ARG VERTICA_RPM="vertica-x86_64.RHEL6.latest.rpm"
ARG MINIMAL=""
ARG MINIMAL
spilchen marked this conversation as resolved.
Show resolved Hide resolved
ARG DBADMIN_GID=5000
ARG DBADMIN_UID=5000

Expand Down Expand Up @@ -88,6 +89,11 @@ FROM ubuntu:${BASE_OS_VERSION}

ARG DBADMIN_GID=5000
ARG DBADMIN_UID=5000
# Controls the version of jre to be installed by apt-get. The list of all
# available jre packages can be queried through apt-cache. For instance,
# "apt-cache search jre | grep jre"
ARG JRE_PKG=openjdk-8-jre-headless
ARG MINIMAL

COPY --from=builder /opt/vertica /opt/vertica
COPY --from=builder /home/dbadmin /home/dbadmin
Expand Down Expand Up @@ -129,6 +135,10 @@ RUN set -x \
procps \
sysstat \
sudo \
# Install jre if not minimal
&& if [[ ($MINIMAL != "YES" && $MINIMAL != "yes") ]] ; then \
apt-get install -y --no-install-recommends $JRE_PKG; \
fi \
&& rm -rf /var/lib/apt/lists/* \
# Make the "en_US.UTF-8" locale so vertica will be utf-8 enabled by default
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
Expand All @@ -138,9 +148,15 @@ RUN set -x \
&& /usr/sbin/useradd -r -m -s /bin/bash -g verticadba --uid ${DBADMIN_UID} dbadmin \
# Allow passwordless sudo access from dbadmin
&& echo "dbadmin ALL=(ALL) NOPASSWD: ALL" | tee -a /etc/sudoers \
&& echo "dbadmin - nofile 65536" >> /etc/security/limits.conf

ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
&& echo "dbadmin - nofile 65536" >> /etc/security/limits.conf \
# Set JAVA_HOME environment variable if not minimal, this will be loaded to all shells
&& if [[ $MINIMAL != "YES" && $MINIMAL != "yes" ]]; then \
echo "JAVA_HOME=/usr" >> /etc/environment; \
fi \
# Create a symlink to python3 interpreter in vertica
&& update-alternatives --install /usr/bin/python python /opt/vertica/oss/python3/bin/python3 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we need to do this? I removed this and was still able to run the python udx from /opt/vertica/sdk/examples.

Copy link
Collaborator

@dmankins dmankins Aug 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to do this. Zhuoyu thought it would be a convenience if our python3 was in a normal path instead of needing to add /opt/vertica/oss/python3/bin/ to one's path.

(I don't know if he has scripts that expect python3 to be ours without changing the path.)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zhuoyu reminded me that we needed this to run one of the sample C++ udx. There is some code that invokes python to generate a bunch of numbers for the test. We want to build a CI that runs the udx tests, so adding this to the container made sense.


ENTRYPOINT [ "/usr/local/bin/docker-entrypoint.sh" ]

# vertica port
EXPOSE 5433
Expand Down
3 changes: 2 additions & 1 deletion docker-vertica/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
set -e
set -o errexit
set -o xtrace

start_cron(){
# daemonizes, no need for &
Expand Down
6 changes: 3 additions & 3 deletions docker-vertica/packages/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@
# wander around in the image looking for things you can remove
rm -r -f \
/opt/vertica/examples \
/opt/vertica/sdk \
/opt/vertica/packages/*/examples \
/opt/vertica/oss/python*/lib/python*/test \
/opt/vertica/oss/python*/lib/python*/unittest/test \
/opt/vertica/oss/python*/lib/python*/pip \
/opt/vertica/oss/python*/lib/python*/site-packages/pip \
/opt/vertica/oss/python*/lib/python*/config-[0-9]* \
/opt/vertica/oss/python*/lib/python*/tkinter \
/opt/vertica/oss/python*/lib/python*/idlelib
/opt/vertica/oss/python*/lib/python*/idlelib

# cleanup many of the __pycache__ directories
find /opt/vertica/oss/ -type d -name "__pycache__" -exec rm -rf {} +
Expand All @@ -51,12 +50,13 @@ strip /opt/vertica/packages/*/lib/*.so* 2> /dev/null
/opt/vertica/oss/python*/bin/python[0-9] \
/tmp/package-checksum-patcher.py /opt/vertica/packages/*

# (optional) minimal images remove packages that aren't auto installed
# (optional) minimal images remove packages that aren't auto installed as well as the sdk folder
if [ "$MINIMAL" = "YES" ] || [ "$MINIMAL" = "yes" ]
then
cd /opt/vertica/packages
for i in $(find . -name package.conf -exec grep Autoinstall=False {} + | cut -d"/" -f2)
do
rm -rf $i
done
rm -r -f /opt/vertica/sdk
fi
1 change: 1 addition & 0 deletions kuttl-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ skipDelete: true
# These are overridden when running kuttl from the Makefile
testDirs:
- tests/e2e
- tests/e2e-udx
- tests/e2e-extra
- tests/e2e-server-upgrade
- tests/e2e-operator-upgrade-overlays
Expand Down
2 changes: 1 addition & 1 deletion scripts/kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set -e

UPLOAD_IMAGES=
TAG=latest
KUBEVER=1.21.1
KUBEVER=1.23.0
spilchen marked this conversation as resolved.
Show resolved Hide resolved
IP_FAMILY=ipv4
LISTEN_ALL_INTERFACES=N
VSQL_PORT=5433
Expand Down
3 changes: 2 additions & 1 deletion scripts/push-to-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ if [ $(( $# - $OPTIND )) -lt 0 ]
then
# Typical kind cluster name is something like: kind-matt1
# We only want what is after 'kind-'
CLUSTER_NAME=$(kubectl config current-context | cut -d"-" -f2)
# Need to use "2-" after -f option to indidate everything after and including the 2nd field (in case we have cluster name like kind-cluster-test)
CLUSTER_NAME=$(kubectl config current-context | cut -d"-" -f2-)
else
CLUSTER_NAME=${@:$OPTIND:1}
fi
Expand Down
4 changes: 2 additions & 2 deletions scripts/setup-kustomize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -738,11 +738,11 @@ setup_creds_for_private_repo

# Descend into each test and create the overlay kustomization.
# The overlay is created in a directory like: overlay/<tc-name>
for tdir in e2e/*/*/base e2e-extra/*/*/base e2e-server-upgrade/*/*/base e2e-operator-upgrade-overlays/*/*/base
for tdir in e2e/*/*/base e2e-extra/*/*/base e2e-server-upgrade/*/*/base e2e-operator-upgrade-overlays/*/*/base e2e-udx/*/*/base
do
create_vdb_pod_kustomization $(dirname $tdir) $(basename $(realpath $tdir/../..))
done
for tdir in e2e/* e2e-extra/* e2e-disabled/* e2e-server-upgrade/* e2e-operator-upgrade-overlays/*
for tdir in e2e/* e2e-extra/* e2e-disabled/* e2e-server-upgrade/* e2e-operator-upgrade-overlays/* e2e-udx/*
do
clean_communal_kustomization $tdir
done
Expand Down
18 changes: 18 additions & 0 deletions tests/e2e-udx/udx-java/00-create-creds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: kustomize build ../../manifests/communal-creds/overlay | kubectl apply -f - --namespace $NAMESPACE
- script: kustomize build ../../manifests/priv-container-creds/overlay | kubectl apply -f - --namespace $NAMESPACE
20 changes: 20 additions & 0 deletions tests/e2e-udx/udx-java/05-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Pod
metadata:
labels:
control-plane: controller-manager
status:
phase: Running
17 changes: 17 additions & 0 deletions tests/e2e-udx/udx-java/05-deploy-operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: sh -c "cd ../../.. && make deploy-operator NAMESPACE=$NAMESPACE"
27 changes: 27 additions & 0 deletions tests/e2e-udx/udx-java/15-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: v-udx-java-sc1
status:
replicas: 1
---
apiVersion: vertica.com/v1beta1
kind: VerticaDB
metadata:
name: v-udx-java
status:
subclusters:
- installCount: 1
17 changes: 17 additions & 0 deletions tests/e2e-udx/udx-java/15-setup-vdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: bash -c "kustomize build setup-vdb/overlay | kubectl -n $NAMESPACE apply -f - "
51 changes: 51 additions & 0 deletions tests/e2e-udx/udx-java/17-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: v-udx-java-sc1
status:
replicas: 1
readyReplicas: 1
---
apiVersion: vertica.com/v1beta1
kind: VerticaDB
metadata:
name: v-udx-java
status:
subclusters:
- installCount: 1
addedToDBCount: 1
upNodeCount: 1
---
# We enable spread encryption, so the cluster will restart as part of the create
apiVersion: v1
kind: Event
reason: StopDBSucceeded
source:
component: verticadb-operator
involvedObject:
apiVersion: vertica.com/v1beta1
kind: VerticaDB
name: v-udx-java
---
apiVersion: v1
kind: Event
reason: ClusterRestartSucceeded
source:
component: verticadb-operator
involvedObject:
apiVersion: vertica.com/v1beta1
kind: VerticaDB
name: v-udx-java
1 change: 1 addition & 0 deletions tests/e2e-udx/udx-java/17-wait-for-createdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Intentionally empty to give this step a name in kuttl
22 changes: 22 additions & 0 deletions tests/e2e-udx/udx-java/20-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: integration-test-role
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: integration-test-rb
18 changes: 18 additions & 0 deletions tests/e2e-udx/udx-java/20-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: kubectl apply --namespace $NAMESPACE -f ../../manifests/rbac/base/rbac.yaml
ignoreFailure: true
7 changes: 7 additions & 0 deletions tests/e2e-udx/udx-java/45-upload-files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
# upload the built library binaries
- command: kubectl -n $NAMESPACE cp ../../../bin/udx-libs/build v-udx-java-sc1-0:/opt/vertica/sdk/examples
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does bin/udx-libs/build get built? There isn't any change to the Makefile, so I assume there is a manual step somewhere. Did we look at building these in a container?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still in the process of testing building those UDx libs locally. If I can build them locally in my WSL2 Ubuntu then I guess I could also build it in a Ubuntu container in GitHub action

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I guess this will be considered a follow-on item.

# upload the expected outputs of executing sql files
- command: kubectl -n $NAMESPACE cp ./expected-outputs v-udx-java-sc1-0:/opt/vertica/sdk/examples
23 changes: 23 additions & 0 deletions tests/e2e-udx/udx-java/50-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# (c) Copyright [2021-2022] Micro Focus or one of its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Pod
metadata:
name: test-verify-java-scalar-transform
status:
containerStatuses:
- name: test
state:
terminated:
exitCode: 0
Loading