Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
125 changes: 125 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# OSX leaves these everywhere on SMB shares
._*

# OSX trash
.DS_Store

# Eclipse files
.classpath
.project
.settings/**

# Files generated by JetBrains IDEs, e.g. IntelliJ IDEA
.idea/
*.iml

# Vscode files
.vscode

# This is where the result of the go build goes
/output*/
/_output*/
/_output

# Emacs save files
*~
\#*\#
.\#*

# Vim-related files
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist

# cscope-related files
cscope.*

# Go test binaries
*.test
/hack/.test-cmd-auth

# JUnit test output from ginkgo e2e tests
/junit*.xml

# Mercurial files
**/.hg
**/.hg*

# Vagrant
.vagrant
network_closure.sh

# Local cluster env variables
/cluster/env.sh

# Compiled binaries in third_party
/third_party/pkg

# Also ignore etcd installed by hack/install-etcd.sh
/third_party/etcd*
/default.etcd

# User cluster configs
.kubeconfig

.tags*

# Version file for dockerized build
.dockerized-kube-version-defs

# Web UI
/www/master/node_modules/
/www/master/npm-debug.log
/www/master/shared/config/development.json

# Karma output
/www/test_out

# precommit temporary directories created by ./hack/verify-generated-docs.sh and ./hack/lib/util.sh
/_tmp/
/doc_tmp/

# Test artifacts produced by Jenkins jobs
/_artifacts/

# Go dependencies installed on Jenkins
/_gopath/

# Config directories created by gcloud and gsutil on Jenkins
/.config/gcloud*/
/.gsutil/

# CoreOS stuff
/cluster/libvirt-coreos/coreos_*.img

# Juju Stuff
/cluster/juju/charms/*
/cluster/juju/bundles/local.yaml

# Downloaded Kubernetes binary release
/kubernetes/

# direnv .envrc files
.envrc

# Downloaded kubernetes binary release tar ball
kubernetes.tar.gz

# generated files in any directory
# TODO(thockin): uncomment this when we stop committing the generated files.
#zz_generated.*
#zz_generated.openapi.go

# make-related metadata
/.make/
# Just in time generated data in the source, should never be commited
/test/e2e/generated/bindata.go

# This file used by some vendor repos (e.g. github.com/go-openapi/...) to store secret variables and should not be ignored
!\.drone\.sec

/bazel-*
*.pyc

52 changes: 52 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
BIN_DIR=_output/bin
RELEASE_VER=v0.2
CONTRIB_VENDOR_GOPATH=${HOME}/tmp/contrib/DLaaS
CURRENT_DIR=$(shell pwd)
CONTRIB_VENDOR_GOPATH_SRC_TARGET=${CURRENT_DIR}/vendor
SYM_LINK_EXISTS=$(shell [ -e ${CONTRIB_VENDOR_GOPATH}/src ] && echo 1 || echo 0 )
ORIG_GOPATH=${GOPATH}

kar-controller: init
CGO_ENABLED=0 GOARCH=amd64 go build -o ${BIN_DIR}/kar-controllers ./cmd/kar-controllers/

verify: generate-code
# hack/verify-gofmt.sh
# hack/verify-golint.sh
# hack/verify-gencode.sh

init:
mkdir -p ${BIN_DIR}

generate-code: set_gopath_to_generate_code
GOPATH=${ORIG_GOPATH} go build -o ${BIN_DIR}/deepcopy-gen ./cmd/deepcopy-gen/
GOPATH=${CONTRIB_VENDOR_GOPATH}:${GOPATH} ${BIN_DIR}/deepcopy-gen -i ./pkg/apis/controller/v1alpha1/ -O zz_generated.deepcopy -o ../../../../..

images: kube-batch
cp ./_output/bin/kube-batch ./deployment/images/
GOPATH=${ORIG_GOPATH} docker build ./deployment/images -t kubesigs/kube-batch:${RELEASE_VER}
rm -f ./deployment/images/kube-batch

run-test:
# hack/make-rules/test.sh $(WHAT) $(TESTS)

e2e:
# kube-controller
# hack/run-e2e.sh

coverage:
# KUBE_COVER=y hack/make-rules/test.sh $(WHAT) $(TESTS)

clean:
rm -rf _output/
rm -f kar-controllers

set_gopath_to_generate_code: set_gopath_to_generate_code_clean
$(info Make a temporary path to hold the creation of a symbolic link for contrib vendor directory)
mkdir -p ${CONTRIB_VENDOR_GOPATH}
$(info Set symbolic link inside the path of the CONTRIB_VENDOR_GOPATH variable to link to vender directory in contrib)
cd ${CONTRIB_VENDOR_GOPATH} && ln -s ${CONTRIB_VENDOR_GOPATH_SRC_TARGET} src


set_gopath_to_generate_code_clean:
$(info Removing symbolic link to vender directory in contrib)
$(shell if [ "${SYM_LINK_EXISTS}" = "1" ]; then cd ${CONTRIB_VENDOR_GOPATH}; rm src; fi;)
8 changes: 8 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
approvers:
- animeshsingh
- dmatch01
- scostache
reviewers:
- animeshsingh
- dmatch01
- scostache
21 changes: 21 additions & 0 deletions README_orig.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Customized Enhanced QueueJob Controller Contribution
==

This directory is used to manage contribution for an enhanced queuejob controller from vendors.

# Extended Queuejob Controller

The extended queuejob controller `xqueuejob-controller` is a controler to manage batch jobs in Kubernetes, providing mechanisms for applications which would like to run batch jobs leveraging Kubernetes.

Refer to [deployment](deployment/deployment.md) on how to deploy `xqueuejob-controller` as in Kubernetes.

Refer to [tutorial](doc/usage/tutorial.md) on how to use `kube-batch` to run batch job in Kubernetes

## Overall Architecture

![xqueuejob-controler](doc/images/xqueuejob-controller.png)


### Code of conduct

Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md).
171 changes: 171 additions & 0 deletions cluster/lib/logging.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
#!/bin/bash

# Copyright 2014 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.

# Controls verbosity of the script output and logging.
KUBE_VERBOSE="${KUBE_VERBOSE:-5}"

# Handler for when we exit automatically on an error.
# Borrowed from https://gist.github.com/ahendrix/7030300
kube::log::errexit() {
local err="${PIPESTATUS[@]}"

# If the shell we are in doesn't have errexit set (common in subshells) then
# don't dump stacks.
set +o | grep -qe "-o errexit" || return

set +o xtrace
local code="${1:-1}"
# Print out the stack trace described by $function_stack
if [ ${#FUNCNAME[@]} -gt 2 ]
then
kube::log::error "Call tree:"
for ((i=1;i<${#FUNCNAME[@]}-1;i++))
do
kube::log::error " $i: ${BASH_SOURCE[$i+1]}:${BASH_LINENO[$i]} ${FUNCNAME[$i]}(...)"
done
fi
kube::log::error_exit "Error in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}. '${BASH_COMMAND}' exited with status $err" "${1:-1}" 1
}

kube::log::install_errexit() {
# trap ERR to provide an error handler whenever a command exits nonzero this
# is a more verbose version of set -o errexit
trap 'kube::log::errexit' ERR

# setting errtrace allows our ERR trap handler to be propagated to functions,
# expansions and subshells
set -o errtrace
}

# Print out the stack trace
#
# Args:
# $1 The number of stack frames to skip when printing.
kube::log::stack() {
local stack_skip=${1:-0}
stack_skip=$((stack_skip + 1))
if [[ ${#FUNCNAME[@]} -gt $stack_skip ]]; then
echo "Call stack:" >&2
local i
for ((i=1 ; i <= ${#FUNCNAME[@]} - $stack_skip ; i++))
do
local frame_no=$((i - 1 + stack_skip))
local source_file=${BASH_SOURCE[$frame_no]}
local source_lineno=${BASH_LINENO[$((frame_no - 1))]}
local funcname=${FUNCNAME[$frame_no]}
echo " $i: ${source_file}:${source_lineno} ${funcname}(...)" >&2
done
fi
}

# Log an error and exit.
# Args:
# $1 Message to log with the error
# $2 The error code to return
# $3 The number of stack frames to skip when printing.
kube::log::error_exit() {
local message="${1:-}"
local code="${2:-1}"
local stack_skip="${3:-0}"
stack_skip=$((stack_skip + 1))

if [[ ${KUBE_VERBOSE} -ge 4 ]]; then
local source_file=${BASH_SOURCE[$stack_skip]}
local source_line=${BASH_LINENO[$((stack_skip - 1))]}
echo "!!! Error in ${source_file}:${source_line}" >&2
[[ -z ${1-} ]] || {
echo " ${1}" >&2
}

kube::log::stack $stack_skip

echo "Exiting with status ${code}" >&2
fi

exit "${code}"
}

# Log an error but keep going. Don't dump the stack or exit.
kube::log::error() {
timestamp=$(date +"[%m%d %H:%M:%S]")
echo "!!! $timestamp ${1-}" >&2
shift
for message; do
echo " $message" >&2
done
}

# Print an usage message to stderr. The arguments are printed directly.
kube::log::usage() {
echo >&2
local message
for message; do
echo "$message" >&2
done
echo >&2
}

kube::log::usage_from_stdin() {
local messages=()
while read -r line; do
messages+=("$line")
done

kube::log::usage "${messages[@]}"
}

# Print out some info that isn't a top level status line
kube::log::info() {
local V="${V:-0}"
if [[ $KUBE_VERBOSE < $V ]]; then
return
fi

for message; do
echo "$message"
done
}

# Just like kube::log::info, but no \n, so you can make a progress bar
kube::log::progress() {
for message; do
echo -e -n "$message"
done
}

kube::log::info_from_stdin() {
local messages=()
while read -r line; do
messages+=("$line")
done

kube::log::info "${messages[@]}"
}

# Print a status line. Formatted to show up in a stream of output.
kube::log::status() {
local V="${V:-0}"
if [[ $KUBE_VERBOSE < $V ]]; then
return
fi

timestamp=$(date +"[%m%d %H:%M:%S]")
echo "+++ $timestamp $1"
shift
for message; do
echo " $message"
done
}
Loading