No errors while upgrading
The CustomResourceDefinition "bgppeers.crd.projectcalico.org" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema
kubectl apply -f calico.yaml --validate
1.
2.
3.
4.
Trying to upgrade calico
Kubernetes with 1 master & 2 workers
Orchestrator version (e.g. kubernetes, mesos, rkt):
Kubernetes 1.17.13
Operating System and version:
RHEL 7.5
@bdaoudtdc just want to confirm, you're upgrading from Calico v3.1.4 to v3.1.7 on Kubernetes 1.17? Or do you mean v3.14 to v3.17?
We never released a v3.1.14 or a v3.1.17
If you're using Calico v3.1, I'm not sure that can be expected to work. Calico v3.1.x is _very_ old, and we stopped testing of it around the time of Kubernetes 1.10, which is also quite old.
https://docs.projectcalico.org/archive/v3.1/getting-started/kubernetes/requirements
@bdaoudtdc just want to confirm, you're upgrading from Calico v3.1.4 to v3.1.7 on Kubernetes 1.17? Or do you mean v3.14 to v3.17?
We never released a v3.1.14 or a v3.1.17
If you're using Calico v3.1, I'm not sure that can be expected to work. Calico v3.1.x is _very_ old, and we stopped testing of it around the time of Kubernetes 1.10, which is also quite old.
https://docs.projectcalico.org/archive/v3.1/getting-started/kubernetes/requirements
Sorry this was a typo ... versions adjusted.
Same issue with Kubernetes 1.19.4.
Two possible solutions:
preserveUnknownFields: false to the CRD spec:spec:
group: crd.projectcalico.org
names:
kind: BGPPeer
listKind: BGPPeerList
plural: bgppeers
singular: bgppeer
scope: Cluster
preserveUnknownFields: false
[...]
spec.keepOriginalNextHop. This is the only default set for any of the CRDs used by Calico in 3.17.The CRD will apply successfully in both cases.
Thank you .
I added
preserveUnknownFields: false
and it ran OK.
Sounds like we need to be making one of those changes in our CRD manifests, so I'm going to keep this open.
I ran into the same issue today. Do you already have a recommendation about which of the two solutions is the correct one?
In this case it appears that the default value specified in the schema matches the default that would occur anyway due to golang defaulting (i.e., false). So, it should be safe to simply remove the default. https://github.com/projectcalico/libcalico-go/blob/master/lib/apis/v3/bgppeer.go#L78
I still need to wrap my head around the implications of setting preserveUnknownFields: false, and so might be best to hold off on that for now. From a quick look around, though, it seems like we will want to set that eventually in order to use additional defaulting and validation features beyond basic schema validation.
Most helpful comment
I ran into the same issue today. Do you already have a recommendation about which of the two solutions is the correct one?