-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Milestone
Description
Describe the bug
I am using the new Default annotation to generate my CRDs with defaults. My spec class looks like this:
@Data
@Jacksonized
@Builder
public class MyAppSpec {
@Required
private String name;
@Default("1")
private int replicaCount;
@Required
private String image;
@Required
private String imageTag;
@Default("Always")
private String imagePullPolicy;
@Default("false")
private boolean deployment;
}And the generated CRD is missing the default values. The output looks like this:
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: myapps.com.organisation.tree
spec:
group: com.organisation.tree
names:
kind: MyApp
plural: myapps
singular: myapp
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
spec:
properties:
deployment:
type: boolean
image:
type: string
imagePullPolicy:
type: string
imageTag:
type: string
name:
type: string
replicaCount:
type: integer
required:
- name
- image
- imageTag
type: object
status:
properties:
ready:
type: boolean
type: object
type: object
served: true
storage: true
subresources:
status: {}Fabric8 Kubernetes Client version
6.9.0
Steps to reproduce
- Create a spec POJO
- Annotate fields with
@Default - Generate the CRD
Expected behavior
To have default field in the generated CRD
Runtime
Kubernetes (vanilla)
Kubernetes API Server version
1.25.3@latest
Environment
macOS
Fabric8 Kubernetes Client Logs
No response
Additional context
No response