You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expose the deployment strategy values for the policy controller
Prior to this change, the policy controller webhook was not able to have
its deployment strategy modified. If you only deployed a single replica,
it could not perform a rolling update due to the default `maxSurge:
25%` being rounded down to 0.
This change exposes those values, so that the `maxSurge` can be updated
and a single instance can be rolled.
Fixes#748.
Signed-off-by: Alex Shearn <[email protected]>
The `policy-controller` enforce images matching the defined list of `ClusterImagePolicy` for the labeled namespaces.
87
-
88
-
Note that, by default, the `policy-controller` offers a configurable behavior defining whether to allow, deny or warn whenever an image does not match a policy in a specific namespace. This behavior can be configured using the `config-policy-controller` ConfigMap created under the release namespace, and by adding an entry with the property `no-match-policy` and its value `warn|allow|deny`.
89
-
By default, any image that does not match a policy is rejected whenever `no-match-policy` is not configured in the ConfigMap.
90
-
91
-
As supported in previous versions, you could create your own key pair:
92
-
93
-
```shell
94
-
export COSIGN_PASSWORD=<my_cosign_password>
95
-
cosign generate-key-pair
96
-
```
97
-
98
-
This command generates two key files `cosign.key` and `cosign.pub`. Next, create a secret to validate the signatures:
99
-
100
-
```shell
101
-
kubectl create secret generic mysecret -n \
102
-
cosign-system --from-file=cosign.pub=./cosign.pub
103
-
```
104
-
105
-
**IMPORTANT:** The `cosign.secretKeyRef` flag is not supported anymore. Finally, you could reuse your secret `mysecret` by creating a `ClusterImagePolicy` that sets it as listed authorities, as shown below.
The `policy-controller` can be configured to use custom CAs to communicate to container registries, for example, when you have a private registry with a self-signed TLS certificate.
123
-
124
-
To configure `policy-controller` to use custom CAs, follow these steps:
125
-
126
-
1. Make sure the `policy-controller` namespace exists:
127
-
128
-
```shell
129
-
kubectl create namespace cosign-system
130
-
```
131
-
132
-
2. Create a bundle file with all the root and intermediate certificates and name it `ca-bundle.crt`.
133
-
134
-
3. Create a `ConfigMap` from the bundle:
135
-
```shell
136
-
kubectl -n cosign-system create cm ca-bundle-config \
To enable the `policy admission webhook` to check for signed images, you will need to add the following label in each namespace that you would want the webhook triggered:
152
-
153
-
Label: `policy.sigstore.dev/include: "true"`
154
-
155
-
```yaml
156
-
apiVersion: v1
157
-
kind: Namespace
158
-
metadata:
159
-
labels:
160
-
policy.sigstore.dev/include: "true"
161
-
kubernetes.io/metadata.name: my-namespace
162
-
name: my-namespace
163
-
spec:
164
-
finalizers:
165
-
- kubernetes
166
-
```
167
-
168
-
### Testing the webhook
169
-
170
-
1. Using Unsigned Images:
171
-
Creating a deployment referencing images that are not signed will yield the following error and no resources will be created:
172
-
173
-
```shell
174
-
kubectl apply -f my-deployment.yaml
175
-
Error from server (BadRequest): error when creating "my-deployment.yaml": admission webhook "policy.sigstore.dev" denied the request: validation failed: invalid image signature: spec.template.spec.containers[0].image
176
-
```
177
-
178
-
2. Using Signed Images: Assuming a signed `nginx` image with a tag `signed` exists on a registry, the resource will be successfully created.
179
-
180
-
```shell
181
-
kubectl run pod1-signed --image=< REGISTRY_USER >/nginx:signed -n testns
182
-
pod/pod1-signed created
183
-
```
184
-
185
-
186
-
## More info
187
-
188
-
You can find more information about the policy-controller in [here](https://docs.sigstore.dev/policy-controller/overview/).
0 commit comments