Skip to content
Merged
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
14 changes: 5 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,8 @@ help: ## Display this help.

##@ Development

.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kfswain @nirrozenbaum Do you need anything beyond CRDs that could have been generated here? (I'm assuming not, certainly not a webhook, and probably not RBAC, but just want to make sure I'm not missing some EPP dependencies here).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing that I'm aware of.
sorry for the delayed response, missed the question.

$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases

.PHONY: generate
generate: controller-gen code-generator manifests ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
generate: controller-gen code-generator ## Generate WebhookConfiguration, ClusterRole, CustomResourceDefinition objects, code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate/boilerplate.generatego.txt" paths="./..."
./hack/update-codegen.sh

Expand Down Expand Up @@ -132,7 +128,7 @@ vet: ## Run go vet against code.
go vet ./...

.PHONY: test
test: manifests generate fmt vet envtest image-build verify-crds ## Run tests.
test: generate fmt vet envtest image-build verify-crds ## Run tests.
CGO_ENABLED=1 KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e | grep -v /conformance) -race -coverprofile cover.out

.PHONY: test-unit
Expand Down Expand Up @@ -160,7 +156,7 @@ ci-lint: golangci-lint
$(GOLANGCI_LINT) run --timeout 15m0s

.PHONY: verify
verify: vet fmt-verify manifests generate ci-lint verify-all
verify: vet fmt-verify generate ci-lint verify-all
git --no-pager diff --exit-code config api client-go

.PHONY: verify-crds
Expand Down Expand Up @@ -311,11 +307,11 @@ ifndef ignore-not-found
endif

.PHONY: install
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
install: generate kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f -

.PHONY: uninstall
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
uninstall: generate kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -

##@ Helm
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ The Kubernetes Template Project is released on an as-needed basis. The process i
1. All [OWNERS](OWNERS) must LGTM this release
1. An OWNER runs `git tag -s $VERSION` and inserts the changelog and pushes the tag with `git push $VERSION`
1. The release issue is closed
1. An announcement email is sent to `dev@kubernetes.io` with the subject `[ANNOUNCE] kubernetes-template-project $VERSION is released`
1. An announcement email is sent to `dev@kubernetes.io` with the subject `[ANNOUNCE] kubernetes-template-project $VERSION is released`
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.1
inference.networking.k8s.io/bundle-version: v1.0.0-dev
creationTimestamp: null
name: inferencemodels.inference.networking.x-k8s.io
spec:
group: inference.networking.x-k8s.io
Expand Down Expand Up @@ -254,3 +254,9 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: null
storedVersions: null
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.1
inference.networking.k8s.io/bundle-version: v1.0.0-dev
creationTimestamp: null
name: inferencepools.inference.networking.x-k8s.io
spec:
group: inference.networking.x-k8s.io
Expand Down Expand Up @@ -283,3 +283,9 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: null
storedVersions: null
19 changes: 17 additions & 2 deletions hack/release-quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@ echo "Using vLLM GPU image version: ${VLLM_GPU}"
echo "Using vLLM CPU image version: ${VLLM_CPU}"
echo "Using vLLM Simulator image version: ${VLLM_SIM}"

# -----------------------------------------------------------------------------
# Update version/version.go and generating CRDs with new version annotations
# -----------------------------------------------------------------------------
VERSION_FILE="version/version.go"
echo "Updating ${VERSION_FILE} ..."

# Replace bundleVersion in version.go
# This regex finds the line with "BundleVersion" and replaces the string within the quotes.
sed -i.bak -E "s|( *BundleVersion = \")[^\"]+(\")|\1${RELEASE_TAG}\2|g" "$VERSION_FILE"

UPDATED_CRD="config/crd/"
echo "Generating CRDs with new annotations in $UPDATED_CRD"
go run ./pkg/generator
echo "Generated CRDs with new annotations in $UPDATED_CRD"

