-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
Summary
Optional field additions = Safe, backward compatible, should be allowed
The current "unhandled" error is overly conservative - it blocks safe changes that don't break compatibility.
Example: Why Optional Field Additions Are Backward Compatible
Scenario: Example Operator Upgrade 1.6.3 → 1.7.0
What Changed
CRD: applications.example.com
Version 1.6.3:
spec:
config:
secrets:
items:
properties:
key:
type: string
description: "Key in the object"
name:
type: string
description: "Name of the object\nWe support only ConfigMaps and Secrets."Version 1.7.0 (added optional field):
spec:
config:
secrets:
items:
properties:
key:
type: string
description: "Key in the object"
mountPath: # ← NEW OPTIONAL FIELD
type: string
description: "Path to mount the Object. If not specified default-path/Name will be used"
name:
type: string
description: "Name of the object\nSupported ConfigMaps and Secrets." # ← Description updatedWhy This Is Backward Compatible
1. Optional Fields Don't Break Existing Resources
Existing resource (from 1.6.3):
apiVersion: example.com/v1alpha1
kind: Application
spec:
config:
secrets:
- key: "my-key"
name: "my-secret"Still valid in 1.7.0:
# Same resource works perfectly - mountPath is optional
apiVersion: example.com/v1alpha1
kind: Application
spec:
config:
secrets:
- key: "my-key"
name: "my-secret"
# mountPath not required - defaults to default-path/Name2. Kubernetes Schema Validation
- Optional fields = Not in
requiredarray - Existing resources = Don't need to provide optional fields
- New resources = Can optionally use the new field
Current Problem
Error triggered:
unhandled: unhandled changes found :
&v1.JSONSchemaProps{
Properties: map[string]v1.JSONSchemaProps{
"mountPath": { # ← This is safe!
Type: "string",
Description: "Path to mount..."
}
}
}
Why it's wrong:
mountPathis not required (not inrequiredarray)- Adding it doesn't break existing resources
- It's a safe, additive change
Expected Behavior
Should NOT error because:
- ✅ Field is optional (not required)
- ✅ Existing resources remain valid
- ✅ New resources can optionally use it
- ✅ No breaking changes
Should error only if:
- ❌ Field is added to
requiredarray (breaking) - ❌ Field type changes (breaking)
- ❌ Existing fields removed (breaking)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels