-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alex Kursell
committed
Feb 25, 2019
1 parent
e8bfa9a
commit 9e424a4
Showing
52 changed files
with
7,212 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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,73 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2018 The Kubernetes 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
declare -a mandatory | ||
mandatory=( | ||
PKG | ||
ARCH | ||
GIT_COMMIT | ||
REPO_INFO | ||
TAG | ||
) | ||
|
||
missing=false | ||
for var in "${mandatory[@]}"; do | ||
if [[ -z "${!var:-}" ]]; then | ||
echo "Environment variable $var must be set" | ||
missing=true | ||
fi | ||
done | ||
|
||
if [ "$missing" = true ]; then | ||
exit 1 | ||
fi | ||
|
||
export CGO_ENABLED=0 | ||
|
||
release=cmd/plugin/release | ||
|
||
function build_for_arch(){ | ||
os=$1 | ||
arch=$2 | ||
|
||
env GOOS=${os} GOARCH=${arch} go build \ | ||
${GOBUILD_FLAGS} \ | ||
-ldflags "-s -w \ | ||
-X ${PKG}/version.RELEASE=${TAG} \ | ||
-X ${PKG}/version.COMMIT=${GIT_COMMIT} \ | ||
-X ${PKG}/version.REPO=${REPO_INFO}" \ | ||
-o ${release}/kubectl-ingress_nginx ${PKG}/cmd/plugin | ||
|
||
tar -C ${release} -zcvf ${release}/kubectl-ingress_nginx-${os}-${arch}.tar.gz kubectl-ingress_nginx | ||
rm ${release}/kubectl-ingress_nginx | ||
hash=`sha256sum ${release}/kubectl-ingress_nginx-${os}-${arch}.tar.gz | awk '{ print $1 }'` | ||
sed -i "s/%%%shasum_${os}_${arch}%%%/${hash}/g" ${release}/ingress-nginx.yaml | ||
} | ||
|
||
rm -rf ${release} | ||
mkdir ${release} | ||
|
||
cp cmd/plugin/ingress-nginx.yaml.tmpl ${release}/ingress-nginx.yaml | ||
|
||
sed -i "s/%%%tag%%%/${TAG}/g" ${release}/ingress-nginx.yaml | ||
|
||
build_for_arch darwin amd64 | ||
build_for_arch linux amd64 | ||
build_for_arch windows amd64 |
This file contains 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,40 @@ | ||
apiVersion: krew.googlecontainertools.github.com/v1alpha2 | ||
kind: Plugin | ||
metadata: | ||
name: ingress-nginx | ||
spec: | ||
shortDescription: Interact with ingress-nginx | ||
description: | | ||
The official kubectl plugin for ingress-nginx. | ||
version: %%%tag%%% | ||
platforms: | ||
- uri: https://github.com/kubernetes/ingress-nginx/releases/download/nginx-%%%tag%%%/kubectl-ingress_nginx-darwin-amd64.tar.gz | ||
sha256: %%%shasum_darwin_amd64%%% | ||
files: | ||
- from: "*" | ||
to: "." | ||
bin: "./kubectl-ingress_nginx" | ||
selector: | ||
matchLabels: | ||
os: darwin | ||
arch: amd64 | ||
- uri: https://github.com/kubernetes/ingress-nginx/releases/download/nginx-%%%tag%%%/kubectl-ingress_nginx-linux-amd64.tar.gz | ||
sha256: %%%shasum_linux_amd64%%% | ||
files: | ||
- from: "*" | ||
to: "." | ||
bin: "./kubectl-ingress_nginx" | ||
selector: | ||
matchLabels: | ||
os: linux | ||
arch: amd64 | ||
- uri: https://github.com/kubernetes/ingress-nginx/releases/download/nginx-%%%tag%%%/kubectl-ingress_nginx-windows-amd64.tar.gz | ||
sha256: %%%shasum_windows_amd64%%% | ||
files: | ||
- from: "*" | ||
to: "." | ||
bin: "./kubectl-ingress_nginx" | ||
selector: | ||
matchLabels: | ||
os: windows | ||
arch: amd64 |
Oops, something went wrong.