Skip to content

[Bug]: Unable to apply v4.0 CRDs: Invalid value: "v1alpha1": must appear in spec.versions #7010

@kyrofa

Description

@kyrofa

Version

3.7.2

What Kubernetes platforms are you running on?

DigitalOcean k8s

Steps to reproduce

I have the ingress controller installed via helm chart (v1.4.2 specifically, which contains v3.7.2 of the controller). I still need to manage the CRDs manually though (as documented in the installation instructions), so I have a standard practice of applying them before I upgrade the chart. I've been following the deprecation notices, so I don't have any v1alpha1 resources. Today I decided to upgrade the chart to v2.0.0 (v4.0.0 of the controller). The first step was to apply the CRDs, but I got this:

$ kubectl apply -f https://raw.githubusercontent.com/nginxinc/kubernetes-ingress/v4.0.0/deploy/crds.yaml
customresourcedefinition.apiextensions.k8s.io/dnsendpoints.externaldns.nginx.org unchanged
customresourcedefinition.apiextensions.k8s.io/policies.k8s.nginx.org configured
customresourcedefinition.apiextensions.k8s.io/virtualserverroutes.k8s.nginx.org unchanged
customresourcedefinition.apiextensions.k8s.io/virtualservers.k8s.nginx.org unchanged
Error from server (Invalid): error when applying patch:
{"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"apiextensions.k8s.io/v1\",\"kind\":\"CustomResourceDefinition\",\"metadata\":{\"annotations\":{\"controller-gen.kubebuilder.io/version\":\"v0.16.5\"},\"name\":\"globalconfigurations.k8s.nginx.org\"},\"spec\":{\"group\":\"k8s.nginx.org\",\"names\":{\"kind\":\"GlobalConfiguration\",\"listKind\":\"GlobalConfigurationList\",\"plural\":\"globalconfigurations\",\"shortNames\":[\"gc\"],\"singular\":\"globalconfiguration\"},\"scope\":\"Namespaced\",\"versions\":[{\"name\":\"v1\",\"schema\":{\"openAPIV3Schema\":{\"description\":\"GlobalConfiguration defines the GlobalConfiguration resource.\",\"properties\":{\"apiVersion\":{\"description\":\"APIVersion defines the versioned schema of this representation of an object.\\nServers should convert recognized schemas to the latest internal value, and\\nmay reject unrecognized values.\\nMore 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.\\nServers may infer this from the endpoint the client submits requests to.\\nCannot be updated.\\nIn CamelCase.\\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds\",\"type\":\"string\"},\"metadata\":{\"type\":\"object\"},\"spec\":{\"description\":\"GlobalConfigurationSpec is the spec of the GlobalConfiguration resource.\",\"properties\":{\"listeners\":{\"items\":{\"description\":\"Listener defines a listener.\",\"properties\":{\"ipv4\":{\"type\":\"string\"},\"ipv6\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"},\"port\":{\"type\":\"integer\"},\"protocol\":{\"type\":\"string\"},\"ssl\":{\"type\":\"boolean\"}},\"type\":\"object\"},\"type\":\"array\"}},\"type\":\"object\"}},\"type\":\"object\"}},\"served\":true,\"storage\":true}]}}\n"}},"spec":{"versions":[{"name":"v1","schema":{"openAPIV3Schema":{"description":"GlobalConfiguration defines the GlobalConfiguration resource.","properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore 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.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds","type":"string"},"metadata":{"type":"object"},"spec":{"description":"GlobalConfigurationSpec is the spec of the GlobalConfiguration resource.","properties":{"listeners":{"items":{"description":"Listener defines a listener.","properties":{"ipv4":{"type":"string"},"ipv6":{"type":"string"},"name":{"type":"string"},"port":{"type":"integer"},"protocol":{"type":"string"},"ssl":{"type":"boolean"}},"type":"object"},"type":"array"}},"type":"object"}},"type":"object"}},"served":true,"storage":true}]}}
to:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
Name: "globalconfigurations.k8s.nginx.org", Namespace: ""
for: "https://raw.githubusercontent.com/nginxinc/kubernetes-ingress/v4.0.0/deploy/crds.yaml": error when patching "https://raw.githubusercontent.com/nginxinc/kubernetes-ingress/v4.0.0/deploy/crds.yaml": CustomResourceDefinition.apiextensions.k8s.io "globalconfigurations.k8s.nginx.org" is invalid: status.storedVersions[0]: Invalid value: "v1alpha1": must appear in spec.versions
Error from server (Invalid): error when applying patch:
{"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"apiextensions.k8s.io/v1\",\"kind\":\"CustomResourceDefinition\",\"metadata\":{\"annotations\":{\"controller-gen.kubebuilder.io/version\":\"v0.16.5\"},\"name\":\"transportservers.k8s.nginx.org\"},\"spec\":{\"group\":\"k8s.nginx.org\",\"names\":{\"kind\":\"TransportServer\",\"listKind\":\"TransportServerList\",\"plural\":\"transportservers\",\"shortNames\":[\"ts\"],\"singular\":\"transportserver\"},\"scope\":\"Namespaced\",\"versions\":[{\"additionalPrinterColumns\":[{\"description\":\"Current state of the TransportServer. If the resource has a valid status, it means it has been validated and accepted by the Ingress Controller.\",\"jsonPath\":\".status.state\",\"name\":\"State\",\"type\":\"string\"},{\"jsonPath\":\".status.reason\",\"name\":\"Reason\",\"type\":\"string\"},{\"jsonPath\":\".metadata.creationTimestamp\",\"name\":\"Age\",\"type\":\"date\"}],\"name\":\"v1\",\"schema\":{\"openAPIV3Schema\":{\"description\":\"TransportServer defines the TransportServer resource.\",\"properties\":{\"apiVersion\":{\"description\":\"APIVersion defines the versioned schema of this representation of an object.\\nServers should convert recognized schemas to the latest internal value, and\\nmay reject unrecognized values.\\nMore 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.\\nServers may infer this from the endpoint the client submits requests to.\\nCannot be updated.\\nIn CamelCase.\\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds\",\"type\":\"string\"},\"metadata\":{\"type\":\"object\"},\"spec\":{\"description\":\"TransportServerSpec is the spec of the TransportServer resource.\",\"properties\":{\"action\":{\"description\":\"TransportServerAction defines an action.\",\"properties\":{\"pass\":{\"type\":\"string\"}},\"type\":\"object\"},\"host\":{\"type\":\"string\"},\"ingressClassName\":{\"type\":\"string\"},\"listener\":{\"description\":\"TransportServerListener defines a listener for a TransportServer.\",\"properties\":{\"name\":{\"type\":\"string\"},\"protocol\":{\"type\":\"string\"}},\"type\":\"object\"},\"serverSnippets\":{\"type\":\"string\"},\"sessionParameters\":{\"description\":\"SessionParameters defines session parameters.\",\"properties\":{\"timeout\":{\"type\":\"string\"}},\"type\":\"object\"},\"streamSnippets\":{\"type\":\"string\"},\"tls\":{\"description\":\"TransportServerTLS defines TransportServerTLS configuration for a TransportServer.\",\"properties\":{\"secret\":{\"type\":\"string\"}},\"type\":\"object\"},\"upstreamParameters\":{\"description\":\"UpstreamParameters defines parameters for an upstream.\",\"properties\":{\"connectTimeout\":{\"type\":\"string\"},\"nextUpstream\":{\"type\":\"boolean\"},\"nextUpstreamTimeout\":{\"type\":\"string\"},\"nextUpstreamTries\":{\"type\":\"integer\"},\"udpRequests\":{\"type\":\"integer\"},\"udpResponses\":{\"type\":\"integer\"}},\"type\":\"object\"},\"upstreams\":{\"items\":{\"description\":\"TransportServerUpstream defines an upstream.\",\"properties\":{\"backup\":{\"type\":\"string\"},\"backupPort\":{\"type\":\"integer\"},\"failTimeout\":{\"type\":\"string\"},\"healthCheck\":{\"description\":\"TransportServerHealthCheck defines the parameters for active Upstream HealthChecks.\",\"properties\":{\"enable\":{\"type\":\"boolean\"},\"fails\":{\"type\":\"integer\"},\"interval\":{\"type\":\"string\"},\"jitter\":{\"type\":\"string\"},\"match\":{\"description\":\"TransportServerMatch defines the parameters of a custom health check.\",\"properties\":{\"expect\":{\"type\":\"string\"},\"send\":{\"type\":\"string\"}},\"type\":\"object\"},\"passes\":{\"type\":\"integer\"},\"port\":{\"type\":\"integer\"},\"timeout\":{\"type\":\"string\"}},\"type\":\"object\"},\"loadBalancingMethod\":{\"type\":\"string\"},\"maxConns\":{\"type\":\"integer\"},\"maxFails\":{\"type\":\"integer\"},\"name\":{\"type\":\"string\"},\"port\":{\"type\":\"integer\"},\"service\":{\"type\":\"string\"}},\"type\":\"object\"},\"type\":\"array\"}},\"type\":\"object\"},\"status\":{\"description\":\"TransportServerStatus defines the status for the TransportServer resource.\",\"properties\":{\"message\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"state\":{\"type\":\"string\"}},\"type\":\"object\"}},\"type\":\"object\"}},\"served\":true,\"storage\":true,\"subresources\":{\"status\":{}}}]}}\n"}},"spec":{"versions":[{"additionalPrinterColumns":[{"description":"Current state of the TransportServer. If the resource has a valid status, it means it has been validated and accepted by the Ingress Controller.","jsonPath":".status.state","name":"State","type":"string"},{"jsonPath":".status.reason","name":"Reason","type":"string"},{"jsonPath":".metadata.creationTimestamp","name":"Age","type":"date"}],"name":"v1","schema":{"openAPIV3Schema":{"description":"TransportServer defines the TransportServer resource.","properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore 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.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds","type":"string"},"metadata":{"type":"object"},"spec":{"description":"TransportServerSpec is the spec of the TransportServer resource.","properties":{"action":{"description":"TransportServerAction defines an action.","properties":{"pass":{"type":"string"}},"type":"object"},"host":{"type":"string"},"ingressClassName":{"type":"string"},"listener":{"description":"TransportServerListener defines a listener for a TransportServer.","properties":{"name":{"type":"string"},"protocol":{"type":"string"}},"type":"object"},"serverSnippets":{"type":"string"},"sessionParameters":{"description":"SessionParameters defines session parameters.","properties":{"timeout":{"type":"string"}},"type":"object"},"streamSnippets":{"type":"string"},"tls":{"description":"TransportServerTLS defines TransportServerTLS configuration for a TransportServer.","properties":{"secret":{"type":"string"}},"type":"object"},"upstreamParameters":{"description":"UpstreamParameters defines parameters for an upstream.","properties":{"connectTimeout":{"type":"string"},"nextUpstream":{"type":"boolean"},"nextUpstreamTimeout":{"type":"string"},"nextUpstreamTries":{"type":"integer"},"udpRequests":{"type":"integer"},"udpResponses":{"type":"integer"}},"type":"object"},"upstreams":{"items":{"description":"TransportServerUpstream defines an upstream.","properties":{"backup":{"type":"string"},"backupPort":{"type":"integer"},"failTimeout":{"type":"string"},"healthCheck":{"description":"TransportServerHealthCheck defines the parameters for active Upstream HealthChecks.","properties":{"enable":{"type":"boolean"},"fails":{"type":"integer"},"interval":{"type":"string"},"jitter":{"type":"string"},"match":{"description":"TransportServerMatch defines the parameters of a custom health check.","properties":{"expect":{"type":"string"},"send":{"type":"string"}},"type":"object"},"passes":{"type":"integer"},"port":{"type":"integer"},"timeout":{"type":"string"}},"type":"object"},"loadBalancingMethod":{"type":"string"},"maxConns":{"type":"integer"},"maxFails":{"type":"integer"},"name":{"type":"string"},"port":{"type":"integer"},"service":{"type":"string"}},"type":"object"},"type":"array"}},"type":"object"},"status":{"description":"TransportServerStatus defines the status for the TransportServer resource.","properties":{"message":{"type":"string"},"reason":{"type":"string"},"state":{"type":"string"}},"type":"object"}},"type":"object"}},"served":true,"storage":true,"subresources":{"status":{}}}]}}
to:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
Name: "transportservers.k8s.nginx.org", Namespace: ""
for: "https://raw.githubusercontent.com/nginxinc/kubernetes-ingress/v4.0.0/deploy/crds.yaml": error when patching "https://raw.githubusercontent.com/nginxinc/kubernetes-ingress/v4.0.0/deploy/crds.yaml": CustomResourceDefinition.apiextensions.k8s.io "transportservers.k8s.nginx.org" is invalid: status.storedVersions[0]: Invalid value: "v1alpha1": must appear in spec.versions

I'm not sure what to make of it. Any help would be appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn issue reporting a potential bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions