Skip to content

Commit 0e60ef8

Browse files
authored
Separate API types module (#1060)
* create the module Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com> * generation works Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com> * put all api generation into one generate command Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com> * use v0.21.0 of controller gen Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com> * use v0.0.1 of kpt api Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com> * do go mod tidy in the correct place after api gen Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com> * use kpt api module Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com> * move internal api Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com> * add api Makefile, bump k8s api versions in api module Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com> * fix blueprint creator script and allow Dockerfiles to handle replace Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com> * update grpc health probe version Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com> * address copilot review comments Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com> --------- Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
1 parent 6573861 commit 0e60ef8

119 files changed

Lines changed: 1240 additions & 1173 deletions

File tree

Some content is hidden

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

api/Makefile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2026 The kpt 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+
GOLANG_CI_VER ?= 2.12.2
16+
GOLANG_CI_ARGS ?= -v --fix --timeout=10m
17+
18+
##@ API Go Development
19+
20+
.PHONY: fmt
21+
fmt: ## Run go fmt against the module
22+
go fmt ./...
23+
24+
.PHONY: vet
25+
vet: ## Run go vet against the module
26+
go vet ./...
27+
28+
.PHONY: fix
29+
fix: ## Run go fix against the module
30+
go fix ./...
31+
32+
.PHONY: tidy
33+
tidy: ## Run go tidy against the module
34+
go mod tidy
35+
36+
.PHONY: lint
37+
lint: ## Run Go linter against the module
38+
@if command -v golangci-lint >/dev/null 2>&1 && [ "$$(golangci-lint version --short)" = "$(GOLANG_CI_VER)" ]; then \
39+
golangci-lint run ./... $(GOLANG_CI_ARGS); \
40+
else \
41+
go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v$(GOLANG_CI_VER) run ./... $(GOLANG_CI_ARGS); \
42+
fi
43+
44+
.PHONY: fix-all
45+
fix-all: tidy fix vet fmt lint ## Run go mod tidy, fix, vet, fmt and then lint the module

api/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@
1515
// +domain=kpt.dev
1616

1717
package apis
18+
19+
//go:generate go run sigs.k8s.io/controller-tools/cmd/controller-gen@v0.21.0 object:headerFile="../scripts/boilerplate.go.txt",year=$YEAR_GEN crd:crdVersions=v1,headerFile="../scripts/boilerplate.yaml.txt",year=$YEAR_GEN output:crd:artifacts:config=./generated/crds paths={./porchconfig/...,./porch/v1alpha2/...}

api/porchconfig/v1alpha1/config.porch.kpt.dev_functionconfigs.yaml renamed to api/generated/crds/config.porch.kpt.dev_functionconfigs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ apiVersion: apiextensions.k8s.io/v1
1616
kind: CustomResourceDefinition
1717
metadata:
1818
annotations:
19-
controller-gen.kubebuilder.io/version: v0.19.0
19+
controller-gen.kubebuilder.io/version: v0.21.0
2020
name: functionconfigs.config.porch.kpt.dev
2121
spec:
2222
group: config.porch.kpt.dev

internal/api/porchinternal/v1alpha1/config.porch.kpt.dev_packagerevs.yaml renamed to api/generated/crds/config.porch.kpt.dev_packagerevs.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1+
# Copyright 2026 The kpt 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.
114
---
215
apiVersion: apiextensions.k8s.io/v1
316
kind: CustomResourceDefinition
417
metadata:
518
annotations:
6-
controller-gen.kubebuilder.io/version: v0.19.0
19+
controller-gen.kubebuilder.io/version: v0.21.0
720
name: packagerevs.config.porch.kpt.dev
821
spec:
922
group: config.porch.kpt.dev

controllers/config/crd/bases/config.porch.kpt.dev_packagevariants.yaml renamed to api/generated/crds/config.porch.kpt.dev_packagevariants.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ apiVersion: apiextensions.k8s.io/v1
1616
kind: CustomResourceDefinition
1717
metadata:
1818
annotations:
19-
controller-gen.kubebuilder.io/version: v0.19.0
19+
controller-gen.kubebuilder.io/version: v0.21.0
2020
name: packagevariants.config.porch.kpt.dev
2121
spec:
2222
group: config.porch.kpt.dev

controllers/config/crd/bases/config.porch.kpt.dev_packagevariantsets.yaml renamed to api/generated/crds/config.porch.kpt.dev_packagevariantsets.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ apiVersion: apiextensions.k8s.io/v1
1616
kind: CustomResourceDefinition
1717
metadata:
1818
annotations:
19-
controller-gen.kubebuilder.io/version: v0.19.0
19+
controller-gen.kubebuilder.io/version: v0.21.0
2020
name: packagevariantsets.config.porch.kpt.dev
2121
spec:
2222
group: config.porch.kpt.dev

api/porchconfig/v1alpha1/config.porch.kpt.dev_repositories.yaml renamed to api/generated/crds/config.porch.kpt.dev_repositories.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ apiVersion: apiextensions.k8s.io/v1
1616
kind: CustomResourceDefinition
1717
metadata:
1818
annotations:
19-
controller-gen.kubebuilder.io/version: v0.19.0
19+
controller-gen.kubebuilder.io/version: v0.21.0
2020
name: repositories.config.porch.kpt.dev
2121
spec:
2222
group: config.porch.kpt.dev

api/porchconfig/v1alpha1/config.porch.kpt.dev_servicetemplates.yaml renamed to api/generated/crds/config.porch.kpt.dev_servicetemplates.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ apiVersion: apiextensions.k8s.io/v1
1616
kind: CustomResourceDefinition
1717
metadata:
1818
annotations:
19-
controller-gen.kubebuilder.io/version: v0.19.0
19+
controller-gen.kubebuilder.io/version: v0.21.0
2020
name: servicetemplates.config.porch.kpt.dev
2121
spec:
2222
group: config.porch.kpt.dev

api/porch/v1alpha2/porch.kpt.dev_packagerevisions.yaml renamed to api/generated/crds/porch.kpt.dev_packagerevisions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ apiVersion: apiextensions.k8s.io/v1
1616
kind: CustomResourceDefinition
1717
metadata:
1818
annotations:
19-
controller-gen.kubebuilder.io/version: v0.20.1
19+
controller-gen.kubebuilder.io/version: v0.21.0
2020
name: packagerevisions.porch.kpt.dev
2121
spec:
2222
group: porch.kpt.dev

api/go.mod

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
module github.com/kptdev/porch/api
2+
3+
go 1.26.0
4+
5+
require (
6+
github.com/kptdev/kpt/api v0.0.1
7+
github.com/stretchr/testify v1.11.1
8+
k8s.io/api v0.36.1
9+
k8s.io/apiextensions-apiserver v0.36.1
10+
k8s.io/apimachinery v0.36.1
11+
k8s.io/client-go v0.36.1
12+
k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a
13+
sigs.k8s.io/yaml v1.6.0
14+
)
15+
16+
require (
17+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
18+
github.com/distribution/reference v0.6.0 // indirect
19+
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
20+
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
21+
github.com/go-errors/errors v1.4.2 // indirect
22+
github.com/go-logr/logr v1.4.3 // indirect
23+
github.com/go-openapi/jsonpointer v0.21.0 // indirect
24+
github.com/go-openapi/jsonreference v0.20.2 // indirect
25+
github.com/go-openapi/swag v0.23.0 // indirect
26+
github.com/google/gnostic-models v0.7.0 // indirect
27+
github.com/google/go-cmp v0.7.0 // indirect
28+
github.com/google/uuid v1.6.0 // indirect
29+
github.com/josharian/intern v1.0.0 // indirect
30+
github.com/json-iterator/go v1.1.12 // indirect
31+
github.com/mailru/easyjson v0.7.7 // indirect
32+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
33+
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
34+
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
35+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
36+
github.com/opencontainers/go-digest v1.0.0 // indirect
37+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
38+
github.com/spf13/pflag v1.0.9 // indirect
39+
github.com/x448/float16 v0.8.4 // indirect
40+
github.com/xlab/treeprint v1.2.0 // indirect
41+
go.yaml.in/yaml/v2 v2.4.3 // indirect
42+
go.yaml.in/yaml/v3 v3.0.4 // indirect
43+
golang.org/x/net v0.49.0 // indirect
44+
golang.org/x/oauth2 v0.34.0 // indirect
45+
golang.org/x/sys v0.40.0 // indirect
46+
golang.org/x/term v0.39.0 // indirect
47+
golang.org/x/text v0.33.0 // indirect
48+
golang.org/x/time v0.14.0 // indirect
49+
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect
50+
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
51+
gopkg.in/inf.v0 v0.9.1 // indirect
52+
gopkg.in/yaml.v3 v3.0.1 // indirect
53+
k8s.io/klog/v2 v2.140.0 // indirect
54+
k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 // indirect
55+
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
56+
sigs.k8s.io/kustomize/kyaml v0.21.1 // indirect
57+
sigs.k8s.io/randfill v1.0.0 // indirect
58+
sigs.k8s.io/structured-merge-diff/v6 v6.3.2 // indirect
59+
)

0 commit comments

Comments
 (0)