// Copyright (c) 2023 Volvo Car Corporation
// SPDX-License-Identifier: Apache-2.0

// Code generated by lingon. EDIT AS MUCH AS YOU LIKE.

package policy

import (
	ku "github.com/golingon/lingon/pkg/kubeutil"
	admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const PolicySigstoreDev = "policy.sigstore.dev"

var ValidatingPolicySigstoreDevVWC = &admissionregistrationv1.ValidatingWebhookConfiguration{
	TypeMeta:   ku.TypeValidatingWebhookConfigurationV1,
	ObjectMeta: metav1.ObjectMeta{Name: PolicySigstoreDev},
	Webhooks: []admissionregistrationv1.ValidatingWebhook{
		{
			AdmissionReviewVersions: []string{"v1"},
			ClientConfig: admissionregistrationv1.WebhookClientConfig{
				Service: &admissionregistrationv1.ServiceReference{
					Name: SVC.Name, Namespace: SVC.Namespace,
				},
			},
			FailurePolicy: P(admissionregistrationv1.Fail),
			Name:          PolicySigstoreDev,
			NamespaceSelector: &metav1.LabelSelector{
				MatchExpressions: []metav1.LabelSelectorRequirement{
					{
						Key:      "policy.sigstore.dev/include",
						Operator: metav1.LabelSelectorOperator("In"),
						Values:   []string{"true"},
					},
				},
			},
			SideEffects: P(admissionregistrationv1.SideEffectClassNone),
		},
	},
}

var ValidatingClusterImagePolicyVWC = &admissionregistrationv1.ValidatingWebhookConfiguration{
	TypeMeta:   ku.TypeValidatingWebhookConfigurationV1,
	ObjectMeta: metav1.ObjectMeta{Name: "validating.clusterimagepolicy.sigstore.dev"},
	Webhooks: []admissionregistrationv1.ValidatingWebhook{
		{
			AdmissionReviewVersions: []string{"v1"},
			ClientConfig: admissionregistrationv1.WebhookClientConfig{
				Service: &admissionregistrationv1.ServiceReference{
					Name: SVC.Name, Namespace: SVC.Namespace,
				},
			},
			FailurePolicy: P(admissionregistrationv1.Fail),
			MatchPolicy:   P(admissionregistrationv1.Equivalent),
			Name:          "validating.clusterimagepolicy.sigstore.dev",
			SideEffects:   P(admissionregistrationv1.SideEffectClassNone),
		},
	},
}
