Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(metrics-operator): add AnalysisValueTemplate CRD #1822

Merged
merged 16 commits into from
Aug 9, 2023
Merged
52 changes: 52 additions & 0 deletions docs/content/en/docs/crd-ref/metrics/v1alpha3/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Package v1alpha3 contains API Schema definitions for the metrics v1alpha3 API gr
- [AnalysisDefinition](#analysisdefinition)
- [AnalysisDefinitionList](#analysisdefinitionlist)
- [AnalysisList](#analysislist)
- [AnalysisValueTemplate](#analysisvaluetemplate)
- [AnalysisValueTemplateList](#analysisvaluetemplatelist)
- [KeptnMetric](#keptnmetric)
- [KeptnMetricList](#keptnmetriclist)
- [KeptnMetricsProvider](#keptnmetricsprovider)
Expand Down Expand Up @@ -123,6 +125,55 @@ _Appears in:_
| `analysisDefinition` _[ObjectReference](#objectreference)_ | AnalysisDefinition refers to the AnalysisDefinition, a CRD that stores the AnalysisValuesTemplates |


#### AnalysisValueTemplate



AnalysisValueTemplate is the Schema for the analysisvaluetemplates API

_Appears in:_
- [AnalysisValueTemplateList](#analysisvaluetemplatelist)

| Field | Description |
| --- | --- |
| `apiVersion` _string_ | `metrics.keptn.sh/v1alpha3`
| `kind` _string_ | `AnalysisValueTemplate`
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. |
| `spec` _[AnalysisValueTemplateSpec](#analysisvaluetemplatespec)_ | Spec contains the specification for the AnalysisValueTemplate |
| `status` _string_ | unused field |


#### AnalysisValueTemplateList



AnalysisValueTemplateList contains a list of AnalysisValueTemplate



| Field | Description |
| --- | --- |
| `apiVersion` _string_ | `metrics.keptn.sh/v1alpha3`
| `kind` _string_ | `AnalysisValueTemplateList`
| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. |
| `items` _[AnalysisValueTemplate](#analysisvaluetemplate) array_ | |


#### AnalysisValueTemplateSpec



AnalysisValueTemplateSpec defines the desired state of AnalysisValueTemplate

_Appears in:_
- [AnalysisValueTemplate](#analysisvaluetemplate)

| Field | Description |
| --- | --- |
| `provider` _[ProviderRef](#providerref)_ | Provider represents the provider object |
| `query` _string_ | Query represents the query to be run. It can include placeholders that are defined using the go template syntax |


#### KeptnMetric


Expand Down Expand Up @@ -313,6 +364,7 @@ _Appears in:_
ProviderRef represents the provider object

_Appears in:_
- [AnalysisValueTemplateSpec](#analysisvaluetemplatespec)
- [KeptnMetricSpec](#keptnmetricspec)

| Field | Description |
Expand Down
74 changes: 74 additions & 0 deletions helm/chart/templates/analysisvaluetemplate-crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: analysisvaluetemplates.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: AnalysisValueTemplate
listKind: AnalysisValueTemplateList
plural: analysisvaluetemplates
singular: analysisvaluetemplate
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .spec.provider.name
name: Provider
type: string
- jsonPath: .spec.query
name: Query
type: string
name: v1alpha3
schema:
openAPIV3Schema:
description: AnalysisValueTemplate is the Schema for the analysisvaluetemplates
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: Spec contains the specification for the AnalysisValueTemplate
properties:
provider:
description: Provider represents the provider object
properties:
name:
description: Name of the provider
type: string
required:
- name
type: object
query:
description: Query represents the query to be run. It can include
placeholders that are defined using the go template syntax
type: string
required:
- provider
- query
type: object
status:
description: unused field
type: string
type: object
served: true
storage: true
subresources:
status: {}
8 changes: 8 additions & 0 deletions metrics-operator/PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,12 @@ resources:
kind: Analysis
path: github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha3
version: v1alpha3
- api:
crdVersion: v1
namespaced: true
domain: keptn.sh
group: metrics
kind: AnalysisValueTemplate
path: github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha3
version: v1alpha3
version: "3"
59 changes: 59 additions & 0 deletions metrics-operator/api/v1alpha3/analysisvaluetemplate_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
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"
)

// AnalysisValueTemplateSpec defines the desired state of AnalysisValueTemplate
type AnalysisValueTemplateSpec struct {
// Provider represents the provider object
Provider ProviderRef `json:"provider"`
bacherfl marked this conversation as resolved.
Show resolved Hide resolved
// Query represents the query to be run. It can include placeholders that are defined using the go template
// syntax
bacherfl marked this conversation as resolved.
Show resolved Hide resolved
Query string `json:"query"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Provider",type=string,JSONPath=`.spec.provider.name`
// +kubebuilder:printcolumn:name="Query",type=string,JSONPath=`.spec.query`
bacherfl marked this conversation as resolved.
Show resolved Hide resolved

// AnalysisValueTemplate is the Schema for the analysisvaluetemplates API
type AnalysisValueTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// Spec contains the specification for the AnalysisValueTemplate
Spec AnalysisValueTemplateSpec `json:"spec,omitempty"`
// unused field
Status string `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// AnalysisValueTemplateList contains a list of AnalysisValueTemplate
type AnalysisValueTemplateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []AnalysisValueTemplate `json:"items"`
}

func init() {
SchemeBuilder.Register(&AnalysisValueTemplate{}, &AnalysisValueTemplateList{})
}
74 changes: 74 additions & 0 deletions metrics-operator/api/v1alpha3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.1
name: analysisvaluetemplates.metrics.keptn.sh
spec:
group: metrics.keptn.sh
names:
kind: AnalysisValueTemplate
listKind: AnalysisValueTemplateList
plural: analysisvaluetemplates
singular: analysisvaluetemplate
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .spec.provider.name
name: Provider
type: string
- jsonPath: .spec.query
name: Query
type: string
name: v1alpha3
schema:
openAPIV3Schema:
description: AnalysisValueTemplate is the Schema for the analysisvaluetemplates
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: Spec contains the specification for the AnalysisValueTemplate
properties:
provider:
description: Provider represents the provider object
properties:
name:
description: Name of the provider
type: string
required:
- name
type: object
query:
description: Query represents the query to be run. It can include
placeholders that are defined using the go template syntax
type: string
required:
- provider
- query
type: object
status:
description: unused field
type: string
type: object
served: true
storage: true
subresources:
status: {}
Loading