Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always use correct tool version #13

Merged
merged 1 commit into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,15 @@ updates:
update-types:
- version-update:semver-major
- version-update:semver-minor
- package-ecosystem: gomod
directory: "/hack/controller-gen"
schedule:
interval: daily
- package-ecosystem: gomod
directory: "/hack/ginkgo"
schedule:
interval: daily
- package-ecosystem: gomod
directory: "/hack/kustomize"
schedule:
interval: daily
43 changes: 10 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ else
GOBIN=$(shell go env GOBIN)
endif

CONTROLLER_GEN ?= go run -modfile hack/controller-gen/go.mod sigs.k8s.io/controller-tools/cmd/controller-gen
GINKGO ?= go run -modfile hack/ginkgo/go.mod github.com/onsi/ginkgo/ginkgo
KUSTOMIZE ?= go run -modfile hack/kustomize/go.mod sigs.k8s.io/kustomize/kustomize/v3

# Setting SHELL to bash allows bash commands to be executed by recipes.
# This is a requirement for 'setup-envtest.sh' in the test target.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
Expand All @@ -37,10 +41,10 @@ help: ## Display this help.

##@ Development

manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
manifests: ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases

generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
generate: ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

fmt: ## Run go fmt against code.
Expand All @@ -50,7 +54,7 @@ vet: ## Run go vet against code.
go vet ./...

ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
test: manifests generate fmt vet ginkgo ## Run tests.
test: manifests generate fmt vet ## Run tests.
mkdir -p ${ENVTEST_ASSETS_DIR}
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.8.3/hack/setup-envtest.sh
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); $(GINKGO) -v ./... -coverprofile cover.out
Expand All @@ -71,42 +75,15 @@ docker-push: ## Push docker image with the manager.

##@ Deployment

install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
install: manifests ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl apply -f -

uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
uninstall: manifests ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl delete -f -

deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
deploy: manifests ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | kubectl apply -f -

undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/default | kubectl delete -f -


CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1)

KUSTOMIZE = $(shell pwd)/bin/kustomize
kustomize: ## Download kustomize locally if necessary.
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v3@v3.8.7)

GINKGO = $(shell pwd)/bin/ginkgo
ginkgo: ## Download ginkgo locally if necessary.
$(call go-get-tool,$(GINKGO),github.com/onsi/ginkgo/ginkgo@v1.16.4)

# go-get-tool will 'go get' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool
@[ -f $(1) ] || { \
set -e ;\
TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
go mod init tmp ;\
echo "Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
rm -rf $$TMP_DIR ;\
}
endef
6 changes: 3 additions & 3 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ layout:
- go.kubebuilder.io/v3
multigroup: true
projectName: service-binding-operator
repo: github.com/kubernetes-sigs/service-binding
repo: github.com/k8s-service-bindings/implementation
resources:
- api:
crdVersion: v1
namespaced: true
controller: true
domain: service.binding
kind: ServiceBinding
path: github.com/kubernetes-sigs/service-binding/apis/v1alpha2
path: github.com/k8s-service-bindings/implementation/apis/v1alpha2
version: v1alpha2
- api:
crdVersion: v1
controller: true
domain: service.binding
kind: ClusterApplicationResourceMapping
path: github.com/kubernetes-sigs/service-binding/apis/v1alpha2
path: github.com/k8s-service-bindings/implementation/apis/v1alpha2
version: v1alpha2
version: "3"
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ spec:
singular: clusterapplicationresourcemapping
scope: Cluster
versions:
- name: v1alpha2
- additionalPrinterColumns:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha2
schema:
openAPIV3Schema:
description: ClusterApplicationResourceMapping is the Schema for the clusterapplicationresourcemappings
Expand All @@ -38,20 +42,49 @@ spec:
description: ClusterApplicationResourceMappingSpec defines the desired
state of ClusterApplicationResourceMapping
properties:
foo:
description: Foo is an example field of ClusterApplicationResourceMapping.
Edit clusterapplicationresourcemapping_types.go to remove/update
type: string
type: object
status:
description: ClusterApplicationResourceMappingStatus defines the observed
state of ClusterApplicationResourceMapping
versions:
description: Versions is the collection of versions for a given resource,
with mappings.
items:
description: ClusterApplicationResourceMappingVersion defines the
mapping for a specific version of an application resource.
properties:
containers:
description: Containers is the collection of JSONPaths that
container configuration may be written to.
items:
type: string
type: array
envs:
description: Envs is the collection of JSONPaths that env configuration
may be written to.
items:
type: string
type: array
version:
description: Version is the version of the application resource
that this mapping is for.
type: string
volumeMounts:
description: VolumeMounts is the collection of JSONPaths that
volume mount configuration may be written to.
items:
type: string
type: array
volumes:
description: Volumes is the JSONPath that volume configuration
must be written to.
type: string
required:
- version
- volumes
type: object
type: array
type: object
type: object
served: true
storage: true
subresources:
status: {}
subresources: {}
status:
acceptedNames:
kind: ""
Expand Down
Loading