-
Notifications
You must be signed in to change notification settings - Fork 2
HBASE-27846 Introduce hadoop image #6
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
Merged
Merged
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # syntax=docker/dockerfile:1.4 | ||
| # | ||
| # 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. | ||
|
|
||
| # hadolint global ignore=DL3020 | ||
|
|
||
| ARG BASE_IMG='apache/hadoop' | ||
| ARG BASE_TAG='3' | ||
| ARG BASE_IMG_ALPINE='alpine' | ||
| ARG BASE_IMG_TAG_ALPINE='latest' | ||
|
|
||
| FROM ${BASE_IMG_ALPINE}:${BASE_IMG_TAG_ALPINE} as alpine | ||
|
|
||
| ## -- Stage installed_jmx_exporter -- | ||
| # A stage that prepares the JMX Exporter installation directory. The jar must be in well-known | ||
| # location so can refer to it in command yaml value. | ||
| FROM alpine AS installed_jmx_exporter | ||
| ARG JMX_PROMETHEUS_JAR_URL | ||
| ADD --link ${JMX_PROMETHEUS_JAR_URL} /tmp/jmx_prometheus_javaagent.jar | ||
|
|
||
| FROM ${BASE_IMG}:${BASE_TAG} as final | ||
| ARG CORRETTO_KEY_URL | ||
| ARG CORRETTO_KEY | ||
| ARG CORRETTO_REPO_URL | ||
| ARG CORRETTO_REPO | ||
| USER root | ||
| ADD --link ${CORRETTO_KEY_URL} /tmp/ | ||
| ADD --link ${CORRETTO_REPO_URL} /etc/yum.repos.d/ | ||
|
|
||
| RUN rpm --import "/tmp/${CORRETTO_KEY}" \ | ||
| && yum -y remove java-1.8.0-* \ | ||
| && yum -y update \ | ||
| && yum -y install java-17-amazon-corretto-devel \ | ||
| && yum -y clean all \ | ||
| && rm -rf /var/cache | ||
|
|
||
| COPY --from=installed_jmx_exporter \ | ||
| --chown=hadoop:users \ | ||
| /tmp/jmx_prometheus_javaagent.jar /opt/hadoop/jmx_prometheus_javaagent.jar | ||
|
|
||
| ENV JMX_PROMETHEUS_JAR /opt/hadoop/jmx_prometheus_javaagent.jar | ||
| ENV USER='hadoop' | ||
| USER ${USER} | ||
|
|
||
| # verify the image basically works | ||
| FROM bats/bats:v1.10.0 as bats | ||
|
|
||
| FROM final AS test | ||
| COPY --from=bats --chown=0755 /opt/bats ./bats | ||
| COPY dockerfiles/hadoop/test/* ./ | ||
| RUN ./bats/bin/bats *.bats | ||
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,56 @@ | ||
| <!-- | ||
| 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. | ||
| --> | ||
|
|
||
| # dockerfiles/hadoop | ||
|
|
||
| There is a contract that must be maintained between the container image run in the pod and the | ||
| infrastructure that launched the pod. Details like paths, users/groups, permissions, and | ||
| environment variables must align so that the deployment layer can pass runtime concerns down to | ||
| the container. | ||
|
|
||
| Start with the official hadoop image and extend it from there. Note that `apache/hadoop:3` is only | ||
| published for `linux/amd64` at this time. | ||
|
|
||
| ## Build | ||
|
|
||
| Input arguments are managed by [docker-bake.override.hcl](./docker-bake.override.hcl). | ||
|
|
||
| Start by creating a buildx context that supports at least `linux/amd64` 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, | ||
|
|
||
| ```shell | ||
| $ docker buildx bake \ | ||
| --file dockerfiles/hadoop/docker-bake.hcl \ | ||
| --file dockerfiles/hadoop/docker-bake.override.hcl \ | ||
| --set '*.platform=linux/amd64' \ | ||
| --pull \ | ||
| --load | ||
| ``` | ||
|
|
||
| This exports an image to your local repository that is tagged as | ||
| `${USER}/hbase/kustomize/hadoop:latest`. |
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,71 @@ | ||
| # 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. | ||
| # | ||
| # A convenience script for build the kuttl image. | ||
| # See hbase-kubernetes-deployment/dockerfiles/kuttl/README.md | ||
| # | ||
|
|
||
| variable BASE_IMG { | ||
| default = "apache/hadoop" | ||
| } | ||
| variable BASE_TAG { | ||
| default = "3" | ||
| } | ||
| variable USER { | ||
| default = "apache" | ||
| } | ||
| variable IMAGE_TAG { | ||
| default = "latest" | ||
| } | ||
| variable IMAGE_NAME { | ||
| default = "${USER}/hbase/kustomize/hadoop" | ||
| } | ||
| variable CORRETTO_KEY_URL {} | ||
| variable CORRETTO_KEY {} | ||
| variable CORRETTO_REPO_URL {} | ||
| variable CORRETTO_REPO {} | ||
| variable JMX_PROMETHEUS_JAR_URL {} | ||
| variable JMX_PROMETHEUS_JAR {} | ||
|
|
||
| group default { | ||
| targets = [ "hadoop", "hadoop-test" ] | ||
| } | ||
|
|
||
| target hadoop { | ||
| dockerfile = "dockerfiles/hadoop/Dockerfile" | ||
| args = { | ||
| BASE_IMG = BASE_IMG | ||
| BASE_TAG = BASE_TAG | ||
| CORRETTO_KEY_URL = CORRETTO_KEY_URL | ||
| CORRETTO_KEY = CORRETTO_KEY | ||
| CORRETTO_REPO_URL = CORRETTO_REPO_URL | ||
| CORRETTO_REPO = CORRETTO_REPO | ||
| JMX_PROMETHEUS_JAR_URL = JMX_PROMETHEUS_JAR_URL | ||
| JMX_PROMETHEUS_JAR = JMX_PROMETHEUS_JAR | ||
| } | ||
| target = "final" | ||
| platforms = [ | ||
| # upstream image only provides linux/amd64 | ||
| "linux/amd64" | ||
| ] | ||
| tags = [ "${IMAGE_NAME}:${IMAGE_TAG}" ] | ||
| } | ||
|
|
||
| target hadoop-test { | ||
| inherits = [ "hadoop" ] | ||
| target = "test" | ||
| tags = [] | ||
| } |
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,47 @@ | ||
| # 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. | ||
| # | ||
| # Externalize default values of build parameters and document how to retrieve them. | ||
| # | ||
|
|
||
| function "basename" { | ||
| params = [a] | ||
| result = split("/", a)[length(split("/", a)) - 1] | ||
| } | ||
|
|
||
| variable CORRETTO_KEY_URL { | ||
| default = "https://yum.corretto.aws/corretto.key" | ||
| } | ||
|
|
||
| variable CORRETTO_KEY { | ||
| default = "${basename(CORRETTO_KEY_URL)}" | ||
| } | ||
|
|
||
| variable CORRETTO_REPO_URL { | ||
| default = "https://yum.corretto.aws/corretto.repo" | ||
| } | ||
|
|
||
| variable CORRETTO_REPO { | ||
| default = "${basename(CORRETTO_REPO_URL)}" | ||
| } | ||
|
|
||
| variable JMX_PROMETHEUS_JAR_URL { | ||
| default = "https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.16.1/jmx_prometheus_javaagent-0.16.1.jar" | ||
| } | ||
|
|
||
| variable JMX_PROMETHEUS_JAR { | ||
| default = "${basename(JMX_PROMETHEUS_JAR_URL)}" | ||
| } |
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,27 @@ | ||
| #!/usr/bin/env bats | ||
| # 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. | ||
|
|
||
| @test "hadoop command on path" { | ||
| hadoop version | ||
| } | ||
|
|
||
| @test "hadoop checknative runs" { | ||
| hadoop checknative | ||
| } | ||
|
|
||
| @test "hdfs command on path" { | ||
| hdfs datanode --help | ||
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So there is already an image for hadoop 3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the one I'm relying on is built out of their docker-hadoop-3 branch, https://github.com/apache/hadoop/tree/docker-hadoop-3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that as of now the upstream image is only build for
linux/amd64.