Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1808457: [release-4.4] generate CRD manifests and fix for oc explain #1520

Commits on Feb 27, 2020

  1. Generate crd manifests with OpenAPIV3 schemas

    Generate validation for:
    
    containerruntimeconfig
    controllerconfig
    kubeletconfig
    machineconfig
    machineconfigpool
    
    Using update-codegen-crds target from
    https://github.com/openshift/build-machinery-go, which will be
    included in a separate commit as it is not directly usable with the
    MCO repo until coreos/ignition#917 is
    resolved. The current generation is done via hacking ignition's
    config/v2_2/types/schema.go to have dummy `json:",inline"` for fields
    that are causing errors.
    
    Some background on this, there were 2 attempts to add generated
    schemas in: openshift#1403
    and openshift#955.
    This supercedes those with updated generation methods.
    
    Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
    yuqi-zhang authored and openshift-cherrypick-robot committed Feb 27, 2020
    Copy the full SHA
    60be900 View commit details
    Browse the repository at this point in the history
  2. Fix autogenerated crd schemas for oc explain

    Now that we have generated schemas, for oc explain to work we need to
    turn on validation via preserveUnknownFields: false in the spec.
    
    There is also one error in the autogenerated machineconfigpool spec
    due to IntOrString, see: https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#intorstring
    
    Also minor formatting in machineconfig.crd.yaml.
    
    Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
    yuqi-zhang authored and openshift-cherrypick-robot committed Feb 27, 2020
    Copy the full SHA
    8d18a28 View commit details
    Browse the repository at this point in the history
  3. Modify machineconfig crd for descriptiveness

    Manually modify machineconfig crd fields to have description fields
    again. Also remove unused fields.
    
    Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
    yuqi-zhang authored and openshift-cherrypick-robot committed Feb 27, 2020
    Copy the full SHA
    e654508 View commit details
    Browse the repository at this point in the history
  4. update generated bindata after crd changes

    Run ./hack/update-generated-bindata.sh
    
    Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
    yuqi-zhang authored and openshift-cherrypick-robot committed Feb 27, 2020
    Copy the full SHA
    572792a View commit details
    Browse the repository at this point in the history
  5. Add nullable to various api fields

    Add nullable to additionalTrustBundle, cloudProviderCAData, proxy,
    and kernelArguments, as they will otherwise be generated as null
    during CI runs, and the validation will cause it to fail.
    
    Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
    yuqi-zhang authored and openshift-cherrypick-robot committed Feb 27, 2020
    Copy the full SHA
    f63de12 View commit details
    Browse the repository at this point in the history
  6. Add x-kubernetes-preserve-unknown-fields for ignition

    This allows MCC/MCD to validate the ignition section instead, much
    like we've always done. Otherwise, any non-valid ignition section
    will instead get pruned by the validation.
    
    A bit more background: for oc explain to work, we need to have
    
    preserveUnknownFields: false
    
    which means all fields not defined by the crd schema will be pruned
    upon generation of the CR. Since we only define ignition sections
    that are allowed, an invalid ignition spec field will simply get
    removed when the machineconfig is created. Adding the flag tells
    validation that anything under Config is allowed, and we will let
    MCC/MCD do the validation instead, like we do today.
    
    Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
    yuqi-zhang authored and openshift-cherrypick-robot committed Feb 27, 2020
    Copy the full SHA
    35995b9 View commit details
    Browse the repository at this point in the history