Compare commits

...

138 Commits
v0.1.0 ... main

Author SHA1 Message Date
Stefan Prodan 192da0594c
Merge pull request #142 from fluxcd/update-kyverno
Update kyverno to v1.14.4
2025-06-27 10:23:57 +03:00
fluxcdbot cebc051bc8 Update kyverno to v1.14.4
Signed-off-by: GitHub <noreply@github.com>
2025-06-27 00:06:52 +00:00
Stefan Prodan e030d9306a
Merge pull request #141 from fluxcd/update-kyverno
Update kyverno to v1.14.3
2025-06-20 08:10:25 +03:00
fluxcdbot c17a9d209a Update kyverno to v1.14.3
Signed-off-by: GitHub <noreply@github.com>
2025-06-20 00:06:47 +00:00
Stefan Prodan 9d0bb45e40
Merge pull request #140 from fluxcd/update-kyverno
Update kyverno to v1.14.2
2025-06-04 09:03:55 +01:00
fluxcdbot 9cecb7e71a Update kyverno to v1.14.2
Signed-off-by: GitHub <noreply@github.com>
2025-06-04 00:06:44 +00:00
Stefan Prodan 98d0b576b0
Merge pull request #139 from fluxcd/update-kyverno
Update kyverno to v1.14.1
2025-05-01 08:51:04 +03:00
fluxcdbot abc5e6771a Update kyverno to v1.14.1
Signed-off-by: GitHub <noreply@github.com>
2025-05-01 00:07:20 +00:00
Stefan Prodan 250df0510e
Merge pull request #138 from fluxcd/update-kyverno
Update kyverno to v1.14.0
2025-04-26 09:11:24 +03:00
fluxcdbot e9ab39c150 Update kyverno to v1.14.0
Signed-off-by: GitHub <noreply@github.com>
2025-04-26 00:06:23 +00:00
Stefan Prodan 0804ce8cf0
Merge pull request #137 from fluxcd/update-kyverno
Update kyverno to v1.13.4
2025-02-09 11:26:13 +02:00
fluxcdbot 8b4dcbff72 Update kyverno to v1.13.4
Signed-off-by: GitHub <noreply@github.com>
2025-02-09 00:06:30 +00:00
Stefan Prodan 094bc4535b
Merge pull request #136 from ilkimo/main
Fix shell command in README
2025-01-15 09:26:49 +02:00
il_kimo 2dc341a47a
Fix shell command in README
If applied, this commit will correct the yq command to extract the public key from the secret.

