-
Notifications
You must be signed in to change notification settings - Fork 1.5k
OpenShift image and fixed bug on running multiple operators/webhooks #343
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
Show all changes
13 commits
Select commit
Hold shift + click to select a range
73d09c8
Added support for running the containers using a non-root user; fixed…
yuchaoran2011 13e91b9
Added prerequisites for OpenShift image
yuchaoran2011 140b20c
Update Go image to 1.11.3
yuchaoran2011 0b6d745
Don't fail when label is empty string
yuchaoran2011 d7c9e07
Auto patch Spark job namespace with a label
yuchaoran2011 bb6a096
Fixed gofmt
yuchaoran2011 7790887
Fixed label value
yuchaoran2011 0f9e085
Updated to Go 1.11.4
yuchaoran2011 45271b6
Now using an non-invasive approach to determine which pods to mutate …
yuchaoran2011 2b15a16
Changed logging level
yuchaoran2011 71ce0da
Fixed logging level
yuchaoran2011 4a79ee6
Made job namespace a field of Webhook
yuchaoran2011 44140ba
Fixed webhook test
yuchaoran2011 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # syntax=docker/dockerfile:experimental | ||
| # | ||
| # Copyright 2018 Google LLC | ||
| # | ||
| # 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 | ||
| # | ||
| # https://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. | ||
| # | ||
|
|
||
| # Build an OpenShift image. | ||
| # Before running docker build, make sure | ||
| # 1. Your Docker version is >= 18.09 | ||
| # 2. export DOCKER_BUILDKIT=1 | ||
|
|
||
| ARG SPARK_IMAGE=gcr.io/spark-operator/spark:v2.4.0 | ||
| ARG USER_ID=185 | ||
|
|
||
| FROM golang:1.11.4-alpine as builder | ||
| ARG DEP_VERSION="0.5.0" | ||
| RUN apk add --no-cache bash git | ||
| ADD https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 /usr/bin/dep | ||
| RUN chmod +x /usr/bin/dep | ||
|
|
||
| WORKDIR ${GOPATH}/src/github.com/GoogleCloudPlatform/spark-on-k8s-operator | ||
| COPY Gopkg.toml Gopkg.lock ./ | ||
| RUN dep ensure -vendor-only | ||
| COPY . ./ | ||
| RUN go generate && CGO_ENABLED=0 GOOS=linux go build -o /usr/bin/spark-operator | ||
|
|
||
| FROM ${SPARK_IMAGE} | ||
| COPY --from=builder /usr/bin/spark-operator /usr/bin/ | ||
| USER root | ||
|
|
||
| # Comment out the following three lines if you do not have a RedHat subscription. | ||
| COPY install_packages.sh / | ||
| RUN --mount=target=/opt/spark/credentials,type=secret,id=credentials,required /install_packages.sh | ||
| RUN rm /install_packages.sh | ||
|
|
||
| RUN chmod -R u+x /tmp | ||
|
|
||
| RUN apk add --no-cache openssl curl tini | ||
| COPY hack/gencerts.sh /usr/bin/ | ||
| COPY entrypoint.sh /usr/bin/ | ||
| USER ${USER_ID} | ||
| ENTRYPOINT ["/usr/bin/entrypoint.sh"] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/bin/bash | ||
|
|
||
| # echo commands to the terminal output | ||
| set -ex | ||
|
|
||
| # Check whether there is a passwd entry for the container UID | ||
| myuid=$(id -u) | ||
| mygid=$(id -g) | ||
| # turn off -e for getent because it will return error code in anonymous uid case | ||
| set +e | ||
| uidentry=$(getent passwd $myuid) | ||
| set -e | ||
|
|
||
| echo $myuid | ||
| echo $mygid | ||
| echo $uidentry | ||
|
|
||
| # If there is no passwd entry for the container UID, attempt to create one | ||
| if [[ -z "$uidentry" ]] ; then | ||
| if [[ -w /etc/passwd ]] ; then | ||
| echo "$myuid:x:$myuid:$mygid:anonymous uid:$SPARK_HOME:/bin/false" >> /etc/passwd | ||
| else | ||
| echo "Container ENTRYPOINT failed to add passwd entry for anonymous UID" | ||
| fi | ||
| fi | ||
|
|
||
| exec /sbin/tini -s -- /usr/bin/spark-operator "$@" | ||
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,11 @@ | ||
| #!/bin/bash | ||
| arg1=$(head -2 /opt/spark/credentials | tail -1) | ||
| arg2=$(head -3 /opt/spark/credentials | tail -1) | ||
| arg3=$(head -1 /opt/spark/credentials | tail -1) | ||
|
|
||
| subscription-manager register --username=$arg1 --password=$arg2 --name=docker | ||
| subscription-manager attach --pool=$arg3 && \ | ||
| yum install -y openssl | ||
| subscription-manager remove --al | ||
| subscription-manager unregister | ||
| subscription-manager clean |
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
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
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.