Closed sowmyav27 closed 3 years ago
@sowmyav27 - Is this a new failure? (Regression from 2.5.6-->2.5.8) or has this always been happening?
I dont see this issue on 2.5.7 using monitoring v1 version - 0.2.1
and monitoring v2 version: 9.4.203
This feels like a regression if it's not happening in 2.5.7. Thanks for giving me the details Sowmya, I'll do some research and figure out where we want to be with it.
@sowmyav27 seems like the logs posted above are a partial dump. Do you have access to the full logs? Specifically, at the very end of the logs there should be an error that indicates exactly which property within the CRD upgrade was rejected iirc.
Also I don't think this is a regression but rather an artifact of trying to install v0.39.0 Prometheus Operator CRDs for Monitoring V1 (which are still using non-structural schemas based on apiextensions.k8s.io/v1beta
) and then trying to upgrade to v0.45.0 CRDs for Monitoring V2 (which are using structural schemas based on apiextensions.k8s.io/v1
).
This is similar to the issue we found when trying to upgrade Monitoring V2 from 9.4.203 to 14.5.100, which was resolved by https://github.com/rancher/charts/pull/1131. This was due to an issue with upgrading from Prometheus Operator CRDs of v0.38.1 to v0.45.0.
@sowmyav27 seems like the logs posted above are a partial dump. Do you have access to the full logs? Specifically, at the very end of the logs there should be an error that indicates exactly which property within the CRD upgrade was rejected iirc.
Spoke offline and we don't have those logs anymore, I'll attempt to reproduce and add the full logs to this ticket.
Reproduced this issue. The following logs were printed from the rancher-monitoring-crd-create
pod and the pod keeps restarting.
Error from server (NotFound): customresourcedefinitions.apiextensions.k8s.io "alertmanagerconfigs.monitoring.coreos.com" not found
The CustomResourceDefinition "alertmanagers.monitoring.coreos.com" is invalid: spec.versions[0].schema.openAPIV3Schema: Required value: schemas are required
Error from server (NotFound): customresourcedefinitions.apiextensions.k8s.io "probes.monitoring.coreos.com" not found
The CustomResourceDefinition "prometheuses.monitoring.coreos.com" is invalid: spec.versions[0].schema.openAPIV3Schema: Required value: schemas are required
The CustomResourceDefinition "prometheusrules.monitoring.coreos.com" is invalid: spec.versions[0].schema.openAPIV3Schema: Required value: schemas are required
The CustomResourceDefinition "servicemonitors.monitoring.coreos.com" is invalid: spec.versions[0].schema.openAPIV3Schema: Required value: schemas are required
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
Name: "prometheuses.monitoring.coreos.com", Namespace: ""
for: "/etc/config/crd-manifest.yaml": CustomResourceDefinition.apiextensions.k8s.io "prometheuses.monitoring.coreos.com" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema
Also I don't think this is a regression but rather an artifact of trying to install v0.39.0 Prometheus Operator CRDs for Monitoring V1 (which are still using non-structural schemas based on
apiextensions.k8s.io/v1beta
) and then trying to upgrade to v0.45.0 CRDs for Monitoring V2 (which are using structural schemas based onapiextensions.k8s.io/v1
).
Correction: the reason why this issue is happening is because the patch step attempts to convert a structural schema (post upgrade and uninstall of V1) into a non-structural schema temporarily. This fails to remove preserveUnknownFields, which is why we see this issue in Monitoring V1 -> V2 migrations.
Testing out a fix, will get a PR out soon.
@sowmyav27 seems like not overriding the schema did the trick, but since this affects the CRD installation process we should double check that all test cases involving CRD installs work as expected.
For testing this fix, I tried 9.4.203 upgrade to 14.5.00, a clean install, and a Monitoring V1 to Monitoring V2 upgrade and those seemed to work as expected now.
On 2.5.8-rc16
branch: dev-v2.5
commit: e17b8cc9dfbc2bd2c704ea4a01358b14faacb980
14.5.100
I just tried deploying 14.5.100 to a brand new cluster and getting the same error as reported here:
rancher-monitoring-crd-create-xt4vj create-crds to:
rancher-monitoring-crd-create-xt4vj create-crds Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
rancher-monitoring-crd-create-xt4vj create-crds Name: "prometheuses.monitoring.coreos.com", Namespace: ""
rancher-monitoring-crd-create-xt4vj create-crds for: "/etc/config/crd-manifest.yaml": CustomResourceDefinition.apiextensions.k8s.io "prometheuses.monitoring.coreos.com" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema
@digiserg we have an issue for this here https://github.com/rancher/rancher/issues/32827 but the workaround is to just try redeploying the CRD chart / original chart. It seems to be a race condition.
What kind of request is this (question/bug/enhancement/feature request): bug
Steps to reproduce (least amount of steps as possible):
Note: Workaround: Delete monitoring v2 CRD and re install it. It deploys.
Environment information
rancher/rancher
/rancher/server
image tag or shown bottom left in the UI): 2.5.8-rc16, monitoring - 14.5.100 and chart commit: