Upgrading eck-operator is failing on spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema

Docker v20.10
K8s: v1.20

I'm using Rancher to upgrade the ECK operator from version 1.6.0 to 2.0.0 and the upgrade process fails with the following error from the UI.

helm upgrade --history-max=5 --install=true --namespace=elastic-system --reset-values=true --timeout=10m0s --values=/home/shell/helm/values-eck-operator-2.0.0.yaml --version=2.0.0 --wait=true eck-operator /home/shell/helm/eck-operator-2.0.0.tgz
checking 17 resources for changes
Looks like there are no changes for ServiceAccount "elastic-operator"
Looks like there are no changes for Secret "elastic-operator-webhook-cert"
Looks like there are no changes for ConfigMap "elastic-operator"
error updating the resource "agents.agent.k8s.elastic.co":
cannot patch "agents.agent.k8s.elastic.co" with kind CustomResourceDefinition: CustomResourceDefinition.apiextensions.k8s.io "agents.agent.k8s.elastic.co" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema
error updating the resource "apmservers.apm.k8s.elastic.co":
cannot patch "apmservers.apm.k8s.elastic.co" with kind CustomResourceDefinition: CustomResourceDefinition.apiextensions.k8s.io "apmservers.apm.k8s.elastic.co" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema
error updating the resource "elasticmapsservers.maps.k8s.elastic.co":
cannot patch "elasticmapsservers.maps.k8s.elastic.co" with kind CustomResourceDefinition: CustomResourceDefinition.apiextensions.k8s.io "elasticmapsservers.maps.k8s.elastic.co" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema
error updating the resource "elasticsearches.elasticsearch.k8s.elastic.co":
cannot patch "elasticsearches.elasticsearch.k8s.elastic.co" with kind CustomResourceDefinition: CustomResourceDefinition.apiextensions.k8s.io "elasticsearches.elasticsearch.k8s.elastic.co" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema
error updating the resource "enterprisesearches.enterprisesearch.k8s.elastic.co":
cannot patch "enterprisesearches.enterprisesearch.k8s.elastic.co" with kind CustomResourceDefinition: CustomResourceDefinition.apiextensions.k8s.io "enterprisesearches.enterprisesearch.k8s.elastic.co" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema
error updating the resource "kibanas.kibana.k8s.elastic.co":
cannot patch "kibanas.kibana.k8s.elastic.co" with kind CustomResourceDefinition: CustomResourceDefinition.apiextensions.k8s.io "kibanas.kibana.k8s.elastic.co" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema
Looks like there are no changes for ClusterRole "elastic-operator"
Looks like there are no changes for ClusterRole "elastic-operator-view"
Looks like there are no changes for ClusterRole "elastic-operator-edit"
Looks like there are no changes for ClusterRoleBinding "elastic-operator"
Looks like there are no changes for Service "elastic-operator-webhook"
Error: UPGRADE FAILED: cannot patch "agents.agent.k8s.elastic.co" with kind CustomResourceDefinition: CustomResourceDefinition.apiextensions.k8s.io "agents.agent.k8s.elastic.co" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema && cannot patch "apmservers.apm.k8s.elastic.co" with kind CustomResourceDefinition: CustomResourceDefinition.apiextensions.k8s.io "apmservers.apm.k8s.elastic.co" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema && cannot patch "elasticmapsservers.maps.k8s.elastic.co" with kind CustomResourceDefinition: CustomResourceDefinition.apiextensions.k8s.io "elasticmapsservers.maps.k8s.elastic.co" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema && cannot patch "elasticsearches.elasticsearch.k8s.elastic.co" with kind CustomResourceDefinition: CustomResourceDefinition.apiextensions.k8s.io "elasticsearches.elasticsearch.k8s.elastic.co" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema && cannot patch "enterprisesearches.enterprisesearch.k8s.elastic.co" with kind CustomResourceDefinition: CustomResourceDefinition.apiextensions.k8s.io "enterprisesearches.enterprisesearch.k8s.elastic.co" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema && cannot patch "kibanas.kibana.k8s.elastic.co" with kind CustomResourceDefinition: CustomResourceDefinition.apiextensions.k8s.io "kibanas.kibana.k8s.elastic.co" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema

Is there a way around this ?

We switched to v1 CRDs between 1.6 and 1.7. That means that a regular upgrade which does a apply behind the scenes does not work. You have to force upgrade the CRDs which does a replace instead. We have detailed upgrade instructions here Upgrade ECK | Elastic Cloud on Kubernetes [2.0] | Elastic

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.