-
Notifications
You must be signed in to change notification settings - Fork 491
Reimplement katib-cert-generator in Go #1662
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
google-oss-robot
merged 24 commits into
kubeflow:master
from
tenzen-y:issue-1656-reimplement-katib-cert-generator
Sep 15, 2021
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
31ac0c1
add cert-generator command
tenzen-y 26f4cfe
go mod tidy
tenzen-y 2c66840
fix gofmt lint check
tenzen-y 3986c6a
fix unittest for katib-cert-generator
tenzen-y 1075d26
remove unnecessary test code
tenzen-y 928cf4b
fix comment
tenzen-y 4e5f95d
review: fix kubeClient
tenzen-y 0797cd5
review: stop to use k8s.io/utils
tenzen-y 49680cf
review: delete containers[].securityContext
tenzen-y 3d369b3
review: change directory name for cert-generator
tenzen-y 3875a26
review: fix const
tenzen-y ee4de35
review: stop to use k8s.io/utils
tenzen-y b1d2220
review: delete containers[].securityContext
tenzen-y 7a35691
review: change directory name for cert-generator
tenzen-y 85c8410
review: fix const
tenzen-y 78f53f2
Merge branch 'issue-1656-reimplement-katib-cert-generator' of https:/…
tenzen-y a3c391e
review: take webhook domain as consts
tenzen-y 9b2b581
review: keep the name testDescription and err
tenzen-y eb9da24
review: do not try to patch webhook configuration in many times
tenzen-y 5816bc7
review: fix some functions to generate cert
tenzen-y 9c47bb9
review: add comments
tenzen-y ebd6ead
review: remove v1beta1 from admissionReviewVersions in ValidatingWebh…
tenzen-y a7a111d
fix comments
tenzen-y 37a9156
review: remove the securityContext field
tenzen-y 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 |
|---|---|---|
| @@ -1,13 +1,29 @@ | ||
| FROM alpine:3.12.4 | ||
| # Build the Katib Cert Generatoe. | ||
| FROM golang:alpine AS build-env | ||
|
|
||
| ARG KUBECTL_VERSION="v1.19.3" | ||
| WORKDIR /go/src/github.com/kubeflow/katib | ||
|
|
||
| RUN apk add --update openssl | ||
| RUN wget https://storage.googleapis.com/kubernetes-release/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl \ | ||
| && chmod +x ./kubectl && mv ./kubectl /usr/local/bin/kubectl | ||
| # Download packages. | ||
| COPY go.mod . | ||
| COPY go.sum . | ||
| RUN go mod download -x | ||
|
|
||
| COPY ./hack/cert-generator.sh /app/cert-generator.sh | ||
| RUN chmod +x /app/cert-generator.sh | ||
| # Copy sources. | ||
| COPY cmd/ cmd/ | ||
| COPY pkg/ pkg/ | ||
|
|
||
| # Build the binary. | ||
| RUN if [ "$(uname -m)" = "ppc64le" ]; then \ | ||
| CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le go build -a -o katib-cert-generator ./cmd/cert-generator/v1beta1; \ | ||
| elif [ "$(uname -m)" = "aarch64" ]; then \ | ||
| CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -o katib-cert-generator ./cmd/cert-generator/v1beta1; \ | ||
| else \ | ||
| CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o katib-cert-generator ./cmd/cert-generator/v1beta1; \ | ||
| fi | ||
|
|
||
| # Copy the cert-generator into a thin image. | ||
| FROM gcr.io/distroless/static:nonroot | ||
andreyvelich marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| WORKDIR /app | ||
| ENTRYPOINT ["sh", "./cert-generator.sh"] | ||
| COPY --from=build-env /go/src/github.com/kubeflow/katib/katib-cert-generator /app/ | ||
| USER 65532:65532 | ||
| ENTRYPOINT ["./katib-cert-generator"] | ||
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,42 @@ | ||
| /* | ||
| Copyright 2021 The Kubeflow Authors. | ||
|
|
||
| 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. | ||
| */ | ||
|
|
||
| package main | ||
|
|
||
| import ( | ||
| "github.com/kubeflow/katib/pkg/cert-generator/v1beta1" | ||
| "k8s.io/client-go/kubernetes/scheme" | ||
| "k8s.io/klog" | ||
| "os" | ||
| "sigs.k8s.io/controller-runtime/pkg/client" | ||
| "sigs.k8s.io/controller-runtime/pkg/client/config" | ||
| ) | ||
|
|
||
| func main() { | ||
| kubeClient, err := client.New(config.GetConfigOrDie(), client.Options{Scheme: scheme.Scheme}) | ||
| if err != nil { | ||
| klog.Fatalf("Failed to create kube client.") | ||
| } | ||
|
|
||
| cmd, err := v1beta1.NewKatibCertGeneratorCmd(kubeClient) | ||
| if err != nil { | ||
| klog.Fatalf("Failed to generate cert: %v", err) | ||
| } | ||
|
|
||
| if err = cmd.Execute(); err != nil { | ||
| os.Exit(1) | ||
| } | ||
| } |
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
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.