Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
7d18d25
wip
pmalek Feb 10, 2026
9f0b563
wip
pmalek Feb 10, 2026
28f82df
tests: added CRD validation tests
pmalek Feb 10, 2026
dc3c8cd
chore: update openapi.yaml and add 'all' target to generate and lint …
pmalek Feb 10, 2026
3c55024
wip
pmalek Feb 11, 2026
4797ab5
chore: refactor
pmalek Feb 12, 2026
f55afac
feat: add Developers API
pmalek Feb 12, 2026
de9737b
feat: allow CRD type overrides through x-speakeasy-entity-operation["…
pmalek Feb 12, 2026
dd3374a
wip
pmalek Feb 13, 2026
2f02962
chore: go mod tidy
pmalek Feb 13, 2026
6925c55
tests(crdsvalidation): add more CRDs validation tests
pmalek Feb 13, 2026
0096b65
chore: dont inline api field, put them under spec.apiSpec
pmalek Feb 13, 2026
a797e52
chore: go mod tidy
pmalek Feb 17, 2026
816aceb
chore: bump deps
pmalek Feb 17, 2026
7d45f6e
chore: adapt to KO v2 module
pmalek Feb 18, 2026
ab483f0
chore: cleanup
pmalek Feb 18, 2026
44762e8
feat: structured config file
pmalek Feb 18, 2026
0e0261a
chore: AGENTS.md
pmalek Feb 21, 2026
9657da1
chore: map.Keys and slices.Collect
pmalek Feb 21, 2026
79d5f75
feat: sdk conversion funcs
pmalek Feb 23, 2026
c96b4bb
chore: refactor generator template
pmalek Feb 23, 2026
859f290
chore: add TODOs in README
pmalek Feb 23, 2026
f2434f0
chore: go mod tidy
pmalek Feb 26, 2026
78e183b
chore: remove x-speakeasy crd-name annotation support
pmalek Feb 26, 2026
ff21cbf
chore: lo.ToPtr -> new
pmalek Feb 26, 2026
5768b4d
chore: fix CRD validation tests
pmalek Feb 26, 2026
c522a44
chore: fix CRD validation tests
pmalek Feb 26, 2026
f855aad
chore: mise tweak
pmalek Feb 26, 2026
493a03c
chore: add comment about generated code
pmalek Mar 2, 2026
5a727f3
chore: add go fix
pmalek Mar 2, 2026
333f276
feat: add option to specify common types config like ObjectRef via co…
pmalek Mar 2, 2026
155f90d
chore: go mod tidy
pmalek Mar 2, 2026
53b4233
chore: make object ref the same as in ko
pmalek Mar 2, 2026
a761e01
refactor: extract main's code to run
pmalek Mar 2, 2026
0c68f1a
chore: go mod tidy
pmalek Mar 12, 2026
19f8335
feat: add event gateway CRD
pmalek Mar 12, 2026
d279186
chore: regenerate based on latest OAS
pmalek Mar 12, 2026
b544097
chore: minimize number of new APIs
pmalek Mar 12, 2026
695ba41
chore: produce API types in api/ dir
pmalek Mar 12, 2026
d2b11ff
chore: adapt to KO CI
pmalek Mar 13, 2026
0fd581d
tests: remove unwanted test files
pmalek Mar 13, 2026
50dcd83
chore: use openapi.yaml from sdk-konnect-go repo
pmalek Mar 13, 2026
169c320
chore: prune x-konnect.konghq.com CRDs from chart
pmalek Mar 13, 2026
422ba30
chore: fix linter issues
pmalek Mar 13, 2026
572bfc4
chore: remove unwanted CRDs and adjust code
pmalek Mar 13, 2026
ddd1ff1
chore: adjust makefile targets
pmalek Mar 13, 2026
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
82 changes: 82 additions & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
[settings.github]
github_attestations = false

################################################################################
# Tools

[tools."github:kubernetes-sigs/controller-tools"]
# renovate: datasource=github-releases depName=kubernetes-sigs/controller-tools
version = "0.20.1"

[tools."github:golangci/golangci-lint"]
# renovate: datasource=github-releases depName=golangci/golangci-lint
version = "2.11.3"

[tools."github:kubernetes-sigs/controller-runtime"]
# renovate: datasource=github-releases depName=kubernetes-sigs/controller-runtime
version = "0.23.3"
[tools."github:kubernetes-sigs/controller-runtime".platforms]
darwin-arm64 = { asset_pattern = "setup-envtest-darwin-arm64" }
linux-arm64 = { asset_pattern = "setup-envtest-linux-arm64" }
linux-amd64 = { asset_pattern = "setup-envtest-linux-amd64" }

# NOTE: The reason for tool version being set here and not in .tools-versions.toml
# is that mise requires the version to be specified when using version_prefix
# and we need to set the latter for kustomize because its tags on GitHub are prefixed
Expand Down Expand Up @@ -48,3 +67,66 @@ macos-arm64 = { url = "https://get.helm.sh/helm-v{{version}}-darwin-arm64.tar.gz
[tools."go:sigs.k8s.io/kube-api-linter/cmd/golangci-lint-kube-api-linter"]
# renovate: datasource=git-refs packageName=https://github.com/kubernetes-sigs/kube-api-linter.git
version = "39e3d06a2850e38a8e9e82918bab14ce84e608de"


################################################################################
# Tasks

[env]
DIR = "crd-from-oas"

[tasks.build-crd-from-oas]
description = "Build the {{env.DIR}} binary"
dir = "./{{env.DIR}}"
run = "go build -o ../bin/{{env.DIR}} main.go"

[tasks.clean]
# TODO: This hardcodes the x-konnect API group. Removing this hardcode would cause
# the removal of other non generated APIs to be removed.
description = "Clean generated api/x-konnect directory"
run = "rm -rf ./api/x-konnect/"

[tasks.generate-api]
description = "Generate Kubernetes Go API from OpenAPI spec"
dir = "./{{env.DIR}}"
# NOTE we get the openapi.yaml file from the sdk-konnect-go module which is expected
# to be present in the local Go module cache.
# This ensures that we use the same OpenAPI spec as the one used to generate the
# SDK which should help avoid potential discrepancies between the API and the SDK.
run = '''
export INPUT_FILE="$(go list -m -f '{{`{{.Dir}}`}}' github.com/Kong/sdk-konnect-go)/openapi.yaml"
export OUTPUT_DIR="../api/"
export CONFIG_FILE="config.yaml"
go run .
'''
depends = [ "clean" ]
depends_post = [ "generate-deepcopy" ]

[tasks.generate-deepcopy]
description = "Generate DeepCopy methods for the API types"
dir = "./{{env.DIR}}"
run = "controller-gen object:headerFile='../hack/generators/boilerplate.go.txt' paths=../api/..."

[tasks.lint-api]
description = "Run golangci-lint"
# TODO: This hardcodes the x-konnect API group. Removing this hardcode would cause the linter
# to run against all the API groups which might create unwanted issues being reported here.
run = "golangci-lint-kube-api-linter run -v --config .golangci-kube-api.yaml ./api/x-konnect/..."

[tasks.test-crdsvalidation]
description = "Run CRD validation tests"
dir = "./{{env.DIR}}"
# Update test paths below if more API groups are added
run = '''
export KUBEBUILDER_ASSETS=$(setup-envtest use -p path)
go test -v -count 1 ${GOTESTFLAGS} ./test/crdsvalidation/x-konnect.konghq.com/...
'''

[tasks.all]
description = "Generate API, CRDs, and run all tests and linters"
run = [
{ task = "generate-api" },
{ task = "lint" },
{ tasks = [ "lint-api", "test-unit", "gofix"] },
{ task = "test-crdsvalidation" },
]
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ API_DIR ?= api
# make generate && make manifests && make test.charts.golden.update
# into a single command: make generate
# Note: manifests is placed near the end to preserve the prior ordering (docs are generated from CRDs first).
generate: generate.crds generate.crd-kustomize generate.k8sio-gomod-replace generate.deepcopy generate.apitypes-funcs generate.docs generate.lint-fix manifests test.charts.golden.update generate.cli-arguments-docs
generate: generate.api generate.api-from-oas generate.crds generate.crd-kustomize generate.k8sio-gomod-replace generate.apitypes-funcs generate.docs generate.lint-fix manifests test.charts.golden.update generate.cli-arguments-docs

.PHONY: generate.crds
generate.crds: controller-gen ## Generate WebhookConfiguration and CustomResourceDefinition objects.
Expand All @@ -338,8 +338,9 @@ generate.crd-kustomize:
generate.api: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/generators/boilerplate.go.txt" paths="./$(API_DIR)/..."

.PHONY: generate.deepcopy
generate.deepcopy: generate.api
.PHONY: generate.api-from-oas
generate.api-from-oas:
mise r generate-api

.PHONY: generate.apitypes-funcs
generate.apitypes-funcs:
Expand Down Expand Up @@ -566,6 +567,7 @@ KONG_CONTROLLER_FEATURE_GATES ?= GatewayAlpha=true
test: test.unit

UNIT_TEST_PATHS := ./api/... ./controller/... ./internal/... ./pkg/... ./modules/... ./ingress-controller/internal/... ./ingress-controller/pkg/...
UNIT_TEST_PATHS_CRD_GEN := ./pkg/...

.PHONY: _test.unit
_test.unit: gotestsum
Expand All @@ -575,6 +577,11 @@ _test.unit: gotestsum
-coverprofile=coverage.unit.out \
-ldflags "$(LDFLAGS_COMMON) $(LDFLAGS)" \
$(UNIT_TEST_PATHS)
cd crd-from-oas && \
GOTESTSUM_FORMAT=$(GOTESTSUM_FORMAT) \
$(GOTESTSUM) -- $(GOTESTFLAGS) \
-race \
$(UNIT_TEST_PATHS_CRD_GEN)

.PHONY: test.unit
test.unit:
Expand Down Expand Up @@ -1135,3 +1142,4 @@ lint.api: download.kube-api-linter
./api/konnect/v1alpha1/... \
./api/konnect/v1alpha2/... \
./api/common/v1alpha1/...
mise r lint-api
80 changes: 80 additions & 0 deletions api/x-konnect/v1alpha1/common_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions api/x-konnect/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Package v1alpha1 contains API types for the x-konnect.konghq.com API group.
//
// +kubebuilder:object:generate=true
// +groupName=x-konnect.konghq.com
package v1alpha1
112 changes: 112 additions & 0 deletions api/x-konnect/v1alpha1/eventgateway_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions api/x-konnect/v1alpha1/portal_sdkops.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading