Skip to content

Commit 7ddc93b

Browse files
authored
Merge pull request #1 from BlaineEXE/cosi-new-master
Merge COSI API monorepo
2 parents 8ed940b + 5fa5cf7 commit 7ddc93b

File tree

7,816 files changed

+2551652
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

7,816 files changed

+2551652
-6
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Bug Report
3+
about: Use this template for reporting bugs or issues.
4+
title: "[DATE] - Title"
5+
labels: bug
6+
---
7+
# Bug Report
8+
9+
<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks!
10+
11+
If the matter is security related, please disclose it privately via https://kubernetes.io/security/
12+
-->
13+
14+
**What happened**:
15+
16+
**What you expected to happen**:
17+
18+
**How to reproduce this bug (as minimally and precisely as possible)**:
19+
20+
**Anything else relevant for this bug report?**:
21+
22+
**Environment**:
23+
24+
- Kubernetes version (use `kubectl version`), please list client and server:
25+
- Sidecar version (provide the release tag or commit hash):
26+
- Provisoner name and version (provide the release tag or commit hash):
27+
- Cloud provider or hardware configuration:
28+
- OS (e.g: `cat /etc/os-release`):
29+
- Kernel (e.g. `uname -a`):
30+
- Install tools:
31+
- Network plugin and version (if this is a network-related bug):
32+
- Others:

.github/ISSUE_TEMPLATE/enhancement.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Enhancement/Feature Request
3+
about: Use this template to request a new feature or enhancement for the COSI API
4+
title: "[DATE] - Title"
5+
---
6+
# Enhancement
7+
8+
**Is your feature request related to a problem?/Why is this needed**
9+
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
10+
11+
**Describe the solution you'd like in detail**
12+
<!-- A clear and concise description of what you want to happen. -->
13+
14+
**Describe alternatives you've considered**
15+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
16+
17+
**Additional context**
18+
<!-- Add any other context or screenshots about the feature request or enhancement here. -->

.github/SECURITY.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
Information about supported Kubernetes versions can be found on the
6+
[Kubernetes version and version skew support policy] page on the Kubernetes website.
7+
8+
## Reporting a Vulnerability
9+
10+
Instructions for reporting a vulnerability can be found on the
11+
[Kubernetes Security and Disclosure Information] page.
12+
13+
[Kubernetes version and version skew support policy]: https://kubernetes.io/docs/setup/release/version-skew-policy/#supported-versions
14+
[Kubernetes Security and Disclosure Information]: https://kubernetes.io/docs/reference/issues-security/security/#report-a-vulnerability

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.tmp
2+
.DS_Store
3+
.build
4+
*.swp
5+
release-tools
6+
.idea
7+
travis.yml
8+
.cache

.golangci.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
run:
2+
timeout: 5m
3+
allow-parallel-runners: true
4+
5+
issues:
6+
# don't skip warning about doc comments
7+
# don't exclude the default set of lint
8+
exclude-use-default: false
9+
# restore some of the defaults
10+
# (fill in the rest as needed)
11+
exclude-rules:
12+
- path: "apis/*"
13+
linters:
14+
- lll
15+
- path: "internal/*"
16+
linters:
17+
- dupl
18+
- lll
19+
linters:
20+
disable-all: true
21+
enable:
22+
- copyloopvar
23+
- dupl
24+
- errcheck
25+
- ginkgolinter
26+
- goconst
27+
- gocyclo
28+
- gofmt
29+
- goimports
30+
- gosimple
31+
- govet
32+
- ineffassign
33+
- lll
34+
- misspell
35+
- nakedret
36+
- prealloc
37+
- revive
38+
- staticcheck
39+
- typecheck
40+
- unconvert
41+
- unparam
42+
- unused
43+
44+
linters-settings:
45+
revive:
46+
rules:
47+
- name: comment-spacings

CHANGELOG/CHANGELOG-0.1.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# First Release v0.1.0
2+
3+
### New Features
4+
5+
- API v1alpha1 for Bucket* resources and respective controllers
6+
7+
### Thanks to our contributors
8+
9+
- wlan0
10+
- krishchow
11+
- mukhoakash
12+
- brahmaroutu
13+
- tparikh
14+
- thotz
15+
16+
and others

Makefile

