1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 16:06:56 +00:00
This commit is contained in:
Jim Bugwadia 2022-05-11 21:16:15 -07:00 committed by GitHub
parent a0eadad77b
commit f05d86d375
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 3 deletions

View file

@ -136,6 +136,7 @@ The command removes all the Kubernetes components associated with the chart and
| networkPolicy.ingressFrom | list | `[]` | A list of valid from selectors according to https://kubernetes.io/docs/concepts/services-networking/network-policies. | | networkPolicy.ingressFrom | list | `[]` | A list of valid from selectors according to https://kubernetes.io/docs/concepts/services-networking/network-policies. |
| webhooksCleanup.enable | bool | `false` | Create a helm pre-delete hook to cleanup webhooks. | | webhooksCleanup.enable | bool | `false` | Create a helm pre-delete hook to cleanup webhooks. |
| webhooksCleanup.image | string | `"bitnami/kubectl:latest"` | `kubectl` image to run commands for deleting webhooks. | | webhooksCleanup.image | string | `"bitnami/kubectl:latest"` | `kubectl` image to run commands for deleting webhooks. |
| tufRootMountPath | string | `"/.sigstore"` | A writable volume to use for the TUF root initialization |
## TLS Configuration ## TLS Configuration

View file

@ -127,6 +127,8 @@ spec:
fieldPath: metadata.name fieldPath: metadata.name
- name: KYVERNO_SVC - name: KYVERNO_SVC
value: {{ template "kyverno.serviceName" . }} value: {{ template "kyverno.serviceName" . }}
- name: TUF_ROOT
value: {{ .Values.tufRootMountPath }}
{{- with .Values.envVars }} {{- with .Values.envVars }}
{{- toYaml . | nindent 10 }} {{- toYaml . | nindent 10 }}
{{- end }} {{- end }}
@ -138,3 +140,9 @@ spec:
{{- with .Values.readinessProbe }} {{- with .Values.readinessProbe }}
readinessProbe: {{ tpl (toYaml .) $ | nindent 12 }} readinessProbe: {{ tpl (toYaml .) $ | nindent 12 }}
{{- end }} {{- end }}
volumeMounts:
- mountPath: {{ .Values.tufRootMountPath }}
name: sigstore
volumes:
- name: sigstore
emptyDir: {}

View file

@ -373,3 +373,6 @@ webhooksCleanup:
enable: false enable: false
# -- `kubectl` image to run commands for deleting webhooks. # -- `kubectl` image to run commands for deleting webhooks.
image: bitnami/kubectl:latest image: bitnami/kubectl:latest
# -- A writable volume to use for the TUF root initialization
tufRootMountPath: /.sigstore

View file

@ -370,7 +370,7 @@ func main() {
// webhookconfigurations are registered by the leader only // webhookconfigurations are registered by the leader only
webhookRegisterLeader, err := leaderelection.New("webhook-register", config.KyvernoNamespace, kubeClient, registerWebhookConfigurations, nil, log.Log.WithName("webhookRegister/LeaderElection")) webhookRegisterLeader, err := leaderelection.New("webhook-register", config.KyvernoNamespace, kubeClient, registerWebhookConfigurations, nil, log.Log.WithName("webhookRegister/LeaderElection"))
if err != nil { if err != nil {
setupLog.Error(err, "failed to elector leader") setupLog.Error(err, "failed to elect a leader")
os.Exit(1) os.Exit(1)
} }
@ -386,6 +386,11 @@ func main() {
os.Exit(1) os.Exit(1)
} }
if err := cosign.Init(); err != nil {
setupLog.Error(err, "initialization failed")
os.Exit(1)
}
// WEBHOOK // WEBHOOK
// - https server to provide endpoints called based on rules defined in Mutating & Validation webhook configuration // - https server to provide endpoints called based on rules defined in Mutating & Validation webhook configuration
// - reports the results based on the response from the policy engine: // - reports the results based on the response from the policy engine:

16
pkg/cosign/init.go Normal file
View file

@ -0,0 +1,16 @@
package cosign
import (
"fmt"
"github.com/sigstore/cosign/cmd/cosign/cli/fulcio"
)
func Init() error {
certs := fulcio.GetRoots()
if certs == nil {
return fmt.Errorf("failed to initialize Fulcio roots")
}
return nil
}

View file

@ -161,8 +161,8 @@ func NewWebhookServer(
Addr: ":9443", // Listen on port for HTTPS requests Addr: ":9443", // Listen on port for HTTPS requests
TLSConfig: &tls.Config{Certificates: []tls.Certificate{pair}, MinVersion: tls.VersionTLS12}, TLSConfig: &tls.Config{Certificates: []tls.Certificate{pair}, MinVersion: tls.VersionTLS12},
Handler: mux, Handler: mux,
ReadTimeout: 15 * time.Second, ReadTimeout: 30 * time.Second,
WriteTimeout: 15 * time.Second, WriteTimeout: 30 * time.Second,
} }
return ws, nil return ws, nil
} }