forked from keptn/lifecycle-toolkit
-
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.
feat(metrics-operator): add Analysis CRD (keptn#1839)
Signed-off-by: realanna <anna.reale@dynatrace.com>
- Loading branch information
1 parent
512a8ca
commit 200253e
Showing
16 changed files
with
568 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: analyses.metrics.keptn.sh | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.12.1 | ||
labels: | ||
app.kubernetes.io/part-of: keptn-lifecycle-toolkit | ||
crdGroup: metrics.keptn.sh | ||
keptn.sh/inject-cert: "true" | ||
{{- include "chart.labels" . | nindent 4 }} | ||
spec: | ||
group: metrics.keptn.sh | ||
names: | ||
kind: Analysis | ||
listKind: AnalysisList | ||
plural: analyses | ||
singular: analysis | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha3 | ||
schema: | ||
openAPIV3Schema: | ||
description: Analysis is the Schema for the analyses 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: AnalysisSpec defines the desired state of Analysis | ||
properties: | ||
analysisDefinition: | ||
description: AnalysisDefinition refers to the AnalysisDefinition, a | ||
CRD that stores the AnalysisValuesTemplates | ||
properties: | ||
name: | ||
description: Name of the AnalysisDefinition | ||
type: string | ||
required: | ||
- name | ||
type: object | ||
args: | ||
additionalProperties: | ||
type: string | ||
description: Args corresponds to a map of key/value pairs that can be | ||
used to substitute placeholders in the AnalysisValueTemplate query. | ||
The placeholder must be the capitalized version of the key; i.e. for | ||
args foo:bar the query could be "query:percentile(95)?scope=tag(my_foo_label:{{.Foo}})". | ||
type: object | ||
timeframe: | ||
description: Timeframe specifies the range for the corresponding query | ||
in the AnalysisValueTemplate | ||
properties: | ||
from: | ||
description: From is the time of start for the query, this field | ||
follows RFC3339 time format | ||
format: date-time | ||
type: string | ||
to: | ||
description: To is the time of end for the query, this field follows | ||
RFC3339 time format | ||
format: date-time | ||
type: string | ||
required: | ||
- from | ||
- to | ||
type: object | ||
required: | ||
- analysisDefinition | ||
- timeframe | ||
type: object | ||
status: | ||
type: string | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
Copyright 2023. | ||
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 v1alpha3 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// AnalysisSpec defines the desired state of Analysis | ||
type AnalysisSpec struct { | ||
//Timeframe specifies the range for the corresponding query in the AnalysisValueTemplate | ||
Timeframe `json:"timeframe"` | ||
// Args corresponds to a map of key/value pairs that can be used to substitute placeholders in the AnalysisValueTemplate query. The placeholder must be the capitalized version of the key; i.e. for args foo:bar the query could be "query:percentile(95)?scope=tag(my_foo_label:{{.Foo}})". | ||
Args map[string]string `json:"args,omitempty"` | ||
// AnalysisDefinition refers to the AnalysisDefinition, a CRD that stores the AnalysisValuesTemplates | ||
AnalysisDefinition ObjectReference `json:"analysisDefinition"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
//+kubebuilder:subresource:status | ||
//+kubebuilder:printcolumn:name="AnalysisDefinition",type=string,JSONPath=.spec.analysisDefinition.name | ||
|
||
// Analysis is the Schema for the analyses API | ||
type Analysis struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec AnalysisSpec `json:"spec,omitempty"` | ||
Status string `json:"status,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// AnalysisList contains a list of Analysis | ||
type AnalysisList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []Analysis `json:"items"` | ||
} | ||
|
||
type Timeframe struct { | ||
// From is the time of start for the query, this field follows RFC3339 time format | ||
From metav1.Time `json:"from"` | ||
// To is the time of end for the query, this field follows RFC3339 time format | ||
To metav1.Time `json:"to"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&Analysis{}, &AnalysisList{}) | ||
} |
Oops, something went wrong.