+212
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
# Copyright 2020 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
.DEFAULT_GOAL := help
16+
.SUFFIXES: # remove legacy builtin suffixes to allow easier make debugging
17+
SHELL = /usr/bin/env bash
18+
19+
.PHONY: help
20+
help: ## Display this help.
21+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
22+
23+
# If GOARCH is not set in the env, find it
24+
GOARCH ?= $(shell go env GOARCH)
25+
26+
##
27+
## ==== ARGS ===== #
28+
29+
## Container build tool compatible with `docker` API
30+
DOCKER ?= docker
31+
32+
## Platform for 'build'
33+
PLATFORM ?= linux/$(GOARCH)
34+
35+
## Additional args for 'build'
36+
BUILD_ARGS ?=
37+
38+
## Image tag for controller image build
39+
CONTROLLER_TAG ?= cosi-controller:latest
40+
41+
## Image tag for sidecar image build
42+
SIDECAR_TAG ?= cosi-provisioner-sidecar:latest
43+
44+
## Location to install dependencies to
45+
TOOLBIN ?= $(CURDIR)/.cache/tools
46+
$(TOOLBIN):
47+
mkdir -p $(TOOLBIN)
48+
49+
##@ Development
50+
51+
.PHONY: all .gen
52+
.gen: generate codegen # can be done in parallel with 'make -j'
53+
.NOTPARALLEL: all # codegen must be finished before fmt/vet
54+
all: .gen fmt vet build ## Build all targets, plus their prerequisites (faster with 'make -j')
55+
56+
.PHONY: generate
57+
generate: controller/Dockerfile sidecar/Dockerfile ## Generate files
58+
$(MAKE) -C client crds
59+
$(MAKE) -C proto generate
60+
61+
.PHONY: codegen
62+
codegen: codegen.client codegen.proto ## Generate code
63+
64+
.PHONY: fmt
65+
fmt: fmt.client fmt.controller fmt.sidecar ## Format code
66+
67+
.PHONY: vet
68+
vet: vet.client vet.controller vet.sidecar ## Vet code
69+
70+
.PHONY: test
71+
test: .test.proto test.client test.controller test.sidecar ## Run tests including unit tests
72+
73+
.PHONY: test-e2e
74+
test-e2e: chainsaw # Run e2e tests against the K8s cluster specified in ~/.kube/config. It requires both controller and driver deployed. If you need to create a cluster beforehand, consider using 'cluster' and 'deploy' targets.
75+
$(CHAINSAW) test --values ./test/e2e/values.yaml
76+
77+
.PHONY: lint
78+
lint: golangci-lint.client golangci-lint.controller golangci-lint.sidecar ## Run all linters (suggest `make -k`)
79+
80+
.PHONY: lint-fix
81+
lint-fix: golangci-lint-fix.client golangci-lint-fix.controller golangci-lint-fix.sidecar ## Run all linters and perform fixes where possible (suggest `make -k`)
82+
83+
##@ Build
84+
85+
.PHONY: build
86+
build: build.controller build.sidecar ## Build all container images for development
87+
88+
.PHONY: build.controller build.sidecar
89+
build.controller: controller/Dockerfile ## Build only the controller container image
90+
$(DOCKER) build --file controller/Dockerfile --platform $(PLATFORM) $(BUILD_ARGS) --tag $(CONTROLLER_TAG) .
91+
build.sidecar: sidecar/Dockerfile ## Build only the sidecar container image
92+
$(DOCKER) build --file sidecar/Dockerfile --platform $(PLATFORM) $(BUILD_ARGS) --tag $(SIDECAR_TAG) .
93+
94+
.PHONY: clean
95+
## Clean build environment
96+
clean:
97+
$(MAKE) -C proto clean
98+
99+
.PHONY: clobber
100+
## Clean build environment and cached tools
101+
clobber:
102+
$(MAKE) -C proto clobber
103+
rm -rf $(TOOLBIN)
104+
rm -rf $(CURDIR)/.cache
105+
106+
##
107+
## === INTERMEDIATES === #
108+
109+
%/Dockerfile: hack/Dockerfile.in hack/gen-dockerfile.sh
110+
hack/gen-dockerfile.sh $* > "$@"
111+
112+
codegen.%: FORCE
113+
$(MAKE) -C $* codegen
114+
115+
fmt.%: FORCE
116+
cd $* && go fmt ./...
117+
118+
vet.%: FORCE
119+
cd $* && go vet ./...
120+
121+
test.%: fmt.% vet.% FORCE
122+
cd $* && go test ./...
123+
124+
# golangci-lint --new flag only complains about new code
125+
golangci-lint.%: $(GOLANGCI_LINT)
126+
cd $* && $(GOLANGCI_LINT) run --config $(CURDIR)/.golangci.yaml --new
127+
128+
golangci-lint-fix.%: $(GOLANGCI_LINT)
129+
cd $* && $(GOLANGCI_LINT) run --config $(CURDIR)/.golangci.yaml --new --fix
130+
131+
.PHONY: .test.proto
132+
.test.proto: # gRPC proto has a special unit test
133+
$(MAKE) -C proto check
134+
135+
.PHONY: FORCE # use this to force phony behavior for targets with pattern rules
136+
FORCE:
137+
138+
##@ Deployment
139+
140+
.PHONY: cluster
141+
cluster: kind ctlptl ## Create Kind cluster and local registry
142+
$(CTLPTL) apply -f ctlptl.yaml
143+
144+
.PHONY: cluster-reset
145+
cluster-reset: kind ctlptl ## Delete Kind cluster
146+
$(CTLPTL) delete -f ctlptl.yaml
147+
148+
.PHONY: deploy
149+
deploy: kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. The 'generate' and 'codegen' targets should be run manually, and are expected to be run at least once before the 'deploy' target, as those are not cached.
150+
$(KUSTOMIZE) build . | $(KUBECTL) apply -f -
151+
152+
.PHONY: undeploy
153+
undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
154+
$(KUSTOMIZE) build . | $(KUBECTL) delete --ignore-not-found=true -f -
155+
156+
##@ Tools
157+
158+
## Tool Binaries
159+
CHAINSAW ?= $(TOOLBIN)/chainsaw
160+
CTLPTL ?= $(TOOLBIN)/ctlptl
161+
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
162+
KIND ?= $(TOOLBIN)/kind
163+
KUBECTL ?= kubectl ## Special case, we do not manage it via tools.go
164+
KUSTOMIZE ?= $(TOOLBIN)/kustomize
165+
166+
## Tool Versions
167+
CHAINSAW_VERSION ?= $(shell grep 'github.com/kyverno/chainsaw ' ./hack/tools/go.mod | cut -d ' ' -f 2)
168+
CTLPTL_VERSION ?= $(shell grep 'github.com/tilt-dev/ctlptl ' ./hack/tools/go.mod | cut -d ' ' -f 2)
169+
GOLANGCI_LINT_VERSION ?= $(shell grep 'github.com/golangci/golangci-lint ' ./hack/tools/go.mod | cut -d ' ' -f 2)
170+
KIND_VERSION ?= $(shell grep 'sigs.k8s.io/kind ' ./hack/tools/go.mod | cut -d ' ' -f 2)
171+
KUSTOMIZE_VERSION ?= $(shell grep 'sigs.k8s.io/kustomize/kustomize/v5 ' ./hack/tools/go.mod | cut -d ' ' -f 2)
172+
173+
.PHONY: chainsaw
174+
chainsaw: $(CHAINSAW)$(CHAINSAW_VERSION) ## Download chainsaw locally if necessary.
175+
$(CHAINSAW)$(CHAINSAW_VERSION): $(TOOLBIN)
176+
$(call go-install-tool,$(CHAINSAW),github.com/kyverno/chainsaw,$(CHAINSAW_VERSION))
177+
178+
.PHONY: ctlptl
179+
ctlptl: $(CTLPTL)$(CTLPTL_VERSION) ## Download ctlptl locally if necessary.
180+
$(CTLPTL)$(CTLPTL_VERSION): $(TOOLBIN)
181+
$(call go-install-tool,$(CTLPTL),github.com/tilt-dev/ctlptl/cmd/ctlptl,$(CTLPTL_VERSION))
182+
183+
.PHONY: golangci-lint
184+
golangci-lint: $(GOLANGCI_LINT)$(GOLANGCI_LINT_VERSION) ## Download golangci-lint locally if necessary.
185+
$(GOLANGCI_LINT)$(GOLANGCI_LINT_VERSION): $(LOCALBIN)
186+
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
187+
188+
.PHONY: kind
189+
kind: $(KIND)$(KIND_VERSION) ## Download kind locally if necessary.
190+
$(KIND)$(KIND_VERSION): $(TOOLBIN)
191+
$(call go-install-tool,$(KIND),sigs.k8s.io/kind,$(KIND_VERSION))
192+
193+
.PHONY: kustomize
194+
kustomize: $(KUSTOMIZE)$(KUSTOMIZE_VERSION) ## Download kustomize locally if necessary.
195+
$(KUSTOMIZE)$(KUSTOMIZE_VERSION): $(TOOLBIN)
196+
$(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION))
197+
198+
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
199+
# $1 - target path with name of binary
200+
# $2 - package url which can be installed
201+
# $3 - specific version of package
202+
define go-install-tool
203+
@[ -f "$(1)-$(3)" ] || { \
204+
set -e; \
205+
package=$(2)@$(3) ;\
206+
echo "Downloading $${package}" ;\
207+
rm -f $(1) || true ;\
208+
GOBIN=$(TOOLBIN) go install $${package} ;\
209+
mv $(1) $(1)-$(3) ;\
210+
} ;\
211+
ln -sf $(1)-$(3) $(1)
212+
endef

OWNERS

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ approvers:
77
- saad-ali
88
- shanduur
99
- xing-yang
10+
emeritus_approvers:
11+
- wlan0 # 2024-11-22
12+
- mukhoakash # 2024-11-22

0 commit comments

Comments
 (0)