Skip to content

Commit f955721

Browse files
bouskaJknrc
authored andcommitted
Regenerate project
Signed-off-by: Jan Bouska <[email protected]>
1 parent 1d65566 commit f955721

Some content is hidden

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

41 files changed

+1411
-295
lines changed

.devcontainer/devcontainer.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "Kubebuilder DevContainer",
3+
"image": "docker.io/golang:1.23",
4+
"features": {
5+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
6+
"ghcr.io/devcontainers/features/git:1": {}
7+
},
8+
9+
"runArgs": ["--network=host"],
10+
11+
"customizations": {
12+
"vscode": {
13+
"settings": {
14+
"terminal.integrated.shell.linux": "/bin/bash"
15+
},
16+
"extensions": [
17+
"ms-kubernetes-tools.vscode-kubernetes-tools",
18+
"ms-azuretools.vscode-docker"
19+
]
20+
}
21+
},
22+
23+
"onCreateCommand": "bash .devcontainer/post-install.sh"
24+
}
25+

.devcontainer/post-install.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -x
3+
4+
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
5+
chmod +x ./kind
6+
mv ./kind /usr/local/bin/kind
7+
8+
curl -L -o kubebuilder https://go.kubebuilder.io/dl/latest/linux/amd64
9+
chmod +x kubebuilder
10+
mv kubebuilder /usr/local/bin/
11+
12+
KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
13+
curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl"
14+
chmod +x kubectl
15+
mv kubectl /usr/local/bin/kubectl
16+
17+
docker network create -d=bridge --subnet=172.19.0.0/24 kind
18+
19+
kind version
20+
kubebuilder version
21+
docker --version
22+
go version
23+
kubectl version --client

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2+
# Ignore build and test binaries.
3+
bin/

.github/workflows/lint.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
lint:
9+
name: Run on Ubuntu
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Clone the code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version-file: go.mod
19+
20+
- name: Run linter
21+
uses: golangci/golangci-lint-action@v6
22+
with:
23+
version: v1.63.4

.github/workflows/test-e2e.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: E2E Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test-e2e:
9+
name: Run on Ubuntu
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Clone the code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version-file: go.mod
19+
20+
- name: Install the latest version of kind
21+
run: |
22+
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
23+
chmod +x ./kind
24+
sudo mv ./kind /usr/local/bin/kind
25+
26+
- name: Verify kind installation
27+
run: kind version
28+
29+
- name: Create kind cluster
30+
run: kind create cluster
31+
32+
- name: Running Test e2e
33+
run: |
34+
go mod tidy
35+
make test-e2e

.github/workflows/test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
name: Run on Ubuntu
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Clone the code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version-file: go.mod
19+
20+
- name: Running Tests
21+
run: |
22+
go mod tidy
23+
make test

.golangci.yml

Lines changed: 47 additions & 0 deletions
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: "api/*"
13+
linters:
14+
- lll
15+
- path: "internal/*"
16+
linters:
17+
- dupl
18+
- lll
19+
linters:
20+
disable-all: true
21+
enable:
22+
- dupl
23+
- errcheck
24+
- copyloopvar
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

Makefile

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
2828
# This variable is used to construct full image tags for bundle and catalog images.
2929
#
3030
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
31-
# sigstore.dev/sdk-init-bundle:$VERSION and sigstore.dev/sdk-init-catalog:$VERSION.
32-
IMAGE_TAG_BASE ?= sigstore.dev/sdk-init
31+
# sigstore.dev/model-validation-operator-bundle:$VERSION and sigstore.dev/model-validation-operator-catalog:$VERSION.
32+
IMAGE_TAG_BASE ?= sigstore.dev/model-validation-operator
3333

3434
# BUNDLE_IMG defines the image:tag used for the bundle.
3535
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
@@ -48,12 +48,9 @@ endif
4848

4949
# Set the Operator SDK version to use. By default, what is installed on the system is used.
5050
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
51-
OPERATOR_SDK_VERSION ?= v1.39.2
51+
OPERATOR_SDK_VERSION ?= v1.40.0
5252
# Image URL to use all building/pushing image targets
5353
IMG ?= controller:latest
54-
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
55-
ENVTEST_K8S_VERSION = 1.31.0
56-
ENVTEST_VERSION ?= release-0.17
5754

5855
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
5956
ifeq (,$(shell go env GOBIN))
@@ -112,12 +109,15 @@ vet: ## Run go vet against code.
112109
go vet ./...
113110

114111
.PHONY: test
115-
test: manifests generate fmt vet envtest ## Run tests.
112+
test: manifests generate fmt vet setup-envtest ## Run tests.
116113
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out
117114

118-
# Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors.
119-
.PHONY: test-e2e # Run the e2e tests against a Kind k8s instance that is spun up.
120-
test-e2e:
115+
# TODO(user): To use a different vendor for e2e tests, modify the setup under 'tests/e2e'.
116+
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
117+
# CertManager is installed by default; skip with:
118+
# - CERT_MANAGER_INSTALL_SKIP=true
119+
.PHONY: test-e2e
120+
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
121121
go test ./test/e2e/ -v -ginkgo.v
122122

123123
.PHONY: lint
@@ -128,6 +128,10 @@ lint: golangci-lint ## Run golangci-lint linter
128128
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
129129
$(GOLANGCI_LINT) run --fix
130130

131+
.PHONY: lint-config
132+
lint-config: golangci-lint ## Verify golangci-lint linter configuration
133+
$(GOLANGCI_LINT) config verify
134+
131135
##@ Build
132136

