Closed viveksahu26 closed 2 years ago
Hey @chipzoller , could you please assign this to me.
Thanks for taking this up, Vivek. Getting these changes made will be very helpful. We may also need to update some e2e tests on kyverno/kyverno as well.
Thanks for taking this up, Vivek. Getting these changes made will be very helpful. We may also need to update some e2e tests on kyverno/kyverno as well.
Not sure about e2e test cases are present specifically for it or not. But I will look to it, if present then ok. Otherwise need to log an issue for the same to create new e2e test cases.
Kyverno Version
1.7.x
Kubernetes Version
1.24.x
Kubernetes Platform
KinD
Description
Earlier when the values of preconditions are not found they are assigned as empty string, whereas for variables present outside the block of precondition or normal variables whose value is not found they are assigned as nil and error is thrown. This partiality b/w normal and preconditions variables has to remove. And from now onwards, any variables whether it's a normal or precondition variables, if there value not found then assigned them with a nil value.
The status of the policy earlier when values were not found for preconditions was assigned as empty therefore precondition block values is compared against the empty string with the values found in the resource. Which means that the possible results would be skip/fail/pass. But from now onwards if the values is assigned as nil, which means values for the variables are not assigned or not provided. Therefore the status of the result when value is not provided by the user won't be either skip/pass/fail. Simply it will be error.
Conclusion: When value for variable in not provided by the user either through resource or values.yaml or configMaps, therefore nil value is assigned. Status ---> error
Steps to reproduce
apiVersion: cert-manager.io/v1 kind: Certificate metadata: name: letsencrypt-crt spec: secretName: letsencrypt-crt-secret dnsNames:
name: limit-duration policies:
policy: cert-manager-limit-duration rule: certificate-duration-max-100days resource: letsencrypt-crt kind: Certificate result: skip
Expected behavior
When value for variable in not provided by the user either through resource or values.yaml or configMaps, therefore nil value is assigned. Status should be error instead of skip/pass/fail.
Screenshots
No response
Kyverno logs
No response
Slack discussion
No response
Troubleshooting