-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #464 from mojaloop/feat/kyverno
feat: kyverno chart
- Loading branch information
Showing
13 changed files
with
211 additions
and
28 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
gitops/applications/base/kyverno/image-rewrite-policy.yaml
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,86 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: redirect-dockerio-to-mirrorgcrio | ||
spec: | ||
rules: | ||
- name: redirect-dockerio-to-mirrorgcrio | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
exclude: | ||
any: | ||
- resources: | ||
namespaces: | ||
- istio-ingress-ext | ||
- istio-ingress-int | ||
mutate: | ||
foreach: | ||
- list: request.object.spec.containers[] | ||
preconditions: | ||
all: | ||
- key: "{{ image_normalize(element.image) }}" | ||
operator: AnyIn | ||
value: | ||
- docker.io/* | ||
patchStrategicMerge: | ||
metadata: | ||
annotations: | ||
kyverno/redirect-dockerio-to-mirrorgcrio: applied | ||
spec: | ||
containers: | ||
- name: "{{ element.name }}" | ||
env: | ||
- name: ORIGINAL_IMAGE | ||
value: "{{ element.image }}" | ||
image: 'mirror.gcr.io/{{ images.containers."{{element.name}}".path}}:{{images.containers."{{element.name}}".tag}}' | ||
--- | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: redirect-xpkgupboundio-to-ghcr | ||
spec: | ||
rules: | ||
- name: redirect-xpkgupboundio-to-ghcr | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
exclude: | ||
any: | ||
- resources: | ||
namespaces: | ||
- istio-ingress-ext | ||
- istio-ingress-int | ||
mutate: | ||
foreach: | ||
- list: request.object.spec.containers[] | ||
preconditions: | ||
all: | ||
- key: "{{ image_normalize(element.image) }}" | ||
operator: AnyIn | ||
value: | ||
- xpkg.upbound.io/* | ||
- key: "{{ element.image }}" | ||
operator: NotEquals | ||
value: "auto:latest" | ||
patchStrategicMerge: | ||
metadata: | ||
annotations: | ||
kyverno/redirect-xpkgupboundio-to-ghcr: applied | ||
spec: | ||
containers: | ||
- name: "{{ element.name }}" | ||
env: | ||
- name: ORIGINAL_IMAGE | ||
value: "{{ element.image }}" | ||
image: 'ghcr.io/mojaloop/infra/{{ images.containers."{{element.name}}".path}}:{{images.containers."{{element.name}}".tag}}' |
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,14 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
resources: | ||
- namespaces.yaml | ||
- image-rewrite-policy.yaml | ||
|
||
helmCharts: | ||
- name: kyverno | ||
releaseName: kyverno | ||
version: ${ARGOCD_ENV_kyverno_helm_version} | ||
repo: https://kyverno.github.io/kyverno/ | ||
valuesFile: kyverno-values.yaml | ||
namespace: ${ARGOCD_ENV_kyverno_namespace} |
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,26 @@ | ||
config: | ||
|
||
# TODO | ||
# If possible we should not watch and mutate kube-system but image rewrite likely needs it | ||
|
||
# Enable Kyverno to touch resources in kube-system namespace | ||
resourceFiltersExcludeNamespaces: | ||
- kube-system | ||
|
||
# Enable Kyverno to watch resources in kube-system namespace | ||
webhooks: | ||
namespaceSelector: | ||
matchExpressions: {} | ||
|
||
reportsController: | ||
rbac: | ||
coreClusterRole: | ||
extraResources: | ||
- apiGroups: | ||
- '*' | ||
resources: | ||
- '*' | ||
verbs: | ||
- get | ||
- list | ||
- watch |
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,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: ${ARGOCD_ENV_kyverno_namespace} |
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,43 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
metadata: | ||
name: ${ARGOCD_ENV_utils_kyverno_app_name} | ||
namespace: ${ARGOCD_ENV_argocd_app_namespace} | ||
annotations: | ||
argocd.argoproj.io/sync-wave: ${ARGOCD_ENV_utils_sync_wave} | ||
|
||
finalizers: | ||
- resources-finalizer.argocd.argoproj.io | ||
|
||
spec: | ||
project: default | ||
syncPolicy: | ||
automated: | ||
prune: true | ||
selfHeal: true | ||
retry: | ||
limit: 20 | ||
backoff: | ||
duration: 10s | ||
maxDuration: 3m0s | ||
factor: 2 | ||
syncOptions: | ||
- CreateNamespace=true | ||
- PrunePropagationPolicy=foreground | ||
- PruneLast=true | ||
- ServerSideApply=true | ||
destination: | ||
server: "https://kubernetes.default.svc" | ||
namespace: ${ARGOCD_ENV_utils_kyverno_namespace} | ||
source: | ||
repoURL: ${ARGOCD_ENV_argocd_repo_url} | ||
targetRevision: ${ARGOCD_ENV_utils_application_gitrepo_tag} | ||
path: gitops/applications/base/kyverno | ||
plugin: | ||
name: envsubst | ||
env: | ||
- name: "kyverno_namespace" | ||
value: "${ARGOCD_ENV_utils_kyverno_namespace}" | ||
|
||
- name: "kyverno_helm_version" | ||
value: "${ARGOCD_ENV_utils_kyverno_helm_version}" |
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
Oops, something went wrong.