Signed-off-by: il_kimo <vibertikim@yahoo.it>
2025-01-14 16:41:57 +01:00
Stefan Prodan f1c3f8c7e2
Merge pull request #134 from fluxcd/update-kyverno
Update kyverno to v1.13.2
2024-12-11 10:53:27 +02:00
fluxcdbot 5e223c87ab Update kyverno to v1.13.2
Signed-off-by: GitHub <noreply@github.com>
2024-12-11 00:06:03 +00:00
Stefan Prodan 24a3735b1d
Merge pull request #133 from fluxcd/update-kyverno
Update kyverno to v1.13.1
2024-11-13 10:18:49 +02:00
fluxcdbot cddd96e3b3 Update kyverno to v1.13.1
Signed-off-by: GitHub <noreply@github.com>
2024-11-13 00:05:41 +00:00
Stefan Prodan d500f6f59b
Merge pull request #132 from fluxcd/update-kyverno
Update kyverno to v1.13.0
2024-10-30 09:41:24 +02:00
fluxcdbot da15130d31 Update kyverno to v1.13.0
Signed-off-by: GitHub <noreply@github.com>
2024-10-30 00:05:49 +00:00
Stefan Prodan a35e8937f4
Merge pull request #129 from fluxcd/update-kyverno
Update kyverno to v1.12.5
2024-07-13 09:16:43 +03:00
fluxcdbot 2364ffce97 Update kyverno to v1.12.5
Signed-off-by: GitHub <noreply@github.com>
2024-07-13 00:05:27 +00:00
Stefan Prodan db9e036c8b
Merge pull request #128 from fluxcd/update-kyverno
Update kyverno to v1.12.4
2024-06-18 09:22:15 +03:00
fluxcdbot 01d8686902 Update kyverno to v1.12.4
Signed-off-by: GitHub <noreply@github.com>
2024-06-18 00:05:11 +00:00
Stefan Prodan 596bdbde52
Merge pull request #127 from fluxcd/update-kyverno
Update kyverno to v1.12.3
2024-06-01 09:55:13 +03:00
fluxcdbot 6613fcde40 Update kyverno to v1.12.3
Signed-off-by: GitHub <noreply@github.com>
2024-06-01 00:05:01 +00:00
Stefan Prodan 9ba47566d7
Merge pull request #124 from fluxcd/update-kyverno
Update kyverno to v1.12.2
2024-05-24 08:28:48 +03:00
fluxcdbot 9a56d7d4c9 Update kyverno to v1.12.2
Signed-off-by: GitHub <noreply@github.com>
2024-05-24 00:05:27 +00:00
Stefan Prodan a4f492ddb8
Merge pull request #125 from chipzoller/kyverno-policy-fixes
Updates/fixes Kyverno policies for 1.11+
2024-03-01 19:56:04 +00:00
chipzoller dc19e7b852 updates/fixes policies for 1.11+
Signed-off-by: chipzoller <chipzoller@gmail.com>
2024-03-01 09:47:32 -05:00
Stefan Prodan 8525be1674
Merge pull request #120 from nw0rn/main
Add namespace reference to kustomize files
2024-02-08 09:47:19 +02:00
Stefan Prodan 2ed0e2b73c
Merge pull request #123 from fluxcd/update-kyverno
Update kyverno to v1.11.4
2024-01-20 09:09:57 +02:00
fluxcdbot 50a797da78 Update kyverno to v1.11.4
Signed-off-by: GitHub <noreply@github.com>
2024-01-20 00:04:29 +00:00
Stefan Prodan 92a9b324e9
Merge pull request #122 from fluxcd/update-kyverno
Update kyverno to v1.11.3
2024-01-06 10:23:40 +02:00
fluxcdbot 863960cedd Update kyverno to v1.11.3
Signed-off-by: GitHub <noreply@github.com>
2024-01-06 00:04:36 +00:00
Stefan Prodan 6ae88ddd2d
Merge pull request #121 from fluxcd/update-kyverno
Update kyverno to v1.11.2
2023-12-29 09:11:25 +02:00
fluxcdbot 1e6ad41823 Update kyverno to v1.11.2
Signed-off-by: GitHub <noreply@github.com>
2023-12-29 00:03:49 +00:00
nw0rn c49e6be6ad add namespace to kustomize files
Signed-off-by: nw0rn <nicolaswoerner1@gmail.com>
2023-12-15 09:55:12 +01:00
Stefan Prodan 94a2d28da9
Merge pull request #119 from fluxcd/update-kyverno
Update kyverno to v1.11.1
2023-11-29 10:24:36 +02:00
fluxcdbot b03f76aece Update kyverno to v1.11.1
Signed-off-by: GitHub <noreply@github.com>
2023-11-29 00:04:39 +00:00
Stefan Prodan 96fdcf5d98
Merge pull request #113 from fluxcd/update-kyverno
Update kyverno to v1.11.0
2023-11-11 08:36:49 +02:00
fluxcdbot 34a92347e3 Update kyverno to v1.11.0
Signed-off-by: GitHub <noreply@github.com>
2023-11-11 00:04:00 +00:00
Stefan Prodan 9b02d83644
Merge pull request #117 from fluxcd/disable-remote-bases
Disable Kustomize remote bases
2023-10-10 15:46:25 +03:00
Stefan Prodan 39968f5712
Disable Kustomize remote bases
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-10-10 15:18:18 +03:00
Stefan Prodan 266c957a2c
Merge pull request #115 from kingdonb/fix-114
Fix broken link in README
2023-09-21 20:11:27 +03:00
Kingdon Barrett aa01685419
Fix broken link in README
Signed-off-by: Kingdon Barrett <kingdon@weave.works>
2023-09-21 13:07:45 -04:00
Stefan Prodan 46034dbb46
Merge pull request #112 from fluxcd/update-kyverno
Update kyverno to v1.10.2
2023-07-29 09:17:19 +03:00
fluxcdbot ee005a295d Update kyverno to v1.10.2
Signed-off-by: GitHub <noreply@github.com>
2023-07-29 00:04:29 +00:00
Stefan Prodan 5392cafe9f
Merge pull request #111 from fluxcd/update-kyverno
Update kyverno to v1.10.1
2023-07-07 10:13:10 +03:00
fluxcdbot 8f764cb57f Update kyverno to v1.10.1
Signed-off-by: GitHub <noreply@github.com>
2023-07-07 00:04:39 +00:00
Stefan Prodan ad1f1b2cee
Merge pull request #110 from Pro/fix-kyverno
loosen kyverno policies due to #107
2023-06-29 12:40:03 +03:00
Stefan Profanter 5938ad4fb5
loosen kyverno policies due to #107
Signed-off-by: Stefan Profanter <stefan.profanter@agile-robots.com>
2023-06-13 12:48:44 +02:00
Stefan Prodan 4eb6299e68
Merge pull request #106 from chipzoller/main
Modernize Kyverno policies
2023-05-31 16:23:32 +03:00
Stefan Prodan 7cb0dac0e0
Merge pull request #100 from fluxcd/update-kyverno
Update kyverno to v1.10.0
2023-05-31 08:33:38 +03:00
fluxcdbot 0934a2d333 Update kyverno to v1.10.0
Signed-off-by: GitHub <noreply@github.com>
2023-05-31 00:04:14 +00:00
Chip Zoller 8c5ef74ef6 modernize
Signed-off-by: Chip Zoller <chipzoller@gmail.com>
2023-05-25 20:01:59 -04:00
Chip Zoller 170eec1c7e modernize policy
Signed-off-by: Chip Zoller <chipzoller@gmail.com>
2023-05-25 20:01:59 -04:00
Stefan Prodan 8731f964fc
Merge pull request #104 from fluxcd/updates
Update manifests and workflows to Kustomize v5
2023-05-24 18:51:12 +03:00
Stefan Prodan 52586ef8e8
Remove the deprecated actions
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-24 18:39:38 +03:00
Stefan Prodan b8bd87e5a2
Update the verify images policy to match fluxcd issuer
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-24 18:19:10 +03:00
Stefan Prodan 79f0744033
Update manifests and workflows to Kustomize v5
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-24 18:18:24 +03:00
Stefan Prodan fc9fc880ea
Merge pull request #99 from fluxcd/flux-v2.0.0-rc.1
Update APIs to v1 (Flux v2.0.0-rc.1)
2023-04-06 16:10:47 +03:00
Stefan Prodan 4263c715b5
Update APIs to v1 (Flux v2.0.0-rc.1)
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-04-06 16:04:41 +03:00
Hidde Beydals b46e8930fa
Merge pull request #97 from fluxcd/update-kyverno
Update kyverno to v1.9.2
2023-03-23 10:36:36 +01:00
fluxcdbot 8cfb6a6b0c Update kyverno to v1.9.2
Signed-off-by: GitHub <noreply@github.com>
2023-03-23 00:38:41 +00:00
Stefan Prodan 62903514f0
Merge pull request #96 from fluxcd/update-kyverno
Update kyverno to v1.9.1
2023-03-10 10:03:20 +02:00
fluxcdbot 7d729e5fd3 Update kyverno to v1.9.1
Signed-off-by: GitHub <noreply@github.com>
2023-03-10 00:42:02 +00:00
Stefan Prodan 813ed98dc9
Merge pull request #95 from fluxcd/update-kyverno
Update kyverno to v1.9.0
2023-02-02 10:08:44 +02:00
fluxcdbot a1396bdf3b Update kyverno to v1.9.0
Signed-off-by: GitHub <noreply@github.com>
2023-02-02 00:41:11 +00:00
Stefan Prodan 6c925b57b4
Merge pull request #94 from fluxcd/update-kyverno
Update kyverno to v1.8.5
2022-12-21 09:02:53 +02:00
fluxcdbot 2aefab0b54 Update kyverno to v1.8.5
Signed-off-by: GitHub <noreply@github.com>
2022-12-21 00:35:39 +00:00
Stefan Prodan b0845952f2
Merge pull request #93 from fluxcd/update-kyverno
Update kyverno to v1.8.4
2022-12-10 09:16:49 +02:00
fluxcdbot 02792ab2a7 Update kyverno to v1.8.4
Signed-off-by: GitHub <noreply@github.com>
2022-12-10 00:36:31 +00:00
Stefan Prodan 759aba2b9e
Merge pull request #92 from fluxcd/update-kyverno
Update kyverno to v1.8.3
2022-12-06 10:21:54 +02:00
fluxcdbot 8eb7568b63 Update kyverno to v1.8.3
Signed-off-by: GitHub <noreply@github.com>
2022-12-06 00:37:47 +00:00
Stefan Prodan 29a8ce1fb1
Merge pull request #87 from fluxcd/update-kyverno
Update kyverno to v1.8.1
2022-10-26 09:30:07 +03:00
fluxcdbot 7822fd8d56 Update kyverno to v1.8.1
Signed-off-by: GitHub <noreply@github.com>
2022-10-26 00:51:32 +00:00
Stefan Prodan 8467b90ce7
Merge pull request #88 from fluxcd/kubernetes-1.23
Update Kubernetes to 1.23 in CI
2022-10-18 13:32:25 +03:00
Stefan Prodan d36b3d020c
Update Kubernetes to 1.23 in CI
Required by Kyverno 1.8.x

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-10-18 13:17:57 +03:00
Stefan Prodan 196cdba59c
Merge pull request #86 from fluxcd/kyverno-oci
Install Kyverno using signed OCI artifacts
2022-10-12 16:23:17 +03:00
Stefan Prodan 56e897d747
Install Kyverno using signed OCI artifacts
Switch the Kyverno source from `GitRepository` to `OCIRepository` and enabled Cosign keyless verification of Kyverno OCI artifacts.
From a security perspective, this change is a major improvement towards a safer deploy pipeline for critical cluster addons. Instead of blindly trusting the Kyverno Git repository host, Flux now verifies the authenticity of Kyverno manifests using the public transparency log hosted at [rekor.sigstore.dev](https://rekor.sigstore.dev).

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-10-12 16:13:48 +03:00
Stefan Prodan 66808a1f1e
Merge pull request #84 from dholbach/update-flux-docs-structure
update to new doc links structure
2022-08-30 16:01:23 +03:00
Daniel Holbach b841d06bf8 update to new doc links structure
Signed-off-by: Daniel Holbach <daniel@weave.works>
2022-08-30 14:57:22 +02:00
Stefan Prodan 32b0f229df
Merge pull request #83 from fluxcd/update-kyverno
Update kyverno to v1.7.3
2022-08-25 10:00:13 +03:00
fluxcdbot 48f0ca2014 Update kyverno to v1.7.3
Signed-off-by: GitHub <noreply@github.com>
2022-08-25 00:55:55 +00:00
Stefan Prodan b43e210f23
Merge pull request #82 from jtyr/jtyr-readme
Fixing typo of a resource name
2022-07-26 12:48:10 +02:00
Jiri Tyr 21146eafdb
Fixing typo of a resource name
This PR is fixing a typo in the `README.md` file where `Kustomize` is used instead of `Kustomization`.

Signed-off-by: Jiri Tyr <jtyr@users.noreply.github.com>
2022-07-26 11:27:23 +01:00
Stefan Prodan 95b3802199
Merge pull request #80 from fluxcd/update-kyverno
Update kyverno to v1.7.2
2022-07-26 11:59:27 +02:00
fluxcdbot 00cc9b4ebe Update kyverno to v1.7.2
Signed-off-by: GitHub <noreply@github.com>
2022-07-26 00:50:30 +00:00
Stefan Prodan 1c1d57ae8c
Merge pull request #78 from fluxcd/update-kyverno
Update kyverno to v1.7.1
2022-06-18 19:10:10 +01:00
fluxcdbot 65d8187d14 Update kyverno to v1.7.1
Signed-off-by: GitHub <noreply@github.com>
2022-06-18 00:42:47 +00:00
Stefan Prodan 2a2bcbdbd8
Merge pull request #77 from fluxcd/ci-ignore-flux-system
e2e: Use `--ignore-paths` when creating the Git source
2022-06-10 11:22:04 +03:00
Stefan Prodan cc70734c54
e2e: Use `--ignore-paths` when creating the Git source
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-06-10 11:15:23 +03:00
Stefan Prodan e20bce02d6
Merge pull request #71 from fluxcd/update-kyverno
Update kyverno to v1.7.0
2022-06-03 12:19:23 +03:00
fluxcdbot 50a78b1209 Update kyverno to v1.7.0
Signed-off-by: GitHub <noreply@github.com>
2022-06-03 00:35:19 +00:00
Stefan Prodan 50ad87d145
Merge pull request #73 from fluxcd/docs-fixes
Adapt docs to latest Flux release
2022-05-23 18:59:12 +03:00
Stefan Prodan 33dad0c22c
Fix e2e test flakiness
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-05-23 18:52:11 +03:00
Stefan Prodan c7f85aa46c
Adapt docs to latest Flux release
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-05-23 18:46:11 +03:00
Stefan Prodan 7a326ee3bc
Merge pull request #72 from fluxcd/fix-staging-sa
Set service account name for staging tenants
2022-05-23 18:31:39 +03:00
Stefan Prodan 5121939e4d
Set service account name for staging tenants
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-05-23 18:24:43 +03:00
Stefan Prodan ea6c2be1b8
Merge pull request #70 from ruzickap/fix-script
Fix validate.sh to pass shellcheck
2022-05-01 13:18:35 +03:00
Petr Ruzicka 3efa4dbbf7 Fix validate.sh to pass shellcheck
Signed-off-by: Petr Ruzicka <petr.ruzicka@gmail.com>
2022-04-30 12:58:58 +02:00
Stefan Prodan 290dd8f039
Merge pull request #68 from dholbach/update-links
update toolkit.f.i docs link
2022-04-01 11:17:04 +03:00
Daniel Holbach 2b1a644b7e update toolkit.f.i docs link
Signed-off-by: Daniel Holbach <daniel@weave.works>
2022-04-01 10:15:44 +02:00
Stefan Prodan 669f98512d
Merge pull request #67 from fluxcd/update-kyverno
Update kyverno to v1.6.2
2022-04-01 09:32:31 +03:00
fluxcdbot b990973648 Update kyverno to v1.6.2
Signed-off-by: GitHub <noreply@github.com>
2022-04-01 00:39:13 +00:00
Hidde Beydals 8396ccf892
Merge pull request #66 from fluxcd/source-v1beta2 2022-03-24 16:20:36 +01:00
Stefan Prodan a9295bb541
Upgrade Source API to v1beta2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-03-24 17:14:02 +02:00
Stefan Prodan 8663ac5691
Merge pull request #64 from kingdonb/fixup-kubeval
fixup reference to kubeval
2022-03-07 11:09:30 +02:00
Kingdon Barrett 3d36b02af5
fixup reference to kubeval
Signed-off-by: Kingdon Barrett <kingdon@weave.works>
2022-03-06 12:36:22 -05:00
Stefan Prodan 64959640eb
Merge pull request #63 from fluxcd/update-kyverno
Update kyverno to v1.6.1
2022-03-02 10:01:27 +02:00
fluxcdbot bf2c46ef5c Update kyverno to v1.6.1
Signed-off-by: GitHub <noreply@github.com>
2022-03-02 00:39:24 +00:00
Stefan Prodan 493987ff27
Merge pull request #61 from kisoku/kubeconform
Replace kubeval with kubeconform for static analysis
2022-02-17 15:32:17 +02:00
Mathieu Sauve-Frankel 5eed4898a5 Replace kubeval with kubeconform for static analysis
Signed-off-by: Mathieu Sauve-Frankel <msf@kisoku.net>
2022-02-17 22:07:36 +09:00
Stefan Prodan 226da464f8
Merge pull request #60 from dholbach/fix-link
fix link to verify-flux-images policy
2022-02-12 09:17:11 +02:00
Daniel Holbach d9ee1cfc85 fix link to verify-flux-images policy
Signed-off-by: Daniel Holbach <daniel@weave.works>
2022-02-11 16:59:48 +01:00
Stefan Prodan f8677a2769
Merge pull request #59 from sthapa/main
Set service account name for the tenants Kustomization
2022-02-11 12:59:27 +02:00
Suchandra Thapa b5d0bc2aa9
Need to specify service account for tenants
Signed-off-by: Suchandra Thapa <suchandra@gmail.com>
2022-02-10 22:01:45 -10:00
Stefan Prodan bec0e0d25a
Merge pull request #58 from fluxcd/update-kyverno
Update kyverno to v1.6.0
2022-02-08 11:39:55 +02:00
fluxcdbot a05997ee84 Update kyverno to v1.6.0
Signed-off-by: GitHub <noreply@github.com>
2022-02-08 09:30:16 +00:00
Stefan Prodan e8d81ca0bb
Merge pull request #57 from fluxcd/kyverno-source
Replace kustomize remote base with Flux GitRepository
2022-02-08 11:29:25 +02:00
Stefan Prodan 6a0231f7c9
Replace kustomize remote base with Flux GitRepository
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-02-08 11:10:04 +02:00
Stefan Prodan 56baf30850
Merge pull request #56 from fluxcd/update-kyverno
Update kyverno to v1.6.0-rc4
2022-02-08 09:19:03 +02:00
fluxcdbot 2ad4e20692 Update kyverno to v1.6.0-rc4
Signed-off-by: GitHub <noreply@github.com>
2022-02-08 00:26:08 +00:00
Stefan Prodan 05c3e8ad22
Merge pull request #53 from fluxcd/update-kyverno
Update kyverno to v1.6.0-rc2
2022-02-03 12:10:26 +02:00
fluxcdbot 621b6dd3ed Update kyverno to v1.6.0-rc2
Signed-off-by: GitHub <noreply@github.com>
2022-02-03 10:07:07 +00:00
Stefan Prodan 5dc2253e1c
Merge pull request #55 from pjbgf/kyverno
Update kyverno install.yaml path
2022-02-03 12:06:33 +02:00
Paulo Gomes a3f9f6f4c6
Update kyverno install.yaml path
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-02-03 09:56:25 +00:00
Stefan Prodan 57a04f5514
Merge pull request #54 from pjbgf/lockdown
Update example based on Flux v0.26 changes
2022-02-03 11:39:32 +02:00
Paulo Gomes 0f3fc03ab1
Apply multi-tenancy lockdown patch
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-02-03 09:20:36 +00:00
Paulo Gomes 66ee1d7363
Add kyverno policies to verify image signatures for flux components and block tenant GitRepository sources
This also removes  policy. It is no longer needed from Flux  as it has built-in features to enforce similar requirements.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-02-03 08:19:00 +00:00
Paulo Gomes 01484188d7
Update Kyverno to 1.6.0
Some issues using cosign forced the update. The bug seems to be related to: https://github.com/kyverno/kyverno/issues/3014

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-02-03 08:18:49 +00:00
Stefan Prodan 9cc163d85a
Merge pull request #52 from fluxcd/update-kyverno
Update kyverno to v1.5.5
2022-01-21 09:49:38 +02:00
fluxcdbot 0d9ab1434f Update kyverno to v1.5.5
Signed-off-by: GitHub <noreply@github.com>
2022-01-21 00:24:17 +00:00
Stefan Prodan b2b0502d81
Merge pull request #51 from fluxcd/update-kyverno
Update kyverno to v1.5.4
2022-01-13 10:53:37 +02:00
fluxcdbot 04a25507f1 Update kyverno to v1.5.4
Signed-off-by: GitHub <noreply@github.com>
2022-01-13 00:29:11 +00:00
Stefan Prodan b616f8b51a
Merge pull request #49 from fluxcd/update-kyverno
Update kyverno to v1.5.2
2021-12-10 10:15:12 +02:00
fluxcdbot d0d3727462 Update kyverno to v1.5.2
Signed-off-by: GitHub <noreply@github.com>
2021-12-10 07:55:20 +00:00
32 changed files with 514 additions and 255 deletions

View File

@ -1,6 +0,0 @@
FROM stefanprodan/alpine-base:latest
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
USER 1001
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,9 +0,0 @@
name: 'kustomize'
description: 'A GitHub Action with Kubernetes tools'
author: 'Stefan Prodan'
branding:
icon: 'command'
color: 'blue'
runs:
using: 'docker'
image: 'Dockerfile'

View File

@ -1,28 +0,0 @@
#!/bin/bash
set -eu
YQ_VERSION="v4.6.1"
KUSTOMIZE_VERSION="4.1.3"
KUBEVAL_VERSION="v0.16.1"
mkdir -p $GITHUB_WORKSPACE/bin
cd $GITHUB_WORKSPACE/bin
curl -sL https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 -o yq
chmod +x $GITHUB_WORKSPACE/bin/yq
kustomize_url=https://github.com/kubernetes-sigs/kustomize/releases/download && \
curl -sL ${kustomize_url}/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz | \
tar xz
chmod +x $GITHUB_WORKSPACE/bin/kustomize
curl -sL https://github.com/instrumenta/kubeval/releases/download/${KUBEVAL_VERSION}/kubeval-linux-amd64.tar.gz | \
tar xz
chmod +x $GITHUB_WORKSPACE/bin/kubeval
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin" >> $GITHUB_PATH

View File

@ -1,6 +1,7 @@
name: e2e
on:
workflow_dispatch:
push:
branches: [ '*' ]
@ -9,16 +10,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup tools
uses: ./.github/actions/tools
uses: actions/checkout@v3
- name: Setup Flux
uses: fluxcd/flux2/action@main
- name: Setup Kubernetes
uses: engineerd/setup-kind@v0.5.0
uses: helm/kind-action@v1.7.0
with:
version: v0.11.1
image: kindest/node:v1.22.0@sha256:b8bda84bb3a190e6e028b1760d277454a72267a5454b57db34437c34a588d047
cluster_name: flux
- name: Install Flux in Kubernetes Kind
run: flux install --log-level debug
- name: Setup cluster reconciliation
@ -26,31 +24,35 @@ jobs:
flux create source git flux-system \
--interval=15m \
--url=${{ github.event.repository.html_url }} \
--branch=${GITHUB_REF#refs/heads/}
--branch=${GITHUB_REF#refs/heads/} \
--ignore-paths="./clusters/**/flux-system/"
flux create kustomization flux-system \
--interval=15m \
--source=flux-system \
--path=./clusters/staging
- name: Verify cluster reconciliation
run: |
kubectl -n flux-system wait kustomization/kyverno --for=condition=ready --timeout=1m
kubectl -n flux-system wait kustomization/kyverno-policies --for=condition=ready --timeout=1m
kubectl -n flux-system wait kustomization/kyverno --for=condition=ready --timeout=5m
kubectl -n flux-system wait kustomization/kyverno-controller --for=condition=ready --timeout=3m
kubectl -n flux-system wait kustomization/kyverno-policies --for=condition=ready --timeout=3m
kubectl -n flux-system wait kustomization/tenants --for=condition=ready --timeout=3m
- name: Verify tenant reconciliation
run: |
kubectl -n apps wait kustomization/dev-team --for=condition=ready --timeout=1m
kubectl -n apps wait helmrelease/podinfo --for=condition=ready --timeout=1m
- name: Debug failure
if: failure()
- name: List reconciliations
run: |
flux get all --all-namespaces
- name: Logs
if: always()
run: |
kubectl -n flux-system get all
kubectl -n flux-system logs deploy/source-controller
kubectl -n flux-system logs deploy/kustomize-controller
kubectl -n flux-system logs deploy/helm-controller
kubectl -n flux-system logs deploy/notification-controller
kubectl -n kyverno get all
kubectl -n kyverno logs deploy/kyverno
kubectl get clusterpolicy flux-multi-tenancy -oyaml
kubectl -n kyverno describe po
kubectl -n kyverno logs -l app.kubernetes.io/part-of=kyverno
kubectl get clusterpolicies.kyverno.io -oyaml
flux get sources all --all-namespaces
flux get ks --all-namespaces

View File

@ -11,8 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup tools
uses: ./.github/actions/tools
uses: actions/checkout@v3
- name: Setup yq
uses: fluxcd/pkg/actions/yq@main
- name: Setup kubeconform
uses: fluxcd/pkg/actions/kubeconform@main
- name: Setup kustomize
uses: fluxcd/pkg/actions/kustomize@main
- name: Validate manifests
run: ./scripts/validate.sh

View File

@ -10,9 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup tools
uses: ./.github/actions/tools
uses: actions/checkout@v3
- name: Setup yq
uses: fluxcd/pkg/actions/yq@main
- name: Fetch latest version
id: version
run: |
@ -25,9 +25,9 @@ jobs:
head -n1)
echo ::set-output name=NUMBER::${VERSION}
- name: Patch version
run: |
export URL="https://raw.githubusercontent.com/kyverno/kyverno/${{ steps.version.outputs.NUMBER }}/definitions/release/install.yaml"
yq e '.resources[0]=strenv(URL)' -i ./infrastructure/kyverno/kustomization.yaml
env:
KYVERNO_VERSION: ${{ steps.version.outputs.NUMBER }}
run: yq e '.spec.ref.tag=strenv(KYVERNO_VERSION)' -i ./infrastructure/kyverno/source.yaml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:

View File

@ -1,5 +1,5 @@
# Flux ignore
# https://toolkit.fluxcd.io/components/source/gitrepositories/#excluding-files
# https://fluxcd.io/flux/components/source/gitrepositories/#excluding-files
docs/
scripts/
*.md

356
README.md
View File

@ -65,7 +65,83 @@ A [tenant repository](https://github.com/fluxcd/flux2-multi-tenancy/tree/dev-tea
└── podinfo-values.yaml
```
## Onboard tenants
## Bootstrap the staging cluster
Install the Flux CLI and fork this repository on your personal GitHub account
and export your GitHub username and repo name:
```sh
export GITHUB_USER=<your-username>
export GITHUB_REPO=<repository-name>
```
Verify that your staging cluster satisfies the prerequisites with:
```sh
flux check --pre
```
Set the `--context` argument to the kubectl context to your staging cluster and bootstrap Flux:
```sh
flux bootstrap github \
--context=your-staging-context \
--owner=${GITHUB_USER} \
--repository=${GITHUB_REPO} \
--branch=main \
--personal \
--path=clusters/staging
```
At this point flux cli will ask you for your `GITHUB_TOKEN` (a.k.a [Personal Access Token]).
> **NOTE:** The `GITHUB_TOKEN` is used exclusively by the flux CLI during the bootstrapping process,
> and does not leave your machine. The credential is used for
> configuring the GitHub repository and registering the deploy key.
The bootstrap command commits the manifests for the Flux components in `clusters/staging/flux-system` dir
and creates a deploy key with read-only access on GitHub, so it can pull changes inside the cluster.
Wait for the staging cluster reconciliation to finish:
```console
$ flux get kustomizations --watch
NAME READY MESSAGE
flux-system True Applied revision: main/616001c38e7bc81b00ef2c65ac8cfd58140155b8
kyverno Unknown Reconciliation in progress
kyverno-policies False Dependency 'flux-system/kyverno' is not ready
tenants False Dependency 'flux-system/kyverno-policies' is not ready
```
Verify that the tenant Git repository has been cloned:
```console
$ flux -n apps get sources git
NAME READY MESSAGE
dev-team True Fetched revision: dev-team/ca8ec25405cc03f2f374d2f35f9299d84ced01e4
```
Verify that the tenant Helm repository index has been downloaded:
```console
$ flux -n apps get sources helm
NAME READY MESSAGE
podinfo True Fetched revision: 2022-05-23T10:09:58.648748663Z
```
Wait for the demo app to be installed:
```console
$ watch flux -n apps get helmreleases
NAME READY MESSAGE REVISION SUSPENDED
podinfo True Release reconciliation succeeded 5.0.3 False
```
To expand on this example, check the [enforce tenant isolation](#enforce-tenant-isolation) for security related considerations.
[Personal Access Token]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
### Onboard new tenants
The Flux CLI offers commands to generate the Kubernetes manifests needed to define tenants.
@ -104,14 +180,14 @@ flux create kustomization dev-team \
Create the base `kustomization.yaml` file:
```sh
cd ./tenants/base/dev-team/ && kustomize create --autodetect
cd ./tenants/base/dev-team/ && kustomize create --autodetect --namespace apps
```
Create the staging overlay and set the path to the staging dir inside the tenant repository:
```sh
cat << EOF | tee ./tenants/staging/dev-team-patch.yaml
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: dev-team
@ -123,10 +199,11 @@ EOF
cat << EOF | tee ./tenants/staging/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: apps
resources:
- ../base/dev-team
patchesStrategicMerge:
- dev-team-patch.yaml
patches:
- path: dev-team-patch.yaml
EOF
```
@ -135,13 +212,182 @@ dev-team's repository, and it will reconcile the `./staging` directory from the
using the `dev-team` service account. Since that service account is restricted to the `apps` namespace,
the dev-team repository must contain Kubernetes objects scoped to the `apps` namespace only.
#### Tenant onboarding via Kyverno
Alternatively to the `flux create tenant` approach, Kyverno's [resource generation] feature can
be leveraged to the same effect.
[resource generation]: https://kyverno.io/docs/writing-policies/generate/
## Enforce tenant isolation
To enforce tenant isolation, cluster admins must configure Flux to reconcile
the `Kustomization` and `HelmRelease` kinds by impersonating a service account
from the namespace where these objects are created. In order to make the
`spec.ServiceAccountName` field mandatory, you should use a validation webhook, for example
[Kyverno](https://github.com/kyverno/kyverno) or [OPA Gatekeeper](https://github.com/open-policy-agent/gatekeeper).
from the namespace where these objects are created.
Flux has built-in [multi-tenancy lockdown] features which enables tenant isolation
at Control Plane level without the need of external admission controllers (e.g. Kyverno). The
recommended patch:
- Enforce controllers to block cross namespace references.
Meaning that a tenant cant use another tenants sources or subscribe to their events.
- Deny accesses to Kustomize remote bases, thus ensuring all resources refer to local files.
Meaning that only approved Flux Sources can affect the cluster-state.
- Sets a default service account via `--default-service-account` to `kustomize-controller` and `helm-controller`.
Meaning that, if a tenant does not specify a service account in a Flux `Kustomization` or
`HelmRelease`, it would automatically default to said account.
> **NOTE:** It is recommended that the default service account has no privileges.
> And each named service account used observes the least privilege model.
This repository applies this patch automatically via
[kustomization.yaml](clusters/production/flux-system/kustomization.yaml) in both clusters.
```yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- gotk-components.yaml
- gotk-sync.yaml
patches:
- patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --no-cross-namespace-refs=true
target:
kind: Deployment
name: "(kustomize-controller|helm-controller|notification-controller|image-reflector-controller|image-automation-controller)"
- patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --no-remote-bases=true
target:
kind: Deployment
name: "kustomize-controller"
- patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --default-service-account=default
target:
kind: Deployment
name: "(kustomize-controller|helm-controller)"
- patch: |
- op: add
path: /spec/serviceAccountName
value: kustomize-controller
target:
kind: Kustomization
name: "flux-system"
```
### Side Effects
When Flux is bootstrapped with the patch both `kustomize-controller` and `helm-controller` will impersonate the `default`
service account in the tenant namespace when applying changes to the cluster. The `default` service account
exist in all namespaces and should always be kept without any privileges.
To enable a tenant to operate, a service account must be created with the required permissions and its name set
to the `spec.serviceAccountName` of all `Kustomization` and `HelmRelease` resources the tenant has.
### Tenancy policies
Depending on the aimed security posture, the Platform Admin may impose additional policies to enforce specific
behaviours. Below are a few consideration points, some of which are already implemented in this repository.
#### Image provenance
Assuring the provenance of container images across a cluster can be achieved on several ways.
The [verify-flux-images policy](infrastructure/kyverno-policies/verify-flux-images.yaml)
ensures that all Flux images used are the ones built and signed by the Flux team:
```yaml
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: verify-flux-images
spec:
validationFailureAction: enforce
background: false
webhookTimeoutSeconds: 30
failurePolicy: Fail
rules:
- name: verify-cosign-signature
match:
resources:
kinds:
- Pod
verifyImages:
- imageReferences:
- "ghcr.io/fluxcd/source-controller:*"
- "ghcr.io/fluxcd/kustomize-controller:*"
- "ghcr.io/fluxcd/helm-controller:*"
- "ghcr.io/fluxcd/notification-controller:*"
attestors:
- entries:
- keyless:
subject: "https://github.com/fluxcd/*"
issuer: "https://token.actions.githubusercontent.com"
rekor:
url: https://rekor.sigstore.dev
```
Other policies to explore:
- Restrict what repositories can be accessed in each cluster. Some deployments may need this to be environment-specific.
- Align image policies with pods that require `securityContext` that are highly privileged.
#### Flux Sources
Flux uses sources to define the origin of flux manifests. Some deployments may require that
all of them come from a specific GitHub Organisation, as the
[verify-git-repositories policy](infrastructure/kyverno-policies/verify-git-repositories.yaml) shows:
```yaml
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: verify-git-repositories
spec:
validationFailureAction: audit # Change to 'enforce' once the specific org url is set.
rules:
- name: github-repositories-only
exclude:
resources:
namespaces:
- flux-system
match:
resources:
kinds:
- GitRepository
validate:
message: ".spec.url must be from a repository within the organisation X"
anyPattern:
- spec:
url: "https://github.com/fluxcd/?*" # repositories in fluxcd via https
- spec:
url: "ssh://git@github.com:fluxcd/?*" # repositories in fluxcd via ssh
```
Other policies to explore:
- Expand the policies to `HelmRepository` and `Bucket`.
- For `HelmRepository` and `GitRepository` consider which protocols should be allowed.
- For `Bucket`, consider restrictions on providers and regions.
#### Make serviceAccountName mandatory
The lockdown patch sets a default service account that is applied to any `Kustomization` and `HelmRelease`
instances that have no `spec.ServiceAccountName` set.
If the recommended best practices above are followed, such instances won't be able to apply changes to
a cluster as the default service account has no permissions to do so.
An additional extra could be taken to make the `spec.ServiceAccountName` field mandatory via a validation
webhook, for example [Kyverno](https://github.com/kyverno/kyverno) or
[OPA Gatekeeper](https://github.com/open-policy-agent/gatekeeper).
Resulting on `Kustomization` and `HelmRelease` instances not being admitted when `spec.ServiceAccountName` is not set.
#### Reconciliation hierarchy
On cluster bootstrap, you need to configure Flux to deploy the validation webhook and its policies before
reconciling the tenants repositories.
@ -162,7 +408,7 @@ First we setup the reconciliation of custom resource definitions and their contr
example we'll use [Kyverno](https://github.com/kyverno/kyverno):
```yaml
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: kyverno
@ -178,11 +424,11 @@ spec:
timeout: 5m
```
Then we setup [cluster policies](./infrastructure/kyverno-policies/flux-multi-tenancy.yaml)
(Kyverno custom resources) to enforce tenant isolation:
Then we setup [cluster policies](./infrastructure/kyverno-policies/verify-git-repositories.yaml)
(Kyverno custom resources) to enforce a specific GitHub Organisation:
```yaml
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: kyverno-policies
@ -203,7 +449,7 @@ With `dependsOn` we tell Flux to install Kyverno before deploying the cluster po
And finally we setup the reconciliation for the tenants workloads with:
```yaml
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: tenants
@ -219,75 +465,8 @@ spec:
prune: true
```
With the above configuration, we ensure that the Kyverno validation webhook will reject `Kustomizations` and
`HelmReleases` that don't specify a service account name when deployed in a tenant's namespace.
## Bootstrap the staging cluster
Install the Flux CLI and fork this repository on your personal GitHub account
and export your GitHub access token, username and repo name:
```sh
export GITHUB_TOKEN=<your-token>
export GITHUB_USER=<your-username>
export GITHUB_REPO=<repository-name>
```
Verify that your staging cluster satisfies the prerequisites with:
```sh
flux check --pre
```
Set the `--context` argument to the kubectl context to your staging cluster and bootstrap Flux:
```sh
flux bootstrap github \
--context=your-staging-context \
--owner=${GITHUB_USER} \
--repository=${GITHUB_REPO} \
--branch=main \
--personal \
--path=clusters/staging
```
The bootstrap command commits the manifests for the Flux components in `clusters/staging/flux-system` dir
and creates a deploy key with read-only access on GitHub, so it can pull changes inside the cluster.
Wait for the staging cluster reconciliation to finish:
```console
$ watch flux get kustomization
NAME READY MESSAGE
flux-system True Applied revision: main/616001c38e7bc81b00ef2c65ac8cfd58140155b8
kyverno Unknown Reconciliation in progress
kyverno-policies False Dependency 'flux-system/kyverno' is not ready
tenants False Dependency 'flux-system/kyverno-policies' is not ready
```
Verify that the tenant Git repository has been cloned:
```console
$ flux -n apps get sources git
NAME READY MESSAGE
dev-team True Fetched revision: dev-team/ca8ec25405cc03f2f374d2f35f9299d84ced01e4
```
Verify that the tenant Helm repository index has been downloaded:
```console
$ flux -n apps get sources helm
NAME READY MESSAGE
podinfo True Fetched revision: 2020-10-28T10:09:58.648748663Z
```
Wait for the demo app to be installed:
```console
$ watch flux -n apps get helmreleases
NAME READY MESSAGE REVISION SUSPENDED
podinfo True Release reconciliation succeeded 5.0.3 False
```
With the above configuration, we ensure that the Kyverno validation webhook will reject `GitRepository`
that don't originate from a specific GitHub Organisation, in our case `fluxcd`.
## Onboard tenants with private repositories
@ -298,7 +477,7 @@ in the platform admin repository as a Kubernetes secret.
### Encrypt Kubernetes secrets in Git
In order to store credentials safely in a Git repository, you can use Mozilla's
SOPS CLI to encrypt Kubernetes secrets with OpenPGP or KMS.
SOPS CLI to encrypt Kubernetes secrets with OpenPGP, Age or KMS.
Install [gnupg](https://www.gnupg.org/) and [sops](https://github.com/mozilla/sops):
@ -345,7 +524,7 @@ flux -n apps create secret git dev-team-auth \
Print the SSH public key and add it as a read-only deploy key to the dev-team repository:
```sh
yq read git-auth.yaml 'data."identity.pub"' | base64 --decode
yq eval '.stringData."identity.pub"' ./tenants/base/dev-team/auth.yaml
```
### Git over HTTP/S
@ -427,5 +606,10 @@ a pull request is merged into the main branch and synced on the cluster.
This repository contains the following GitHub CI workflows:
* the [test](./.github/workflows/test.yaml) workflow validates the Kubernetes manifests and Kustomize overlays with kubeval
* the [e2e](./.github/workflows/e2e.yaml) workflow starts a Kubernetes cluster in CI and tests the staging setup by running Flux in Kubernetes Kind
* the [test](./.github/workflows/test.yaml) workflow validates the Kubernetes manifests
and Kustomize overlays with [kubeconform](https://github.com/yannh/kubeconform)
* the [e2e](./.github/workflows/e2e.yaml) workflow starts a Kubernetes cluster in CI
and tests the staging setup by running Flux in Kubernetes Kind
[multi-tenancy lockdown]: https://fluxcd.io/flux/installation/configuration/multitenancy/

View File

@ -0,0 +1 @@
# This file will be generated automatically by flux boostrap.

View File

@ -0,0 +1 @@
# This file will be generated automatically by flux boostrap.

View File

@ -0,0 +1,34 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- gotk-components.yaml
- gotk-sync.yaml
patches:
- patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --no-cross-namespace-refs=true
target:
kind: Deployment
name: "(kustomize-controller|helm-controller|notification-controller|image-reflector-controller|image-automation-controller)"
- patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --no-remote-bases=true
target:
kind: Deployment
name: "kustomize-controller"
- patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --default-service-account=default
target:
kind: Deployment
name: "(kustomize-controller|helm-controller)"
- patch: |
- op: add
path: /spec/serviceAccountName
value: kustomize-controller
target:
kind: Kustomization
name: "flux-system"

View File

@ -1,4 +1,4 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: kyverno
@ -8,12 +8,13 @@ spec:
sourceRef:
kind: GitRepository
name: flux-system
serviceAccountName: kustomize-controller
path: ./infrastructure/kyverno
prune: true
wait: true
timeout: 5m
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: kyverno-policies
@ -25,5 +26,6 @@ spec:
sourceRef:
kind: GitRepository
name: flux-system
serviceAccountName: kustomize-controller
path: ./infrastructure/kyverno-policies
prune: true

View File

@ -1,4 +1,4 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: tenants
@ -7,6 +7,7 @@ spec:
dependsOn:
- name: kyverno-policies
interval: 5m
serviceAccountName: kustomize-controller
sourceRef:
kind: GitRepository
name: flux-system

View File

@ -0,0 +1 @@
# This file will be generated automatically by flux boostrap.

View File

@ -0,0 +1 @@
# This file will be generated automatically by flux boostrap.

View File

@ -0,0 +1,34 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- gotk-components.yaml
- gotk-sync.yaml
patches:
- patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --no-cross-namespace-refs=true
target:
kind: Deployment
name: "(kustomize-controller|helm-controller|notification-controller|image-reflector-controller|image-automation-controller)"
- patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --no-remote-bases=true
target:
kind: Deployment
name: "kustomize-controller"
- patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --default-service-account=default
target:
kind: Deployment
name: "(kustomize-controller|helm-controller)"
- patch: |
- op: add
path: /spec/serviceAccountName
value: kustomize-controller
target:
kind: Kustomization
name: "flux-system"

View File

@ -1,19 +1,20 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: kyverno
namespace: flux-system
spec:
interval: 720m
interval: 720m0s
sourceRef:
kind: GitRepository
name: flux-system
serviceAccountName: kustomize-controller
path: ./infrastructure/kyverno
prune: true
wait: true
timeout: 5m
timeout: 10m
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: kyverno-policies
@ -21,9 +22,10 @@ metadata:
spec:
dependsOn:
- name: kyverno
interval: 15m
interval: 15m0s
sourceRef:
kind: GitRepository
name: flux-system
serviceAccountName: kustomize-controller
path: ./infrastructure/kyverno-policies
prune: true

View File

@ -1,4 +1,4 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: tenants
@ -7,6 +7,7 @@ spec:
dependsOn:
- name: kyverno-policies
interval: 5m
serviceAccountName: kustomize-controller
sourceRef:
kind: GitRepository
name: flux-system

View File

@ -1,64 +0,0 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: flux-multi-tenancy
spec:
validationFailureAction: enforce
rules:
- name: serviceAccountName
exclude:
resources:
namespaces:
- flux-system
match:
resources:
kinds:
- Kustomization
- HelmRelease
validate:
message: ".spec.serviceAccountName is required"
pattern:
spec:
serviceAccountName: "?*"
- name: kustomizationSourceRefNamespace
exclude:
resources:
namespaces:
- flux-system
match:
resources:
kinds:
- Kustomization
preconditions:
any:
- key: "{{request.object.spec.sourceRef.namespace}}"
operator: NotEquals
value: ""
validate:
message: "spec.sourceRef.namespace must be the same as metadata.namespace"
deny:
conditions:
- key: "{{request.object.spec.sourceRef.namespace}}"
operator: NotEquals
value: "{{request.object.metadata.namespace}}"
- name: helmReleaseSourceRefNamespace
exclude:
resources:
namespaces:
- flux-system
match:
resources:
kinds:
- HelmRelease
preconditions:
any:
- key: "{{request.object.spec.chart.spec.sourceRef.namespace}}"
operator: NotEquals
value: ""
validate:
message: "spec.chart.spec.sourceRef.namespace must be the same as metadata.namespace"
deny:
conditions:
- key: "{{request.object.spec.chart.spec.sourceRef.namespace}}"
operator: NotEquals
value: "{{request.object.metadata.namespace}}"

View File

@ -1,4 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- flux-multi-tenancy.yaml
- verify-flux-images.yaml
- verify-git-repositories.yaml

View File

@ -0,0 +1,39 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: verify-flux-images
spec:
validationFailureAction: Audit
background: false
webhookTimeoutSeconds: 30
failurePolicy: Fail
rules:
- name: verify-cosign-signature
match:
any:
- resources:
kinds:
- Pod
verifyImages:
- imageReferences:
- "ghcr.io/fluxcd/source-controller:*"
- "ghcr.io/fluxcd/kustomize-controller:*"
- "ghcr.io/fluxcd/helm-controller:*"
- "ghcr.io/fluxcd/notification-controller:*"
- "ghcr.io/fluxcd/image-reflector-controller:*"
- "ghcr.io/fluxcd/image-automation-controller:*"
- "docker.io/fluxcd/source-controller:*"
- "docker.io/fluxcd/kustomize-controller:*"
- "docker.io/fluxcd/helm-controller:*"
- "docker.io/fluxcd/notification-controller:*"
- "docker.io/fluxcd/image-reflector-controller:*"
- "docker.io/fluxcd/image-automation-controller:*"
mutateDigest: false
verifyDigest: false
attestors:
- entries:
- keyless:
subject: "https://github.com/fluxcd/*"
issuer: "https://token.actions.githubusercontent.com"
rekor:
url: https://rekor.sigstore.dev

View File

@ -0,0 +1,26 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: verify-git-repositories
spec:
# This provides users a working example of how an admin
# would be able to enforce git repository sources across
# all tenants.
validationFailureAction: Audit # Change to 'Enforce' once the specific org url is set.
rules:
- name: github-repositories-only
match:
any:
- resources:
kinds:
- GitRepository
exclude:
any:
- resources:
namespaces:
- flux-system
validate:
message: ".spec.url must be from a repository within the organisation X"
pattern:
spec:
url: https://github.com/fluxcd/?* | ssh://git@github.com:fluxcd/?*

View File

@ -1,4 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- https://raw.githubusercontent.com/kyverno/kyverno/v1.5.1/definitions/release/install.yaml
- source.yaml
- sync.yaml

View File

@ -0,0 +1,13 @@
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: OCIRepository
metadata:
name: kyverno-controller
namespace: flux-system
spec:
interval: 120m0s
provider: generic
url: oci://ghcr.io/kyverno/manifests/kyverno
ref:
tag: "v1.14.4"
verify:
provider: cosign

View File

@ -0,0 +1,15 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: kyverno-controller
namespace: flux-system
spec:
interval: 720m0s
sourceRef:
kind: OCIRepository
name: kyverno-controller
serviceAccountName: kustomize-controller
path: ./
prune: true
wait: true
timeout: 5m

View File

@ -1,11 +1,11 @@
#!/usr/bin/env bash
# This script downloads the Flux OpenAPI schemas, then it validates the
# Flux custom resources and the kustomize overlays using kubeval.
# Flux custom resources and the kustomize overlays using kubeconform.
# This script is meant to be run locally and in CI before the changes
# are merged on the main branch that's synced by Flux.
# Copyright 2020 The Flux authors. All rights reserved.
# Copyright 2023 The Flux authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -19,16 +19,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# This script is meant to be run locally and in CI to validate the Kubernetes
# manifests (including Flux custom resources) before changes are merged into
# the branch synced by Flux in-cluster.
# Prerequisites
# - yq v4.6
# - kustomize v4.1
# - kubeval v0.15
# - yq v4.34
# - kustomize v5.0
# - kubeconform v0.6
set -o errexit
set -o pipefail
# mirror kustomize-controller build options
kustomize_flags=("--load-restrictor=LoadRestrictionsNone")
kustomize_config="kustomization.yaml"
# skip Kubernetes Secrets due to SOPS fields failing validation
kubeconform_flags=("-skip=Secret")
kubeconform_config=("-strict" "-ignore-missing-schemas" "-schema-location" "default" "-schema-location" "/tmp/flux-crd-schemas" "-verbose")
echo "INFO - Downloading Flux OpenAPI schemas"
mkdir -p /tmp/flux-crd-schemas/master-standalone-strict
@ -43,22 +48,18 @@ done
echo "INFO - Validating clusters"
find ./clusters -maxdepth 2 -type f -name '*.yaml' -print0 | while IFS= read -r -d $'\0' file;
do
kubeval ${file} --strict --ignore-missing-schemas --additional-schema-locations=file:///tmp/flux-crd-schemas
kubeconform "${kubeconform_flags[@]}" "${kubeconform_config[@]}" "${file}"
if [[ ${PIPESTATUS[0]} != 0 ]]; then
exit 1
fi
done
# mirror kustomize-controller build options
kustomize_flags="--load-restrictor=LoadRestrictionsNone --reorder=legacy"
kustomize_config="kustomization.yaml"
echo "INFO - Validating kustomize overlays"
find . -type f -name $kustomize_config -print0 | while IFS= read -r -d $'\0' file;
do
echo "INFO - Validating kustomization ${file/%$kustomize_config}"
kustomize build "${file/%$kustomize_config}" $kustomize_flags | \
kubeval --ignore-missing-schemas --strict --additional-schema-locations=file:///tmp/flux-crd-schemas
kustomize build "${file/%$kustomize_config}" "${kustomize_flags[@]}" | \
kubeconform "${kubeconform_flags[@]}" "${kubeconform_config[@]}"
if [[ ${PIPESTATUS[0]} != 0 ]]; then
exit 1
fi

View File

@ -1,5 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: apps
resources:
- rbac.yaml
- sync.yaml

View File

@ -1,4 +1,4 @@
apiVersion: source.toolkit.fluxcd.io/v1beta1
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: dev-team
@ -9,7 +9,7 @@ spec:
ref:
branch: dev-team
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: dev-team
@ -21,6 +21,5 @@ spec:
kind: GitRepository
name: dev-team
prune: true
validation: client

View File

@ -1,4 +1,4 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: dev-team

View File

@ -1,6 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: apps
resources:
- ../base/dev-team
patchesStrategicMerge:
- dev-team-patch.yaml
patches:
- path: dev-team-patch.yaml

View File

@ -1,4 +1,4 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: dev-team

View File

@ -1,6 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: apps
resources:
- ../base/dev-team
patchesStrategicMerge:
- dev-team-patch.yaml
patches:
- path: dev-team-patch.yaml