Skip to content
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

Generated CRDs have status fields in their output set #456

Closed
maxsmythe opened this issue Jun 30, 2020 · 25 comments
Closed

Generated CRDs have status fields in their output set #456

maxsmythe opened this issue Jun 30, 2020 · 25 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@maxsmythe
Copy link
Contributor

Generated CRDs have blank values in their status field. This appears to interfere with ArgoCD.

Given that manifests should not define status, it may be worth explicitly removing status from the output.

Here is some sample output from running controller-gen in the Gatekeeper repository:

$ controller-gen crd:trivialVersions=true paths="./apis/..." paths="./pkg/..." output:stdout

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.3.0
  creationTimestamp: null
  name: constraintpodstatuses.status.gatekeeper.sh
spec:
  group: status.gatekeeper.sh
  names:
    kind: ConstraintPodStatus
    listKind: ConstraintPodStatusList
    plural: constraintpodstatuses
    singular: constraintpodstatus
  scope: Namespaced
  validation:
    openAPIV3Schema:
      description: ConstraintPodStatus is the Schema for the constraintpodstatuses
        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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds'
          type: string
        metadata:
          type: object
        status:
          description: ConstraintPodStatusStatus defines the observed state of ConstraintPodStatus
          properties:
            constraintUID:
              description: Storing the constraint UID allows us to detect drift, such
                as when a constraint has been recreated after its CRD was deleted
                out from under it, interrupting the watch
              type: string
            enforced:
              type: boolean
            errors:
              items:
                description: Error represents a single error caught while adding a
                  constraint to OPA
                properties:
                  code:
                    type: string
                  location:
                    type: string
                  message:
                    type: string
                required:
                - code
                - message
                type: object
              type: array
            id:
              type: string
            observedGeneration:
              format: int64
              type: integer
            operations:
              items:
                type: string
              type: array
          type: object
      type: object
  version: v1beta1
  versions:
  - name: v1beta1
    served: true
    storage: true
status:
  acceptedNames:
    kind: ""
    plural: ""
  conditions: []
  storedVersions: []
@alexellis
Copy link

Rather than:

status:
  acceptedNames:
    kind: ""
    plural: ""
  conditions: []
  storedVersions: []

We get:

status:
  acceptedNames:
    kind: ""
    plural: ""
  conditions: null
  storedVersions: null

The null causes the following error for some users:

error: error validating "inlets.inlets.dev_tunnels.yaml": error validating data: ValidationError(CustomResourceDefinition.status): missing required field "storedVersions" in io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionStatus; if you choose to ignore these errors, turn validation off with --validate=false

https://github.com/inlets/inlets-operator/blob/master/artifacts/crds/inlets.inlets.dev_tunnels.yaml

https://github.com/inlets/inlets-operator/blob/master/hack/update-crds.sh

alexellis added a commit to inlets/inlets-operator that referenced this issue Jul 4, 2020
Until I can find out how to make kubebuilder output "[]"
instead of "null", this manual patch will have to exist.

See also:

kubernetes-sigs/controller-tools#456

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
@knight42
Copy link
Member

knight42 commented Jul 5, 2020

EDIT: I could confirm that this issue has not been fixed.

Fixed by #433

@alexellis
Copy link

If that was fixed 2 months ago then why are we having issues now? Can yo advise which specific version of the tool we need to take for the fix?

@narahari92
Copy link

I see same issue @alexellis mentioned. Had to manually edit the yaml to replace null to [].

@vijtrip2
Copy link

vijtrip2 commented Aug 3, 2020

the latest versions of controller-tools is still producing following section in CRD.

status:
  acceptedNames:
    kind: ""
    plural: ""
  conditions: null
  storedVersions: null

Reverting the commit b9fd300("sparkles: Remove status from generated CRDs") produces crd versions with empty status fields rather than null and does not produce the validation error

@mcristina422 am I missing something here??

@mcristina422
Copy link
Contributor

No, it seems like my commit is indeed wrong and did not actually accomplish what I thought it did. I think we should revert my previous PR #472

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 15, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Dec 15, 2020
@misterkramer
Copy link

