Skip to content

Commit

Permalink
add first boilerplate code version of metrics v1alpha3
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Wiesinger <[email protected]>
  • Loading branch information
mowies committed Apr 17, 2023
1 parent 99ef223 commit b3d4309
Show file tree
Hide file tree
Showing 10 changed files with 497 additions and 10 deletions.
18 changes: 18 additions & 0 deletions metrics-operator/PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,22 @@ resources:
kind: KeptnMetric
path: github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: keptn.sh
group: metrics
kind: KeptnMetric
path: github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha3
version: v1alpha3
- api:
crdVersion: v1
namespaced: true
controller: true
domain: keptn.sh
group: metrics
kind: KeptnMetricsProvider
path: github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha3
version: v1alpha3
version: "3"
36 changes: 36 additions & 0 deletions metrics-operator/api/v1alpha3/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
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 contains API Schema definitions for the metrics v1alpha3 API group
// +kubebuilder:object:generate=true
// +groupName=metrics.keptn.sh
package v1alpha3

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "metrics.keptn.sh", Version: "v1alpha3"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)
64 changes: 64 additions & 0 deletions metrics-operator/api/v1alpha3/keptnmetric_types.go
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"
)

// 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.

// KeptnMetricSpec defines the desired state of KeptnMetric
type KeptnMetricSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of KeptnMetric. Edit keptnmetric_types.go to remove/update
Foo string `json:"foo,omitempty"`
}

// KeptnMetricStatus defines the observed state of KeptnMetric
type KeptnMetricStatus 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

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

Spec KeptnMetricSpec `json:"spec,omitempty"`
Status KeptnMetricStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

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

func init() {
SchemeBuilder.Register(&KeptnMetric{}, &KeptnMetricList{})
}
64 changes: 64 additions & 0 deletions metrics-operator/api/v1alpha3/keptnmetricsprovider_types.go
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"
)

// 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.

// KeptnMetricsProviderSpec defines the desired state of KeptnMetricsProvider
type KeptnMetricsProviderSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of KeptnMetricsProvider. Edit keptnmetricsprovider_types.go to remove/update
Foo string `json:"foo,omitempty"`
}

// KeptnMetricsProviderStatus defines the observed state of KeptnMetricsProvider
type KeptnMetricsProviderStatus 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

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

Spec KeptnMetricsProviderSpec `json:"spec,omitempty"`
Status KeptnMetricsProviderStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

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

func init() {
SchemeBuilder.Register(&KeptnMetricsProvider{}, &KeptnMetricsProviderList{})
}
204 changes: 204 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.

Loading

0 comments on commit b3d4309

Please sign in to comment.