# -----------------------------------------------------------------------------
# Update pkg/README.md
# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -115,8 +130,8 @@ sed -i.bak '/llm-d\/llm-d-inference-sim/{n;s/Always/IfNotPresent/;}' "$VLLM_SIM_
# -----------------------------------------------------------------------------
# Stage the changes
# -----------------------------------------------------------------------------
echo "Staging $README $EPP $EPP_HELM $BBR_HELM $CONFORMANCE_MANIFESTS $VLLM_GPU_DEPLOY $VLLM_CPU_DEPLOY $VLLM_SIM_DEPLOY files..."
git add $README $EPP $EPP_HELM $BBR_HELM $CONFORMANCE_MANIFESTS $VLLM_GPU_DEPLOY $VLLM_CPU_DEPLOY $VLLM_SIM_DEPLOY
echo "Staging $VERSION_FILE $UPDATED_CRD $README $EPP $EPP_HELM $BBR_HELM $CONFORMANCE_MANIFESTS $VLLM_GPU_DEPLOY $VLLM_CPU_DEPLOY $VLLM_SIM_DEPLOY files..."
git add $VERSION_FILE $UPDATED_CRD $README $EPP $EPP_HELM $BBR_HELM $CONFORMANCE_MANIFESTS $VLLM_GPU_DEPLOY $VLLM_CPU_DEPLOY $VLLM_SIM_DEPLOY

# -----------------------------------------------------------------------------
# Cleanup backup files and finish
Expand Down
3 changes: 3 additions & 0 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ set -o errexit
set -o nounset
set -o pipefail

echo "Generating CRDs"
go run ./pkg/generator

SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
echo "$SCRIPT_ROOT script"
CODEGEN_PKG=${2:-bin}
Expand Down
104 changes: 104 additions & 0 deletions pkg/generator/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
Copyright 2025 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package main

import (
"fmt"
"log"
"os"

apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"sigs.k8s.io/controller-tools/pkg/crd"
"sigs.k8s.io/controller-tools/pkg/loader"
"sigs.k8s.io/controller-tools/pkg/markers"
"sigs.k8s.io/gateway-api-inference-extension/version"
"sigs.k8s.io/yaml"
)

// This generation code is largely copied from
// github.com/kubernetes-sigs/gateway-api/blob/main/pkg/generator/main.go
func main() {
roots, err := loader.LoadRoots(
"k8s.io/apimachinery/pkg/runtime/schema", // Needed to parse generated register functions.
"sigs.k8s.io/gateway-api-inference-extension/api/v1alpha2",
)
if err != nil {
log.Fatalf("failed to load package roots: %s", err)
}

generator := &crd.Generator{}

parser := &crd.Parser{
Collector: &markers.Collector{Registry: &markers.Registry{}},
Checker: &loader.TypeChecker{
NodeFilters: []loader.NodeFilter{generator.CheckFilter()},
},
}

err = generator.RegisterMarkers(parser.Collector.Registry)
if err != nil {
log.Fatalf("failed to register markers: %s", err)
}

crd.AddKnownTypes(parser)
for _, r := range roots {
parser.NeedPackage(r)
}

metav1Pkg := crd.FindMetav1(roots)
if metav1Pkg == nil {
log.Fatalf("no objects in the roots, since nothing imported metav1")
}

kubeKinds := crd.FindKubeKinds(parser, metav1Pkg)
if len(kubeKinds) == 0 {
log.Fatalf("no objects in the roots")
}

for _, groupKind := range kubeKinds {

log.Printf("generating CRD for %v\n", groupKind)

parser.NeedCRDFor(groupKind, nil)
crdRaw := parser.CustomResourceDefinitions[groupKind]

// Inline version of "addAttribution(&crdRaw)" ...
if crdRaw.ObjectMeta.Annotations == nil {
crdRaw.ObjectMeta.Annotations = map[string]string{}
}
crdRaw.ObjectMeta.Annotations[version.BundleVersionAnnotation] = version.BundleVersion

// Prevent the top level metadata for the CRD to be generated regardless of the intention in the arguments
crd.FixTopLevelMetadata(crdRaw)

conv, err := crd.AsVersion(*crdRaw.DeepCopy(), apiext.SchemeGroupVersion)
if err != nil {
log.Fatalf("failed to convert CRD: %s", err)
}

out, err := yaml.Marshal(conv)
if err != nil {
log.Fatalf("failed to marshal CRD: %s", err)
}

fileName := fmt.Sprintf("config/crd/bases/%s_%s.yaml", crdRaw.Spec.Group, crdRaw.Spec.Names.Plural)
err = os.WriteFile(fileName, out, 0o600)
if err != nil {
log.Fatalf("failed to write CRD: %s", err)
}
}
}
6 changes: 5 additions & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ limitations under the License.
package version

const (
// BundleVersionAnnotation is the annotation key used in the Gateway API inference extension CRDs to specify
// the installed Gateway API inference extension version.
BundleVersionAnnotation = "inference.networking.k8s.io/bundle-version"

// BundleVersion is the value used for labeling the version of the gateway-api-inference-extension.
BundleVersion = "v0.4.0-dev"
BundleVersion = "v1.0.0-dev"
)