Skip to content
Open
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
23 changes: 19 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,26 @@ jobs:
go-version: "1.26"
cache: true
cache-dependency-path: go/go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
- name: golangci-lint
working-directory: go
run: make lint

api-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v6
with:
version: v2.11.3
working-directory: go
go-version: "1.26"
cache: true
cache-dependency-path: go/go.sum

- name: Run kube-api-linter
working-directory: go
run: make lint-api

python-test:
env:
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ lint:
make -C go lint
make -C python lint

.PHONY: lint-api
lint-api:
make -C go lint-api

.PHONY: push
push: push-controller push-ui push-app push-kagent-adk push-golang-adk push-golang-adk-full

Expand Down
42 changes: 42 additions & 0 deletions go/.golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ linters:
- importas
- ineffassign
- iotamixing
- kubeapilinter
- makezero
- misspell
- modernize
Expand All @@ -26,6 +27,43 @@ linters:
- unused
- whitespace
settings:
custom:
kubeapilinter:
path: "bin/kube-api-linter.so"
description: Kube API Linter lints Kube like APIs based on API conventions and best practices.
original-url: sigs.k8s.io/kube-api-linter
settings:
linters:
enable:
- "conflictingmarkers"
- "duplicatemarkers"
- "nofloats"
- "optionalorrequired"
- "statussubresource"
- "uniquemarkers"
- "statusoptional"
- "nophase"
- "nonullable"
- "forbiddenmarkers"
- "nomaps"
disable:
- "*"
lintersConfig:
conflictingmarkers:
conflicts:
- name: "default_vs_required"
sets:
- ["default", "kubebuilder:default"]
- ["required", "kubebuilder:validation:Required", "k8s:required"]
description: "A field with a default value cannot be required"
forbiddenmarkers:
markers:
- identifier: "+kubebuilder:pruning:PreserveUnknownFields"
- identifier: "+kubebuilder:validation:XPreserveUnknownFields"
- identifier: "+kubebuilder:validation:items:XPreserveUnknownFields"
- identifier: "+kubebuilder:validation:EmbeddedResource"
- identifier: "+kubebuilder:validation:XEmbeddedResource"
- identifier: "+kubebuilder:validation:items:XEmbeddedResource"
depguard:
rules:
forbid-pkg-errors:
Expand Down Expand Up @@ -88,6 +126,10 @@ linters:
paths:
- zz_generated.*\.go$
- .*conversion.*\.go$
rules:
- linters:
- kubeapilinter
path-except: "api/v1alpha"
issues:
max-issues-per-linter: 0
max-same-issues: 0
Expand Down
26 changes: 24 additions & 2 deletions go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,37 @@ fmt: ## Run go fmt.
vet: ## Run go vet.
go vet ./...

KAL_SO = $(LOCALBIN)/kube-api-linter.so

.PHONY: lint
lint: golangci-lint ## Run golangci-lint.
lint: golangci-lint $(KAL_SO) ## Run golangci-lint.
$(GOLANGCI_LINT) run

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint with auto-fix.
lint-fix: golangci-lint $(KAL_SO) ## Run golangci-lint with auto-fix.
$(GOLANGCI_LINT) run --fix

.PHONY: lint-config
lint-config: golangci-lint ## Verify golangci-lint linter configuration.
$(GOLANGCI_LINT) config verify

.PHONY: lint-api
lint-api: golangci-lint $(KAL_SO)
$(GOLANGCI_LINT) run ./api/v1alpha1/... ./api/v1alpha2/...

.PHONY: lint-api-fix
lint-api-fix: golangci-lint $(KAL_SO)
$(GOLANGCI_LINT) run --fix ./api/v1alpha1/... ./api/v1alpha2/...

$(KAL_SO):
@mkdir -p $(LOCALBIN)
@echo "Building kube-api-linter plugin..."
@rm -rf $(LOCALBIN)/golangci-lint-src
@git clone --depth 1 --branch $(GOLANGCI_LINT_VERSION) --quiet https://github.com/golangci/golangci-lint.git $(LOCALBIN)/golangci-lint-src
@cd $(LOCALBIN)/golangci-lint-src && go get sigs.k8s.io/kube-api-linter@$(KAL_VERSION)
@cd $(LOCALBIN)/golangci-lint-src && go build -buildmode=plugin -o $(KAL_SO) sigs.k8s.io/kube-api-linter/pkg/plugin
@rm -rf $(LOCALBIN)/golangci-lint-src

.PHONY: govulncheck
govulncheck: ## Run govulncheck.
$(call go-install-tool,bin/govulncheck,golang.org/x/vuln/cmd/govulncheck,latest)
Expand Down Expand Up @@ -99,6 +118,8 @@ core/bin/kagent-windows-amd64.exe.sha256: core/bin/kagent-windows-amd64.exe
.PHONY: clean
clean:
rm -f core/bin/kagent* && mkdir -p core/bin
rm -f $(LOCALBIN)/kube-api-linter.so
rm -rf $(LOCALBIN)/golangci-lint-src

