Skip to content

Openshift case - io.k8s.api.core.v1.LimitRangeItem -> permit Images and ImageStream #20

Description

@mmv2010

Hi,

For kubernetes-validate module run from ansible, kubernetes version: v1.23.5
validation for size/number of Images and ImageSources on LimitRanges is not under definitions

https://docs.openshift.com/container-platform/4.10/nodes/clusters/nodes-cluster-limit-ranges.html

  • "Image streams: You can set limits on the number of images and tags in an ImageStream object"
  • "Images: You can limit the size of images that can be pushed to an internal registry."

Defining those two limits and apply using ansible fails validation with error message:
"msg": "LimitRange core-resource-limits: resource definition validation error at spec.limits.2.type: 'openshift.io/Images' is not one of ['Container', 'PersistentVolumeClaim', 'Pod']"

Validation process LimitRangeItem does not include these (or should be case for Openshift only)
https://github.com/willthames/kubernetes-validate/blob/main/src/kubernetes_validate/kubernetes-json-schema/v1.23.0-local-strict/_definitions.json#L7209

Check with manual update under _definitions.json
"type": { "enum": [ "Container", "PersistentVolumeClaim", "Pod", "openshift.io/Images", "openshift.io/ImageStream" ]}

Results in proper validation and therefore object is created on the cluster.
localhost : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

Alternative to bypass validate using "strict: no"

Thanks!
Mihai

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions