Skip to content

Instantly share code, notes, and snippets.

@aaron-prindle
Last active February 6, 2025 01:40
Show Gist options
  • Save aaron-prindle/305ddd14a0bc9304061457d6f2e88b3b to your computer and use it in GitHub Desktop.
Save aaron-prindle/305ddd14a0bc9304061457d6f2e88b3b to your computer and use it in GitHub Desktop.
valid.yaml for ReplicationController.Replicas
# Base valid ReplicationController object
apiVersion: v1
kind: ReplicationController
metadata:
name: valid-rc
spec:
replicas: 1 # Valid: default value
selector:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-container
image: nginx:latest
---
# Test Case 1: Replicas = 3 (replace)
name: valid replicas - 3 (replace)
replace:
"spec.replicas": 3
---
# Test Case 2: Replicas = 0 (replace)
name: valid replicas - 0 (replace)
replace:
"spec.replicas": 0
---
# Test Case 3: Replicas = 10 (applyConfiguration)
name: valid replicas - 10 (applyConfiguration)
applyConfiguration:
spec:
replicas: 10
---
# Test Case 4: Replicas = 5 (jsonPatch)
name: valid replicas - 5 (jsonPatch)
jsonPatch:
- { "op": "replace", "path": "/spec/replicas", "value": 5 }
@jpbetz
Copy link

jpbetz commented Feb 6, 2025

This is super promising. It's interesting the generated output uses all possible patch mechanisms instead of favoring one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment