Collectd Operator Unit Tests
[demo.git] / vnfs / DAaaS / microservices / collectd-operator / pkg / apis / onap / v1alpha1 / collectdplugin_types.go
1 /*
2 Copyright 2019 Intel Corporation.
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6     http://www.apache.org/licenses/LICENSE-2.0
7 Unless required by applicable law or agreed to in writing, software
8 distributed under the License is distributed on an "AS IS" BASIS,
9 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 See the License for the specific language governing permissions and
11 limitations under the License.
12 */
13
14 package v1alpha1
15
16 import (
17         metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
18 )
19
20 const (
21         //Initial indicates the initial status of CollectdPlugin
22         Initial = ""
23         //Created indicates the status of CollectdPlugin after first reconcile
24         Created = "Created"
25         //Enabled indicates the status of CollectdPlugin after all the pods are reloaded
26         Enabled = "Enabled"
27         //Deleting state
28         Deleting = "Deleting"
29         //Deprecated state when a plugin with same name is created. Old plugin gets deprecated and deleted eventually.
30         Deprecated = "Deprecated"
31 )
32
33 // EDIT THIS FILE!  THIS IS SCAFFOLDING FOR YOU TO OWN!
34 // NOTE: json tags are required.  Any new fields you add must have json tags for the fields to be serialized.
35
36 // CollectdPluginSpec defines the desired state of CollectdPlugin
37 // +k8s:openapi-gen=true
38 type CollectdPluginSpec struct {
39         // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
40         // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
41         // Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html
42         PluginName string `json:"pluginName"`
43         PluginConf string `json:"pluginConf"`
44 }
45
46 // CollectdPluginStatus defines the observed state of CollectdPlugin
47 // +k8s:openapi-gen=true
48 type CollectdPluginStatus struct {
49         // CollectdAgents are the collectd pods in the Daemonset
50         // Status can be one of "", Created, Deleting, Applied, Deprecated
51         CollectdAgents []string `json:"collectdAgents,omitempty"`
52         Status         string   `json:"status"`
53 }
54
55 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
56
57 // CollectdPlugin is the Schema for the collectdplugins API
58 // +k8s:openapi-gen=true
59 // +kubebuilder:subresource:status
60 type CollectdPlugin struct {
61         metav1.TypeMeta   `json:",inline"`
62         metav1.ObjectMeta `json:"metadata,omitempty"`
63
64         Spec   CollectdPluginSpec   `json:"spec,omitempty"`
65         Status CollectdPluginStatus `json:"status,omitempty"`
66 }
67
68 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
69
70 // CollectdPluginList contains a list of CollectdPlugin
71 type CollectdPluginList struct {
72         metav1.TypeMeta `json:",inline"`
73         metav1.ListMeta `json:"metadata,omitempty"`
74         Items           []CollectdPlugin `json:"items"`
75 }
76
77 func init() {
78         SchemeBuilder.Register(&CollectdPlugin{}, &CollectdPluginList{})
79 }