Added Status Handler for Collectd Operator
[demo.git] / vnfs / DAaaS / microservices / collectd-operator / pkg / apis / onap / v1alpha1 / collectdplugin_types.go
1 package v1alpha1
2
3 import (
4         metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5 )
6
7
8 const (
9         //Initial indicates the initial status of CollectdPlugin
10         Initial         = ""
11         //Created indicates the status of CollectdPlugin after first reconcile
12         Created     = "Created"
13         //Enabled indicates the status of CollectdPlugin after all the pods are reloaded
14         Enabled     = "Enabled"
15         //Deleting state
16         Deleting        = "Deleting"
17         //Deprecated state when a plugin with same name is created. Old plugin gets deprecated and deleted eventually.
18         Deprecated      = "Deprecated"
19 )
20
21 // EDIT THIS FILE!  THIS IS SCAFFOLDING FOR YOU TO OWN!
22 // NOTE: json tags are required.  Any new fields you add must have json tags for the fields to be serialized.
23
24 // CollectdPluginSpec defines the desired state of CollectdPlugin
25 // +k8s:openapi-gen=true
26 type CollectdPluginSpec struct {
27         // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
28         // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
29         // Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html
30         PluginName string `json:"pluginName"`
31         PluginConf string `json:"pluginConf"`
32 }
33
34 // CollectdPluginStatus defines the observed state of CollectdPlugin
35 // +k8s:openapi-gen=true
36 type CollectdPluginStatus struct {
37         // CollectdAgents are the collectd pods in the Daemonset
38         // Status can be one of "", Created, Deleting, Applied, Deprecated
39         CollectdAgents []string `json:"collectdAgents,omitempty"`
40         Status         string   `json:"status"`
41 }
42
43 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
44
45 // CollectdPlugin is the Schema for the collectdplugins API
46 // +k8s:openapi-gen=true
47 // +kubebuilder:subresource:status
48 type CollectdPlugin struct {
49         metav1.TypeMeta   `json:",inline"`
50         metav1.ObjectMeta `json:"metadata,omitempty"`
51
52         Spec   CollectdPluginSpec   `json:"spec,omitempty"`
53         Status CollectdPluginStatus `json:"status,omitempty"`
54 }
55
56 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
57
58 // CollectdPluginList contains a list of CollectdPlugin
59 type CollectdPluginList struct {
60         metav1.TypeMeta `json:",inline"`
61         metav1.ListMeta `json:"metadata,omitempty"`
62         Items           []CollectdPlugin `json:"items"`
63 }
64
65 func init() {
66         SchemeBuilder.Register(&CollectdPlugin{}, &CollectdPluginList{})
67 }