-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1 from projectsyn/initial-implementation
Initial implementation
- Loading branch information
Showing
59 changed files
with
4,038 additions
and
12 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
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 |
---|---|---|
@@ -1,10 +1,54 @@ | ||
// main template for sigstore-policy-controller | ||
local com = import 'lib/commodore.libjsonnet'; | ||
local kap = import 'lib/kapitan.libjsonnet'; | ||
local kube = import 'lib/kube.libjsonnet'; | ||
|
||
local prometheus = import 'lib/prometheus.libsonnet'; | ||
|
||
local inv = kap.inventory(); | ||
// The hiera parameters for the component | ||
local params = inv.parameters.sigstore_policy_controller; | ||
|
||
// Define outputs below | ||
// NOTE(sg): SkipDryRunOnMissingResource isn't required, since the Helm chart | ||
// renders the CRDs, so ArgoCD will know not to do dry-run on first apply. | ||
local ClusterPolicy(name) = | ||
kube._Object('policy.sigstore.dev/v1beta1', 'ClusterImagePolicy', name); | ||
|
||
local policies = com.generateResources( | ||
params.cluster_policies, | ||
ClusterPolicy, | ||
); | ||
|
||
local aggregated_rbac = | ||
kube.ClusterRole('syn:sigstore-policy-controller:cluster-reader') { | ||
metadata+: { | ||
labels+: { | ||
'rbac.authorization.k8s.io/aggregate-to-cluster-reader': 'true', | ||
}, | ||
}, | ||
rules: [ | ||
{ | ||
apiGroups: [ 'policy.sigstore.dev' ], | ||
resources: [ '*' ], | ||
verbs: [ 'get', 'list', 'watch' ], | ||
}, | ||
], | ||
}; | ||
|
||
local namespace = | ||
local ns = kube.Namespace(params.namespace) { | ||
metadata+: { | ||
labels+: { | ||
// Scrape metrics through cluster-monitoring stack on OCP4 | ||
'openshift.io/cluster-monitoring': 'true', | ||
}, | ||
}, | ||
}; | ||
if std.member(inv.applications, 'prometheus') then | ||
prometheus.RegisterNamespace(ns) | ||
else | ||
ns; | ||
|
||
{ | ||
'00_namespace': namespace, | ||
'02_aggregated_rbac': aggregated_rbac, | ||
[if std.length(policies) > 0 then '10_clusterpolicies']: policies, | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
= sigstore-policy-controller | ||
|
||
sigstore-policy-controller is a Commodore component to manage sigstore-policy-controller. | ||
sigstore-policy-controller is a Commodore component to manage the https://docs.sigstore.dev/policy-controller/overview/[sigstore Kubernetes policy controller^]. | ||
|
||
See the xref:references/parameters.adoc[parameters] reference for further details. |
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,18 @@ | ||
local com = import 'lib/commodore.libjsonnet'; | ||
|
||
local dir = std.extVar('output_path'); | ||
|
||
local stem(elem) = | ||
local elems = std.split(elem, '.'); | ||
std.join('.', elems[:std.length(elems) - 1]); | ||
|
||
local filepath(file) = dir + '/' + file; | ||
|
||
local fixup(file) = | ||
local contents = com.yaml_load_all(filepath(file)); | ||
std.filter(function(it) it != null, contents); | ||
|
||
{ | ||
[stem(file)]: fixup(file) | ||
for file in com.list_dir(dir) | ||
} |
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,13 @@ | ||
# Test integration with component-prometheus | ||
applications: | ||
- prometheus | ||
|
||
parameters: | ||
kapitan: | ||
dependencies: | ||
- type: https | ||
source: https://raw.githubusercontent.com/projectsyn/component-prometheus/master/lib/prometheus.libsonnet | ||
output_path: vendor/lib/prometheus.libsonnet | ||
|
||
prometheus: | ||
defaultInstance: infra |
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 |
---|---|---|
@@ -1,3 +1,18 @@ | ||
# Overwrite parameters here | ||
|
||
# parameters: {...} | ||
parameters: | ||
sigstore_policy_controller: | ||
cluster_policies: | ||
test-policy: | ||
metadata: | ||
annotations: | ||
sigstore-policy-controller.syn.tools/description: | | ||
Verify signature of all images against the provided public key. | ||
spec: | ||
images: | ||
- glob: "**" | ||
authorities: | ||
- key: | ||
hashAlgorithm: sha256 | ||
data: |- | ||
-----BEGIN PUBLIC KEY----- | ||
.... | ||
-----END PUBLIC KEY----- |
10 changes: 10 additions & 0 deletions
10
...lden/component-prometheus/sigstore-policy-controller/apps/sigstore-policy-controller.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,10 @@ | ||
spec: | ||
ignoreDifferences: | ||
- group: admissionregistration.k8s.io | ||
jqPathExpressions: | ||
- .webhooks[]?.namespaceSelector.matchExpressions | ||
kind: MutatingWebhookConfiguration | ||
- group: admissionregistration.k8s.io | ||
jqPathExpressions: | ||
- .webhooks[]?.namespaceSelector.matchExpressions | ||
kind: ValidatingWebhookConfiguration |
9 changes: 9 additions & 0 deletions
9
...ponent-prometheus/sigstore-policy-controller/sigstore-policy-controller/00_namespace.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,9 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
annotations: {} | ||
labels: | ||
monitoring.syn.tools/infra: 'true' | ||
name: syn-sigstore-policy-controller | ||
openshift.io/cluster-monitoring: 'true' | ||
name: syn-sigstore-policy-controller |
Oops, something went wrong.