.PHONY: build
build: core/bin/kagent-linux-amd64.sha256 core/bin/kagent-linux-arm64.sha256 core/bin/kagent-darwin-amd64.sha256 core/bin/kagent-darwin-arm64.sha256 core/bin/kagent-windows-amd64.exe.sha256
Expand Down Expand Up @@ -136,6 +157,7 @@ ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
GOLANGCI_LINT_VERSION ?= v2.11.3
KAL_VERSION ?= v0.0.0-20260423112246-3fa174937a6b
SQLC_VERSION ?= v1.30.0

.PHONY: controller-gen
Expand Down
47 changes: 12 additions & 35 deletions go/api/config/crd/bases/kagent.dev_agents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2258,14 +2258,10 @@ spec:
type: string
type: object
type:
allOf:
- enum:
- McpServer
- Agent
- enum:
- McpServer
- Agent
description: ToolProviderType represents the tool provider type
enum:
- McpServer
- Agent
type: string
type: object
x-kubernetes-validations:
Expand Down Expand Up @@ -2348,9 +2344,6 @@ spec:
observedGeneration:
format: int64
type: integer
required:
- configHash
- observedGeneration
type: object
type: object
served: true
Expand Down Expand Up @@ -13059,19 +13052,15 @@ spec:
type: array
type: object
runtime:
allOf:
- enum:
- python
- go
- enum:
- python
- go
default: python
description: |-
Runtime specifies which ADK implementation to use for this agent.
- "python": Uses the Python ADK (default, slower startup, full feature set)
- "go": Uses the Go ADK (faster startup, most features supported)
The runtime determines both the container image and readiness probe configuration.
enum:
- python
- go
type: string
stream:
description: |-
Expand Down Expand Up @@ -13218,15 +13207,11 @@ spec:
rule: '!has(self.requireApproval) || self.requireApproval.all(x,
has(self.toolNames) && x in self.toolNames)'
type:
allOf:
- enum:
- McpServer
- Agent
- enum:
- McpServer
- Agent
description: ToolProviderType represents the tool provider
type
enum:
- McpServer
- Agent
type: string
type: object
x-kubernetes-validations:
Expand Down Expand Up @@ -13556,18 +13541,12 @@ spec:
type: array
type: object
type:
allOf:
- enum:
- Declarative
- BYO
- enum:
- Declarative
- BYO
default: Declarative
description: AgentType represents the agent type
enum:
- Declarative
- BYO
type: string
required:
- type
type: object
x-kubernetes-validations:
- message: type must be specified
Expand Down Expand Up @@ -13640,8 +13619,6 @@ spec:
observedGeneration:
format: int64
type: integer
required:
- observedGeneration
type: object
type: object
served: true
Expand Down
5 changes: 0 additions & 5 deletions go/api/config/crd/bases/kagent.dev_memories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ spec:
enum:
- Pinecone
type: string
required:
- provider
type: object
status:
description: MemoryStatus defines the observed state of Memory.
Expand Down Expand Up @@ -151,9 +149,6 @@ spec:
observedGeneration:
format: int64
type: integer
required:
- conditions
- observedGeneration
type: object
type: object
served: true
Expand Down
15 changes: 2 additions & 13 deletions go/api/config/crd/bases/kagent.dev_modelconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ spec:
type: string
required:
- model
- provider
type: object
x-kubernetes-validations:
- message: provider.openAI must be nil if the provider is not OpenAI
Expand Down Expand Up @@ -340,9 +339,6 @@ spec:
observedGeneration:
format: int64
type: integer
required:
- conditions
- observedGeneration
type: object
type: object
served: true
Expand Down Expand Up @@ -606,13 +602,10 @@ spec:
- audience
type: object
type:
allOf:
- enum:
- GDCHServiceAccount
- enum:
- GDCHServiceAccount
description: TokenExchangeType identifies the token exchange
mechanism
enum:
- GDCHServiceAccount
type: string
required:
- type
Expand Down Expand Up @@ -691,7 +684,6 @@ spec:
type: object
required:
- model
- provider
type: object
x-kubernetes-validations:
- message: provider.openAI must be nil if the provider is not OpenAI
Expand Down Expand Up @@ -821,9 +813,6 @@ spec:
this model config detect changes to these secrets and restart if
necessary.
type: string
required:
- conditions
- observedGeneration
type: object
type: object
served: true
Expand Down
3 changes: 0 additions & 3 deletions go/api/config/crd/bases/kagent.dev_remotemcpservers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,6 @@ spec:
Important: Run "make" to regenerate code after modifying this file
format: int64
type: integer
required:
- conditions
- observedGeneration
type: object
type: object
served: true
Expand Down
Loading
Loading