-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Remove status from generated CRDs #433
✨ Remove status from generated CRDs #433
Conversation
/assign @vincepri |
/approve |
@DirectXMan12 Can you please confirm if it's now safe to do this? |
Can you quickly confirm that you've run this against a few different API server version and kubectl versions? If this serialized properly now (as shown in the PR) we should be fine, but better safe than sorry. |
mainly just looking for a slighly older version (e.g. 1.14 or something) |
Using
I generated a new CRD with simply type CronJobSpec struct {
Schedule string `json:"schedule"`
} CRD YAML---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: (devel)
creationTimestamp: null
name: cronjobs.testdata.kubebuilder.io
spec:
group: testdata.kubebuilder.io
names:
kind: CronJob
listKind: CronJobList
plural: cronjobs
singular: mycronjob
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: CronJob is the Schema for the cronjobs API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
schedule:
description: The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
type: string
required:
- schedule
type: object
status:
description: CronJobStatus defines the observed state of CronJob
properties:
active:
description: A list of pointers to currently running jobs.
items:
description: ObjectReference contains enough information to let
you inspect or modify the referred object.
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of
an entire object, this string should contain a valid JSON/Go
field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen
only to have some well-defined way of referencing a part of
an object. TODO: this design is not final and this field is
subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
type: array
lastScheduleMicroTime:
description: Information about the last time the job was successfully
scheduled, with microsecond precision.
format: date-time
type: string
lastScheduleTime:
description: Information when was the last time the job was successfully
scheduled.
format: date-time
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
or v1beta1 for v1.14 ---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: (devel)
creationTimestamp: null
name: cronjobs.testdata.kubebuilder.io
spec:
group: testdata.kubebuilder.io
names:
kind: CronJob
listKind: CronJobList
plural: cronjobs
singular: mycronjob
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: CronJob is the Schema for the cronjobs API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
schedule:
type: string
required:
- schedule
type: object
status:
description: CronJobStatus defines the observed state of CronJob
properties:
active:
description: A list of pointers to currently running jobs.
items:
description: ObjectReference contains enough information to let you
inspect or modify the referred object.
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of
an entire object, this string should contain a valid JSON/Go
field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen
only to have some well-defined way of referencing a part of
an object. TODO: this design is not final and this field is
subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
type: array
lastScheduleMicroTime:
description: Information about the last time the job was successfully
scheduled, with microsecond precision.
format: date-time
type: string
lastScheduleTime:
description: Information when was the last time the job was successfully
scheduled.
format: date-time
type: string
type: object
type: object
version: v1
versions:
- name: v1
served: true
storage: true
Testing this PR works against kind clusters v1.17
v1.14.10
|
/lgtm /hold Awesome. I suspect it was something around the actual Go types not having |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: DirectXMan12, mcristina422, vincepri The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
- the presence of this section confused tooling such as `kapp` which would think our desired state of the CRD was to have an empty `status` conditions array - long term this should be resolved by this change to controller-tools kubernetes-sigs/controller-tools#433 which we will adopt in https://www.pivotaltracker.com/story/show/172569440 [#172569406](https://www.pivotaltracker.com/story/show/172569406)
Sorry I wasn't clear, I had to test v1beta1 above because v1 isnt included in k8s v1.14.10, it was added in v1.16 /hold cancel |
I've been trying to get this to work without much success. I'm not at all familiar with golang, so it's very possible I'm missing something obvious. Any ideas?
|
@akloss-cibo same here, did you get any further? Asper #456 - I still see null instead of []. |
Nope. I gave up and added
to my argocd application config instead. :( |
removes empty status from generated crds due to: kubernetes-sigs/controller-tools#433
This sets the CRDs status to empty so it is no longer generated in CRD yamls.
This was originally added in #203 which confuses me because v1beta1 has had the optional marker for awhile https://github.com/kubernetes/kubernetes/pull/66102/files#diff-3029a18192feb70af52de676209da9b6R206
This is currently a problem because continuous delivery tools cant converge when applying them against the updated server set properties