-
Notifications
You must be signed in to change notification settings - Fork 150
HBASE-27829 Introduce build for kuttl image, basis for dev/test environment
#118
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
Closed
ndimiduk
wants to merge
1
commit into
apache:HBASE-27827-kubernetes-deployment
from
ndimiduk:27829-introduce-kuttl-image
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
hbase-kubernetes-deployment/hbase-kubernetes-testing-image/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| <!-- | ||
| 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. | ||
| --> | ||
|
|
||
| # hbase-kubernetes-testing-image | ||
|
|
||
| This directory builds a docker image containing everything required to run `kubectl-kuttl` in | ||
| "mocked control plane" mode. This image is used as the basis for both dev and test environments. | ||
|
|
||
| ## Build | ||
|
|
||
| Building the docker image locally is a little picky because there's lots of input arguments. These | ||
| are managed via the [docker-bake.override.hcl](./src/main/docker/docker-bake.override.hcl). | ||
|
|
||
| Start by creating a buildx context that supports (optionally) multi-platform images. If you've | ||
| created this context previously, it's enough to ensure that it's active via `docker buildx ls`. | ||
|
|
||
| ```shell | ||
| $ docker buildx create \ | ||
| --driver docker-container \ | ||
| --platform linux/amd64,linux/arm64 \ | ||
| --use \ | ||
| --bootstrap | ||
| ``` | ||
|
|
||
| Finally, build the image using `maven package`, or manually, using, | ||
|
|
||
| ```shell | ||
| $ docker buildx bake \ | ||
| --file src/main/docker/docker-bake.hcl \ | ||
| --file src/main/docker/docker-bake.override.hcl \ | ||
| --pull \ | ||
| --load | ||
| ``` | ||
|
|
||
| This exports an image to your local repository that is tagged as `${USER}/hbase/operator-tools/kuttl:latest`. | ||
|
|
||
| ## Usage | ||
|
|
||
| The image is configured with `kuttle` as the entrypoint. | ||
|
|
||
| ```shell | ||
| $ docker container run --rm -it ${USER}/hbase/operator-tools/kuttl:latest --help | ||
|
|
||
| ``` | ||
|
|
||
| Running tests in the image requires mounting the workspace into the container image and passing | ||
| appropriate parameters to `kuttl`. For example, run the "small" tests like this: | ||
|
|
||
| ```shell | ||
| $ docker container run \ | ||
| --mount type=bind,source=$(pwd),target=/workspace \ | ||
| --workdir /workspace \ | ||
| ${USER}/hbase/operator-tools/kuttl:latest \ | ||
| --config tests/kuttl-test-small.yaml | ||
| ``` | ||
126 changes: 126 additions & 0 deletions
126
hbase-kubernetes-deployment/hbase-kubernetes-testing-image/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| <?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-testing-image</artifactId> | ||
| <name>Apache HBase - Kubernetes Testing Image</name> | ||
| <description>A container image to facilitate testing of Kubernetes Deployment.</description> | ||
| <packaging>pom</packaging> | ||
|
|
||
| <properties> | ||
| <container_image.platforms>linux/amd64</container_image.platforms> | ||
| </properties> | ||
|
|
||
| <dependencies /> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.codehaus.mojo</groupId> | ||
| <artifactId>exec-maven-plugin</artifactId> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The best alternative I can find to using |
||
| <configuration> | ||
| <useMavenLogger>true</useMavenLogger> | ||
| </configuration> | ||
| <executions> | ||
| <execution> | ||
| <id>docker-buildx-bake-print</id> | ||
| <goals> | ||
| <goal>exec</goal> | ||
| </goals> | ||
| <phase>package</phase> | ||
| <configuration> | ||
| <executable>/usr/bin/env</executable> | ||
| <arguments> | ||
| <argument>sh</argument> | ||
| <argument>-c</argument> | ||
| <argument> | ||
| 2>&1 \ | ||
| docker buildx bake \ | ||
| --print \ | ||
| --file src/main/docker/docker-bake.hcl \ | ||
| --file src/main/docker/docker-bake.override.hcl | ||
| </argument> | ||
| </arguments> | ||
| </configuration> | ||
| </execution> | ||
| <execution> | ||
| <id>docker-buildx-bake</id> | ||
| <goals> | ||
| <goal>exec</goal> | ||
| </goals> | ||
| <phase>package</phase> | ||
| <configuration> | ||
| <executable>/usr/bin/env</executable> | ||
| <arguments> | ||
| <argument>sh</argument> | ||
| <argument>-c</argument> | ||
| <argument> | ||
| 2>&1 \ | ||
| docker buildx bake \ | ||
| --progress plain \ | ||
| --pull \ | ||
| --load \ | ||
| --set *.platform=${container_image.platforms} \ | ||
| --file src/main/docker/docker-bake.hcl \ | ||
| --file src/main/docker/docker-bake.override.hcl | ||
| </argument> | ||
| </arguments> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
|
|
||
| <profiles> | ||
| <profile> | ||
| <id>amd64</id> | ||
| <activation> | ||
| <os> | ||
| <arch>x86_64</arch> | ||
| </os> | ||
| </activation> | ||
| <properties> | ||
| <container_image.platforms>linux/amd64</container_image.platforms> | ||
| </properties> | ||
| </profile> | ||
| <profile> | ||
| <id>arm64</id> | ||
| <activation> | ||
| <os> | ||
| <arch>aarch64</arch> | ||
| </os> | ||
| </activation> | ||
| <properties> | ||
| <container_image.platforms>linux/arm64</container_image.platforms> | ||
| </properties> | ||
| </profile> | ||
| </profiles> | ||
| </project> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.