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
40 changes: 35 additions & 5 deletions .github/workflows/crd-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,28 @@ name: CRD Validation

on:
pull_request:
types: [opened, edited, synchronize, reopened]
types: [opened, edited, synchronize, reopened, labeled, unlabeled]

permissions:
contents: read
pull-requests: write

jobs:
ack-breaking-changes:
name: Ack Breaking Changes Labeler
if: github.event.issue.pull_request && contains(github.event.comment.body, '/ack-breaking-changes')
runs-on: ubuntu-latest
steps:
- name: Add Label
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ github.event.issue.number }} --add-label "ack-breaking-changes"
echo "✅ Added 'ack-breaking-changes' label based on comment."

crd-validation:
name: CRD Validation Check
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -28,7 +42,17 @@ jobs:
run: |
go install sigs.k8s.io/crdify@latest

- name: Reset Validation Approval
if: github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'ack-breaking-changes')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ github.event.pull_request.number }} --remove-label "ack-breaking-changes"
echo "⚠️ Removed 'ack-breaking-changes' label due to new changes. Re-approval required."

- name: Run CRD Validation Check
env:
ALLOW_BREAKING: ${{ contains(github.event.pull_request.labels.*.name, 'ack-breaking-changes') && github.event.action != 'synchronize' }}
run: |
git fetch origin ${{ github.base_ref }}:upstream_base
BASE_SHA=$(git rev-parse upstream_base)
Expand All @@ -37,15 +61,21 @@ jobs:
for crd in config/crd/bases/*.yaml; do
if ! crdify "git://${BASE_SHA}?path=$crd" "git://HEAD?path=$crd"; then
echo "❌ Incompatible change detected in $crd"
((FAILED++))
FAILED=$((FAILED + 1))
else
echo "✅ $crd is valid"
fi
done

if [ "$FAILED" -gt 0 ]; then
echo "::error::Validation failed! Found $FAILED incompatible CRD change(s)."
exit 1
if [[ "$ALLOW_BREAKING" == "true" ]]; then
echo "⚠️ Validation failed with $FAILED incompatible change(s), but allowed via 'ack-breaking-changes' label."
exit 0
else
echo "❌ error: Validation failed! Found $FAILED incompatible CRD change(s)."
echo "⚠️ notice: To allow these changes, a reviewer must add the 'ack-breaking-changes' label to the PR."
exit 1
fi
fi

echo "All CRDs are compatible."
echo "All CRDs are compatible."
2 changes: 1 addition & 1 deletion apix/v1alpha2/inferencemodelrewrite_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ type InferenceModelRewriteRule struct {
// +optional
// +kubebuilder:validation:MinItems=1
//
Targets []TargetModel `json:"split,omitempty"`
Targets []TargetModel `json:"targets,omitempty"`
}

// TargetModel defines a weighted model destination for traffic distribution.
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ spec:
- model
type: object
type: array
split:
targets:
items:
description: TargetModel defines a weighted model destination
for traffic distribution.
Expand Down
Loading