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

HBASE-27831 Introduce zookeeper-single-instance component #121

Open
wants to merge 3 commits into
base: HBASE-27827-kubernetes-deployment
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ linklint-*.zip
linklint/
.checkstyle
**/.checkstyle

# detritus produced by kuttl
kubeconfig*
33 changes: 23 additions & 10 deletions dev-support/jenkins/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,29 @@
FROM hadolint/hadolint:latest-debian as hadolint

FROM maven:3.8-jdk-8

# hadolint ignore=DL3008
RUN apt-get -q update && apt-get -q install --no-install-recommends -y \
binutils \
git \
rsync \
shellcheck \
wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# hadolint ignore=SC1091
RUN install -m 0755 -d /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
&& chmod a+r /etc/apt/keyrings/docker.gpg \
&& echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get -q update \
&& apt-get -q install --no-install-recommends -y \
binutils=* \
ca-certificates=* \
curl=* \
docker-buildx-plugin=* \
docker-ce-cli=* \
git=* \
gnupg=* \
rsync=* \
shellcheck=* \
wget=* \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY --from=hadolint /bin/hadolint /bin/hadolint

Expand Down
32 changes: 31 additions & 1 deletion dev-support/jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,34 @@ pipeline {
YETUS_DRIVER = "${WORKDIR}/${YETUS_DRIVER_REL}"
YETUSDIR = "${WORKDIR}/${YETUS_REL}"
PLUGINS = 'all'
// workaround for INFRA-24621
NON_ROOT_AS_JENKINS = 'true'
NON_ROOT_USER = """${sh(
returnStdout: true,
script: '''#!/usr/bin/env bash
set -e

if [ "${DEBUG}" = 'true' ] ; then
set -x
fi

whoami
'''
)}
""".trim()
NON_ROOT_UID = """${sh(
returnStdout: true,
script: '''#!/usr/bin/env bash
set -e

if [ "${DEBUG}" = 'true' ] ; then
set -x
fi

echo "${UID}"
'''
)}
""".trim()
}

parameters {
Expand Down Expand Up @@ -78,7 +106,9 @@ pipeline {
usernameVariable: 'GITHUB_USER'
)]) {
sh label: 'test-patch', script: '''#!/bin/bash -e
docker container run --rm --user=0 --mount type=bind,source=${SOURCEDIR},target=/sourcedir --workdir /sourcedir alpine:latest rm -rfv hbase-kubernetes-deployment/hbase-kubernetes-kustomize/target
printenv 2>&1 | sort
export DOCKER_EXTRAENVS=("NON_ROOT_AS_JENKINS" "NON_ROOT_USER" "NON_ROOT_UID" )
echo "[INFO] Launching Yetus via ${YETUS_DRIVER}"
"${YETUS_DRIVER}"
'''
Expand Down Expand Up @@ -138,4 +168,4 @@ pipeline {
}
}
}
}
}
4 changes: 3 additions & 1 deletion dev-support/jenkins/jenkins_precommit_github_yetus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ YETUS_ARGS+=("--tests-filter=test4tests")
# Dockerfile since we don't want to use the auto-pulled version.
YETUS_ARGS+=("--docker")
YETUS_ARGS+=("--dockerfile=${DOCKERFILE}")
# enabled docker-in-docker so that we can build container images
YETUS_ARGS+=("--dockerind=true")
YETUS_ARGS+=("--mvn-custom-repos")
YETUS_ARGS+=("--java-home=${SET_JAVA_HOME}")
# effectively treat dev-support as a custom maven module
Expand All @@ -127,4 +129,4 @@ YETUS_ARGS+=("--proclimit=5000")
echo "Launching yetus with command line:"
echo "${TESTPATCHBIN} ${YETUS_ARGS[*]}"

/usr/bin/env bash "${TESTPATCHBIN}" "${YETUS_ARGS[@]}"
/usr/bin/env bash "${TESTPATCHBIN}" "${YETUS_ARGS[@]}"
91 changes: 91 additions & 0 deletions hbase-kubernetes-deployment/hbase-kubernetes-kustomize/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!--
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
-->
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>hbase-kubernetes-deployment</artifactId>
<groupId>org.apache.hbase.operator.tools</groupId>
<version>${revision}</version>
<relativePath>..</relativePath>
</parent>

<artifactId>hbase-kubernetes-kustomize</artifactId>
<name>Apache HBase - Kubernetes Kustomize</name>
<description>Kustomize deployment descriptors.</description>
<packaging>pom</packaging>

<dependencies>
<dependency>
<groupId>org.apache.hbase.operator.tools</groupId>
<artifactId>hbase-kubernetes-testing-image</artifactId>
<type>pom</type>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<executable>src/test/resources/mvn_exec_run_kuttl.sh</executable>
<useMavenLogger>true</useMavenLogger>
<skip>${skipTests}</skip>
</configuration>
<executions>
<execution>
<id>kuttl-unit-tests</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<arguments>
<argument>--config</argument>
<argument>src/test/resources/kuttl-test-unit.yaml</argument>
<argument>--artifacts-dir</argument>
<argument>target/kuttl-reports</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>kuttl-integration-tests</id>
<phase>verify</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<arguments>
<argument>--config</argument>
<argument>src/test/resources/kuttl-test-integration.yaml</argument>
<argument>--artifacts-dir</argument>
<argument>target/kuttl-reports</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->

Uses latest image from the apache zookeeper project.
There is then a start script in 'single-instance/start.sh'
which sets parameters for the zookeeper image and process
on startup. Currently only logs to STDOUT/STDERR; there
are no files in /var/log/zookeeper.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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: kustomize.config.k8s.io/v1alpha1
kind: Component

configMapGenerator:
- name: zookeeper-scripts
files:
- start.sh
# Publish where the zk ensemble can be found.
- name: zookeeper-quorum
literals:
# Hard-coded. Default we expect a simple standalone zk at this location.
# One define is for hbase, the other for hadoop.
- HBASE_ZOOKEEPER_QUORUM="zookeeper-0.zookeeper-headless"
- HA_ZOOKEEPER_QUORUM="zookeeper-0.zookeeper-headless:2181"
options:
disableNameSuffixHash: true

resources:
- zookeeper.yaml
Loading