forked from kyverno/kyverno
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 1298_fix_variable_validation
- Loading branch information
Showing
19 changed files
with
185 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,8 @@ jobs: | |
go-version: 1.14 | ||
- uses: creekorful/[email protected] | ||
|
||
- name: login to docker hub | ||
run: echo "${{ secrets.DOCKERIO_PASSWORD }}" | docker login -u "${{ secrets.DOCKERIO_USERNAME }}" --password-stdin | ||
- name: login to GitHub Container Registry | ||
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin | ||
|
||
- name : docker images publish | ||
run: | | ||
|
@@ -45,37 +45,41 @@ jobs: | |
echo ">>> Run Kyverno e2e test" | ||
make test-e2e | ||
kyvernocli-and-helm: | ||
create-release-gh-helm-krew: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Unshallow | ||
run: git fetch --prune --unshallow | ||
- | ||
name: Set up Go | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.14 | ||
- uses: creekorful/[email protected] | ||
|
||
- | ||
name: Run GoReleaser | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: J12934/helm-gh-pages-action@master | ||
name: Run Helm Publish | ||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Install Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
access-token: ${{ secrets.ACCESS_TOKEN }} | ||
deploy-branch: gh-pages | ||
charts-folder: charts | ||
version: v3.4.0 | ||
|
||
- name: Run chart-releaser | ||
uses: helm/[email protected] | ||
env: | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
- name: Update new version in krew-index | ||
uses: rajatjindal/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Require `imagePullPolicy` is set to `Always` for images not using `latest` tags | ||
|
||
By default, Kubernetes sets the `imagePullPolicy` for images which specify a tag to be `IfNotPresent`. In some cases, this may not be desired where the image could be rebuilt upstream. This sample policy ensures that all containers have their `imagePullPolicy` set to `Always`. | ||
|
||
## Policy YAML | ||
|
||
[imagepullpolicy-always.yaml](misc/imagepullpolicy-always.yaml) | ||
|
||
```yaml | ||
apiVersion : kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: imagepullpolicy-always | ||
spec: | ||
validationFailureAction: audit | ||
background: false | ||
rules: | ||
- name: imagepullpolicy-always | ||
match: | ||
resources: | ||
kinds: | ||
- Pod | ||
validate: | ||
message: "The imagePullPolicy must be set to `Always` for all containers when a tag other than `latest` is used." | ||
pattern: | ||
spec: | ||
containers: | ||
- imagePullPolicy: Always | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Require images using `latest` tag set `imagePullPolicy` to not `Always` | ||
|
||
When using the `latest` tag for images, although generally [not a best practice](DisallowLatestTag.md), Kubernetes defaults its `imagePullPolicy` to `Always`. Since Docker Hub has instituted a [rate-limiting policy](https://www.docker.com/blog/what-you-need-to-know-about-upcoming-docker-hub-rate-limiting/), this could result in reaching that limit faster than anticipated, which could mean errors for other Pods in the cluster or across the enterprise. Ensuring those `latest`-tagged images do not use the default of `Always` is one way to ensure pulls are only when needed. | ||
|
||
This sample policy checks the `image` value and ensures that if `:latest` is defined that the `imagePullPolicy` must use something other than the value of `Always`. Note that if no tag is defined, Kyverno will not see that as a violation of the policy. | ||
|
||
## Policy YAML | ||
|
||
[latestimage-notalways.yaml](misc/latestimage-notalways.yaml) | ||
|
||
```yaml | ||
apiVersion : kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: latestimage-notalways | ||
spec: | ||
validationFailureAction: audit | ||
background: false | ||
rules: | ||
- name: latestimage-notalways | ||
match: | ||
resources: | ||
kinds: | ||
- Pod | ||
validate: | ||
message: "When using the `latest` tag, the `imagePullPolicy` must not use `Always`." | ||
pattern: | ||
spec: | ||
containers: | ||
- (image): "*:latest" | ||
imagePullPolicy: "!Always" | ||
``` |
Oops, something went wrong.