Skip to content

Commit 0dcf72b

Browse files
committed
add make target to generate crds from kubebuilder outputs
1 parent 7bfc654 commit 0dcf72b

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,29 @@ help: ## Display this help.
4545
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
4646
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
4747

48+
.PHONY: helm-crd
49+
helm-crd: manifests ## Generate Helm CRD template from the generated CRD definition.
50+
@echo "Generating Helm CRD template from config/crd/bases/kagent.dev_mcpservers.yaml"
51+
@mkdir -p helm/kmcp/templates/crds
52+
@echo '{{- if .Values.crd.create }}' > helm/kmcp/templates/crds/mcpserver-crd.yaml
53+
@awk '/^ name: mcpservers.kagent.dev$$/ { \
54+
print; \
55+
print " labels:"; \
56+
print " {{- include \"kmcp.labels\" . | nindent 4 }}"; \
57+
next; \
58+
} \
59+
{ print }' config/crd/bases/kagent.dev_mcpservers.yaml >> helm/kmcp/templates/crds/mcpserver-crd.yaml
60+
@echo '{{- end }}' >> helm/kmcp/templates/crds/mcpserver-crd.yaml
61+
@echo "Helm CRD template generated at helm/kmcp/templates/crds/mcpserver-crd.yaml"
62+
63+
.PHONY: helm-templates
64+
helm-templates: helm-crd ## Generate all Helm templates from source definitions.
65+
@echo "All Helm templates updated successfully"
66+
67+
.PHONY: manifests-all
68+
manifests-all: manifests helm-templates ## Generate both Kustomize and Helm manifests from source definitions.
69+
@echo "All manifests (Kustomize and Helm) updated successfully"
70+
4871
.PHONY: generate
4972
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
5073
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

helm/kmcp/.helmignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Patterns to ignore when building packages.
2-
# This supports shell glob matching, relative path matching, and
3-
# negation (prefixed with !). Only one pattern per line.
41
.DS_Store
52
# Common VCS dirs
63
.git/

helm/kmcp/templates/crds/mcpserver-crd.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ spec:
7474
description: HTTPTransport defines the configuration for a Streamable
7575
HTTP transport.
7676
properties:
77+
path:
78+
description: the target path where MCP is served
79+
type: string
7780
targetPort:
7881
description: target port is the HTTP port that serves the MCP
7982
server.over HTTP
@@ -181,4 +184,4 @@ spec:
181184
storage: true
182185
subresources:
183186
status: {}
184-
{{- end }}
187+
{{- end }}

0 commit comments

Comments
 (0)