Hi! Can we remove status field from generation? The CRD shouldn't include the status field as an input (it's an output field). There will be problems with tools like Pulumi pulumi/pulumi-kubernetes#800

@misterkramer
Copy link

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Dec 28, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 29, 2021
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 28, 2021
@maxsmythe
Copy link
Contributor Author

/remove-lifecycle rotten

Unless this has been fixed, it looks like people may still be interested in seeing this fixed.

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Apr 28, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 15, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Dec 15, 2021
@morgante
Copy link

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Dec 15, 2021
justinsb added a commit to justinsb/controller-tools that referenced this issue Feb 25, 2022
It's tricky to get the existing CRD types to not include the status,
so we instead allow for filtering of the map just before writing.

Issue kubernetes-sigs#456
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 15, 2022
@pintohutch
Copy link

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 1, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 30, 2022
@knight42
Copy link
Member

knight42 commented Jul 1, 2022

This issue should be resolved by #630.
/close

@k8s-ci-robot
Copy link
Contributor

@knight42: Closing this issue.

In response to this:

This issue should be resolved by #630.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

jan--f added a commit to jan--f/observability-operator that referenced this issue Jul 6, 2022
This mostly pulls in many fixes from controller-tools. Mainly
controller-gen now respects type marker in types and generated the CRD
manifests accordingly. This means that SSA now functions correctly with
the generated manifests. Accordingly this also reenables the
`revert-test`.
The other changes added here are mostly whitespace changes in the
manifests, the status being no longer included in the CRD manifests (see
kubernetes-sigs/controller-tools#456 for
details) and we seem to have forgotten to regenerate some manifests
after a version bump.

Fixes: rhobs#142

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
jan--f added a commit to jan--f/observability-operator that referenced this issue Jul 6, 2022
This mostly pulls in many fixes from controller-tools. Mainly
controller-gen now respects type marker in types and generated the CRD
manifests accordingly. This means that SSA now functions correctly with
the generated manifests. Accordingly this also reenables the
`revert-test`.
The other changes added here are mostly whitespace changes in the
manifests, the status being no longer included in the CRD manifests (see
kubernetes-sigs/controller-tools#456 for
details) and we seem to have forgotten to regenerate some manifests
after a version bump.

Fixes: rhobs#142

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
jan--f added a commit to jan--f/observability-operator that referenced this issue Jul 8, 2022
This mostly pulls in many fixes from controller-tools. Mainly
controller-gen now respects type marker in types and generated the CRD
manifests accordingly. This means that SSA now functions correctly with
the generated manifests. Accordingly this also reenables the
`revert-test`.
The other changes added here are mostly whitespace changes in the
manifests, the status being no longer included in the CRD manifests (see
kubernetes-sigs/controller-tools#456 for
details) and we seem to have forgotten to regenerate some manifests
after a version bump.

Fixes: rhobs#142

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
jan--f added a commit to jan--f/observability-operator that referenced this issue Jul 11, 2022
This mostly pulls in many fixes from controller-tools. Mainly
controller-gen now respects type marker in types and generated the CRD
manifests accordingly. This means that SSA now functions correctly with
the generated manifests. Accordingly this also reenables the
`revert-test`.
The other changes added here are mostly whitespace changes in the
manifests, the status being no longer included in the CRD manifests (see
kubernetes-sigs/controller-tools#456 for
details) and we seem to have forgotten to regenerate some manifests
after a version bump.

Fixes: rhobs#142

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
sthaha pushed a commit to rhobs/observability-operator that referenced this issue Jul 12, 2022
This mostly pulls in many fixes from controller-tools. Mainly
controller-gen now respects type marker in types and generated the CRD
manifests accordingly. This means that SSA now functions correctly with
the generated manifests. Accordingly this also reenables the
`revert-test`.
The other changes added here are mostly whitespace changes in the
manifests, the status being no longer included in the CRD manifests (see
kubernetes-sigs/controller-tools#456 for
details) and we seem to have forgotten to regenerate some manifests
after a version bump.

The patch also updates  kustomize to 4.5.2

Fixes: #142

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests