diff --git a/README.md b/README.md index 92aa8421e6..cf56685e2d 100644 --- a/README.md +++ b/README.md @@ -253,6 +253,45 @@ A Task is responsible for executing the TaskDefinition of a workload. The execution is done spawning a K8s Job to handle a single Task. In its state, it keeps track of the current status of the K8s Job created. +### Keptn Evaluation Definition +A `KeptnEvaluationDefinition` is a CRD used to define evaluation tasks that can be run by the Keptn Lifecycle Controller +as part of pre- and post-analysis phases of a workload or application. + +A Keptn evaluation definition looks like the following: + +```yaml +apiVersion: keptn.sh/v1 +kind: KeptnEvaluationDefinition +metadata: + name: my-prometheus-evaluation +spec: + source: prometheus + objectives: + - name: query-1 + query: "xxxx" + evaluationTarget: <20 + - name: query-2 + query: "yyyy" + evaluationTarget: >4 +``` + + +### Keptn Evaluation Provider +A `KeptnEvaluationProvider` is a CRD used to define evaluation provider, which will provide data for the +pre- and post-analysis phases of a workload or application. + +A Keptn evaluation provider looks like the following: + +```yaml +apiVersion: keptn.sh/v1 +kind: KeptnEvaluationProvider +metadata: + name: prometheus +spec: + targetServer: "http://prometheus-k8s.monitoring.svc.cluster.local:9090" + secretName: prometheusLoginCredentials +``` + ## Install a dev build diff --git a/operator/PROJECT b/operator/PROJECT index c99ad0e504..c2fb223f0c 100644 --- a/operator/PROJECT +++ b/operator/PROJECT @@ -58,4 +58,21 @@ resources: kind: KeptnAppVersion path: github.com/keptn-sandbox/lifecycle-controller/operator/api/v1alpha1 version: v1alpha1 +- api: + crdVersion: v1 + namespaced: true + controller: true + domain: keptn.sh + group: lifecycle + kind: KeptnEvaluationDefinition + path: github.com/keptn-sandbox/lifecycle-controller/operator/api/v1alpha1 + version: v1alpha1 +- api: + crdVersion: v1 + namespaced: true + domain: keptn.sh + group: lifecycle + kind: KeptnEvaluationProvider + path: github.com/keptn-sandbox/lifecycle-controller/operator/api/v1alpha1 + version: v1alpha1 version: "3" diff --git a/operator/api/v1alpha1/keptnevaluationdefinition_types.go b/operator/api/v1alpha1/keptnevaluationdefinition_types.go new file mode 100644 index 0000000000..2c71314ce4 --- /dev/null +++ b/operator/api/v1alpha1/keptnevaluationdefinition_types.go @@ -0,0 +1,68 @@ +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// KeptnEvaluationDefinitionSpec defines the desired state of KeptnEvaluationDefinition +type KeptnEvaluationDefinitionSpec struct { + Source string `json:"source"` + Objectives []Objective `json:"objectives"` +} + +type Objective struct { + Name string `json:"name"` + Query string `json:"query"` + EvaluationTarget string `json:"evaluationTarget"` +} + +// KeptnEvaluationDefinitionStatus defines the observed state of KeptnEvaluationDefinition +type KeptnEvaluationDefinitionStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +//+kubebuilder:resource:path=keptnevaluationdefinitions,shortName=ked + +// KeptnEvaluationDefinition is the Schema for the keptnevaluationdefinitions API +type KeptnEvaluationDefinition struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec KeptnEvaluationDefinitionSpec `json:"spec,omitempty"` + Status KeptnEvaluationDefinitionStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// KeptnEvaluationDefinitionList contains a list of KeptnEvaluationDefinition +type KeptnEvaluationDefinitionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []KeptnEvaluationDefinition `json:"items"` +} + +func init() { + SchemeBuilder.Register(&KeptnEvaluationDefinition{}, &KeptnEvaluationDefinitionList{}) +} diff --git a/operator/api/v1alpha1/keptnevaluationprovider_types.go b/operator/api/v1alpha1/keptnevaluationprovider_types.go new file mode 100644 index 0000000000..3b83aeff0d --- /dev/null +++ b/operator/api/v1alpha1/keptnevaluationprovider_types.go @@ -0,0 +1,62 @@ +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// KeptnEvaluationProviderSpec defines the desired state of KeptnEvaluationProvider +type KeptnEvaluationProviderSpec struct { + TargetServer string `json:"targetServer"` + SecretName string `json:"secretName"` +} + +// KeptnEvaluationProviderStatus defines the observed state of KeptnEvaluationProvider +type KeptnEvaluationProviderStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +//+kubebuilder:resource:path=keptnevaluationproviders,shortName=kep + +// KeptnEvaluationProvider is the Schema for the keptnevaluationproviders API +type KeptnEvaluationProvider struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec KeptnEvaluationProviderSpec `json:"spec,omitempty"` + Status KeptnEvaluationProviderStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// KeptnEvaluationProviderList contains a list of KeptnEvaluationProvider +type KeptnEvaluationProviderList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []KeptnEvaluationProvider `json:"items"` +} + +func init() { + SchemeBuilder.Register(&KeptnEvaluationProvider{}, &KeptnEvaluationProviderList{}) +} diff --git a/operator/api/v1alpha1/zz_generated.deepcopy.go b/operator/api/v1alpha1/zz_generated.deepcopy.go index 3f4c1a5c7a..3d15d9dfbd 100644 --- a/operator/api/v1alpha1/zz_generated.deepcopy.go +++ b/operator/api/v1alpha1/zz_generated.deepcopy.go @@ -361,6 +361,189 @@ func (in *KeptnAppVersionStatus) DeepCopy() *KeptnAppVersionStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnEvaluationDefinition) DeepCopyInto(out *KeptnEvaluationDefinition) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationDefinition. +func (in *KeptnEvaluationDefinition) DeepCopy() *KeptnEvaluationDefinition { + if in == nil { + return nil + } + out := new(KeptnEvaluationDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnEvaluationDefinition) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnEvaluationDefinitionList) DeepCopyInto(out *KeptnEvaluationDefinitionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KeptnEvaluationDefinition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationDefinitionList. +func (in *KeptnEvaluationDefinitionList) DeepCopy() *KeptnEvaluationDefinitionList { + if in == nil { + return nil + } + out := new(KeptnEvaluationDefinitionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnEvaluationDefinitionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnEvaluationDefinitionSpec) DeepCopyInto(out *KeptnEvaluationDefinitionSpec) { + *out = *in + if in.Objectives != nil { + in, out := &in.Objectives, &out.Objectives + *out = make([]Objective, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationDefinitionSpec. +func (in *KeptnEvaluationDefinitionSpec) DeepCopy() *KeptnEvaluationDefinitionSpec { + if in == nil { + return nil + } + out := new(KeptnEvaluationDefinitionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnEvaluationDefinitionStatus) DeepCopyInto(out *KeptnEvaluationDefinitionStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationDefinitionStatus. +func (in *KeptnEvaluationDefinitionStatus) DeepCopy() *KeptnEvaluationDefinitionStatus { + if in == nil { + return nil + } + out := new(KeptnEvaluationDefinitionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnEvaluationProvider) DeepCopyInto(out *KeptnEvaluationProvider) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationProvider. +func (in *KeptnEvaluationProvider) DeepCopy() *KeptnEvaluationProvider { + if in == nil { + return nil + } + out := new(KeptnEvaluationProvider) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnEvaluationProvider) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnEvaluationProviderList) DeepCopyInto(out *KeptnEvaluationProviderList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KeptnEvaluationProvider, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationProviderList. +func (in *KeptnEvaluationProviderList) DeepCopy() *KeptnEvaluationProviderList { + if in == nil { + return nil + } + out := new(KeptnEvaluationProviderList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnEvaluationProviderList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnEvaluationProviderSpec) DeepCopyInto(out *KeptnEvaluationProviderSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationProviderSpec. +func (in *KeptnEvaluationProviderSpec) DeepCopy() *KeptnEvaluationProviderSpec { + if in == nil { + return nil + } + out := new(KeptnEvaluationProviderSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnEvaluationProviderStatus) DeepCopyInto(out *KeptnEvaluationProviderStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationProviderStatus. +func (in *KeptnEvaluationProviderStatus) DeepCopy() *KeptnEvaluationProviderStatus { + if in == nil { + return nil + } + out := new(KeptnEvaluationProviderStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KeptnTask) DeepCopyInto(out *KeptnTask) { *out = *in @@ -776,6 +959,21 @@ func (in *KeptnWorkloadStatus) DeepCopy() *KeptnWorkloadStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Objective) DeepCopyInto(out *Objective) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Objective. +func (in *Objective) DeepCopy() *Objective { + if in == nil { + return nil + } + out := new(Objective) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceReference) DeepCopyInto(out *ResourceReference) { *out = *in diff --git a/operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationdefinitions.yaml b/operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationdefinitions.yaml new file mode 100644 index 0000000000..a5328e6cfc --- /dev/null +++ b/operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationdefinitions.yaml @@ -0,0 +1,71 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.9.2 + creationTimestamp: null + name: keptnevaluationdefinitions.lifecycle.keptn.sh +spec: + group: lifecycle.keptn.sh + names: + kind: KeptnEvaluationDefinition + listKind: KeptnEvaluationDefinitionList + plural: keptnevaluationdefinitions + shortNames: + - ked + singular: keptnevaluationdefinition + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: KeptnEvaluationDefinition is the Schema for the keptnevaluationdefinitions + API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: KeptnEvaluationDefinitionSpec defines the desired state of + KeptnEvaluationDefinition + properties: + objectives: + items: + properties: + evaluationTarget: + type: string + name: + type: string + query: + type: string + required: + - evaluationTarget + - name + - query + type: object + type: array + source: + type: string + required: + - objectives + - source + type: object + status: + description: KeptnEvaluationDefinitionStatus defines the observed state + of KeptnEvaluationDefinition + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationproviders.yaml b/operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationproviders.yaml new file mode 100644 index 0000000000..0df639ec92 --- /dev/null +++ b/operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationproviders.yaml @@ -0,0 +1,58 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.9.2 + creationTimestamp: null + name: keptnevaluationproviders.lifecycle.keptn.sh +spec: + group: lifecycle.keptn.sh + names: + kind: KeptnEvaluationProvider + listKind: KeptnEvaluationProviderList + plural: keptnevaluationproviders + shortNames: + - kep + singular: keptnevaluationprovider + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: KeptnEvaluationProvider is the Schema for the keptnevaluationproviders + API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: KeptnEvaluationProviderSpec defines the desired state of + KeptnEvaluationProvider + properties: + secretName: + type: string + targetServer: + type: string + required: + - secretName + - targetServer + type: object + status: + description: KeptnEvaluationProviderStatus defines the observed state + of KeptnEvaluationProvider + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/operator/config/crd/kustomization.yaml b/operator/config/crd/kustomization.yaml index f53197345b..f723cdde44 100644 --- a/operator/config/crd/kustomization.yaml +++ b/operator/config/crd/kustomization.yaml @@ -8,6 +8,8 @@ resources: - bases/lifecycle.keptn.sh_keptnworkloads.yaml - bases/lifecycle.keptn.sh_keptnworkloadinstances.yaml - bases/lifecycle.keptn.sh_keptnappversions.yaml +- bases/lifecycle.keptn.sh_keptnevaluationdefinitions.yaml +- bases/lifecycle.keptn.sh_keptnevaluationproviders.yaml #+kubebuilder:scaffold:crdkustomizeresource patchesStrategicMerge: @@ -19,6 +21,8 @@ patchesStrategicMerge: #- patches/webhook_in_keptnworkloads.yaml #- patches/webhook_in_keptnworkloadinstances.yaml #- patches/webhook_in_keptnappversions.yaml +#- patches/webhook_in_keptnevaluationdefinitions.yaml +#- patches/webhook_in_keptnevaluationproviders.yaml #+kubebuilder:scaffold:crdkustomizewebhookpatch # [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. @@ -29,6 +33,8 @@ patchesStrategicMerge: #- patches/cainjection_in_keptnworkloads.yaml #- patches/cainjection_in_keptnworkloadinstances.yaml #- patches/cainjection_in_keptnappversions.yaml +#- patches/cainjection_in_keptnevaluationdefinitions.yaml +#- patches/cainjection_in_keptnevaluationproviders.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/operator/config/crd/patches/cainjection_in_keptnevaluationdefinitions.yaml b/operator/config/crd/patches/cainjection_in_keptnevaluationdefinitions.yaml new file mode 100644 index 0000000000..62f9f4f1a2 --- /dev/null +++ b/operator/config/crd/patches/cainjection_in_keptnevaluationdefinitions.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + name: keptnevaluationdefinitions.lifecycle.keptn.sh diff --git a/operator/config/crd/patches/cainjection_in_keptnevaluationproviders.yaml b/operator/config/crd/patches/cainjection_in_keptnevaluationproviders.yaml new file mode 100644 index 0000000000..18bb1b4b9b --- /dev/null +++ b/operator/config/crd/patches/cainjection_in_keptnevaluationproviders.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + name: keptnevaluationproviders.lifecycle.keptn.sh diff --git a/operator/config/crd/patches/webhook_in_keptnevaluationdefinitions.yaml b/operator/config/crd/patches/webhook_in_keptnevaluationdefinitions.yaml new file mode 100644 index 0000000000..191bd5fb27 --- /dev/null +++ b/operator/config/crd/patches/webhook_in_keptnevaluationdefinitions.yaml @@ -0,0 +1,16 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: keptnevaluationdefinitions.lifecycle.keptn.sh +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: system + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 diff --git a/operator/config/crd/patches/webhook_in_keptnevaluationproviders.yaml b/operator/config/crd/patches/webhook_in_keptnevaluationproviders.yaml new file mode 100644 index 0000000000..92a73cb347 --- /dev/null +++ b/operator/config/crd/patches/webhook_in_keptnevaluationproviders.yaml @@ -0,0 +1,16 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: keptnevaluationproviders.lifecycle.keptn.sh +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: system + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 diff --git a/operator/config/rbac/keptnevaluationdefinition_editor_role.yaml b/operator/config/rbac/keptnevaluationdefinition_editor_role.yaml new file mode 100644 index 0000000000..f8cd19a837 --- /dev/null +++ b/operator/config/rbac/keptnevaluationdefinition_editor_role.yaml @@ -0,0 +1,24 @@ +# permissions for end users to edit keptnevaluationdefinitions. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: keptnevaluationdefinition-editor-role +rules: +- apiGroups: + - lifecycle.keptn.sh + resources: + - keptnevaluationdefinitions + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - lifecycle.keptn.sh + resources: + - keptnevaluationdefinitions/status + verbs: + - get diff --git a/operator/config/rbac/keptnevaluationdefinition_viewer_role.yaml b/operator/config/rbac/keptnevaluationdefinition_viewer_role.yaml new file mode 100644 index 0000000000..5a06eb0529 --- /dev/null +++ b/operator/config/rbac/keptnevaluationdefinition_viewer_role.yaml @@ -0,0 +1,20 @@ +# permissions for end users to view keptnevaluationdefinitions. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: keptnevaluationdefinition-viewer-role +rules: +- apiGroups: + - lifecycle.keptn.sh + resources: + - keptnevaluationdefinitions + verbs: + - get + - list + - watch +- apiGroups: + - lifecycle.keptn.sh + resources: + - keptnevaluationdefinitions/status + verbs: + - get diff --git a/operator/config/rbac/keptnevaluationprovider_editor_role.yaml b/operator/config/rbac/keptnevaluationprovider_editor_role.yaml new file mode 100644 index 0000000000..fc63cc4892 --- /dev/null +++ b/operator/config/rbac/keptnevaluationprovider_editor_role.yaml @@ -0,0 +1,24 @@ +# permissions for end users to edit keptnevaluationproviders. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: keptnevaluationprovider-editor-role +rules: +- apiGroups: + - lifecycle.keptn.sh + resources: + - keptnevaluationproviders + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - lifecycle.keptn.sh + resources: + - keptnevaluationproviders/status + verbs: + - get diff --git a/operator/config/rbac/keptnevaluationprovider_viewer_role.yaml b/operator/config/rbac/keptnevaluationprovider_viewer_role.yaml new file mode 100644 index 0000000000..5f2472ca6f --- /dev/null +++ b/operator/config/rbac/keptnevaluationprovider_viewer_role.yaml @@ -0,0 +1,20 @@ +# permissions for end users to view keptnevaluationproviders. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: keptnevaluationprovider-viewer-role +rules: +- apiGroups: + - lifecycle.keptn.sh + resources: + - keptnevaluationproviders + verbs: + - get + - list + - watch +- apiGroups: + - lifecycle.keptn.sh + resources: + - keptnevaluationproviders/status + verbs: + - get diff --git a/operator/config/samples/lifecycle_v1alpha1_keptnevaluationdefinition.yaml b/operator/config/samples/lifecycle_v1alpha1_keptnevaluationdefinition.yaml new file mode 100644 index 0000000000..f72dcd9f7b --- /dev/null +++ b/operator/config/samples/lifecycle_v1alpha1_keptnevaluationdefinition.yaml @@ -0,0 +1,6 @@ +apiVersion: lifecycle.keptn.sh/v1alpha1 +kind: KeptnEvaluationDefinition +metadata: + name: keptnevaluationdefinition-sample +spec: + # TODO(user): Add fields here diff --git a/operator/config/samples/lifecycle_v1alpha1_keptnevaluationprovider.yaml b/operator/config/samples/lifecycle_v1alpha1_keptnevaluationprovider.yaml new file mode 100644 index 0000000000..3c167a398b --- /dev/null +++ b/operator/config/samples/lifecycle_v1alpha1_keptnevaluationprovider.yaml @@ -0,0 +1,6 @@ +apiVersion: lifecycle.keptn.sh/v1alpha1 +kind: KeptnEvaluationProvider +metadata: + name: keptnevaluationprovider-sample +spec: + # TODO(user): Add fields here