Created
March 14, 2025 17:16
-
-
Save aaron-prindle/6963e077b716d2a342b79f36aa10235d to your computer and use it in GitHub Desktop.
rc_declarative_validation.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test Case: valid replicas (1), feature gate enabled | |
# Expected: Success | |
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: rc-validation-1 | |
namespace: default | |
spec: | |
replicas: 1 | |
selector: | |
name: test-pod | |
template: | |
metadata: | |
labels: | |
name: test-pod | |
spec: | |
containers: | |
- image: nginx:latest | |
name: test-container | |
--- | |
# Test Case: valid replicas (0), feature gate enabled | |
# Expected: Success | |
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: rc-validation-0 | |
namespace: default | |
spec: | |
replicas: 0 | |
selector: | |
name: test-pod | |
template: | |
metadata: | |
labels: | |
name: test-pod | |
spec: | |
containers: | |
- image: nginx:latest | |
name: test-container | |
--- | |
# Test Case: invalid replicas (-1), feature gate enabled | |
# Expected: Error (FieldValueInvalid, must be greater than or equal to 0) | |
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: rc-validation--1 | |
namespace: default | |
spec: | |
replicas: -1 | |
selector: | |
name: test-pod | |
template: | |
metadata: | |
labels: | |
name: test-pod | |
spec: | |
containers: | |
- image: nginx:latest | |
name: test-container | |
--- | |
# Test Case: valid replicas (nil), feature gate enabled | |
# Expected: Success (defaulting to 1) | |
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: "rc-validation-<nil>" # Go will substitute <nil> | |
namespace: default | |
spec: | |
replicas: null # Explicitly set to null | |
selector: | |
name: test-pod | |
template: | |
metadata: | |
labels: | |
name: test-pod | |
spec: | |
containers: | |
- image: nginx:latest | |
name: test-container | |
--- | |
# Test Case: valid replicas (1), feature gate disabled | |
# Expected: Success | |
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: rc-validation-1 | |
namespace: default | |
spec: | |
replicas: 1 | |
selector: | |
name: test-pod | |
template: | |
metadata: | |
labels: | |
name: test-pod | |
spec: | |
containers: | |
- image: nginx:latest | |
name: test-container | |
--- | |
# Test Case: valid replicas (0), feature gate disabled | |
# Expected: Success | |
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: rc-validation-0 | |
namespace: default | |
spec: | |
replicas: 0 | |
selector: | |
name: test-pod | |
template: | |
metadata: | |
labels: | |
name: test-pod | |
spec: | |
containers: | |
- image: nginx:latest | |
name: test-container | |
--- | |
# Test Case: invalid replicas (-1), feature gate disabled | |
# Expected: Error (FieldValueInvalid, must be non-negative) | |
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: rc-validation--1 | |
namespace: default | |
spec: | |
replicas: -1 | |
selector: | |
name: test-pod | |
template: | |
metadata: | |
labels: | |
name: test-pod | |
spec: | |
containers: | |
- image: nginx:latest | |
name: test-container | |
--- | |
# Test Case: valid replicas (nil), feature gate disabled | |
# Expected: Error FieldValueRequired | |
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: "rc-validation-<nil>" | |
namespace: default | |
spec: | |
replicas: null | |
selector: | |
name: test-pod | |
template: | |
metadata: | |
labels: | |
name: test-pod | |
spec: | |
containers: | |
- image: nginx:latest | |
name: test-container |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment