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

CRD policyendpoints does not pass kubeconform schema validation #3017

Open
phihos opened this issue Aug 28, 2024 · 2 comments
Open

CRD policyendpoints does not pass kubeconform schema validation #3017

phihos opened this issue Aug 28, 2024 · 2 comments

Comments

@phihos
Copy link

phihos commented Aug 28, 2024

What happened:

After rendering resources via aws-vpc-cni helm chart kubeconform checks it against the CustomResourceDefinition schema and fails with

policyendpoints.networking.k8s.aws is invalid: For field metadata.creationTimestamp: Invalid type. Expected: string, given: null

It refers to this line:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.11.3
  creationTimestamp: null  <--- this one
  labels:
    app.kubernetes.io/name: amazon-network-policy-controller-k8s
  name: policyendpoints.networking.k8s.aws
spec:

Can this attribute be safely deleted? If not, what is the purpose of setting creationTimestamp: null ?

What you expected to happen:

The CRD should pass kubeconform.

How to reproduce it (as minimally and precisely as possible):

git clone https://github.com/aws/amazon-vpc-cni-k8s.git
cd amazon-vpc-cni-k8s/charts/aws-vpc-cni
cat crds/customresourcedefinition.yaml| kubeconform -schema-location default -schema-location 'https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/{{.NormalizedKubernetesVersion}}/{{.ResourceKind}}.json'

Output:

stdin - CustomResourceDefinition policyendpoints.networking.k8s.aws is invalid: problem validating schema. Check JSON formatting: jsonschema: '/metadata/creationTimestamp' does not validate with https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master/customresourcedefinition.json#/properties/metadata/$ref/properties/creationTimestamp/$ref/type: expected string, but got null
@phihos phihos added the bug label Aug 28, 2024
@orsenthil
Copy link
Member

I think, we just have to remove this line

https://github.com/aws/amazon-vpc-cni-k8s/blob/master/charts/aws-vpc-cni/crds/customresourcedefinition.yaml#L61

And it should be set automatically by Kubernetes when the resource is created.

@hpatel292-seneca
Copy link

Hi @orsenthil, can I work on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants