commit
710e537dd3
|
@ -28,3 +28,7 @@ debug
|
|||
|
||||
/ark
|
||||
.idea/
|
||||
|
||||
.container-*
|
||||
.vimrc
|
||||
.go
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Copyright 2017 Heptio Inc.
|
||||
# Copyright 2016 The Kubernetes Authors.
|
||||
#
|
||||
# Modifications Copyright 2017 the Heptio Ark contributors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -12,13 +14,11 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM alpine:3.6
|
||||
MAINTAINER Andy Goldstein "andy@heptio.com"
|
||||
FROM ARG_FROM
|
||||
|
||||
RUN apk add --no-cache ca-certificates && \
|
||||
adduser -S -D -H -u 1000 ark
|
||||
MAINTAINER Andy Goldstein <andy@heptio.com>
|
||||
|
||||
ADD _output/bin/ark /ark
|
||||
ADD /bin/ARG_OS/ARG_ARCH/ARG_BIN /ARG_BIN
|
||||
|
||||
USER ark
|
||||
ENTRYPOINT ["/ark"]
|
||||
USER nobody:nobody
|
||||
ENTRYPOINT ["/ARG_BIN"]
|
219
Makefile
219
Makefile
|
@ -1,4 +1,6 @@
|
|||
# Copyright 2017 Heptio Inc.
|
||||
# Copyright 2016 The Kubernetes Authors.
|
||||
#
|
||||
# Modifications Copyright 2017 the Heptio Ark contributors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -12,99 +14,154 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# project related vars
|
||||
ROOT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
PROJECT = ark
|
||||
VERSION ?= v0.4.0
|
||||
GOTARGET = github.com/heptio/$(PROJECT)
|
||||
OUTPUT_DIR = $(ROOT_DIR)/_output
|
||||
BIN_DIR = $(OUTPUT_DIR)/bin
|
||||
GIT_SHA=$(shell git rev-parse --short HEAD)
|
||||
GIT_DIRTY=$(shell git status --porcelain $(ROOT_DIR) 2> /dev/null)
|
||||
ifeq ($(GIT_DIRTY),)
|
||||
GIT_TREE_STATE := clean
|
||||
else
|
||||
GIT_TREE_STATE := dirty
|
||||
endif
|
||||
# The binary to build (just the basename).
|
||||
BIN := ark
|
||||
|
||||
# docker related vars
|
||||
# This repo's root import path (under GOPATH).
|
||||
PKG := github.com/heptio/ark
|
||||
|
||||
# Where to push the docker image.
|
||||
REGISTRY ?= gcr.io/heptio-images
|
||||
BUILD_IMAGE ?= gcr.io/heptio-images/golang:1.8-alpine3.6
|
||||
LDFLAGS = -X $(GOTARGET)/pkg/buildinfo.Version=$(VERSION)
|
||||
LDFLAGS += -X $(GOTARGET)/pkg/buildinfo.DockerImage=$(REGISTRY)/$(PROJECT)
|
||||
LDFLAGS += -X $(GOTARGET)/pkg/buildinfo.GitSHA=$(GIT_SHA)
|
||||
LDFLAGS += -X $(GOTARGET)/pkg/buildinfo.GitTreeState=$(GIT_TREE_STATE)
|
||||
# go build -i installs compiled packages so they can be reused later.
|
||||
# This speeds up recompiles.
|
||||
BUILDCMD = go build -i -v -ldflags "$(LDFLAGS)"
|
||||
BUILDMNT = /go/src/$(GOTARGET)
|
||||
EXTRA_MNTS ?=
|
||||
|
||||
# test related vars
|
||||
TESTARGS ?= -timeout 60s
|
||||
TEST_PKGS ?= ./cmd/... ./pkg/...
|
||||
# Which architecture to build - see $(ALL_ARCH) for options.
|
||||
ARCH ?= linux-amd64
|
||||
|
||||
VERSION ?= master
|
||||
|
||||
###
|
||||
### These variables should not need tweaking.
|
||||
###
|
||||
|
||||
SRC_DIRS := cmd pkg # directories which hold app source (not vendored)
|
||||
|
||||
CLI_PLATFORMS := linux-amd64 linux-arm linux-arm64 darwin-amd64 windows-amd64
|
||||
CONTAINER_PLATFORMS := linux-amd64 linux-arm linux-arm64
|
||||
|
||||
platform_temp = $(subst -, ,$(ARCH))
|
||||
GOOS = $(word 1, $(platform_temp))
|
||||
GOARCH = $(word 2, $(platform_temp))
|
||||
|
||||
BASEIMAGE?=alpine:3.6
|
||||
|
||||
# TODO(ncdc): support multiple image architectures once gcr.io supports manifest lists
|
||||
# Set default base image dynamically for each arch
|
||||
#ifeq ($(GOARCH),amd64)
|
||||
# BASEIMAGE?=alpine:3.6
|
||||
#endif
|
||||
#ifeq ($(GOARCH),arm)
|
||||
# BASEIMAGE?=armel/busybox
|
||||
#endif
|
||||
#ifeq ($(GOARCH),arm64)
|
||||
# BASEIMAGE?=aarch64/busybox
|
||||
#endif
|
||||
|
||||
IMAGE := $(REGISTRY)/$(BIN)
|
||||
|
||||
BUILD_IMAGE ?= gcr.io/heptio-images/golang:1.9-alpine3.6
|
||||
|
||||
# If you want to build all binaries, see the 'all-build' rule.
|
||||
# If you want to build all containers, see the 'all-container' rule.
|
||||
# If you want to build AND push all containers, see the 'all-push' rule.
|
||||
all: build
|
||||
|
||||
build-%:
|
||||
@$(MAKE) --no-print-directory ARCH=$* build
|
||||
|
||||
#container-%:
|
||||
# @$(MAKE) --no-print-directory ARCH=$* container
|
||||
|
||||
#push-%:
|
||||
# @$(MAKE) --no-print-directory ARCH=$* push
|
||||
|
||||
all-build: $(addprefix build-, $(CLI_PLATFORMS))
|
||||
|
||||
#all-container: $(addprefix container-, $(CONTAINER_PLATFORMS))
|
||||
|
||||
#all-push: $(addprefix push-, $(CONTAINER_PLATFORMS))
|
||||
|
||||
build: _output/bin/$(GOOS)/$(GOARCH)/$(BIN)
|
||||
|
||||
_output/bin/$(GOOS)/$(GOARCH)/$(BIN): build-dirs
|
||||
@echo "building: $@"
|
||||
@$(MAKE) shell CMD="-c '\
|
||||
GOOS=$(GOOS) \
|
||||
GOARCH=$(GOARCH) \
|
||||
VERSION=$(VERSION) \
|
||||
PKG=$(PKG) \
|
||||
BIN=$(BIN) \
|
||||
./hack/build.sh'"
|
||||
|
||||
TTY := $(shell tty -s && echo "-t")
|
||||
|
||||
# Example: make shell CMD="date > datefile"
|
||||
shell: build-dirs
|
||||
@docker run \
|
||||
-i $(TTY) \
|
||||
--rm \
|
||||
-u $$(id -u):$$(id -g) \
|
||||
-v "$$(pwd)/.go/pkg:/go/pkg" \
|
||||
-v "$$(pwd)/.go/src:/go/src" \
|
||||
-v "$$(pwd)/.go/std:/go/std" \
|
||||
-v "$$(pwd):/go/src/$(PKG)" \
|
||||
-v "$$(pwd)/_output/bin:/output" \
|
||||
-v "$$(pwd)/.go/std/$(GOOS)/$(GOARCH):/usr/local/go/pkg/$(GOOS)_$(GOARCH)_static" \
|
||||
-w /go/src/$(PKG) \
|
||||
$(BUILD_IMAGE) \
|
||||
/bin/sh $(CMD)
|
||||
|
||||
DOTFILE_IMAGE = $(subst :,_,$(subst /,_,$(IMAGE))-$(VERSION))
|
||||
|
||||
container: verify test .container-$(DOTFILE_IMAGE) container-name
|
||||
.container-$(DOTFILE_IMAGE): _output/bin/$(GOOS)/$(GOARCH)/$(BIN) Dockerfile.in
|
||||
@sed \
|
||||
-e 's|ARG_BIN|$(BIN)|g' \
|
||||
-e 's|ARG_OS|$(GOOS)|g' \
|
||||
-e 's|ARG_ARCH|$(GOARCH)|g' \
|
||||
-e 's|ARG_FROM|$(BASEIMAGE)|g' \
|
||||
Dockerfile.in > _output/.dockerfile-$(GOOS)-$(GOARCH)
|
||||
@docker build -t $(IMAGE):$(VERSION) -f _output/.dockerfile-$(GOOS)-$(GOARCH) _output
|
||||
@docker images -q $(IMAGE):$(VERSION) > $@
|
||||
|
||||
container-name:
|
||||
@echo "container: $(IMAGE):$(VERSION)"
|
||||
|
||||
push: .push-$(DOTFILE_IMAGE) push-name
|
||||
.push-$(DOTFILE_IMAGE): .container-$(DOTFILE_IMAGE)
|
||||
ifeq ($(findstring gcr.io,$(REGISTRY)),gcr.io)
|
||||
@gcloud docker -- push $(IMAGE):$(VERSION)
|
||||
else
|
||||
@docker push $(IMAGE):$(VERSION)
|
||||
endif
|
||||
@docker images -q $(IMAGE):$(VERSION) > $@
|
||||
|
||||
push-name:
|
||||
@echo "pushed: $(IMAGE):$(VERSION)"
|
||||
|
||||
SKIP_TESTS ?=
|
||||
|
||||
# what we're building
|
||||
BINARIES = ark
|
||||
|
||||
local: $(BINARIES)
|
||||
|
||||
$(BINARIES):
|
||||
mkdir -p $(BIN_DIR)
|
||||
$(BUILDCMD) -o $(BIN_DIR)/$@ $(GOTARGET)/cmd/$@
|
||||
test: build-dirs
|
||||
ifneq ($(SKIP_TESTS), 1)
|
||||
@$(MAKE) shell CMD="-c 'hack/test.sh $(SRC_DIRS)'"
|
||||
endif
|
||||
|
||||
fmt:
|
||||
gofmt -w=true $$(find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./pkg/generated/*")
|
||||
goimports -w=true -d $$(find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./pkg/generated/*")
|
||||
|
||||
test:
|
||||
ifneq ($(SKIP_TESTS), 1)
|
||||
# go test -i installs compiled packages so they can be reused later
|
||||
# This speeds up retests.
|
||||
go test -i -v $(TEST_PKGS)
|
||||
go test $(TEST_PKGS) $(TESTARGS)
|
||||
endif
|
||||
@$(MAKE) shell CMD="-c 'hack/update-fmt.sh'"
|
||||
|
||||
verify:
|
||||
ifneq ($(SKIP_TESTS), 1)
|
||||
${ROOT_DIR}/hack/verify-generated-docs.sh
|
||||
${ROOT_DIR}/hack/verify-generated-clientsets.sh
|
||||
${ROOT_DIR}/hack/verify-generated-listers.sh
|
||||
${ROOT_DIR}/hack/verify-generated-informers.sh
|
||||
@$(MAKE) shell CMD="-c 'hack/verify-all.sh'"
|
||||
endif
|
||||
|
||||
update: fmt
|
||||
${ROOT_DIR}/hack/update-generated-clientsets.sh
|
||||
${ROOT_DIR}/hack/update-generated-listers.sh
|
||||
${ROOT_DIR}/hack/update-generated-informers.sh
|
||||
${ROOT_DIR}/hack/update-generated-docs.sh
|
||||
@$(MAKE) shell CMD="-c 'hack/update-all.sh'"
|
||||
|
||||
all: cbuild container
|
||||
build-dirs:
|
||||
@mkdir -p _output/bin/$(GOOS)/$(GOARCH)
|
||||
@mkdir -p .go/src/$(PKG) .go/pkg .go/bin .go/std/$(GOOS)/$(GOARCH)
|
||||
|
||||
cbuild:
|
||||
@docker run --rm \
|
||||
-v $(ROOT_DIR):$(BUILDMNT) \
|
||||
$(EXTRA_MNTS) \
|
||||
-w $(BUILDMNT) \
|
||||
-e SKIP_TESTS=$(SKIP_TESTS) \
|
||||
$(BUILD_IMAGE) \
|
||||
/bin/sh -c " \
|
||||
VERSION=$(VERSION) \
|
||||
make local verify test \
|
||||
"
|
||||
clean: container-clean bin-clean
|
||||
|
||||
container: cbuild
|
||||
@docker build -t $(REGISTRY)/$(PROJECT):latest -t $(REGISTRY)/$(PROJECT):$(VERSION) .
|
||||
container-clean:
|
||||
rm -rf .container-* _output/.dockerfile-* .push-*
|
||||
|
||||
container-local: $(BINARIES)
|
||||
@docker build -t $(REGISTRY)/$(PROJECT):latest -t $(REGISTRY)/$(PROJECT):$(VERSION) .
|
||||
|
||||
push:
|
||||
docker -- push $(REGISTRY)/$(PROJECT):$(VERSION)
|
||||
|
||||
.PHONY: all local container cbuild push test verify update fmt $(BINARIES)
|
||||
|
||||
clean:
|
||||
rm -rf $(OUTPUT_DIR)
|
||||
@docker rmi $(REGISTRY)/$(PROJECT):latest $(REGISTRY)/$(PROJECT):$(VERSION) 2>/dev/null || :
|
||||
bin-clean:
|
||||
rm -rf .go _output
|
||||
|
|
10
README.md
10
README.md
|
@ -76,12 +76,9 @@ kubectl get deployments -l component=ark --namespace=heptio-ark
|
|||
kubectl get deployments --namespace=nginx-example
|
||||
```
|
||||
|
||||
Finally, create an alias for the Ark client's Docker executable. (Make sure that your `KUBECONFIG` environment variable is pointing at the proper config first). This will save a lot of future typing:
|
||||
|
||||
```
|
||||
alias ark='docker run --rm -u $(id -u) -v $(dirname $KUBECONFIG):/kubeconfig -e KUBECONFIG=/kubeconfig/$(basename $KUBECONFIG) gcr.io/heptio-images/ark:latest'
|
||||
```
|
||||
*NOTE*: Depending on how your Kubeconfig is written--if it refers to the Kubernetes API server using the host machine's `localhost`, for instance--you may need to add an additional `--net="host"` flag to the `docker run` command.
|
||||
Finally, install the Ark client somehwere in your `$PATH`:
|
||||
* [Download a pre-built release][26], or
|
||||
* [Build it from scratch][7]
|
||||
|
||||
|
||||
### 3. Back up and restore
|
||||
|
@ -212,3 +209,4 @@ See [the list of releases][6] to find out about feature changes.
|
|||
[23]: /docs/cloud-provider-specifics.md
|
||||
[24]: http://j.hept.io/ark-list
|
||||
[25]: http://slack.kubernetes.io/
|
||||
[26]: https://github.com/heptio/ark/releases
|
||||
|
|
|
@ -5,8 +5,9 @@ While the [README][0] pulls from the Heptio image registry, you can also build y
|
|||
* [0. Prerequisites][1]
|
||||
* [1. Download][2]
|
||||
* [2. Build][3]
|
||||
* [3. Run][7]
|
||||
* [4. Vendoring dependencies][10]
|
||||
* [3. Test][12]
|
||||
* [4. Run][7]
|
||||
* [5. Vendoring dependencies][10]
|
||||
|
||||
## 0. Prerequisites
|
||||
|
||||
|
@ -30,12 +31,46 @@ Set the `$REGISTRY` environment variable (used in the `Makefile`) if you want to
|
|||
|
||||
Run the following in the Ark root directory to build your container with the tag `$REGISTRY/$PROJECT:$VERSION`:
|
||||
```
|
||||
sudo make all
|
||||
make container
|
||||
```
|
||||
|
||||
To push your image to a registry, use `make push`.
|
||||
|
||||
## 3. Run
|
||||
### Updating generated files
|
||||
|
||||
There are several files that are automatically generated based on the source code in the repository.
|
||||
These include:
|
||||
* The clientset
|
||||
* Listers
|
||||
* Shared informers
|
||||
* Documentation
|
||||
|
||||
If you make any of the following changes, you will need to run `make update` to regenerate
|
||||
automatically generated files:
|
||||
* Add/edit/remove command line flags and/or their help text
|
||||
* Add/edit/remove commands or subcommands
|
||||
* Add new API types
|
||||
|
||||
### Cross compiling
|
||||
|
||||
By default, `make` will build an `ark` binary that runs on your host operating system and
|
||||
architecture. If you want to build for another platform, you can do so with `make
|
||||
build-<GOOS>-<GOARCH` - for example, to build for the Mac, you would do `make build-darwin-amd64`.
|
||||
All binaries are placed in `_output/bin/<GOOS>/<GOARCH>`, e.g. `_output/bin/darwin/amd64/ark`.
|
||||
|
||||
Ark's `Makefile` has a convenience target, `all-build`, that builds the following platforms:
|
||||
* linux-amd64
|
||||
* linux-arm
|
||||
* linux-arm64
|
||||
* darwin-amd64
|
||||
* windows-amd64
|
||||
|
||||
## 3. Test
|
||||
|
||||
To run unit tests, use `make test`. You can also run `make verify` to ensure that all generated
|
||||
files (clientset, listers, shared informers, docs) are up to date.
|
||||
|
||||
## 4. Run
|
||||
|
||||
### Considerations
|
||||
|
||||
|
@ -58,7 +93,7 @@ kubectl set image deployment/ark ark=$REGISTRY/$PROJECT:$VERSION
|
|||
```
|
||||
where `$REGISTRY`, `$PROJECT`, and `$VERSION` match what you used in the [build step][3].
|
||||
|
||||
## 4. Vendoring dependencies
|
||||
## 5. Vendoring dependencies
|
||||
If you need to add or update the vendored dependencies, please see [Vendoring dependencies][11].
|
||||
|
||||
[0]: ../README.md
|
||||
|
@ -68,8 +103,9 @@ If you need to add or update the vendored dependencies, please see [Vendoring de
|
|||
[4]: ../README.md#quickstart
|
||||
[5]: https://golang.org/doc/install
|
||||
[6]: /examples
|
||||
[7]: #3-run
|
||||
[7]: #4-run
|
||||
[8]: reference.md#ark-config-definition
|
||||
[9]: cloud-provider-specifics.md
|
||||
[10]: #4-vendoring-dependencies
|
||||
[11]: vendoring-dependencies.md
|
||||
[12]: #3-test
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Copyright 2016 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
|
||||
|
||||
if [ -z "${PKG}" ]; then
|
||||
echo "PKG must be set"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${BIN}" ]; then
|
||||
echo "BIN must be set"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${GOOS}" ]; then
|
||||
echo "GOOS must be set"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${GOARCH}" ]; then
|
||||
echo "GOARCH must be set"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${VERSION}" ]; then
|
||||
echo "VERSION must be set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export CGO_ENABLED=0
|
||||
|
||||
GIT_SHA=$(git describe --tags --always)
|
||||
GIT_DIRTY=$(git status --porcelain 2> /dev/null)
|
||||
if [[ -z "${GIT_DIRTY}" ]]; then
|
||||
GIT_TREE_STATE=clean
|
||||
else
|
||||
GIT_TREE_STATE=dirty
|
||||
fi
|
||||
|
||||
LDFLAGS="-X ${PKG}/pkg/buildinfo.Version=${VERSION}"
|
||||
LDFLAGS="${LDFLAGS} -X ${PKG}/pkg/buildinfo.GitSHA=${GIT_SHA}"
|
||||
LDFLAGS="${LDFLAGS} -X ${PKG}/pkg/buildinfo.GitTreeState=${GIT_TREE_STATE}"
|
||||
|
||||
OUTPUT=/output/${GOOS}/${GOARCH}/${BIN}
|
||||
if [[ "${GOOS}" = "windows" ]]; then
|
||||
OUTPUT="${OUTPUT}.exe"
|
||||
fi
|
||||
|
||||
go build -i \
|
||||
-o ${OUTPUT} \
|
||||
-installsuffix "static" \
|
||||
-ldflags "${LDFLAGS}" \
|
||||
${PKG}/cmd/${BIN}
|
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Copyright 2016 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
|
||||
|
||||
export CGO_ENABLED=0
|
||||
|
||||
TARGETS=$(for d in "$@"; do echo ./$d/...; done)
|
||||
|
||||
echo "Running tests:"
|
||||
go test -i -installsuffix "static" ${TARGETS}
|
||||
go test -installsuffix "static" -timeout 60s ${TARGETS}
|
||||
echo
|
||||
|
||||
echo -n "Checking gofmt: "
|
||||
ERRS=$(find "$@" -type f -name \*.go | xargs gofmt -l 2>&1 || true)
|
||||
if [ -n "${ERRS}" ]; then
|
||||
echo "FAIL - the following files need to be gofmt'ed:"
|
||||
for e in ${ERRS}; do
|
||||
echo " $e"
|
||||
done
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo "PASS"
|
||||
echo
|
||||
|
||||
# TODO(ncdc): there are govet failures in the generated clientset and the log error location hook
|
||||
# that prevent us from running vet at this time.
|
||||
#
|
||||
# echo -n "Checking go vet: "
|
||||
# ERRS=$(go vet ${TARGETS} 2>&1 || true)
|
||||
# if [ -n "${ERRS}" ]; then
|
||||
# echo "FAIL"
|
||||
# echo "${ERRS}"
|
||||
# echo
|
||||
# exit 1
|
||||
# fi
|
||||
# echo "PASS"
|
||||
# echo
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash -e
|
||||
#
|
||||
# Copyright 2017 the Heptio Ark contributors.
|
||||
#
|
||||
# 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.
|
||||
|
||||
HACK_DIR=$(dirname "${BASH_SOURCE}")
|
||||
|
||||
echo "Running all update scripts"
|
||||
|
||||
for f in ${HACK_DIR}/update-*.sh; do
|
||||
if [[ $f = "${HACK_DIR}/update-all.sh" ]]; then
|
||||
continue
|
||||
fi
|
||||
$f
|
||||
done
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash -e
|
||||
#
|
||||
# Copyright 2017 the Heptio Ark contributors.
|
||||
#
|
||||
# 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.
|
||||
|
||||
HACK_DIR=$(dirname "${BASH_SOURCE}")
|
||||
|
||||
echo "Updating formatting"
|
||||
|
||||
gofmt -w=true $(find . -type f -name "*.go" -not -path "./vendor/*" -not -path "./pkg/generated/*")
|
||||
goimports -w=true -d $(find . -type f -name "*.go" -not -path "./vendor/*" -not -path "./pkg/generated/*")
|
||||
|
||||
echo "Success!"
|
|
@ -35,6 +35,8 @@ for i in "$@"; do
|
|||
done
|
||||
|
||||
if [[ -z ${verify} ]]; then
|
||||
echo "Updating generated clientsets"
|
||||
|
||||
find ${ARK_ROOT}/pkg/generated/clientset \
|
||||
\( \
|
||||
-name '*.go' -and \
|
||||
|
@ -54,3 +56,5 @@ ${BIN}/client-gen \
|
|||
--input ark/v1 \
|
||||
--clientset-name clientset \
|
||||
$@
|
||||
|
||||
echo "Success!"
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
ARK_ROOT=$(realpath $(dirname ${BASH_SOURCE})/..)
|
||||
BIN=${ARK_ROOT}/_output/bin
|
||||
mkdir -p ${BIN}
|
||||
|
||||
echo "Updating generated docs"
|
||||
|
||||
go build -o ${BIN}/docs-gen ./docs/generate/ark.go
|
||||
|
||||
if [[ $# -gt 1 ]]; then
|
||||
|
@ -30,3 +33,5 @@ if [[ -z "${OUTPUT_DIR}" ]]; then
|
|||
fi
|
||||
|
||||
${BIN}/docs-gen ark ${OUTPUT_DIR}
|
||||
|
||||
echo "Success!"
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
ARK_ROOT=$(realpath $(dirname ${BASH_SOURCE})/..)
|
||||
BIN=${ARK_ROOT}/_output/bin
|
||||
mkdir -p ${BIN}
|
||||
|
||||
echo "Updating generated informers"
|
||||
|
||||
go build -o ${BIN}/informer-gen ./vendor/k8s.io/kubernetes/cmd/libs/go2idl/informer-gen
|
||||
|
||||
OUTPUT_BASE=""
|
||||
|
@ -48,3 +51,5 @@ ${BIN}/informer-gen \
|
|||
--internal-clientset-package github.com/heptio/ark/pkg/generated/clientset \
|
||||
--versioned-clientset-package github.com/heptio/ark/pkg/generated/clientset \
|
||||
$@
|
||||
|
||||
echo "Success!"
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
ARK_ROOT=$(realpath $(dirname ${BASH_SOURCE})/..)
|
||||
BIN=${ARK_ROOT}/_output/bin
|
||||
mkdir -p ${BIN}
|
||||
|
||||
echo "Updating generated listers"
|
||||
|
||||
go build -o ${BIN}/lister-gen ./vendor/k8s.io/kubernetes/cmd/libs/go2idl/lister-gen
|
||||
|
||||
OUTPUT_BASE=""
|
||||
|
@ -53,3 +56,5 @@ ${BIN}/lister-gen \
|
|||
--input-dirs github.com/heptio/ark/pkg/apis/ark/v1 \
|
||||
--output-package github.com/heptio/ark/pkg/generated/listers \
|
||||
$@
|
||||
|
||||
echo "Success!"
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash -e
|
||||
#
|
||||
# Copyright 2017 the Heptio Ark contributors.
|
||||
#
|
||||
# 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.
|
||||
|
||||
HACK_DIR=$(dirname "${BASH_SOURCE}")
|
||||
|
||||
echo "Running all verification scripts"
|
||||
|
||||
for f in ${HACK_DIR}/verify-*.sh; do
|
||||
if [[ $f = "${HACK_DIR}/verify-all.sh" ]]; then
|
||||
continue
|
||||
fi
|
||||
$f
|
||||
done
|
|
@ -15,8 +15,13 @@
|
|||
# limitations under the License.
|
||||
|
||||
HACK_DIR=$(dirname "${BASH_SOURCE}")
|
||||
|
||||
echo "Verifying generated clientsets"
|
||||
|
||||
if ! output=$(${HACK_DIR}/update-generated-clientsets.sh --verify-only 2>&1); then
|
||||
echo "FAILURE: verification of clientsets failed:"
|
||||
echo "${output}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Success!"
|
||||
|
|
|
@ -25,7 +25,9 @@ cleanup() {
|
|||
rm -rf ${TMP_DIR}
|
||||
}
|
||||
|
||||
${HACK_DIR}/update-generated-docs.sh ${TMP_DIR}
|
||||
echo "Verifying generated docs"
|
||||
|
||||
${HACK_DIR}/update-generated-docs.sh ${TMP_DIR} > /dev/null
|
||||
|
||||
exclude_file="README.md"
|
||||
output=$(echo "`diff -r ${DOCS_DIR} ${TMP_DIR}`" | sed "/${exclude_file}/d")
|
||||
|
@ -35,3 +37,5 @@ if [[ -n "${output}" ]] ; then
|
|||
echo "${output}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Success!"
|
||||
|
|
|
@ -15,8 +15,13 @@
|
|||
# limitations under the License.
|
||||
|
||||
HACK_DIR=$(dirname "${BASH_SOURCE}")
|
||||
|
||||
echo "Verifying generated informers"
|
||||
|
||||
if ! output=$(${HACK_DIR}/update-generated-informers.sh --verify-only 2>&1); then
|
||||
echo "FAILURE: verification of informers failed:"
|
||||
echo "${output}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Success!"
|
||||
|
|
|
@ -15,8 +15,13 @@
|
|||
# limitations under the License.
|
||||
|
||||
HACK_DIR=$(dirname "${BASH_SOURCE}")
|
||||
|
||||
echo "Verifying generated listers"
|
||||
|
||||
if ! output=$(${HACK_DIR}/update-generated-listers.sh --verify-only 2>&1); then
|
||||
echo "FAILURE: verification of listers failed:"
|
||||
echo "${output}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Success!"
|
||||
|
|
|
@ -25,10 +25,6 @@ var (
|
|||
// Version is the current version of Ark, set by the go linker's -X flag at build time.
|
||||
Version string
|
||||
|
||||
// DockerImage is the full path to the docker image for this build, for example
|
||||
// gcr.io/heptio-images/ark.
|
||||
DockerImage string
|
||||
|
||||
// GitSHA is the actual commit that is being built, set by the go linker's -X flag at build time.
|
||||
GitSHA string
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ func NewCommand() *cobra.Command {
|
|||
fmt.Printf("Version: %s\n", buildinfo.Version)
|
||||
fmt.Printf("Git commit: %s\n", buildinfo.GitSHA)
|
||||
fmt.Printf("Git tree state: %s\n", buildinfo.GitTreeState)
|
||||
fmt.Println("Configured docker image:", buildinfo.DockerImage)
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue