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

docs: clarify that variables are not allowed in imageReferences field #1472

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kushal9897
Copy link

Related issue

#1462

Proposed Changes

This PR updates the Verify Images documentation to explicitly state that
variables ({{ }} syntax) are not allowed in the imageReferences field.

Checklist

  • [*] I have read the contributing guidelines.
  • [*] I have inspected the website preview for accuracy.
  • [*] I have signed off my issue.

Copy link

welcome bot commented Feb 8, 2025

Thanks for opening your first Pull Request here! Please check out our Contributing guidelines and confirm that you Signed off.

```
This will result in a validation error because variables are **not allowed** in `imageReferences`.

#### ** Correct Usage (Using Static Values – Allowed)**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove hashes.

Comment on lines +78 to +79
- `preconditions.all`
- `preconditions.any`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to double-check preconditions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preconditions supports variables, have you not been able to verify it?

Comment on lines 81 to 105
#### ** Incorrect Usage (Using Variables – Not Allowed)**
```yaml
rules:
- name: restrict-deployment-kinds
match:
resources:
kinds:
- "{{ request.object.kind }}"
```
**Why is this incorrect?**
- `match.resources.kinds` must contain **static** resource kinds (e.g., `Pod`, `Deployment`).
- Dynamic interpolation using `{{ request.object.kind }}` is **not supported**.

#### ** Correct Usage (Using Static Values – Allowed)**
```yaml
rules:
- name: restrict-deployment-kinds
match:
resources:
kinds:
- Deployment
- StatefulSet
```
**Why is this correct?**
- Only predefined, static resource kinds (`Deployment`, `StatefulSet`) are used.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#### ** Incorrect Usage (Using Variables – Not Allowed)**
```yaml
rules:
- name: restrict-deployment-kinds
match:
resources:
kinds:
- "{{ request.object.kind }}"
```
**Why is this incorrect?**
- `match.resources.kinds` must contain **static** resource kinds (e.g., `Pod`, `Deployment`).
- Dynamic interpolation using `{{ request.object.kind }}` is **not supported**.
#### ** Correct Usage (Using Static Values – Allowed)**
```yaml
rules:
- name: restrict-deployment-kinds
match:
resources:
kinds:
- Deployment
- StatefulSet
```
**Why is this correct?**
- Only predefined, static resource kinds (`Deployment`, `StatefulSet`) are used.

#### **Incorrect Usage**
```yaml
verifyImages:
- imageReferences: ["{{ parse_yaml(allowedregistryprefixes.data.allowedregistryprefixes) }}"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate example.

Comment on lines +78 to +79
- `preconditions.all`
- `preconditions.any`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preconditions supports variables, have you not been able to verify it?

@kushal9897
Copy link
Author

I checked all the preconditions. I will share the logs or attach them with the document.

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

Successfully merging this pull request may close these issues.

2 participants