133137
.PHONY: build
@@ -142,8 +146,8 @@ run: manifests generate fmt vet ## Run a controller from your host.
142146
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
143147
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
144148
.PHONY: docker-build
145-
docker-build: test ## Build docker image with the manager.
146-
$(CONTAINER_TOOL) build -t ${IMG} .
149+
docker-build: ## Build docker image with the manager.
150+
$(CONTAINER_TOOL) build -f Containerfile -t ${IMG} .
147151

148152
.PHONY: docker-push
149153
docker-push: ## Push docker image with the manager.
@@ -160,10 +164,10 @@ PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
160164
docker-buildx: ## Build and push docker image for the manager for cross-platform support
161165
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
162166
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
163-
- $(CONTAINER_TOOL) buildx create --name sdk-init-builder
164-
$(CONTAINER_TOOL) buildx use sdk-init-builder
167+
- $(CONTAINER_TOOL) buildx create --name model-validation-operator-builder
168+
$(CONTAINER_TOOL) buildx use model-validation-operator-builder
165169
- $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
166-
- $(CONTAINER_TOOL) buildx rm sdk-init-builder
170+
- $(CONTAINER_TOOL) buildx rm model-validation-operator-builder
167171
rm Dockerfile.cross
168172

169173
.PHONY: build-installer
@@ -204,16 +208,20 @@ $(LOCALBIN):
204208

205209
## Tool Binaries
206210
KUBECTL ?= kubectl
211+
KIND ?= kind
207212
KUSTOMIZE ?= $(LOCALBIN)/kustomize
208213
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
209214
ENVTEST ?= $(LOCALBIN)/setup-envtest
210215
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
211216

212217
## Tool Versions
213-
KUSTOMIZE_VERSION ?= v5.4.3
214-
CONTROLLER_TOOLS_VERSION ?= v0.16.1
215-
ENVTEST_VERSION ?= release-0.19
216-
GOLANGCI_LINT_VERSION ?= v1.59.1
218+
KUSTOMIZE_VERSION ?= v5.6.0
219+
CONTROLLER_TOOLS_VERSION ?= v0.17.2
220+
#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
221+
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
222+
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
223+
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
224+
GOLANGCI_LINT_VERSION ?= v1.63.4
217225

218226
.PHONY: kustomize
219227
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -225,6 +233,14 @@ controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessar
225233
$(CONTROLLER_GEN): $(LOCALBIN)
226234
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))
227235

236+
.PHONY: setup-envtest
237+
setup-envtest: envtest ## Download the binaries required for ENVTEST in the local bin directory.
238+
@echo "Setting up envtest binaries for Kubernetes version $(ENVTEST_K8S_VERSION)..."
239+
@$(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path || { \
240+
echo "Error: Failed to set up envtest binaries for version $(ENVTEST_K8S_VERSION)."; \
241+
exit 1; \
242+
}
243+
228244
.PHONY: envtest
229245
envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
230246
$(ENVTEST): $(LOCALBIN)
@@ -277,7 +293,7 @@ bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metada
277293

278294
.PHONY: bundle-build
279295
bundle-build: ## Build the bundle image.
280-
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
296+
$(CONTAINER_TOOL) build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
281297

282298
.PHONY: bundle-push
283299
bundle-push: ## Push the bundle image.
@@ -292,7 +308,7 @@ ifeq (,$(shell which opm 2>/dev/null))
292308
set -e ;\
293309
mkdir -p $(dir $(OPM)) ;\
294310
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
295-
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.0/$${OS}-$${ARCH}-opm ;\
311+
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.55.0/$${OS}-$${ARCH}-opm ;\
296312
chmod +x $(OPM) ;\
297313
}
298314
else
@@ -317,7 +333,7 @@ endif
317333
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
318334
.PHONY: catalog-build
319335
catalog-build: opm ## Build a catalog image.
320-
$(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
336+
$(OPM) index add --container-tool $(CONTAINER_TOOL) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
321337

322338
# Push the catalog image.
323339
.PHONY: catalog-push

PROJECT

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ layout:
88
plugins:
99
manifests.sdk.operatorframework.io/v2: {}
1010
scorecard.sdk.operatorframework.io/v2: {}
11-
projectName: sdk-init
11+
projectName: model-validation-operator
1212
repo: github.com/sigstore/model-validation-operator
1313
resources:
1414
- api:
1515
crdVersion: v1
1616
namespaced: true
17+
controller: true
1718
domain: sigstore.dev
1819
group: ml
1920
kind: ModelValidation
20-
path: github.com/sigstore/model-validation-controller/api/v1alpha1
21+
path: github.com/sigstore/model-validation-operator/api/v1alpha1
2122
version: v1alpha1
2223
version: "3"

api/v1alpha1/groupversion_info.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// Package v1alpha1 contains API Schema definitions for the ml v1alpha1 API group
17+
// Package v1alpha1 contains API Schema definitions for the ml v1alpha1 API group.
1818
// +kubebuilder:object:generate=true
1919
// +groupName=ml.sigstore.dev
2020
package v1alpha1
@@ -25,10 +25,10 @@ import (
2525
)
2626

2727
var (
28-
// GroupVersion is group version used to register these objects
28+
// GroupVersion is group version used to register these objects.
2929
GroupVersion = schema.GroupVersion{Group: "ml.sigstore.dev", Version: "v1alpha1"}
3030

31-
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
31+
// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
3232
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
3333

3434
// AddToScheme adds the types in this group-version to the given scheme.

0 commit comments

Comments
 (0)