Switching airshipctl and krm-functions to kustomize 4.2.0
Reworked build process of dependent krm functions to use the latest airshipctl Change-Id: If4c7f992123b86442980f381ae69fb003f4851e3
This commit is contained in:
parent
ab55bc5e86
commit
37c2854cce
@ -1,4 +1,4 @@
|
||||
ARG GO_IMAGE=gcr.io/gcp-runtimes/go1-builder:1.15
|
||||
ARG GO_IMAGE=amd64/golang:1.16.6-buster
|
||||
ARG RELEASE_IMAGE=scratch
|
||||
FROM ${GO_IMAGE} as builder
|
||||
|
||||
|
284
Makefile
284
Makefile
@ -14,9 +14,6 @@ endif
|
||||
|
||||
# Produce CRDs that work back to Kubernetes 1.16
|
||||
CRD_OPTIONS ?= crd:crdVersions=v1
|
||||
|
||||
BINDIR := bin
|
||||
EXECUTABLE_CLI := airshipctl
|
||||
TOOLBINDIR := tools/bin
|
||||
|
||||
# linting
|
||||
@ -36,19 +33,6 @@ DOCKER_IMAGE_TAG ?= latest
|
||||
DOCKER_IMAGE ?= $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
|
||||
DOCKER_TARGET_STAGE ?= release
|
||||
PUBLISH ?= false
|
||||
# use this variables to override base images in internal build process
|
||||
ifneq ($(strip $(DOCKER_BASE_GO_IMAGE)),)
|
||||
DOCKER_CMD_FLAGS += --build-arg GO_IMAGE=$(strip $(DOCKER_BASE_GO_IMAGE))
|
||||
endif
|
||||
ifneq ($(strip $(DOCKER_BASE_RELEASE_IMAGE)),)
|
||||
DOCKER_CMD_FLAGS += --build-arg RELEASE_IMAGE=$(strip $(DOCKER_BASE_RELEASE_IMAGE))
|
||||
endif
|
||||
ifneq ($(strip $(DOCKER_IMAGE_ENTRYPOINT)),)
|
||||
DOCKER_CMD_FLAGS += --build-arg ENTRYPOINT=$(strip $(DOCKER_IMAGE_ENTRYPOINT))
|
||||
endif
|
||||
ifneq ($(strip $(GOPROXY)),)
|
||||
DOCKER_CMD_FLAGS += --build-arg GOPROXY=$(strip $(GOPROXY))
|
||||
endif
|
||||
# use this variable for image labels added in internal build process
|
||||
COMMIT ?= $(shell git rev-parse HEAD)
|
||||
LABEL ?= org.airshipit.build=community
|
||||
@ -72,16 +56,16 @@ USE_PROXY ?= false
|
||||
# docker build flags
|
||||
DOCKER_CMD_FLAGS += --network=host
|
||||
DOCKER_CMD_FLAGS += --force-rm=$(DOCKER_FORCE_CLEAN)
|
||||
|
||||
DOCKER_PROXY_FLAGS := --build-arg http_proxy=$(PROXY)
|
||||
DOCKER_PROXY_FLAGS += --build-arg https_proxy=$(PROXY)
|
||||
DOCKER_PROXY_FLAGS += --build-arg HTTP_PROXY=$(PROXY)
|
||||
DOCKER_PROXY_FLAGS += --build-arg HTTPS_PROXY=$(PROXY)
|
||||
DOCKER_PROXY_FLAGS += --build-arg no_proxy=$(NO_PROXY)
|
||||
DOCKER_PROXY_FLAGS += --build-arg NO_PROXY=$(NO_PROXY)
|
||||
|
||||
ifeq ($(USE_PROXY), true)
|
||||
DOCKER_CMD_FLAGS += $(DOCKER_PROXY_FLAGS)
|
||||
DOCKER_CMD_FLAGS += --build-arg http_proxy=$(PROXY)
|
||||
DOCKER_CMD_FLAGS += --build-arg https_proxy=$(PROXY)
|
||||
DOCKER_CMD_FLAGS += --build-arg HTTP_PROXY=$(PROXY)
|
||||
DOCKER_CMD_FLAGS += --build-arg HTTPS_PROXY=$(PROXY)
|
||||
DOCKER_CMD_FLAGS += --build-arg no_proxy=$(NO_PROXY)
|
||||
DOCKER_CMD_FLAGS += --build-arg NO_PROXY=$(NO_PROXY)
|
||||
endif
|
||||
ifneq ($(strip $(GOPROXY)),)
|
||||
DOCKER_CMD_FLAGS += --build-arg GOPROXY=$(strip $(GOPROXY))
|
||||
endif
|
||||
|
||||
# Godoc server options
|
||||
@ -96,34 +80,157 @@ export KIND_URL ?= https://kind.sigs.k8s.io/dl/v0.8.1/kind-$(UNAME)-amd64
|
||||
KUBECTL_VERSION ?= v1.18.6
|
||||
export KUBECTL_URL ?= https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl
|
||||
|
||||
# Plugins options
|
||||
PLUGINS_DIR := krm-functions
|
||||
PLUGINS := $(subst $(PLUGINS_DIR)/,,$(wildcard $(PLUGINS_DIR)/*))
|
||||
# use this variables to override base images in internal build process
|
||||
ifneq ($(strip $(DOCKER_BASE_PLUGINS_BUILD_IMAGE)),)
|
||||
DOCKER_CMD_FLAGS += --build-arg PLUGINS_BUILD_IMAGE=$(strip $(DOCKER_BASE_PLUGINS_BUILD_IMAGE))
|
||||
endif
|
||||
ifneq ($(strip $(DOCKER_BASE_PLUGINS_RELEASE_IMAGE)),)
|
||||
DOCKER_CMD_FLAGS += --build-arg PLUGINS_RELEASE_IMAGE=$(strip $(DOCKER_BASE_PLUGINS_RELEASE_IMAGE))
|
||||
endif
|
||||
|
||||
|
||||
$(PLUGINS):
|
||||
@CGO_ENABLED=0 go build -o $(BINDIR)/$@ $(GO_FLAGS) ./$(PLUGINS_DIR)/$@/
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
@go mod download
|
||||
|
||||
.PHONY: build
|
||||
build: depend
|
||||
@CGO_ENABLED=0 go build -o $(BINDIR)/$(EXECUTABLE_CLI) $(GO_FLAGS)
|
||||
|
||||
.PHONY: install
|
||||
install: depend
|
||||
install:
|
||||
@CGO_ENABLED=0 go install .
|
||||
|
||||
# Core of build logic
|
||||
BIN_DIR := bin
|
||||
BIN_SRC_DIR := krm-functions
|
||||
BINS := airshipctl $(subst $(BIN_SRC_DIR)/,,$(wildcard $(BIN_SRC_DIR)/*))
|
||||
IMGS := $(BINS)
|
||||
|
||||
# This section sets the settings for different subcomponents
|
||||
|
||||
# airshipctl is a special case - we need to override it manually:
|
||||
# its makefile target for image is 'docker-image' - others have
|
||||
# docker-image-<name of component> targets
|
||||
airshipctl_IMG_TGT_NAME:=docker-image
|
||||
# its main.go is in the root of repo - others have main.go in
|
||||
# $(BIN_SRC_DIR)/<name of component>/main.go
|
||||
airshipctl_FROM_PATH:=.
|
||||
# and its Dockerfile is also in the root of repo - others have Dockerfile in
|
||||
# $(BIN_SRC_DIR)/<name of component>/Dockerfile
|
||||
docker-image_DOCKERFILE:=Dockerfile
|
||||
|
||||
# kubeval-validator, toolbox and toolbox-virsh don't depend on
|
||||
# airshipctl repo. Their Dockerfiles don't
|
||||
# need to be called from the root of the repo.
|
||||
kubeval-validator_IS_INDEPENDED:=true
|
||||
clusterctl_IS_INDEPENDED:=true
|
||||
toolbox-virsh_IS_INDEPENDED:=true
|
||||
# in addition toolbox-virsh docker image needs toolbox docker image to be built first
|
||||
docker-image-toolbox-virsh_DEPENDENCY:=docker-image-toolbox
|
||||
|
||||
# The template that generates targets for creating binaries per component:
|
||||
# Targets will be generated only for components that depend on airshipctl repo (part of that go module)
|
||||
# Note: expressions with ?= won't be executed if the values of that variable was already set to it.
|
||||
# Using that syntax it's possible to build values overrides for components.
|
||||
# Note 2: $$ is needed to instruct make-engine that variable should be used after template rendering.
|
||||
# When template is rendered all $ will be rendered in the template and $$ will be converted to $, e.g.
|
||||
# if we call map_binary_defaults_tmpl for airshipctl $1 will be converted to 'airshipctl' and we'll get
|
||||
# ifneq ($(airshipctl_IS_INDEPENDED),true)
|
||||
# arishipctl_FROM_PATH?=$(BIN_SRC_DIR)/airshipctl/main.go
|
||||
# ...
|
||||
# since we defining arishipctl_FROM_PATH above, and ?= is used in the 2nd line
|
||||
# arishipctl_FROM_PATH will stay the same as it was defined above.
|
||||
define map_binary_defaults_tmpl
|
||||
ifneq ($$($1_IS_INDEPENDED),true)
|
||||
$1_FROM_PATH?=$$(BIN_SRC_DIR)/$1/main.go
|
||||
|
||||
$$(warning Adding dynamic target $$(BIN_DIR)/$1)
|
||||
$$(BIN_DIR)/$1: $$($1_FROM_PATH) depend
|
||||
@CGO_ENABLED=0 go build -o $$@ $$(GO_FLAGS) $$<
|
||||
|
||||
$$(warning Adding dynamic target $1)
|
||||
.PHONY: $1
|
||||
$1: $$(BIN_DIR)/$1
|
||||
|
||||
build: $1
|
||||
endif
|
||||
endef
|
||||
map_binary_defaults = $(eval $(call map_binary_defaults_tmpl,$1))
|
||||
# Go through all components and generate binary targets for each of them
|
||||
$(foreach bin,$(BINS),$(call map_binary_defaults,$(bin)))
|
||||
|
||||
.PHONY: images
|
||||
.PHONY: images-publish
|
||||
|
||||
# The template that generates targets for creating images per components
|
||||
# There is a special logic to handle per-components overrides
|
||||
# 2 targets will be generated per component: docker-image-<component name> (possible to override)
|
||||
# and docker-image-<component name>-publish
|
||||
define map_image_defaults_tmpl
|
||||
$1_IMG_TGT_NAME?=docker-image-$1
|
||||
|
||||
$$($1_IMG_TGT_NAME)_DOCKERTGT?=$$(DOCKER_TARGET_STAGE)
|
||||
$$($1_IMG_TGT_NAME)_DOCKERFILE?=$$(BIN_SRC_DIR)/$1/Dockerfile
|
||||
$$($1_IMG_TGT_NAME)_MAKETGT?=$$(BIN_DIR)/$1
|
||||
|
||||
ifeq ($$($1_IS_INDEPENDED),true)
|
||||
$$($1_IMG_TGT_NAME)_DOCKERROOT?=$$(BIN_SRC_DIR)/$1
|
||||
else
|
||||
$$($1_IMG_TGT_NAME)_DOCKERROOT?=.
|
||||
endif
|
||||
|
||||
ifneq ($1,airshipctl)
|
||||
ifneq ($$(origin DOCKER_BASE_PLUGINS_GO_IMAGE), undefined)
|
||||
$$($1_IMG_TGT_NAME)_BASE_GO_IMAGE?=$$(DOCKER_BASE_PLUGINS_GO_IMAGE)
|
||||
endif
|
||||
endif
|
||||
$$($1_IMG_TGT_NAME)_BASE_GO_IMAGE?=$$(DOCKER_BASE_GO_IMAGE)
|
||||
ifneq ($$(strip $$($$($1_IMG_TGT_NAME)_BASE_GO_IMAGE)),)
|
||||
$$($1_IMG_TGT_NAME)_BUILD_ARG += GO_IMAGE=$$($$($1_IMG_TGT_NAME)_BASE_GO_IMAGE)
|
||||
endif
|
||||
|
||||
ifneq ($1,airshipctl)
|
||||
ifneq ($$(origin DOCKER_BASE_PLUGINS_BUILD_IMAGE), undefined)
|
||||
$$($1_IMG_TGT_NAME)_BASE_BUILD_IMAGE?=$$(DOCKER_BASE_PLUGINS_BUILD_IMAGE)
|
||||
endif
|
||||
endif
|
||||
$$($1_IMG_TGT_NAME)_BASE_BUILD_IMAGE?=$$(DOCKER_BASE_BUILD_IMAGE)
|
||||
ifneq ($$(strip $$($$($1_IMG_TGT_NAME)_BASE_BUILD_IMAGE)),)
|
||||
$$($1_IMG_TGT_NAME)_BUILD_ARG += BUILD_IMAGE=$$($$($1_IMG_TGT_NAME)_BASE_BUILD_IMAGE)
|
||||
endif
|
||||
|
||||
ifneq ($1,airshipctl)
|
||||
ifneq ($$(origin DOCKER_BASE_PLUGINS_RELEASE_IMAGE), undefined)
|
||||
$$($1_IMG_TGT_NAME)_BASE_RELEASE_IMAGE?=$$(DOCKER_BASE_PLUGINS_RELEASE_IMAGE)
|
||||
endif
|
||||
endif
|
||||
$$($1_IMG_TGT_NAME)_BASE_RELEASE_IMAGE?=$$(DOCKER_BASE_RELEASE_IMAGE)
|
||||
ifneq ($$(strip $$($$($1_IMG_TGT_NAME)_BASE_RELEASE_IMAGE)),)
|
||||
$$($1_IMG_TGT_NAME)_BUILD_ARG += RELEASE_IMAGE=$$($$($1_IMG_TGT_NAME)_BASE_RELEASE_IMAGE)
|
||||
endif
|
||||
|
||||
$$(warning Adding dynamic target $$($1_IMG_TGT_NAME))
|
||||
.PHONY: $$($1_IMG_TGT_NAME)
|
||||
$$($1_IMG_TGT_NAME): $$($$($1_IMG_TGT_NAME)_DEPENDENCY)
|
||||
docker build $$($$($1_IMG_TGT_NAME)_DOCKERROOT) $$(DOCKER_CMD_FLAGS)\
|
||||
--file $$($$($1_IMG_TGT_NAME)_DOCKERFILE) \
|
||||
--label $$(LABEL) \
|
||||
--label "org.opencontainers.image.revision=$$(COMMIT)" \
|
||||
--label "org.opencontainers.image.created=$$(shell date --rfc-3339=seconds --utc)" \
|
||||
--label "org.opencontainers.image.title=$1" \
|
||||
--target $$($$($1_IMG_TGT_NAME)_DOCKERTGT) \
|
||||
$$(addprefix --build-arg ,$$($$($1_IMG_TGT_NAME)_BUILD_ARG)) \
|
||||
--build-arg MAKE_TARGET=$$($$($1_IMG_TGT_NAME)_MAKETGT) \
|
||||
--tag $$(DOCKER_REGISTRY)/$$(DOCKER_IMAGE_PREFIX)/$1:$$(DOCKER_IMAGE_TAG) \
|
||||
$$(foreach tag,$$(DOCKER_IMAGE_EXTRA_TAGS),--tag $$(DOCKER_REGISTRY)/$$(DOCKER_IMAGE_PREFIX)/$1:$$(tag) )
|
||||
ifeq ($$(PUBLISH), true)
|
||||
@docker push $$(DOCKER_REGISTRY)/$$(DOCKER_IMAGE_PREFIX)/$1:$$(DOCKER_IMAGE_TAG)
|
||||
endif
|
||||
|
||||
images: $$($1_IMG_TGT_NAME)
|
||||
|
||||
$$(warning Adding dynamic target $$($1_IMG_TGT_NAME)-publish)
|
||||
.PHONY: $$($1_IMG_TGT_NAME)-publish
|
||||
$$($1_IMG_TGT_NAME)-publish: $$($1_IMG_TGT_NAME)
|
||||
@docker push $$(DOCKER_REGISTRY)/$$(DOCKER_IMAGE_PREFIX)/$1:$$(DOCKER_IMAGE_TAG)
|
||||
|
||||
images-publish: $$($1_IMG_TGT_NAME)-publish
|
||||
endef
|
||||
map_image_defaults = $(eval $(call map_image_defaults_tmpl,$1))
|
||||
# go through components and render the template
|
||||
$(foreach img,$(IMGS),$(call map_image_defaults,$(img)))
|
||||
|
||||
.PHONY: test
|
||||
test: lint
|
||||
test: cover
|
||||
@ -163,108 +270,33 @@ tidy:
|
||||
golint:
|
||||
@./tools/golint
|
||||
|
||||
.PHONY: images
|
||||
images: docker-image
|
||||
images: docker-image-clusterctl docker-image-kubeval-validator docker-image-cloud-init docker-image-replacement-transformer docker-image-templater docker-image-toolbox
|
||||
|
||||
.PHONY: docker-image
|
||||
docker-image:
|
||||
@docker build . $(DOCKER_CMD_FLAGS) \
|
||||
--label $(LABEL) \
|
||||
--target $(DOCKER_TARGET_STAGE) \
|
||||
--build-arg MAKE_TARGET=$(DOCKER_MAKE_TARGET) \
|
||||
--tag $(DOCKER_IMAGE)
|
||||
ifeq ($(PUBLISH), true)
|
||||
@docker push $(DOCKER_IMAGE)
|
||||
endif
|
||||
|
||||
.PHONY: docker-image-templater
|
||||
docker-image-templater:
|
||||
@docker build $(PLUGINS_DIR)/templater $(DOCKER_CMD_FLAGS) \
|
||||
--label $(LABEL) \
|
||||
--target $(DOCKER_TARGET_STAGE) \
|
||||
--tag $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/templater:$(DOCKER_IMAGE_TAG)
|
||||
ifeq ($(PUBLISH), true)
|
||||
@docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/templater:$(DOCKER_IMAGE_TAG)
|
||||
endif
|
||||
|
||||
.PHONY: docker-image-replacement-transformer
|
||||
docker-image-replacement-transformer:
|
||||
@docker build $(PLUGINS_DIR)/replacement-transformer $(DOCKER_CMD_FLAGS) \
|
||||
--label $(LABEL) \
|
||||
--target $(DOCKER_TARGET_STAGE) \
|
||||
--tag $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/replacement-transformer:$(DOCKER_IMAGE_TAG)
|
||||
ifeq ($(PUBLISH), true)
|
||||
@docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/replacement-transformer:$(DOCKER_IMAGE_TAG)
|
||||
endif
|
||||
|
||||
.PHONY: docker-image-cloud-init
|
||||
docker-image-cloud-init:
|
||||
@docker build $(PLUGINS_DIR)/cloud-init $(DOCKER_CMD_FLAGS) \
|
||||
--label $(LABEL) \
|
||||
--target $(DOCKER_TARGET_STAGE) \
|
||||
--tag $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/cloud-init:$(DOCKER_IMAGE_TAG)
|
||||
ifeq ($(PUBLISH), true)
|
||||
@docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/cloud-init:$(DOCKER_IMAGE_TAG)
|
||||
endif
|
||||
|
||||
.PHONY: docker-image-clusterctl
|
||||
docker-image-clusterctl:
|
||||
@docker build $(PLUGINS_DIR)/clusterctl $(DOCKER_CMD_FLAGS) \
|
||||
--label $(LABEL) \
|
||||
--target $(DOCKER_TARGET_STAGE) \
|
||||
--tag $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/clusterctl:$(DOCKER_IMAGE_TAG)
|
||||
ifeq ($(PUBLISH), true)
|
||||
@docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/clusterctl:$(DOCKER_IMAGE_TAG)
|
||||
endif
|
||||
|
||||
.PHONY: docker-image-kubeval-validator
|
||||
docker-image-kubeval-validator:
|
||||
@docker build $(PLUGINS_DIR)/kubeval-validator $(DOCKER_CMD_FLAGS) \
|
||||
--label $(LABEL) \
|
||||
--target $(DOCKER_TARGET_STAGE) \
|
||||
--tag $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/kubeval-validator:$(DOCKER_IMAGE_TAG)
|
||||
ifeq ($(PUBLISH), true)
|
||||
@docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/kubeval-validator:$(DOCKER_IMAGE_TAG)
|
||||
endif
|
||||
|
||||
.PHONY: docker-image-toolbox
|
||||
docker-image-toolbox:
|
||||
@docker build $(PLUGINS_DIR)/toolbox $(DOCKER_CMD_FLAGS) \
|
||||
--label $(LABEL) \
|
||||
--target $(DOCKER_TARGET_STAGE) \
|
||||
--tag $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/toolbox:$(DOCKER_IMAGE_TAG)
|
||||
ifeq ($(PUBLISH), true)
|
||||
@docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/toolbox:$(DOCKER_IMAGE_TAG)
|
||||
endif
|
||||
|
||||
.PHONY: print-docker-image-tag
|
||||
print-docker-image-tag:
|
||||
@echo "$(DOCKER_IMAGE)"
|
||||
|
||||
.PHONY: docker-image-test-suite
|
||||
docker-image-test-suite: DOCKER_MAKE_TARGET = "cover update-golden generate check-git-diff"
|
||||
docker-image-test-suite: DOCKER_TARGET_STAGE = builder
|
||||
docker-image-test-suite: docker-image_MAKETGT = "cover update-golden generate check-git-diff"
|
||||
docker-image-test-suite: docker-image_DOCKERTGT = builder
|
||||
docker-image-test-suite: docker-image
|
||||
|
||||
.PHONY: docker-image-unit-tests
|
||||
docker-image-unit-tests: DOCKER_MAKE_TARGET = cover
|
||||
docker-image-unit-tests: DOCKER_TARGET_STAGE = builder
|
||||
docker-image-unit-tests: docker-image_MAKETGT = cover
|
||||
docker-image-unit-tests: docker-image_DOCKERTGT = builder
|
||||
docker-image-unit-tests: docker-image
|
||||
|
||||
.PHONY: docker-image-lint
|
||||
docker-image-lint: DOCKER_MAKE_TARGET = "lint check-copyright"
|
||||
docker-image-lint: DOCKER_TARGET_STAGE = builder
|
||||
docker-image-lint: docker-image_MAKETGT = "lint check-copyright"
|
||||
docker-image-lint: docker-image_DOCKERTGT = builder
|
||||
docker-image-lint: docker-image
|
||||
|
||||
.PHONY: docker-image-golint
|
||||
docker-image-golint: DOCKER_MAKE_TARGET = golint
|
||||
docker-image-golint: DOCKER_TARGET_STAGE = builder
|
||||
docker-image-golint: docker-image_MAKETGT = golint
|
||||
docker-image-golint: docker-image_DOCKERTGT = builder
|
||||
docker-image-golint: docker-image
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@rm -fr $(BINDIR)
|
||||
@rm -fr $(BIN_DIR)
|
||||
@rm -fr $(COVER_PROFILE)
|
||||
|
||||
.PHONY: docs
|
||||
|
@ -40,6 +40,12 @@ __completion_handle_go_custom_completion()
|
||||
{
|
||||
__completion_debug "${FUNCNAME[0]}: cur is ${cur}, words[*] is ${words[*]}, #words[@] is ${#words[@]}"
|
||||
|
||||
local shellCompDirectiveError=1
|
||||
local shellCompDirectiveNoSpace=2
|
||||
local shellCompDirectiveNoFileComp=4
|
||||
local shellCompDirectiveFilterFileExt=8
|
||||
local shellCompDirectiveFilterDirs=16
|
||||
|
||||
local out requestComp lastParam lastChar comp directive args
|
||||
|
||||
# Prepare the command to request completions for the program.
|
||||
@ -73,24 +79,50 @@ __completion_handle_go_custom_completion()
|
||||
__completion_debug "${FUNCNAME[0]}: the completion directive is: ${directive}"
|
||||
__completion_debug "${FUNCNAME[0]}: the completions are: ${out[*]}"
|
||||
|
||||
if [ $((directive & 1)) -ne 0 ]; then
|
||||
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
|
||||
# Error code. No completion.
|
||||
__completion_debug "${FUNCNAME[0]}: received error from custom completion go code"
|
||||
return
|
||||
else
|
||||
if [ $((directive & 2)) -ne 0 ]; then
|
||||
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
|
||||
if [[ $(type -t compopt) = "builtin" ]]; then
|
||||
__completion_debug "${FUNCNAME[0]}: activating no space"
|
||||
compopt -o nospace
|
||||
fi
|
||||
fi
|
||||
if [ $((directive & 4)) -ne 0 ]; then
|
||||
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
|
||||
if [[ $(type -t compopt) = "builtin" ]]; then
|
||||
__completion_debug "${FUNCNAME[0]}: activating no file completion"
|
||||
compopt +o default
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
|
||||
# File extension filtering
|
||||
local fullFilter filter filteringCmd
|
||||
# Do not use quotes around the $out variable or else newline
|
||||
# characters will be kept.
|
||||
for filter in ${out[*]}; do
|
||||
fullFilter+="$filter|"
|
||||
done
|
||||
|
||||
filteringCmd="_filedir $fullFilter"
|
||||
__completion_debug "File filtering command: $filteringCmd"
|
||||
$filteringCmd
|
||||
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
||||
# File completion for directories only
|
||||
local subDir
|
||||
# Use printf to strip any trailing newline
|
||||
subdir=$(printf "%s" "${out[0]}")
|
||||
if [ -n "$subdir" ]; then
|
||||
__completion_debug "Listing directories in $subdir"
|
||||
__completion_handle_subdirs_in_dir_flag "$subdir"
|
||||
else
|
||||
__completion_debug "Listing directories in ."
|
||||
_filedir -d
|
||||
fi
|
||||
else
|
||||
while IFS='' read -r comp; do
|
||||
COMPREPLY+=("$comp")
|
||||
done < <(compgen -W "${out[*]}" -- "$cur")
|
||||
@ -159,10 +191,9 @@ __completion_handle_reply()
|
||||
local completions
|
||||
completions=("${commands[@]}")
|
||||
if [[ ${#must_have_one_noun[@]} -ne 0 ]]; then
|
||||
completions=("${must_have_one_noun[@]}")
|
||||
completions+=("${must_have_one_noun[@]}")
|
||||
elif [[ -n "${has_completion_function}" ]]; then
|
||||
# if a go completion function is provided, defer to that function
|
||||
completions=()
|
||||
__completion_handle_go_custom_completion
|
||||
fi
|
||||
if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
|
||||
@ -339,6 +370,7 @@ _completion_root_command()
|
||||
flags+=("--help")
|
||||
flags+=("-h")
|
||||
local_nonpersistent_flags+=("--help")
|
||||
local_nonpersistent_flags+=("-h")
|
||||
|
||||
must_have_one_flag=()
|
||||
must_have_one_noun=()
|
||||
|
@ -1,4 +1,3 @@
|
||||
Error: accepts 1 arg(s), received 0
|
||||
Usage:
|
||||
completion SHELL [flags]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
Error: accepts 1 arg(s), received 2
|
||||
Usage:
|
||||
completion SHELL [flags]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
Error: unsupported shell type "fish"
|
||||
Usage:
|
||||
completion SHELL [flags]
|
||||
|
||||
|
@ -174,6 +174,12 @@ __completion_handle_go_custom_completion()
|
||||
{
|
||||
__completion_debug "${FUNCNAME[0]}: cur is ${cur}, words[*] is ${words[*]}, #words[@] is ${#words[@]}"
|
||||
|
||||
local shellCompDirectiveError=1
|
||||
local shellCompDirectiveNoSpace=2
|
||||
local shellCompDirectiveNoFileComp=4
|
||||
local shellCompDirectiveFilterFileExt=8
|
||||
local shellCompDirectiveFilterDirs=16
|
||||
|
||||
local out requestComp lastParam lastChar comp directive args
|
||||
|
||||
# Prepare the command to request completions for the program.
|
||||
@ -207,24 +213,50 @@ __completion_handle_go_custom_completion()
|
||||
__completion_debug "${FUNCNAME[0]}: the completion directive is: ${directive}"
|
||||
__completion_debug "${FUNCNAME[0]}: the completions are: ${out[*]}"
|
||||
|
||||
if [ $((directive & 1)) -ne 0 ]; then
|
||||
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
|
||||
# Error code. No completion.
|
||||
__completion_debug "${FUNCNAME[0]}: received error from custom completion go code"
|
||||
return
|
||||
else
|
||||
if [ $((directive & 2)) -ne 0 ]; then
|
||||
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
|
||||
if [[ $(type -t compopt) = "builtin" ]]; then
|
||||
__completion_debug "${FUNCNAME[0]}: activating no space"
|
||||
compopt -o nospace
|
||||
fi
|
||||
fi
|
||||
if [ $((directive & 4)) -ne 0 ]; then
|
||||
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
|
||||
if [[ $(type -t compopt) = "builtin" ]]; then
|
||||
__completion_debug "${FUNCNAME[0]}: activating no file completion"
|
||||
compopt +o default
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
|
||||
# File extension filtering
|
||||
local fullFilter filter filteringCmd
|
||||
# Do not use quotes around the $out variable or else newline
|
||||
# characters will be kept.
|
||||
for filter in ${out[*]}; do
|
||||
fullFilter+="$filter|"
|
||||
done
|
||||
|
||||
filteringCmd="_filedir $fullFilter"
|
||||
__completion_debug "File filtering command: $filteringCmd"
|
||||
$filteringCmd
|
||||
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
||||
# File completion for directories only
|
||||
local subDir
|
||||
# Use printf to strip any trailing newline
|
||||
subdir=$(printf "%s" "${out[0]}")
|
||||
if [ -n "$subdir" ]; then
|
||||
__completion_debug "Listing directories in $subdir"
|
||||
__completion_handle_subdirs_in_dir_flag "$subdir"
|
||||
else
|
||||
__completion_debug "Listing directories in ."
|
||||
_filedir -d
|
||||
fi
|
||||
else
|
||||
while IFS='' read -r comp; do
|
||||
COMPREPLY+=("$comp")
|
||||
done < <(compgen -W "${out[*]}" -- "$cur")
|
||||
@ -293,10 +325,9 @@ __completion_handle_reply()
|
||||
local completions
|
||||
completions=("${commands[@]}")
|
||||
if [[ ${#must_have_one_noun[@]} -ne 0 ]]; then
|
||||
completions=("${must_have_one_noun[@]}")
|
||||
completions+=("${must_have_one_noun[@]}")
|
||||
elif [[ -n "${has_completion_function}" ]]; then
|
||||
# if a go completion function is provided, defer to that function
|
||||
completions=()
|
||||
__completion_handle_go_custom_completion
|
||||
fi
|
||||
if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
|
||||
@ -473,6 +504,7 @@ _completion_root_command()
|
||||
flags+=("--help")
|
||||
flags+=("-h")
|
||||
local_nonpersistent_flags+=("--help")
|
||||
local_nonpersistent_flags+=("-h")
|
||||
|
||||
must_have_one_flag=()
|
||||
must_have_one_noun=()
|
||||
|
@ -1,4 +1,3 @@
|
||||
Error: accepts 1 arg(s), received 0
|
||||
Usage:
|
||||
set-manifest MANIFEST_NAME [flags]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
Error: accepts 1 arg(s), received 2
|
||||
Usage:
|
||||
set-manifest MANIFEST_NAME [flags]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
Error: missing configuration: context with name 'foo'
|
||||
Usage:
|
||||
use-context CONTEXT_NAME [flags]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
Error: accepts 1 arg(s), received 0
|
||||
Usage:
|
||||
use-context CONTEXT_NAME [flags]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
Error: accepts at most 1 arg(s), received 2
|
||||
Usage:
|
||||
get-context CONTEXT_NAME [flags]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
Error: missing configuration: context with name 'contextMissing'
|
||||
Usage:
|
||||
get-context CONTEXT_NAME [flags]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
Error: Unknown management configuration 'foo'.
|
||||
Usage:
|
||||
get-management-config MGMT_CONFIG_NAME [flags]
|
||||
|
||||
|
37
go.mod
37
go.mod
@ -1,9 +1,8 @@
|
||||
module opendev.org/airship/airshipctl
|
||||
|
||||
go 1.13
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/Azure/go-autorest/autorest v0.11.7 // indirect
|
||||
github.com/Masterminds/sprig/v3 v3.2.0
|
||||
github.com/Microsoft/go-winio v0.4.14 // indirect
|
||||
github.com/ahmetalpbalkan/dlog v0.0.0-20170105205344-4fb5f8204f26 // indirect
|
||||
@ -12,42 +11,32 @@ require (
|
||||
github.com/containerd/containerd v1.4.1 // indirect
|
||||
github.com/docker/docker v20.10.5+incompatible
|
||||
github.com/docker/go-connections v0.4.0 // indirect
|
||||
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
|
||||
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f // indirect
|
||||
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f // indirect
|
||||
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.0.0
|
||||
github.com/go-git/go-git-fixtures/v4 v4.0.1
|
||||
github.com/go-git/go-git/v5 v5.0.0
|
||||
github.com/go-logr/zapr v0.1.1 // indirect
|
||||
github.com/gophercloud/gophercloud v0.6.0 // indirect
|
||||
github.com/gorilla/mux v1.7.4 // indirect
|
||||
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
|
||||
github.com/lucasjones/reggen v0.0.0-20200904144131-37ba4fa293bb
|
||||
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 // indirect
|
||||
github.com/morikuni/aec v1.0.0 // indirect
|
||||
github.com/opencontainers/image-spec v1.0.1
|
||||
github.com/spf13/cobra v1.0.0
|
||||
github.com/spf13/cobra v1.1.1
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.6.1
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
|
||||
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
|
||||
gotest.tools/v3 v3.0.3 // indirect
|
||||
k8s.io/api v0.17.9
|
||||
k8s.io/apiextensions-apiserver v0.17.9
|
||||
k8s.io/apimachinery v0.17.9
|
||||
k8s.io/cli-runtime v0.17.4
|
||||
k8s.io/client-go v0.17.9
|
||||
k8s.io/kubectl v0.17.4
|
||||
k8s.io/api v0.21.1
|
||||
k8s.io/apiextensions-apiserver v0.21.1
|
||||
k8s.io/apimachinery v0.21.1
|
||||
k8s.io/cli-runtime v0.21.1
|
||||
k8s.io/client-go v0.21.1
|
||||
k8s.io/kubectl v0.21.1
|
||||
opendev.org/airship/go-redfish v0.0.0-20200318103738-db034d1d753a
|
||||
opendev.org/airship/go-redfish/client v0.0.0-20200318103738-db034d1d753a
|
||||
sigs.k8s.io/cli-utils v0.21.0
|
||||
sigs.k8s.io/controller-runtime v0.5.14
|
||||
sigs.k8s.io/kustomize/api v0.7.2
|
||||
sigs.k8s.io/kustomize/kyaml v0.10.6
|
||||
sigs.k8s.io/cli-utils v0.21.1
|
||||
sigs.k8s.io/controller-runtime v0.8.3
|
||||
sigs.k8s.io/kustomize/api v0.8.11
|
||||
sigs.k8s.io/kustomize/kyaml v0.11.0
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
replace k8s.io/kubectl => k8s.io/kubectl v0.0.0-20191219154910-1528d4eea6dd
|
||||
|
@ -1,8 +1,10 @@
|
||||
ARG GO_IMAGE=gcr.io/gcp-runtimes/go1-builder:1.15
|
||||
ARG PLUGINS_RELEASE_IMAGE=quay.io/airshipit/alpine:3.13.5
|
||||
ARG GO_IMAGE=amd64/golang:1.16.6-buster
|
||||
ARG RELEASE_IMAGE=quay.io/airshipit/alpine:3.13.5
|
||||
FROM ${GO_IMAGE} as builder
|
||||
ARG GOPROXY=""
|
||||
|
||||
ENV PATH "/usr/local/go/bin:$PATH"
|
||||
|
||||
# Inject custom root certificate authorities if needed
|
||||
# Docker does not have a good conditional copy statement and requires that a source file exists
|
||||
# to complete the copy function without error. Therefore the README.md file will be copied to
|
||||
@ -10,13 +12,21 @@ ARG GOPROXY=""
|
||||
COPY ./certs/* /usr/local/share/ca-certificates/
|
||||
RUN update-ca-certificates
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
WORKDIR /go/src/
|
||||
COPY image/go.mod .
|
||||
RUN /usr/local/go/bin/go mod download
|
||||
COPY main.go .
|
||||
RUN /usr/local/go/bin/go build -v -o /usr/local/bin/config-function ./
|
||||
RUN apt-get update -yq && apt-get upgrade -yq && apt-get install -y gcc make
|
||||
|
||||
FROM ${PLUGINS_RELEASE_IMAGE} as release
|
||||
COPY --from=builder /usr/local/bin/config-function /usr/local/bin/config-function
|
||||
SHELL [ "/bin/bash", "-cex" ]
|
||||
WORKDIR /usr/src/airshipctl
|
||||
|
||||
# Take advantage of caching for dependency acquisition
|
||||
COPY go.mod go.sum /usr/src/airshipctl/
|
||||
RUN go mod download
|
||||
|
||||
COPY . /usr/src/airshipctl/
|
||||
ARG MAKE_TARGET=bin/cloud-init
|
||||
RUN make ${MAKE_TARGET}
|
||||
|
||||
FROM ${RELEASE_IMAGE} as release
|
||||
ARG MAKE_TARGET=bin/cloud-init
|
||||
COPY --from=builder /usr/src/airshipctl/${MAKE_TARGET} /usr/local/bin/config-function
|
||||
USER 65534
|
||||
CMD ["/usr/local/bin/config-function"]
|
||||
|
@ -1,76 +0,0 @@
|
||||
.PHONY: generate license fix vet fmt test build tidy image
|
||||
|
||||
SHELL := /bin/bash
|
||||
GOBIN := $(shell go env GOPATH)/bin
|
||||
|
||||
# docker image options
|
||||
DOCKER_REGISTRY ?= quay.io
|
||||
DOCKER_IMAGE_NAME ?= cloud-init
|
||||
DOCKER_IMAGE_PREFIX ?= airshipit
|
||||
DOCKER_IMAGE_TAG ?= latest
|
||||
DOCKER_IMAGE ?= $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
|
||||
PUBLISH ?= false
|
||||
DOCKER_FORCE_CLEAN ?= true
|
||||
|
||||
# proxy options
|
||||
PROXY ?= http://proxy.foo.com:8000
|
||||
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
||||
USE_PROXY ?= false
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
(go build -v -o $(GOBIN)/config-function .)
|
||||
|
||||
.PHONY: all
|
||||
all: generate license build fix vet fmt test lint tidy
|
||||
|
||||
.PHONY: fix
|
||||
fix:
|
||||
(go fix .)
|
||||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
(go fmt .)
|
||||
|
||||
.PHONY: generate
|
||||
generate:
|
||||
(which $(GOBIN)/mdtogo || go get sigs.k8s.io/kustomize/cmd/mdtogo)
|
||||
(GOBIN=$(GOBIN) go generate .)
|
||||
|
||||
.PHONY: tidy
|
||||
tidy:
|
||||
(go mod tidy)
|
||||
|
||||
.PHONY: fix
|
||||
lint:
|
||||
(which $(GOBIN)/golangci-lint || go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.19.1)
|
||||
($(GOBIN)/golangci-lint run .)
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
(go test -cover .)
|
||||
|
||||
.PHONY: vet
|
||||
vet:
|
||||
(go vet .)
|
||||
|
||||
.PHONY: image
|
||||
image:
|
||||
ifeq ($(USE_PROXY), true)
|
||||
docker build . --network=host \
|
||||
--build-arg http_proxy=$(PROXY) \
|
||||
--build-arg https_proxy=$(PROXY) \
|
||||
--build-arg HTTP_PROXY=$(PROXY) \
|
||||
--build-arg HTTPS_PROXY=$(PROXY) \
|
||||
--build-arg no_proxy=$(NO_PROXY) \
|
||||
--build-arg NO_PROXY=$(NO_PROXY) \
|
||||
--tag $(DOCKER_IMAGE) \
|
||||
--force-rm=$(DOCKER_FORCE_CLEAN)
|
||||
else
|
||||
docker build . --network=host \
|
||||
--tag $(DOCKER_IMAGE) \
|
||||
--force-rm=$(DOCKER_FORCE_CLEAN)
|
||||
endif
|
||||
ifeq ($(PUBLISH), true)
|
||||
@docker push $(DOCKER_IMAGE)
|
||||
endif
|
@ -1,8 +0,0 @@
|
||||
module opendev.org/airship/airshipctl/functions/cloud-init/image
|
||||
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
sigs.k8s.io/kustomize/kyaml v0.10.0
|
||||
sigs.k8s.io/kustomize/api v0.7.2
|
||||
)
|
@ -23,6 +23,7 @@ import (
|
||||
"sigs.k8s.io/kustomize/api/provider"
|
||||
"sigs.k8s.io/kustomize/api/resmap"
|
||||
"sigs.k8s.io/kustomize/kyaml/fn/framework"
|
||||
"sigs.k8s.io/kustomize/kyaml/fn/framework/command"
|
||||
"sigs.k8s.io/kustomize/kyaml/fn/runtime/runtimeutil"
|
||||
"sigs.k8s.io/kustomize/kyaml/yaml"
|
||||
|
||||
@ -40,7 +41,7 @@ const (
|
||||
|
||||
func bundleFromRNodes(rnodes []*yaml.RNode) (document.Bundle, error) {
|
||||
p := provider.NewDefaultDepProvider()
|
||||
resmapFactory := resmap.NewFactory(p.GetResourceFactory(), p.GetConflictDetectorFactory())
|
||||
resmapFactory := resmap.NewFactory(p.GetResourceFactory())
|
||||
resmap, err := resmapFactory.NewResMapFromRNodeSlice(rnodes)
|
||||
if err != nil {
|
||||
return &document.BundleFactory{}, err
|
||||
@ -67,14 +68,8 @@ func docFromRNode(rnode *yaml.RNode) (document.Document, error) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
resourceList := &framework.ResourceList{}
|
||||
cmd := framework.Command(resourceList, func() error {
|
||||
functionConfig, ok := resourceList.FunctionConfig.(*yaml.RNode)
|
||||
if !ok {
|
||||
return errors.New("Error while type assert of FunctionConfig")
|
||||
}
|
||||
|
||||
functionConfigDocument, err := docFromRNode(functionConfig)
|
||||
fn := func(rl *framework.ResourceList) error {
|
||||
functionConfigDocument, err := docFromRNode(rl.FunctionConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -89,7 +84,7 @@ func main() {
|
||||
return err
|
||||
}
|
||||
|
||||
docBundle, err := bundleFromRNodes(resourceList.Items)
|
||||
docBundle, err := bundleFromRNodes(rl.Items)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -105,7 +100,7 @@ func main() {
|
||||
return err
|
||||
}
|
||||
|
||||
functionSpec := runtimeutil.GetFunctionSpec(functionConfig)
|
||||
functionSpec := runtimeutil.GetFunctionSpec(rl.FunctionConfig)
|
||||
configPath := functionSpec.Container.StorageMounts[0].DstPath
|
||||
|
||||
fls := make(map[string][]byte)
|
||||
@ -117,12 +112,12 @@ func main() {
|
||||
return err
|
||||
}
|
||||
|
||||
resourceList.Items = []*yaml.RNode{}
|
||||
rl.Items = []*yaml.RNode{}
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
cmd := command.Build(framework.ResourceListProcessorFunc(fn), command.StandaloneEnabled, false)
|
||||
if err := cmd.Execute(); err != nil {
|
||||
fmt.Fprint(os.Stderr, err)
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,8 @@ func runCmd(cmd string, opts []string) error {
|
||||
|
||||
// printMsg is a convenient function to print output to stderr
|
||||
func printMsg(format string, a ...interface{}) {
|
||||
if _, err := fmt.Fprintf(os.Stderr, format, a...); err != nil {}
|
||||
if _, err := fmt.Fprintf(os.Stderr, format, a...); err != nil {
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
ARG GO_IMAGE=gcr.io/gcp-runtimes/go1-builder:1.15
|
||||
ARG GO_IMAGE=amd64/golang:1.16.6-alpine
|
||||
ARG PLUGINS_RELEASE_IMAGE=quay.io/airshipit/alpine:3.13.5
|
||||
FROM ${GO_IMAGE} as function
|
||||
ARG GOPROXY=""
|
||||
|
@ -1,8 +1,8 @@
|
||||
module opendev.org/airship/airshipctl/krm-functions/kubeval-validator/image
|
||||
|
||||
go 1.15
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/instrumenta/kubeval v0.16.1
|
||||
sigs.k8s.io/kustomize/kyaml v0.10.6
|
||||
sigs.k8s.io/kustomize/kyaml v0.11.0
|
||||
)
|
||||
|
@ -11,26 +11,20 @@ cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqCl
|
||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
github.com/360EntSecGroup-Skylar/excelize v1.4.1/go.mod h1:vnax29X2usfl7HHkBrX5EvSCJcmH3dT9luvxzu8iGAE=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
github.com/PuerkitoBio/goquery v1.5.0/go.mod h1:qD2PgZ9lccMbQlc7eEOjaeRlFQON7xY8kdmcsrnKqMg=
|
||||
github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||
github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
|
||||
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
|
||||
github.com/andybalholm/cascadia v1.0.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
|
||||
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
|
||||
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
||||
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
|
||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
@ -54,69 +48,27 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
||||
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||
github.com/dustmop/soup v1.1.2-0.20190516214245-38228baa104e/go.mod h1:CgNC6SGbT+Xb8wGGvzilttZL1mc5sQ/5KkcxsZttMIk=
|
||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
|
||||
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
|
||||
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
|
||||
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
|
||||
github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
|
||||
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI=
|
||||
github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik=
|
||||
github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik=
|
||||
github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk=
|
||||
github.com/go-openapi/analysis v0.19.5/go.mod h1:hkEAkxagaIvIP7VTn8ygJNkd4kAYON2rCu0v0ObL0AU=
|
||||
github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0=
|
||||
github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0=
|
||||
github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94=
|
||||
github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
|
||||
github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
|
||||
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
|
||||
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
|
||||
github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w=
|
||||
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||
github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
|
||||
github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
|
||||
github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
|
||||
github.com/go-openapi/jsonreference v0.19.3 h1:5cxNfTy0UVC3X8JL5ymxzyoUZmo8iZb+jeTWn7tUa8o=
|
||||
github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8=
|
||||
github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU=
|
||||
github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU=
|
||||
github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU=
|
||||
github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs=
|
||||
github.com/go-openapi/loads v0.19.4/go.mod h1:zZVHonKd8DXyxyw4yfnVjPzBjIQcLt0CCsn0N0ZrQsk=
|
||||
github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA=
|
||||
github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64=
|
||||
github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4=
|
||||
github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
|
||||
github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
|
||||
github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY=
|
||||
github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo=
|
||||
github.com/go-openapi/spec v0.19.5 h1:Xm0Ao53uqnk9QE/LlYV5DEU09UAgpliA85QoT9LzqPw=
|
||||
github.com/go-openapi/spec v0.19.5/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk=
|
||||
github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU=
|
||||
github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU=
|
||||
github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY=
|
||||
github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU=
|
||||
github.com/go-openapi/strfmt v0.19.5/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk=
|
||||
github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
|
||||
github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
|
||||
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||
github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY=
|
||||
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||
github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4=
|
||||
github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA=
|
||||
github.com/go-openapi/validate v0.19.8/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/gobuffalo/here v0.6.0/go.mod h1:wAG085dHOYqUpf+Ap+WOdrPTp5IYcDAs/x7PLa8Y5fM=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
@ -127,19 +79,28 @@ github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFU
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
@ -181,21 +142,18 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
|
||||
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.7.0 h1:aizVhC/NAAcKWb+5QsU1iNOZb4Yws5UO2I+aIprQITM=
|
||||
github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
|
||||
github.com/markbates/pkger v0.17.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
|
||||
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
@ -214,17 +172,19 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
|
||||
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/2gBQ3RWajuToeY6ZtZTIKv2v7ThUy5KKusIT0yc0=
|
||||
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4=
|
||||
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/paulmach/orb v0.1.3/go.mod h1:VFlX/8C+IQ1p6FTRRKzKoOPJnvEtA5G0Veuqwbu//Vk=
|
||||
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
@ -237,13 +197,11 @@ github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
||||
github.com/qri-io/starlib v0.4.2-0.20200213133954-ff2e8cd5ef8d/go.mod h1:7DPO4domFU579Ga6E61sB9VFNaniPVwJP5C4bBCu3wA=
|
||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
@ -257,26 +215,26 @@ github.com/spf13/cobra v0.0.0-20180820174524-ff0d02e85550/go.mod h1:1l0Ry5zgKvJa
|
||||
github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8=
|
||||
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
|
||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
|
||||
github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
|
||||
github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.2.3-0.20181224173747-660f15d67dbb/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
|
||||
github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw=
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
|
||||
@ -288,12 +246,8 @@ github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca h1:1CFlNzQhALwjS9mB
|
||||
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg=
|
||||
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
|
||||
go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
|
||||
go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.starlark.net v0.0.0-20190528202925-30ae18b8564f/go.mod h1:c1/X6cHgvdXj6pUlmWKMkuqRnW4K8x2vwt6JAaaircg=
|
||||
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5/go.mod h1:nmDLcffg48OtT/PSW0Hg7FvpRQsQh5OSqIylirxKC7o=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
@ -301,11 +255,8 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
@ -324,10 +275,8 @@ golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@ -335,17 +284,15 @@ golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73r
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 h1:rjwSpXsdiK0dV8/Naq3kAw9ymfAeJIyd0upUIElB+lI=
|
||||
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
@ -362,17 +309,16 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191002063906-3421d5a6bb1c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||
@ -382,7 +328,6 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb
|
||||
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
@ -391,8 +336,6 @@ golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3
|
||||
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
@ -400,6 +343,7 @@ golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtn
|
||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
@ -422,6 +366,12 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
@ -434,18 +384,23 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
|
||||
k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e h1:KLHHjkdQFomZy8+06csTWZ0m1343QqxZhR2LJ1OxCYM=
|
||||
k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
sigs.k8s.io/kustomize/kyaml v0.10.6 h1:xUJxc/k8JoWqHUahaB8DTqY0KwEPxTbTGStvW8TOcDc=
|
||||
sigs.k8s.io/kustomize/kyaml v0.10.6/go.mod h1:K9yg1k/HB/6xNOf5VH3LhTo1DK9/5ykSZO5uIv+Y/1k=
|
||||
sigs.k8s.io/kustomize/kyaml v0.11.0 h1:9KhiCPKaVyuPcgOLJXkvytOvjMJLoxpjodiycb4gHsA=
|
||||
sigs.k8s.io/kustomize/kyaml v0.11.0/go.mod h1:GNMwjim4Ypgp/MueD3zXHLRJEjz7RvtPae0AwlvEMFM=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
|
||||
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
|
@ -1,8 +1,10 @@
|
||||
ARG GO_IMAGE=gcr.io/gcp-runtimes/go1-builder:1.15
|
||||
ARG PLUGINS_RELEASE_IMAGE=quay.io/airshipit/alpine:3.13.5
|
||||
ARG GO_IMAGE=amd64/golang:1.16.6-buster
|
||||
ARG RELEASE_IMAGE=quay.io/airshipit/alpine:3.13.5
|
||||
FROM ${GO_IMAGE} as builder
|
||||
ARG GOPROXY=""
|
||||
|
||||
ENV PATH "/usr/local/go/bin:$PATH"
|
||||
|
||||
# Inject custom root certificate authorities if needed
|
||||
# Docker does not have a good conditional copy statement and requires that a source file exists
|
||||
# to complete the copy function without error. Therefore the README.md file will be copied to
|
||||
@ -10,13 +12,21 @@ ARG GOPROXY=""
|
||||
COPY ./certs/* /usr/local/share/ca-certificates/
|
||||
RUN update-ca-certificates
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
WORKDIR /go/src/
|
||||
COPY image/go.mod .
|
||||
RUN /usr/local/go/bin/go mod download
|
||||
COPY main.go .
|
||||
RUN /usr/local/go/bin/go build -v -o /usr/local/bin/config-function ./
|
||||
RUN apt-get update -yq && apt-get upgrade -yq && apt-get install -y gcc make
|
||||
|
||||
FROM ${PLUGINS_RELEASE_IMAGE} as release
|
||||
COPY --from=builder /usr/local/bin/config-function /usr/local/bin/config-function
|
||||
SHELL [ "/bin/bash", "-cex" ]
|
||||
WORKDIR /usr/src/airshipctl
|
||||
|
||||
# Take advantage of caching for dependency acquisition
|
||||
COPY go.mod go.sum /usr/src/airshipctl/
|
||||
RUN go mod download
|
||||
|
||||
COPY . /usr/src/airshipctl/
|
||||
ARG MAKE_TARGET=bin/replacement-transformer
|
||||
RUN make ${MAKE_TARGET}
|
||||
|
||||
FROM ${RELEASE_IMAGE} as release
|
||||
ARG MAKE_TARGET=bin/replacement-transformer
|
||||
COPY --from=builder /usr/src/airshipctl/${MAKE_TARGET} /usr/local/bin/config-function
|
||||
USER 65534
|
||||
CMD ["/usr/local/bin/config-function"]
|
||||
|
@ -1,76 +0,0 @@
|
||||
.PHONY: generate license fix vet fmt test build tidy image
|
||||
|
||||
SHELL := /bin/bash
|
||||
GOBIN := $(shell go env GOPATH)/bin
|
||||
|
||||
# docker image options
|
||||
DOCKER_REGISTRY ?= quay.io
|
||||
DOCKER_IMAGE_NAME ?= replacement-transformer
|
||||
DOCKER_IMAGE_PREFIX ?= airshipit
|
||||
DOCKER_IMAGE_TAG ?= latest
|
||||
DOCKER_IMAGE ?= $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
|
||||
PUBLISH ?= false
|
||||
DOCKER_FORCE_CLEAN ?= true
|
||||
|
||||
# proxy options
|
||||
PROXY ?= http://proxy.foo.com:8000
|
||||
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
||||
USE_PROXY ?= false
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
(go build -v -o $(GOBIN)/config-function .)
|
||||
|
||||
.PHONY: all
|
||||
all: generate license build fix vet fmt test lint tidy
|
||||
|
||||
.PHONY: fix
|
||||
fix:
|
||||
(go fix .)
|
||||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
(go fmt .)
|
||||
|
||||
.PHONY: generate
|
||||
generate:
|
||||
(which $(GOBIN)/mdtogo || go get sigs.k8s.io/kustomize/cmd/mdtogo)
|
||||
(GOBIN=$(GOBIN) go generate .)
|
||||
|
||||
.PHONY: tidy
|
||||
tidy:
|
||||
(go mod tidy)
|
||||
|
||||
.PHONY: fix
|
||||
lint:
|
||||
(which $(GOBIN)/golangci-lint || go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.19.1)
|
||||
($(GOBIN)/golangci-lint run .)
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
(go test -cover .)
|
||||
|
||||
.PHONY: vet
|
||||
vet:
|
||||
(go vet .)
|
||||
|
||||
.PHONY: image
|
||||
image:
|
||||
ifeq ($(USE_PROXY), true)
|
||||
docker build . --network=host \
|
||||
--build-arg http_proxy=$(PROXY) \
|
||||
--build-arg https_proxy=$(PROXY) \
|
||||
--build-arg HTTP_PROXY=$(PROXY) \
|
||||
--build-arg HTTPS_PROXY=$(PROXY) \
|
||||
--build-arg no_proxy=$(NO_PROXY) \
|
||||
--build-arg NO_PROXY=$(NO_PROXY) \
|
||||
--tag $(DOCKER_IMAGE) \
|
||||
--force-rm=$(DOCKER_FORCE_CLEAN)
|
||||
else
|
||||
docker build . --network=host \
|
||||
--tag $(DOCKER_IMAGE) \
|
||||
--force-rm=$(DOCKER_FORCE_CLEAN)
|
||||
endif
|
||||
ifeq ($(PUBLISH), true)
|
||||
@docker push $(DOCKER_IMAGE)
|
||||
endif
|
@ -1,6 +0,0 @@
|
||||
# Additional Docker image root certificate authorities
|
||||
If you require additional certificate authorities for your Docker image:
|
||||
* Add ASCII PEM encoded .crt files to this directory
|
||||
* The files will be copied into your docker image at build time.
|
||||
|
||||
To update manually copy the .crt files to /usr/local/share/ca-certificates/ and run sudo update-ca-certificates.
|
@ -1,8 +0,0 @@
|
||||
module opendev.org/airship/airshipctl/functions/replacement-transformer/image
|
||||
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
opendev.org/airship/airshipctl v0.0.0-20210421143147-014e24cd1591
|
||||
sigs.k8s.io/kustomize/kyaml v0.7.1
|
||||
)
|
@ -10,23 +10,27 @@ import (
|
||||
"os"
|
||||
|
||||
"sigs.k8s.io/kustomize/kyaml/fn/framework"
|
||||
"sigs.k8s.io/kustomize/kyaml/fn/framework/command"
|
||||
|
||||
"opendev.org/airship/airshipctl/pkg/document/plugin/replacement"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cfg := make(map[string]interface{})
|
||||
resourceList := &framework.ResourceList{FunctionConfig: &cfg}
|
||||
cmd := framework.Command(resourceList, func() error {
|
||||
fn := func(rl *framework.ResourceList) error {
|
||||
cfg, err := rl.FunctionConfig.Map()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
plugin, err := replacement.New(cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
resourceList.Items, err = plugin.Filter(resourceList.Items)
|
||||
rl.Items, err = plugin.Filter(rl.Items)
|
||||
return err
|
||||
})
|
||||
}
|
||||
cmd := command.Build(framework.ResourceListProcessorFunc(fn), command.StandaloneEnabled, false)
|
||||
if err := cmd.Execute(); err != nil {
|
||||
fmt.Fprint(os.Stderr, err)
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
ARG GO_IMAGE=gcr.io/gcp-runtimes/go1-builder:1.15
|
||||
ARG PLUGINS_RELEASE_IMAGE=quay.io/airshipit/alpine:3.13.5
|
||||
ARG GO_IMAGE=amd64/golang:1.16.6-buster
|
||||
ARG RELEASE_IMAGE=quay.io/airshipit/alpine:3.13.5
|
||||
FROM ${GO_IMAGE} as builder
|
||||
ARG GOPROXY=""
|
||||
|
||||
ENV PATH "/usr/local/go/bin:$PATH"
|
||||
|
||||
# Inject custom root certificate authorities if needed
|
||||
# Docker does not have a good conditional copy statement and requires that a source file exists
|
||||
# to complete the copy function without error. Therefore the README.md file will be copied to
|
||||
@ -10,13 +12,21 @@ ARG GOPROXY=""
|
||||
COPY ./certs/* /usr/local/share/ca-certificates/
|
||||
RUN update-ca-certificates
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
WORKDIR /go/src/
|
||||
COPY image/go.mod .
|
||||
RUN /usr/local/go/bin/go mod download
|
||||
COPY main.go .
|
||||
RUN /usr/local/go/bin/go build -v -o /usr/local/bin/config-function ./
|
||||
RUN apt-get update -yq && apt-get upgrade -yq && apt-get install -y gcc make
|
||||
|
||||
FROM ${PLUGINS_RELEASE_IMAGE} as release
|
||||
COPY --from=builder /usr/local/bin/config-function /usr/local/bin/config-function
|
||||
SHELL [ "/bin/bash", "-cex" ]
|
||||
WORKDIR /usr/src/airshipctl
|
||||
|
||||
# Take advantage of caching for dependency acquisition
|
||||
COPY go.mod go.sum /usr/src/airshipctl/
|
||||
RUN go mod download
|
||||
|
||||
COPY . /usr/src/airshipctl/
|
||||
ARG MAKE_TARGET=bin/templater
|
||||
RUN make ${MAKE_TARGET}
|
||||
|
||||
FROM ${RELEASE_IMAGE} as release
|
||||
ARG MAKE_TARGET=bin/templater
|
||||
COPY --from=builder /usr/src/airshipctl/${MAKE_TARGET} /usr/local/bin/config-function
|
||||
USER 65534
|
||||
CMD ["/usr/local/bin/config-function"]
|
||||
|
@ -1,76 +0,0 @@
|
||||
.PHONY: generate license fix vet fmt test build tidy image
|
||||
|
||||
SHELL := /bin/bash
|
||||
GOBIN := $(shell go env GOPATH)/bin
|
||||
|
||||
# docker image options
|
||||
DOCKER_REGISTRY ?= quay.io
|
||||
DOCKER_IMAGE_NAME ?= templater
|
||||
DOCKER_IMAGE_PREFIX ?= airshipit
|
||||
DOCKER_IMAGE_TAG ?= latest
|
||||
DOCKER_IMAGE ?= $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
|
||||
PUBLISH ?= false
|
||||
DOCKER_FORCE_CLEAN ?= true
|
||||
|
||||
# proxy options
|
||||
PROXY ?= http://proxy.foo.com:8000
|
||||
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
||||
USE_PROXY ?= false
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
(go build -v -o $(GOBIN)/config-function .)
|
||||
|
||||
.PHONY: all
|
||||
all: generate license build fix vet fmt test lint tidy
|
||||
|
||||
.PHONY: fix
|
||||
fix:
|
||||
(go fix .)
|
||||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
(go fmt .)
|
||||
|
||||
.PHONY: generate
|
||||
generate:
|
||||
(which $(GOBIN)/mdtogo || go get sigs.k8s.io/kustomize/cmd/mdtogo)
|
||||
(GOBIN=$(GOBIN) go generate .)
|
||||
|
||||
.PHONY: tidy
|
||||
tidy:
|
||||
(go mod tidy)
|
||||
|
||||
.PHONY: fix
|
||||
lint:
|
||||
(which $(GOBIN)/golangci-lint || go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.19.1)
|
||||
($(GOBIN)/golangci-lint run .)
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
(go test -cover .)
|
||||
|
||||
.PHONY: vet
|
||||
vet:
|
||||
(go vet .)
|
||||
|
||||
.PHONY: image
|
||||
image:
|
||||
ifeq ($(USE_PROXY), true)
|
||||
docker build . --network=host \
|
||||
--build-arg http_proxy=$(PROXY) \
|
||||
--build-arg https_proxy=$(PROXY) \
|
||||
--build-arg HTTP_PROXY=$(PROXY) \
|
||||
--build-arg HTTPS_PROXY=$(PROXY) \
|
||||
--build-arg no_proxy=$(NO_PROXY) \
|
||||
--build-arg NO_PROXY=$(NO_PROXY) \
|
||||
--tag $(DOCKER_IMAGE) \
|
||||
--force-rm=$(DOCKER_FORCE_CLEAN)
|
||||
else
|
||||
docker build . --network=host \
|
||||
--tag $(DOCKER_IMAGE) \
|
||||
--force-rm=$(DOCKER_FORCE_CLEAN)
|
||||
endif
|
||||
ifeq ($(PUBLISH), true)
|
||||
@docker push $(DOCKER_IMAGE)
|
||||
endif
|
@ -1,6 +0,0 @@
|
||||
# Additional Docker image root certificate authorities
|
||||
If you require additional certificate authorities for your Docker image:
|
||||
* Add ASCII PEM encoded .crt files to this directory
|
||||
* The files will be copied into your docker image at build time.
|
||||
|
||||
To update manually copy the .crt files to /usr/local/share/ca-certificates/ and run sudo update-ca-certificates.
|
@ -1,8 +0,0 @@
|
||||
module opendev.org/airship/airshipctl/functions/templater/image
|
||||
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
opendev.org/airship/airshipctl v0.0.0-20210421143147-014e24cd1591
|
||||
sigs.k8s.io/kustomize/kyaml v0.7.1
|
||||
)
|
@ -10,23 +10,27 @@ import (
|
||||
"os"
|
||||
|
||||
"sigs.k8s.io/kustomize/kyaml/fn/framework"
|
||||
"sigs.k8s.io/kustomize/kyaml/fn/framework/command"
|
||||
|
||||
"opendev.org/airship/airshipctl/pkg/document/plugin/templater"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cfg := make(map[string]interface{})
|
||||
resourceList := &framework.ResourceList{FunctionConfig: &cfg}
|
||||
cmd := framework.Command(resourceList, func() error {
|
||||
fn := func(rl *framework.ResourceList) error {
|
||||
cfg, err := rl.FunctionConfig.Map()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
plugin, err := templater.New(cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
resourceList.Items, err = plugin.Filter(resourceList.Items)
|
||||
rl.Items, err = plugin.Filter(rl.Items)
|
||||
return err
|
||||
})
|
||||
}
|
||||
cmd := command.Build(framework.ResourceListProcessorFunc(fn), command.StandaloneEnabled, false)
|
||||
if err := cmd.Execute(); err != nil {
|
||||
fmt.Fprint(os.Stderr, err)
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
7
krm-functions/toolbox-virsh/Dockerfile
Normal file
7
krm-functions/toolbox-virsh/Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM quay.io/airshipit/toolbox:latest as release
|
||||
|
||||
RUN apk update \
|
||||
&& apk add ca-certificates libvirt-client \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
COPY ./certs/* /usr/local/share/ca-certificates/
|
||||
RUN update-ca-certificates
|
109
krm-functions/toolbox-virsh/Makefile
Normal file
109
krm-functions/toolbox-virsh/Makefile
Normal file
@ -0,0 +1,109 @@
|
||||
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
SHELL := /bin/bash
|
||||
BUILD_DIR ?= build
|
||||
PUSH_IMAGE ?= false
|
||||
IMAGE_ID ?= none
|
||||
COMMIT ?= $(shell git rev-parse HEAD)
|
||||
LABEL ?= org.airshipit.build=community
|
||||
IMAGE_NAME ?= toolbox-virsh
|
||||
DOCKER_REGISTRY ?= quay.io
|
||||
IMAGE_PREFIX ?= airshipit
|
||||
IMAGE_TAG ?= latest
|
||||
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
|
||||
SH_TO_CHECK := $(wildcard files/*.sh )
|
||||
PROXY ?= http://proxy.foo.com:8000
|
||||
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
||||
USE_PROXY ?= false
|
||||
|
||||
all: lint images
|
||||
|
||||
check-docker:
|
||||
@if [ -z $$(which docker) ]; then \
|
||||
echo "Missing \`docker\` client which is required for development"; \
|
||||
exit 2; \
|
||||
fi
|
||||
|
||||
images: check-docker build_image
|
||||
|
||||
docs: clean build_docs
|
||||
|
||||
build_docs:
|
||||
echo TODO
|
||||
|
||||
build_image:
|
||||
mkdir -p $(BUILD_DIR)
|
||||
ifeq ($(IMAGE_ID), none)
|
||||
ifeq ($(USE_PROXY), true)
|
||||
docker build . \
|
||||
--iidfile $(BUILD_DIR)/image_id \
|
||||
--tag $(IMAGE) \
|
||||
--label $(LABEL) \
|
||||
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||
--label "org.opencontainers.image.created=\
|
||||
$(shell date --rfc-3339=seconds --utc)" \
|
||||
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||
--build-arg http_proxy=$(PROXY) \
|
||||
--build-arg https_proxy=$(PROXY) \
|
||||
--build-arg HTTP_PROXY=$(PROXY) \
|
||||
--build-arg HTTPS_PROXY=$(PROXY) \
|
||||
--build-arg no_proxy=$(NO_PROXY) \
|
||||
--build-arg NO_PROXY=$(NO_PROXY) \
|
||||
--build-arg GIT_COMMIT=$(COMMIT)
|
||||
else
|
||||
docker build . \
|
||||
--iidfile $(BUILD_DIR)/image_id \
|
||||
--tag $(IMAGE) \
|
||||
--label $(LABEL) \
|
||||
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||
--label "org.opencontainers.image.created=\
|
||||
$(shell date --rfc-3339=seconds --utc)" \
|
||||
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||
--build-arg GIT_COMMIT=$(COMMIT)
|
||||
endif
|
||||
else
|
||||
echo $(IMAGE_ID) > $(BUILD_DIR)/image_id
|
||||
endif
|
||||
ifeq ($(PUSH_IMAGE), true)
|
||||
docker push $(IMAGE)
|
||||
endif
|
||||
|
||||
clean:
|
||||
ifeq ($(IMAGE_ID), none)
|
||||
if [[ -s $(BUILD_DIR)/image_id ]]; \
|
||||
then \
|
||||
docker rmi $$(cat $(BUILD_DIR)/image_id); \
|
||||
fi
|
||||
endif
|
||||
rm -rf $(BUILD_DIR)
|
||||
|
||||
# style checks
|
||||
lint: test-shellcheck
|
||||
echo "TODO"
|
||||
|
||||
tests: lint unit_tests
|
||||
|
||||
test-shellcheck: $(SH_TO_CHECK)
|
||||
|
||||
unit_tests:
|
||||
echo TODO
|
||||
|
||||
$(SH_TO_CHECK):
|
||||
docker run --rm -v $(shell pwd):/mnt \
|
||||
nlknguyen/alpine-shellcheck -x /mnt/$(@)
|
||||
|
||||
.PHONY: test clean $(SH_TO_CHECK) test-shellcheck tests lint build_image \
|
||||
all build_docs docs check-docker images
|
||||
|
4
krm-functions/toolbox-virsh/README.md
Normal file
4
krm-functions/toolbox-virsh/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
# toolbox-virsh image
|
||||
|
||||
This image based on the airshipctl toolbox krm-function. It allows to execute libvirt-client(virsh) inside a container.
|
||||
|
@ -1,7 +1,7 @@
|
||||
ARG GO_IMAGE=gcr.io/gcp-runtimes/go1-builder:1.15
|
||||
ARG PLUGINS_BUILD_IMAGE=quay.io/airshipit/alpine:3.13.5
|
||||
ARG PLUGINS_RELEASE_IMAGE=quay.io/airshipit/alpine:3.13.5
|
||||
FROM ${PLUGINS_BUILD_IMAGE} as ctls
|
||||
ARG GO_IMAGE=amd64/golang:1.16.6-buster
|
||||
ARG BUILD_IMAGE=quay.io/airshipit/alpine:3.13.5
|
||||
ARG RELEASE_IMAGE=quay.io/airshipit/alpine:3.13.5
|
||||
FROM ${BUILD_IMAGE} as ctls
|
||||
ARG GOPROXY=""
|
||||
ARG K8S_VERSION=v1.18.6
|
||||
|
||||
@ -21,15 +21,28 @@ RUN curl -L "https://github.com/projectcalico/calicoctl/releases/download/v3.18
|
||||
RUN chmod +x /kubectl /calicoctl
|
||||
|
||||
FROM ${GO_IMAGE} as builder
|
||||
ENV CGO_ENABLED=0
|
||||
WORKDIR /go/src/
|
||||
COPY image/go.mod .
|
||||
RUN /usr/local/go/bin/go mod download
|
||||
COPY main.go .
|
||||
RUN /usr/local/go/bin/go build -v -o /usr/local/bin/config-function ./
|
||||
ARG GOPROXY=""
|
||||
|
||||
ENV PATH "/usr/local/go/bin:$PATH"
|
||||
RUN apt-get update -yq && apt-get upgrade -yq && apt-get install -y gcc make
|
||||
|
||||
SHELL [ "/bin/bash", "-cex" ]
|
||||
WORKDIR /usr/src/airshipctl
|
||||
|
||||
# Take advantage of caching for dependency acquisition
|
||||
COPY go.mod go.sum /usr/src/airshipctl/
|
||||
RUN go mod download
|
||||
|
||||
COPY . /usr/src/airshipctl/
|
||||
ARG MAKE_TARGET=bin/toolbox
|
||||
RUN make ${MAKE_TARGET}
|
||||
|
||||
FROM ${RELEASE_IMAGE} as release
|
||||
ARG MAKE_TARGET=bin/toolbox
|
||||
RUN apk update && apk add ca-certificates curl && rm -rf /var/cache/apk/*
|
||||
COPY ./certs/* /usr/local/share/ca-certificates/
|
||||
RUN update-ca-certificates
|
||||
|
||||
FROM ${PLUGINS_RELEASE_IMAGE} as release
|
||||
RUN apk update && apk add curl && rm -rf /var/cache/apk/*
|
||||
COPY --from=ctls /kubectl /calicoctl /usr/local/bin/
|
||||
COPY --from=builder /usr/local/bin/config-function /usr/local/bin/config-function
|
||||
COPY --from=builder /usr/src/airshipctl/${MAKE_TARGET} /usr/local/bin/config-function
|
||||
CMD ["/usr/local/bin/config-function"]
|
||||
|
@ -1,8 +1,9 @@
|
||||
module opendev.org/airship/airshipctl/krm-fnunctions/toolbox/image
|
||||
|
||||
go 1.14
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
k8s.io/api v0.17.9
|
||||
sigs.k8s.io/kustomize/kyaml v0.10.6
|
||||
k8s.io/api v0.21.1
|
||||
k8s.io/apimachinery v0.21.1
|
||||
sigs.k8s.io/kustomize/kyaml v0.11.0
|
||||
)
|
||||
|
@ -24,7 +24,9 @@ import (
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
kerror "k8s.io/apimachinery/pkg/util/errors"
|
||||
"sigs.k8s.io/kustomize/kyaml/errors"
|
||||
"sigs.k8s.io/kustomize/kyaml/fn/framework"
|
||||
"sigs.k8s.io/kustomize/kyaml/fn/framework/command"
|
||||
"sigs.k8s.io/kustomize/kyaml/kio"
|
||||
kyaml "sigs.k8s.io/kustomize/kyaml/yaml"
|
||||
|
||||
@ -51,21 +53,18 @@ const (
|
||||
)
|
||||
|
||||
func main() {
|
||||
cfg := &v1.ConfigMap{}
|
||||
resourceList := &framework.ResourceList{FunctionConfig: &cfg}
|
||||
runner := ScriptRunner{
|
||||
ScriptFile: scriptPath,
|
||||
WorkDir: workdir,
|
||||
RenderedBundleFile: bundleFile,
|
||||
DataKey: scriptKey,
|
||||
ResourceList: resourceList,
|
||||
ConfigMap: cfg,
|
||||
ErrStream: os.Stderr,
|
||||
OutStream: os.Stderr,
|
||||
}
|
||||
cmd := framework.Command(resourceList, runner.Run)
|
||||
cmd := command.Build(&runner, command.StandaloneDisabled, false)
|
||||
|
||||
if err := cmd.Execute(); err != nil {
|
||||
log.Print(err)
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
@ -77,17 +76,20 @@ type ScriptRunner struct {
|
||||
ErrStream io.Writer
|
||||
OutStream io.Writer
|
||||
|
||||
ConfigMap *v1.ConfigMap
|
||||
ResourceList *framework.ResourceList
|
||||
ConfigMap *v1.ConfigMap
|
||||
}
|
||||
|
||||
// Run writes the script and bundle to the file system and executes it
|
||||
func (c *ScriptRunner) Run() error {
|
||||
// Process writes the script and bundle to the file system and executes it
|
||||
func (c *ScriptRunner) Process(rl *framework.ResourceList) error {
|
||||
if err := framework.LoadFunctionConfig(rl.FunctionConfig, &c.ConfigMap); err != nil {
|
||||
return errors.Wrap(err)
|
||||
}
|
||||
|
||||
bundlePath, scriptPath := c.getBundleAndScriptPath()
|
||||
|
||||
script, exist := c.ConfigMap.Data[c.DataKey]
|
||||
if !exist {
|
||||
return fmt.Errorf("ConfigMap '%s/%s' doesnt' have specified script key '%s'",
|
||||
return fmt.Errorf("ConfigMap '%s/%s' doesn't have specified script key '%s'",
|
||||
c.ConfigMap.Namespace, c.ConfigMap.Name, c.DataKey)
|
||||
}
|
||||
|
||||
@ -95,12 +97,12 @@ func (c *ScriptRunner) Run() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = c.writeBundle(bundlePath, c.ResourceList.Items)
|
||||
err = c.writeBundle(bundlePath, rl.Items)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.ResourceList.Items = nil
|
||||
rl.Items = nil
|
||||
|
||||
clicmd := exec.Command(scriptPath)
|
||||
clicmd.Stdout = c.OutStream
|
||||
|
@ -66,7 +66,7 @@ func TestCmdRun(t *testing.T) {
|
||||
{
|
||||
name: "Wrong key in ConfigMap",
|
||||
workdir: dir,
|
||||
errContains: "ConfigMap '/' doesnt' have specified script key 'script'",
|
||||
errContains: "ConfigMap '/' doesn't have specified script key 'script'",
|
||||
configMap: &v1.ConfigMap{
|
||||
Data: map[string]string{
|
||||
wrongDataKey: "",
|
||||
@ -109,11 +109,12 @@ func TestCmdRun(t *testing.T) {
|
||||
DataKey: dataKey,
|
||||
ErrStream: stderr,
|
||||
OutStream: stdout,
|
||||
ResourceList: &framework.ResourceList{Items: []*yaml.RNode{input}},
|
||||
ConfigMap: tt.configMap,
|
||||
RenderedBundleFile: bundlePath,
|
||||
}
|
||||
err = cmd.Run()
|
||||
err = cmd.Process(&framework.ResourceList{
|
||||
Items: []*yaml.RNode{input},
|
||||
})
|
||||
defer func() {
|
||||
require.NoError(t, cmd.Cleanup())
|
||||
}()
|
||||
@ -156,13 +157,14 @@ func TestCmdRunCleanup(t *testing.T) {
|
||||
DataKey: dataKey,
|
||||
ErrStream: stderr,
|
||||
OutStream: stdout,
|
||||
ResourceList: &framework.ResourceList{Items: []*yaml.RNode{input}},
|
||||
ConfigMap: cMap,
|
||||
RenderedBundleFile: bundlePath,
|
||||
}
|
||||
|
||||
require.NoError(t, cmd.Cleanup())
|
||||
err = cmd.Run()
|
||||
err = cmd.Process(&framework.ResourceList{
|
||||
Items: []*yaml.RNode{input},
|
||||
})
|
||||
defer func() {
|
||||
require.NoError(t, cmd.Cleanup())
|
||||
}()
|
||||
@ -278,9 +280,6 @@ metadata:
|
||||
},
|
||||
}
|
||||
|
||||
input, err := yaml.Parse(inputString)
|
||||
require.NoError(t, err)
|
||||
|
||||
stderr := bytes.NewBuffer([]byte{})
|
||||
stdout := bytes.NewBuffer([]byte{})
|
||||
|
||||
@ -299,7 +298,6 @@ metadata:
|
||||
DataKey: dataKey,
|
||||
ErrStream: stderr,
|
||||
OutStream: stdout,
|
||||
ResourceList: &framework.ResourceList{Items: []*yaml.RNode{input}},
|
||||
ConfigMap: cMap,
|
||||
RenderedBundleFile: bundlePath,
|
||||
}
|
||||
|
@ -114,5 +114,5 @@ files in place in the same folder.
|
||||
|
||||
Kustomize command to decrypt:
|
||||
|
||||
`KUSTOMIZE_PLUGIN_HOME=$(pwd)/manifests SOPS_IMPORT_PGP=$(cat key.asc) kustomize build \ --enable_alpha_plugins \
|
||||
`SOPS_IMPORT_PGP=$(cat key.asc) kustomize build \ --enable-alpha-plugins \
|
||||
manifests/site/test-site/target/generator/results`
|
||||
|
@ -28,5 +28,5 @@ This container encrypt the secrets and write it to directory specified in `kusto
|
||||
|
||||
To decrypt previously encrypted secrets we use [decrypt-secrets.yaml](results/decrypt-secrets.yaml).
|
||||
It will run the decrypt sops function when we run
|
||||
`KUSTOMIZE_PLUGIN_HOME=$(pwd)/manifests SOPS_IMPORT_PGP=$(cat key.asc) kustomize build --enable_alpha_plugins
|
||||
`SOPS_IMPORT_PGP=$(cat key.asc) kustomize build --enable-alpha-plugins
|
||||
manifests/site/test-site/target/catalogues/`
|
||||
|
@ -30,8 +30,8 @@ template: |
|
||||
labels:
|
||||
airshipit.org/deploy-k8s: "false"
|
||||
name: generated-secrets
|
||||
{{- $ephemeralClusterCa := genCAEx .ephemeralCluster.ca.subj .ephemeralCluster.ca.validity }}
|
||||
{{- $ephemeralKubeconfigCert := genSignedCertEx .ephemeralCluster.kubeconfigCert.subj nil nil .ephemeralCluster.kubeconfigCert.validity $ephemeralClusterCa }}
|
||||
{{- $ephemeralClusterCa := genCAEx .ephemeralCluster.ca.subj (int .ephemeralCluster.ca.validity) }}
|
||||
{{- $ephemeralKubeconfigCert := genSignedCertEx .ephemeralCluster.kubeconfigCert.subj nil nil (int .ephemeralCluster.kubeconfigCert.validity) $ephemeralClusterCa }}
|
||||
ephemeralClusterCa:
|
||||
crt: {{ $ephemeralClusterCa.Cert|b64enc|quote }}
|
||||
key: {{ $ephemeralClusterCa.Key|b64enc|quote }}
|
||||
@ -39,8 +39,8 @@ template: |
|
||||
certificate-authority-data: {{ $ephemeralClusterCa.Cert|b64enc|quote }}
|
||||
client-certificate-data: {{ $ephemeralKubeconfigCert.Cert|b64enc|quote }}
|
||||
client-key-data: {{ $ephemeralKubeconfigCert.Key|b64enc|quote }}
|
||||
{{- $targetClusterCa := genCAEx .targetCluster.ca.subj .targetCluster.ca.validity }}
|
||||
{{- $targetKubeconfigCert := genSignedCertEx .targetCluster.kubeconfigCert.subj nil nil .targetCluster.kubeconfigCert.validity $targetClusterCa }}
|
||||
{{- $targetClusterCa := genCAEx .targetCluster.ca.subj (int .targetCluster.ca.validity) }}
|
||||
{{- $targetKubeconfigCert := genSignedCertEx .targetCluster.kubeconfigCert.subj nil nil (int .targetCluster.kubeconfigCert.validity) $targetClusterCa }}
|
||||
targetClusterCa:
|
||||
tls.crt: {{ $targetClusterCa.Cert|b64enc|quote }}
|
||||
tls.key: {{ $targetClusterCa.Key|b64enc|quote }}
|
||||
@ -52,7 +52,7 @@ template: |
|
||||
passwords:
|
||||
root: {{ derivePassword 1 "long" (randAscii 10) "user" "airshipit.org"|quote }}
|
||||
deployer: {{ derivePassword 1 "long" (randAscii 10) "user" "airshipit.org"|quote }}
|
||||
{{- $sshKey := genSSHKeyPair .sshKeyGen.encBit }}
|
||||
{{- $sshKey := genSSHKeyPair (int .sshKeyGen.encBit) }}
|
||||
sshKeys:
|
||||
privateKey: {{ $sshKey.Private|quote }}
|
||||
publicKey: {{ $sshKey.Public|quote }}
|
||||
|
@ -16,12 +16,60 @@ package v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
)
|
||||
|
||||
// These types have been changed in kustomize 4.0.5.
|
||||
// Copying the version from 3.9.2
|
||||
|
||||
// Gvk identifies a Kubernetes API type.
|
||||
// https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
|
||||
type Gvk struct {
|
||||
Group string `json:"group,omitempty" yaml:"group,omitempty"`
|
||||
Version string `json:"version,omitempty" yaml:"version,omitempty"`
|
||||
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
|
||||
}
|
||||
|
||||
// Target refers to a kubernetes object by Group, Version, Kind and Name
|
||||
// gvk.Gvk contains Group, Version and Kind
|
||||
// APIVersion is added to keep the backward compatibility of using ObjectReference
|
||||
// for Var.ObjRef
|
||||
type Target struct {
|
||||
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
|
||||
Gvk `json:",inline,omitempty" yaml:",inline,omitempty"`
|
||||
Name string `json:"name" yaml:"name"`
|
||||
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
// ResID is an identifier of a k8s resource object.
|
||||
type ResID struct {
|
||||
// Gvk of the resource.
|
||||
Gvk `json:",inline,omitempty" yaml:",inline,omitempty"`
|
||||
|
||||
// Name of the resource.
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
|
||||
// Namespace the resource belongs to, if it can belong to a namespace.
|
||||
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
// Selector specifies a set of resources.
|
||||
// Any resource that matches intersection of all conditions
|
||||
// is included in this set.
|
||||
type Selector struct {
|
||||
// ResID refers to a GVKN/Ns of a resource.
|
||||
ResID `json:",inline,omitempty" yaml:",inline,omitempty"`
|
||||
|
||||
// AnnotationSelector is a string that follows the label selection expression
|
||||
// https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
|
||||
// It matches with the resource annotations.
|
||||
AnnotationSelector string `json:"annotationSelector,omitempty" yaml:"annotationSelector,omitempty"`
|
||||
|
||||
// LabelSelector is a string that follows the label selection expression
|
||||
// https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
|
||||
// It matches with the resource labels.
|
||||
LabelSelector string `json:"labelSelector,omitempty" yaml:"labelSelector,omitempty"`
|
||||
}
|
||||
|
||||
// Replacement defines how to perform a substitution
|
||||
// where it is from and where it is to.
|
||||
type Replacement struct {
|
||||
@ -35,15 +83,15 @@ type Replacement struct {
|
||||
// - from a field of one resource
|
||||
// - from a string
|
||||
type ReplSource struct {
|
||||
ObjRef *types.Target `json:"objref,omitempty" yaml:"objref,omitempty"`
|
||||
FieldRef string `json:"fieldref,omitempty" yaml:"fiedldref,omitempty"`
|
||||
Value string `json:"value,omitempty" yaml:"value,omitempty"`
|
||||
ObjRef *Target `json:"objref,omitempty" yaml:"objref,omitempty"`
|
||||
FieldRef string `json:"fieldref,omitempty" yaml:"fiedldref,omitempty"`
|
||||
Value string `json:"value,omitempty" yaml:"value,omitempty"`
|
||||
}
|
||||
|
||||
// ReplTarget defines where a substitution is to.
|
||||
type ReplTarget struct {
|
||||
ObjRef *types.Selector `json:"objref,omitempty" yaml:"objref,omitempty"`
|
||||
FieldRefs []string `json:"fieldrefs,omitempty" yaml:"fieldrefs,omitempty"`
|
||||
ObjRef *Selector `json:"objref,omitempty" yaml:"objref,omitempty"`
|
||||
FieldRefs []string `json:"fieldrefs,omitempty" yaml:"fieldrefs,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
@ -22,7 +22,6 @@ import (
|
||||
"k8s.io/api/core/v1"
|
||||
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
@ -681,6 +680,21 @@ func (in *GetKubeconfigOptions) DeepCopy() *GetKubeconfigOptions {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Gvk) DeepCopyInto(out *Gvk) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Gvk.
|
||||
func (in *Gvk) DeepCopy() *Gvk {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Gvk)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HostNetworkingSpec) DeepCopyInto(out *HostNetworkingSpec) {
|
||||
*out = *in
|
||||
@ -1464,7 +1478,7 @@ func (in *ReplSource) DeepCopyInto(out *ReplSource) {
|
||||
*out = *in
|
||||
if in.ObjRef != nil {
|
||||
in, out := &in.ObjRef, &out.ObjRef
|
||||
*out = new(types.Target)
|
||||
*out = new(Target)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
@ -1484,7 +1498,7 @@ func (in *ReplTarget) DeepCopyInto(out *ReplTarget) {
|
||||
*out = *in
|
||||
if in.ObjRef != nil {
|
||||
in, out := &in.ObjRef, &out.ObjRef
|
||||
*out = new(types.Selector)
|
||||
*out = new(Selector)
|
||||
**out = **in
|
||||
}
|
||||
if in.FieldRefs != nil {
|
||||
@ -1608,6 +1622,22 @@ func (in RepositorySpec) DeepCopy() RepositorySpec {
|
||||
return *out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResID) DeepCopyInto(out *ResID) {
|
||||
*out = *in
|
||||
out.Gvk = in.Gvk
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResID.
|
||||
func (in *ResID) DeepCopy() *ResID {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ResID)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Route) DeepCopyInto(out *Route) {
|
||||
*out = *in
|
||||
@ -1623,6 +1653,22 @@ func (in *Route) DeepCopy() *Route {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Selector) DeepCopyInto(out *Selector) {
|
||||
*out = *in
|
||||
out.ResID = in.ResID
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Selector.
|
||||
func (in *Selector) DeepCopy() *Selector {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Selector)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Service) DeepCopyInto(out *Service) {
|
||||
*out = *in
|
||||
@ -1653,6 +1699,22 @@ func (in *StorageMount) DeepCopy() *StorageMount {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Target) DeepCopyInto(out *Target) {
|
||||
*out = *in
|
||||
out.Gvk = in.Gvk
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Target.
|
||||
func (in *Target) DeepCopy() *Target {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Target)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Templater) DeepCopyInto(out *Templater) {
|
||||
*out = *in
|
||||
|
@ -113,7 +113,7 @@ func NewStatusMap(client client.Interface) (*StatusMap, error) {
|
||||
crds, err := statusMap.client.ApiextensionsClientSet().
|
||||
ApiextensionsV1().
|
||||
CustomResourceDefinitions().
|
||||
List(metav1.ListOptions{})
|
||||
List(context.Background(), metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -136,7 +136,7 @@ func (sm *StatusMap) ReadStatus(ctx context.Context, resource object.ObjMetadata
|
||||
}
|
||||
options := metav1.GetOptions{}
|
||||
object, err := sm.client.DynamicClient().Resource(gvr.Resource).
|
||||
Namespace(resource.Namespace).Get(resource.Name, options)
|
||||
Namespace(resource.Namespace).Get(context.Background(), resource.Name, options)
|
||||
if err != nil {
|
||||
return handleResourceStatusError(resource, err)
|
||||
}
|
||||
@ -165,7 +165,7 @@ func (sm *StatusMap) ReadStatusForObject(
|
||||
gvr := restMapping.Resource
|
||||
|
||||
obj, err := sm.client.DynamicClient().Resource(gvr).Namespace(resource.GetNamespace()).
|
||||
Get(resource.GetName(), metav1.GetOptions{})
|
||||
Get(context.Background(), resource.GetName(), metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return &event.ResourceStatus{
|
||||
Identifier: identifier,
|
||||
@ -214,7 +214,7 @@ func (sm *StatusMap) GetStatusForResource(resource document.Document) (status.St
|
||||
|
||||
gvr := restMapping.Resource
|
||||
obj, err := sm.client.DynamicClient().Resource(gvr).Namespace(resource.GetNamespace()).
|
||||
Get(resource.GetName(), metav1.GetOptions{})
|
||||
Get(context.Background(), resource.GetName(), metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
"strings"
|
||||
|
||||
kustfs "sigs.k8s.io/kustomize/api/filesys"
|
||||
"sigs.k8s.io/kustomize/api/k8sdeps/kunstruct"
|
||||
"sigs.k8s.io/kustomize/api/hasher"
|
||||
"sigs.k8s.io/kustomize/api/krusty"
|
||||
"sigs.k8s.io/kustomize/api/resmap"
|
||||
"sigs.k8s.io/kustomize/api/resource"
|
||||
@ -129,15 +129,14 @@ func NewBundle(fSys fs.FileSystem, kustomizePath string) (Bundle, error) {
|
||||
DoLegacyResourceSort: true, // Default and what we want
|
||||
LoadRestrictions: options.LoadRestrictions,
|
||||
DoPrune: false, // Default
|
||||
UseKyaml: true, // Default
|
||||
PluginConfig: &types.PluginConfig{
|
||||
PluginRestrictions: types.PluginRestrictionsNone,
|
||||
BpLoadingOptions: types.BploUseStaticallyLinked,
|
||||
},
|
||||
}
|
||||
|
||||
kustomizer := krusty.MakeKustomizer(fSys, &o)
|
||||
m, err := kustomizer.Run(kustomizePath)
|
||||
kustomizer := krusty.MakeKustomizer(&o)
|
||||
m, err := kustomizer.Run(fSys, kustomizePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -390,7 +389,7 @@ func (b *BundleFactory) Append(doc Document) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
res, err := resource.NewFactory(kunstruct.NewKunstructuredFactoryImpl()).FromBytes(yaml)
|
||||
res, err := resource.NewFactory(&hasher.Hasher{}).FromBytes(yaml)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/json"
|
||||
|
||||
"sigs.k8s.io/kustomize/api/k8sdeps/kunstruct"
|
||||
"sigs.k8s.io/kustomize/api/hasher"
|
||||
"sigs.k8s.io/kustomize/api/resource"
|
||||
"sigs.k8s.io/yaml"
|
||||
)
|
||||
@ -69,7 +69,9 @@ func (d *Factory) Annotate(newAnnotations map[string]string) {
|
||||
for key, val := range newAnnotations {
|
||||
annotations[key] = val
|
||||
}
|
||||
d.SetAnnotations(annotations)
|
||||
if err := d.SetAnnotations(annotations); err != nil {
|
||||
panic(fmt.Sprintf("Annotate: SetAnnotations failed %v", err))
|
||||
}
|
||||
}
|
||||
|
||||
// Label document by applying labels as map
|
||||
@ -82,7 +84,9 @@ func (d *Factory) Label(newLabels map[string]string) {
|
||||
for key, val := range newLabels {
|
||||
labels[key] = val
|
||||
}
|
||||
d.SetLabels(labels)
|
||||
if err := d.SetLabels(labels); err != nil {
|
||||
panic(fmt.Sprintf("Label: SetLabels failed %v", err))
|
||||
}
|
||||
}
|
||||
|
||||
// GetNamespace returns the namespace the resource thinks it's in.
|
||||
@ -289,7 +293,7 @@ func NewDocument(r *resource.Resource) (Document, error) {
|
||||
|
||||
// NewDocumentFromBytes constructs document from bytes
|
||||
func NewDocumentFromBytes(b []byte) (Document, error) {
|
||||
res, err := resource.NewFactory(kunstruct.NewKunstructuredFactoryImpl()).FromBytes(b)
|
||||
res, err := resource.NewFactory(&hasher.Hasher{}).FromBytes(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -127,12 +127,7 @@ func (lf *LabelFilter) Filter(input []*yaml.RNode) ([]*yaml.RNode, error) {
|
||||
}
|
||||
|
||||
for _, node := range input {
|
||||
nodeLabels, err := node.GetLabels()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if selector.Matches(labels.Set(nodeLabels)) {
|
||||
if selector.Matches(labels.Set(node.GetLabels())) {
|
||||
output = append(output, node)
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
airshipv1 "opendev.org/airship/airshipctl/pkg/api/v1alpha1"
|
||||
)
|
||||
|
||||
// ErrBadConfiguration returned in case of plugin misconfiguration
|
||||
@ -33,7 +33,7 @@ func (e ErrBadConfiguration) Error() string {
|
||||
|
||||
// ErrMultipleResources returned if multiple resources were found
|
||||
type ErrMultipleResources struct {
|
||||
ObjRef *types.Target
|
||||
ObjRef *airshipv1.Target
|
||||
}
|
||||
|
||||
func (e ErrMultipleResources) Error() string {
|
||||
@ -42,7 +42,7 @@ func (e ErrMultipleResources) Error() string {
|
||||
|
||||
// ErrSourceNotFound returned if a replacement source resource does not exist in resource map
|
||||
type ErrSourceNotFound struct {
|
||||
ObjRef *types.Target
|
||||
ObjRef *airshipv1.Target
|
||||
}
|
||||
|
||||
func (e ErrSourceNotFound) Error() string {
|
||||
@ -51,7 +51,7 @@ func (e ErrSourceNotFound) Error() string {
|
||||
|
||||
// ErrTargetNotFound returned if a replacement target resource does not exist in the resource map
|
||||
type ErrTargetNotFound struct {
|
||||
ObjRef *types.Selector
|
||||
ObjRef *airshipv1.Selector
|
||||
}
|
||||
|
||||
func (e ErrTargetNotFound) Error() string {
|
||||
|
@ -852,7 +852,7 @@ spec:
|
||||
containers:
|
||||
- name: myapp-container
|
||||
image: busybox`,
|
||||
expectedErr: "found more than one resources matching identified by Gvk: ~G_~V_Pod",
|
||||
expectedErr: "found more than one resources matching identified by Gvk: { Pod}",
|
||||
},
|
||||
{
|
||||
cfg: `
|
||||
@ -876,7 +876,7 @@ kind: Pod
|
||||
metadata:
|
||||
name: pod1`,
|
||||
expectedErr: "failed to find any source resources identified by " +
|
||||
"Gvk: ~G_~V_Pod Name: doesNotExists Namespace: default",
|
||||
"Gvk: { Pod} Name: doesNotExists Namespace: default",
|
||||
},
|
||||
{
|
||||
cfg: `
|
||||
@ -903,7 +903,7 @@ spec:
|
||||
containers:
|
||||
- name: myapp-container
|
||||
image: busybox`,
|
||||
expectedErr: "failed to find any target resources identified by Gvk: ~G_~V_Deployment",
|
||||
expectedErr: "failed to find any target resources identified by ResID: {{ Deployment} }",
|
||||
},
|
||||
{
|
||||
cfg: `
|
||||
|
@ -21,8 +21,8 @@ import (
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"sigs.k8s.io/kustomize/api/resid"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kyaml/resid"
|
||||
)
|
||||
|
||||
// Selector provides abstraction layer in front of kustomize selector
|
||||
|
@ -22,8 +22,8 @@ import (
|
||||
k8sv1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"sigs.k8s.io/kustomize/api/resid"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kyaml/resid"
|
||||
|
||||
airapiv1 "opendev.org/airship/airshipctl/pkg/api/v1alpha1"
|
||||
"opendev.org/airship/airshipctl/pkg/document"
|
||||
@ -155,10 +155,12 @@ func TestSelectorToObject(t *testing.T) {
|
||||
obj: &airapiv1.Clusterctl{},
|
||||
expectedSel: document.Selector{
|
||||
Selector: types.Selector{
|
||||
Gvk: resid.Gvk{
|
||||
Group: "airshipit.org",
|
||||
Version: "v1alpha1",
|
||||
Kind: "Clusterctl",
|
||||
ResId: resid.ResId{
|
||||
Gvk: resid.Gvk{
|
||||
Group: "airshipit.org",
|
||||
Version: "v1alpha1",
|
||||
Kind: "Clusterctl",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -179,12 +181,14 @@ func TestSelectorToObject(t *testing.T) {
|
||||
},
|
||||
expectedSel: document.Selector{
|
||||
Selector: types.Selector{
|
||||
Gvk: resid.Gvk{
|
||||
Group: "airshipit.org",
|
||||
Version: "v1alpha1",
|
||||
Kind: "Clusterctl",
|
||||
ResId: resid.ResId{
|
||||
Gvk: resid.Gvk{
|
||||
Group: "airshipit.org",
|
||||
Version: "v1alpha1",
|
||||
Kind: "Clusterctl",
|
||||
},
|
||||
Name: "clusterctl-v1",
|
||||
},
|
||||
Name: "clusterctl-v1",
|
||||
},
|
||||
},
|
||||
expectedErr: "",
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
kustfs "sigs.k8s.io/kustomize/api/filesys"
|
||||
kustfs "sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
// File extends kustomize File and provide abstraction to creating temporary files
|
||||
|
@ -30,6 +30,7 @@ import (
|
||||
applyevent "sigs.k8s.io/cli-utils/pkg/apply/event"
|
||||
"sigs.k8s.io/cli-utils/pkg/apply/poller"
|
||||
clicommon "sigs.k8s.io/cli-utils/pkg/common"
|
||||
"sigs.k8s.io/cli-utils/pkg/inventory"
|
||||
"sigs.k8s.io/cli-utils/pkg/manifestreader"
|
||||
"sigs.k8s.io/cli-utils/pkg/provider"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
@ -166,15 +167,18 @@ func (a *Applier) ensureNamespaceExists(name string, dryRun clicommon.DryRunStra
|
||||
return err
|
||||
}
|
||||
nsClient := clientSet.CoreV1().Namespaces()
|
||||
_, err = nsClient.Create(&v1.Namespace{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "Namespace",
|
||||
APIVersion: "v1",
|
||||
_, err = nsClient.Create(
|
||||
context.Background(),
|
||||
&v1.Namespace{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "Namespace",
|
||||
APIVersion: "v1",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
})
|
||||
metav1.CreateOptions{})
|
||||
if err != nil && !apierror.IsAlreadyExists(err) {
|
||||
// we got error and error doesn't say that NS already exist
|
||||
return err
|
||||
@ -225,7 +229,12 @@ func (a *Adaptor) Initialize(p poller.Poller) error {
|
||||
// Run perform apply operation
|
||||
func (a *Adaptor) Run(ctx context.Context, objects []*unstructured.Unstructured,
|
||||
options cliapply.Options) <-chan applyevent.Event {
|
||||
return a.CliUtilsApplier.Run(ctx, objects, options)
|
||||
inv, objects, err := inventory.SplitUnstructureds(objects)
|
||||
if err != nil {
|
||||
log.Debugf("Error while splitting objects %v", err)
|
||||
return nil
|
||||
}
|
||||
return a.CliUtilsApplier.Run(ctx, inv, objects, options)
|
||||
}
|
||||
|
||||
// NewInventoryDocument returns default config map with inventory Id to group up the objects
|
||||
|
@ -15,6 +15,7 @@
|
||||
package kubeconfig
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"time"
|
||||
@ -123,7 +124,7 @@ func FromSecret(c corev1.CoreV1Interface, o *v1alpha1.GetKubeconfigOptions) Kube
|
||||
|
||||
data, exist, secretName := new([]byte), new(bool), fmt.Sprintf("%s-kubeconfig", o.ManagedClusterName)
|
||||
fn := func() (bool, error) {
|
||||
secret, err := c.Secrets(o.ManagedClusterNamespace).Get(secretName, metav1.GetOptions{})
|
||||
secret, err := c.Secrets(o.ManagedClusterNamespace).Get(context.Background(), secretName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
log.Printf("get kubeconfig from secret failed, retrying, reason: %v", err)
|
||||
return false, nil
|
||||
|
@ -16,6 +16,7 @@ package kubeconfig_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
@ -30,6 +31,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
applycorev1 "k8s.io/client-go/applyconfigurations/core/v1"
|
||||
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
v1 "k8s.io/client-go/tools/clientcmd/api/v1"
|
||||
kustfs "sigs.k8s.io/kustomize/api/filesys"
|
||||
@ -179,23 +181,31 @@ type SecretMockInterface struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (s *SecretMockInterface) Create(_ *apiv1.Secret) (*apiv1.Secret, error) {
|
||||
func (s *SecretMockInterface) Create(_ context.Context, _ *apiv1.Secret,
|
||||
_ metav1.CreateOptions) (*apiv1.Secret, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *SecretMockInterface) Update(_ *apiv1.Secret) (*apiv1.Secret, error) {
|
||||
func (s *SecretMockInterface) Update(_ context.Context, _ *apiv1.Secret,
|
||||
_ metav1.UpdateOptions) (*apiv1.Secret, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *SecretMockInterface) Delete(_ string, _ *metav1.DeleteOptions) error {
|
||||
func (s *SecretMockInterface) Delete(_ context.Context, _ string, _ metav1.DeleteOptions) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *SecretMockInterface) DeleteCollection(_ *metav1.DeleteOptions, _ metav1.ListOptions) error {
|
||||
func (s *SecretMockInterface) DeleteCollection(_ context.Context, _ metav1.DeleteOptions,
|
||||
_ metav1.ListOptions) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *SecretMockInterface) Get(name string, options metav1.GetOptions) (*apiv1.Secret, error) {
|
||||
func (s *SecretMockInterface) Apply(_ context.Context, _ *applycorev1.SecretApplyConfiguration,
|
||||
_ metav1.ApplyOptions) (*apiv1.Secret, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *SecretMockInterface) Get(_ context.Context, name string, options metav1.GetOptions) (*apiv1.Secret, error) {
|
||||
args := s.Called(name, options)
|
||||
expectedResult, ok := args.Get(0).(*apiv1.Secret)
|
||||
if !ok {
|
||||
@ -204,15 +214,16 @@ func (s *SecretMockInterface) Get(name string, options metav1.GetOptions) (*apiv
|
||||
return expectedResult, args.Error(1)
|
||||
}
|
||||
|
||||
func (s *SecretMockInterface) List(_ metav1.ListOptions) (*apiv1.SecretList, error) {
|
||||
func (s *SecretMockInterface) List(_ context.Context, _ metav1.ListOptions) (*apiv1.SecretList, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *SecretMockInterface) Watch(_ metav1.ListOptions) (watch.Interface, error) {
|
||||
func (s *SecretMockInterface) Watch(_ context.Context, _ metav1.ListOptions) (watch.Interface, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *SecretMockInterface) Patch(_ string, _ types.PatchType, _ []byte, _ ...string) (*apiv1.Secret, error) {
|
||||
func (s *SecretMockInterface) Patch(_ context.Context, _ string, _ types.PatchType, _ []byte,
|
||||
_ metav1.PatchOptions, _ ...string) (*apiv1.Secret, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,8 @@
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"k8s.io/cli-runtime/pkg/genericclioptions"
|
||||
"k8s.io/cli-runtime/pkg/printers"
|
||||
"k8s.io/kubectl/pkg/cmd/apply"
|
||||
@ -29,7 +31,10 @@ type ApplyOptions struct {
|
||||
|
||||
// SetDryRun enables/disables the dry run flag in kubectl apply options
|
||||
func (ao *ApplyOptions) SetDryRun(dryRun bool) {
|
||||
ao.ApplyOptions.DryRun = dryRun
|
||||
if dryRun {
|
||||
// --dry-run is deprecated and can be replaced with --dry-run=client.
|
||||
ao.ApplyOptions.DryRunStrategy = cmdutil.DryRunClient
|
||||
}
|
||||
}
|
||||
|
||||
// SetPrune enables/disables the prune flag in kubectl apply options
|
||||
@ -64,13 +69,13 @@ func NewApplyOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) (*A
|
||||
|
||||
o.ToPrinter = func(operation string) (printers.ResourcePrinter, error) {
|
||||
o.PrintFlags.NamePrintFlags.Operation = operation
|
||||
if o.DryRun {
|
||||
if o.DryRunStrategy == cmdutil.DryRunClient {
|
||||
err := o.PrintFlags.Complete("%s (dry run)")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if o.ServerDryRun {
|
||||
if o.DryRunStrategy == cmdutil.DryRunServer {
|
||||
err := o.PrintFlags.Complete("%s (server dry run)")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -85,17 +90,16 @@ func NewApplyOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) (*A
|
||||
return nil, err
|
||||
}
|
||||
|
||||
o.DiscoveryClient, err = f.ToDiscoveryClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dynamicClient, err := f.DynamicClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
o.DeleteOptions = o.DeleteFlags.ToOptions(dynamicClient, o.IOStreams)
|
||||
o.DeleteOptions, err = o.DeleteFlags.ToOptions(dynamicClient, o.IOStreams)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// This can only fail if ToDiscoverClient() function fails
|
||||
o.OpenAPISchema, err = f.OpenAPISchema()
|
||||
if err != nil {
|
||||
@ -115,7 +119,12 @@ func NewApplyOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) (*A
|
||||
|
||||
o.DynamicClient = dynamicClient
|
||||
|
||||
o.Namespace, o.EnforceNamespace, err = f.ToRawKubeConfigLoader().Namespace()
|
||||
cl := f.ToRawKubeConfigLoader()
|
||||
if cl == nil {
|
||||
return nil, fmt.Errorf("ToRawKubeConfigLoader() returned nil")
|
||||
}
|
||||
|
||||
o.Namespace, o.EnforceNamespace, err = cl.Namespace()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ var (
|
||||
filenameRC = "testdata/replicationcontroller.yaml"
|
||||
|
||||
testStreams = genericclioptions.NewTestIOStreamsDiscard()
|
||||
ErrToDiscoveryError = errors.New("ErrToDiscoveryError")
|
||||
ErrDynamicClientError = errors.New("ErrDynamicClientError")
|
||||
ErrValidateError = errors.New("ErrValidateError")
|
||||
ErrToRESTMapperError = errors.New("ErrToRESTMapperError")
|
||||
@ -42,10 +41,6 @@ func TestNewApplyOptionsFactoryFailures(t *testing.T) {
|
||||
f cmdutil.Factory
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
f: k8stest.NewMockKubectlFactory().WithToDiscoveryClientByError(nil, ErrToDiscoveryError),
|
||||
expectedError: ErrToDiscoveryError,
|
||||
},
|
||||
{
|
||||
f: k8stest.NewMockKubectlFactory().WithDynamicClientByError(nil, ErrDynamicClientError),
|
||||
expectedError: ErrDynamicClientError,
|
||||
|
@ -13,13 +13,12 @@
|
||||
- name: get BareMetalHost objects
|
||||
shell: |
|
||||
set -e
|
||||
kustomize build --enable_alpha_plugins \
|
||||
kustomize build --enable-alpha-plugins \
|
||||
{{ airship_config_manifest_directory }}/{{ airship_config_site_path }}/{{ path }} 2>/dev/null |
|
||||
kustomize cfg grep "kind=BareMetalHost"
|
||||
register: bmh_command
|
||||
failed_when: "bmh_command.stdout == ''"
|
||||
environment:
|
||||
KUSTOMIZE_PLUGIN_HOME: "/tmp"
|
||||
KUSTOMIZE_ENABLE_ALPHA_COMMANDS: "true"
|
||||
SOPS_IMPORT_PGP: "{{ airship_config_pgp }}"
|
||||
|
||||
@ -29,13 +28,12 @@
|
||||
- name: get network configuration for BareMetalHost objects
|
||||
shell: |
|
||||
set -e
|
||||
kustomize build --enable_alpha_plugins \
|
||||
kustomize build --enable-alpha-plugins \
|
||||
{{ airship_config_manifest_directory }}/{{ airship_config_site_path }}/{{ path }} 2>/dev/null |
|
||||
kustomize cfg grep "metadata.name={{ item.spec.networkData.name }}"
|
||||
register: netdata_command
|
||||
failed_when: "netdata_command.stdout == ''"
|
||||
environment:
|
||||
KUSTOMIZE_PLUGIN_HOME: "/tmp"
|
||||
KUSTOMIZE_ENABLE_ALPHA_COMMANDS: "true"
|
||||
SOPS_IMPORT_PGP: "{{ airship_config_pgp }}"
|
||||
with_items: "{{ bmh }}"
|
||||
|
@ -10,7 +10,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
kustomize_version: v3.9.4
|
||||
kustomize_version: v4.2.0
|
||||
kustomize_download_url: "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/{{ kustomize_version }}/kustomize_{{ kustomize_version }}_linux_amd64.tar.gz"
|
||||
proxy:
|
||||
http:
|
||||
|
Loading…
Reference in New Issue
Block a user