Bug 1794096

Summary: CRD storageversionmigrations.migration.k8s.io has no schema
Product: OpenShift Container Platform Reporter: Luis Sanchez <sanchezl>
Component: kube-apiserverAssignee: Luis Sanchez <sanchezl>
Status: CLOSED ERRATA QA Contact: Ke Wang <kewang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.4CC: aos-bugs, mfojtik, xxia
Target Milestone: ---   
Target Release: 4.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-04 11:26:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Luis Sanchez 2020-01-22 16:09:19 UTC
Description of problem:

"CRD storagestates.migration.k8s.io (storagestates.migration.k8s.io) version=v1alpha1 has no schema: (*v1.CustomResourceValidation)(nil)",

"CRD storageversionmigrations.migration.k8s.io (storageversionmigrations.migration.k8s.io) version=v1alpha1 has no schema: (*v1.CustomResourceValidation)(nil)",

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Xingxing Xia 2020-02-14 06:26:12 UTC
Ke, I guess (didn't yet try) above messages occur in KAS log (Example bug 1802647) (CRD is from k8s, KAS validates cluster CRDs).
About "schema": a resource (no matter core kinds or CRDs) schema defines its fields, and fields' description, type (string or integer etc), constraint (e.g. for integer field, could define max/min) etc, all of which will be validated in KAS start. Resource schema definition can be shown in `oc explain <resource[.<field>...]>`.
Could check PR files and above tips for the verification.

Comment 3 Ke Wang 2020-02-14 15:03:08 UTC
The bug related PR is not bumped into cluster-kube-storage-version-migrator-operator of latest 4.4 payload 4.4.0-0.nightly-2020-02-13-185851:
git clone git:openshift/cluster-kube-storage-version-migrator-operator.git
cd cluster-kube-storage-version-migrator-operator/
git pull

oc adm release info --commits registry.svc.ci.openshift.org/ocp/release:4.4.0-0.nightly-2020-02-13-185851 | grep cluster-kube-storage-version-migrator-operator # get commit id
    cluster-kube-storage-version-migrator-operator https://github.com/openshift/cluster-kube-storage-version-migrator-operator 982c236e916c233c5ec25db6f377b0a3f05b1496

git checkout -b 4.4.0-0.nightly-2020-02-13-185851 982c236
git log --pretty="%h %an %cd - %s" 982c236e | grep -i 'no schema' # searching related PR

The output shows nothing, not found the related PR. 

Searching related crd yaml files under path cluster-kube-storage-version-migrator-operator/

$ ls manifests/0000_40_kube-storage-version-migrator-operator_01_storage_migration_crd.yaml
ls: cannot access 'manifests/0000_40_kube-storage-version-migrator-operator_01_storage_migration_crd.yaml': No such file or directory

$ ls manifests/0000_40_kube-storage-version-migrator-operator_01_storage_state_crd.yaml
ls: cannot access 'manifests/0000_40_kube-storage-version-migrator-operator_01_storage_state_crd.yaml': No such file or directory

Comment 5 Ke Wang 2020-02-19 08:58:50 UTC
1. Verified with OCP build 4.4.0-0.nightly-2020-02-18-191238, 
Refer to PR openshift cluster-kube-storage-version-migrator-operator pull 12 , checked the CRD storagestates.migration.k8s.io  and storageversionmigrations.migration.k8s.io  schemas. 

$ oc get crd storageversionmigrations.migration.k8s.io -o yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    api-approved.kubernetes.io: unapproved
  creationTimestamp: "2020-02-19T01:43:38Z"
  generation: 1
  name: storageversionmigrations.migration.k8s.io
  resourceVersion: "616"
  selfLink: /apis/apiextensions.k8s.io/v1/customresourcedefinitions/storageversionmigrations.migration.k8s.io
  uid: 7a1c2d42-35b5-4627-8e5c-425b98fba9f4
spec:
  conversion:
    strategy: None
  group: migration.k8s.io
  names:
    kind: StorageVersionMigration
    listKind: StorageVersionMigrationList
    plural: storageversionmigrations
    singular: storageversionmigration
  preserveUnknownFields: true
  scope: Cluster
  versions:
  - name: v1alpha1
    schema:
      openAPIV3Schema:
        description: StorageVersionMigration represents a migration of stored data
          to the latest storage version.
        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
          spec:
            description: Specification of the migration.
            properties:
              continueToken:
                description: The token used in the list options to get the next chunk
                  of objects to migrate. When the .status.conditions indicates the
                  migration is "Running", users can use this token to check the progress
                  of the migration.
                type: string
              resource:
                description: The resource that is being migrated. The migrator sends
                  requests to the endpoint serving the resource. Immutable.
                properties:
                  group:
                    description: The name of the group.
                    type: string
                  resource:
                    description: The name of the resource.
                    type: string
                  version:
                    description: The name of the version.
                    type: string
                type: object
            required:
            - resource
            type: object
          status:
            description: Status of the migration.
            properties:
              conditions:
                description: The latest available observations of the migration's
                  current state.
                items:
                  description: Describes the state of a migration at a certain point.
                  properties:
                    lastUpdateTime:
                      description: The last time this condition was updated.
                      format: date-time
                      type: string
                    message:
                      description: A human readable message indicating details about
                        the transition.
                      type: string
                    reason:
                      description: The reason for the condition's last transition.
                      type: string
                    status:
                      description: Status of the condition, one of True, False, Unknown.
                      type: string
                    type:
                      description: Type of the condition.
                      type: string
                  required:
                  - status
                  - type
                  type: object
                type: array
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
...
  
  $ oc get crd storagestates.migration.k8s.io -o yaml

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    api-approved.kubernetes.io: unapproved
  creationTimestamp: "2020-02-19T01:43:40Z"
  generation: 1
  name: storagestates.migration.k8s.io
  resourceVersion: "763"
  selfLink: /apis/apiextensions.k8s.io/v1/customresourcedefinitions/storagestates.migration.k8s.io
  uid: 62dfdffb-25aa-4c05-bb77-96430ab8f59f
spec:
  conversion:
    strategy: None
  group: migration.k8s.io
  names:
    kind: StorageState
    listKind: StorageStateList
    plural: storagestates
    singular: storagestate
  preserveUnknownFields: true
  scope: Cluster
  versions:
  - name: v1alpha1
    schema:
      openAPIV3Schema:
        description: The state of the storage of a specific resource.
        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:
            description: The name must be "<.spec.resource.resouce>.<.spec.resource.group>".
            type: object
          spec:
            description: Specification of the storage state.
            properties:
              resource:
                description: The resource this storageState is about.
                properties:
                  group:
                    description: The name of the group.
                    type: string
                  resource:
                    description: The name of the resource.
                    type: string
                type: object
            type: object
          status:
            description: Status of the storage state.
            properties:
              currentStorageVersionHash:
                description: The hash value of the current storage version, as shown
                  in the discovery document served by the API server. Storage Version
                  is the version to which objects are converted to before persisted.
                type: string
              lastHeartbeatTime:
                description: LastHeartbeatTime is the last time the storage migration
                  triggering controller checks the storage version hash of this resource
                  in the discovery document and updates this field.
                format: date-time
                type: string
              persistedStorageVersionHashes:
                description: The hash values of storage versions that persisted instances
                  of spec.resource might still be encoded in. "Unknown" is a valid
                  value in the list, and is the default value. It is not safe to upgrade
                  or downgrade to an apiserver binary that does not support all versions
                  listed in this field, or if "Unknown" is listed. Once the storage
                  version migration for this resource has completed, the value of
                  this field is refined to only contain the currentStorageVersionHash.
                  Once the apiserver has changed the storage version, the new storage
                  version is appended to the list.
                items:
                  type: string
                type: array
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
...

2. Check if exists related ‘has no schema’ in KAS log.
# apiserver_node=$(oc get po -o wide -n openshift-kube-apiserver | grep kube-apiserver | awk '{print $7}' | head -1)
# oc debug node/$apiserver_node

sh-4.2# chroot /host
sh-4.4# cd /var/log/pods
sh-4.4# grep -rn 'has no schema' *kube-apiserver*

Found nothing for keyword in KAS logs.

Comment 9 errata-xmlrpc 2020-05-04 11:26:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0581