From a4a006a7b3f687310e02975d99bf452215d441a6 Mon Sep 17 00:00:00 2001 From: Dileep Ranganathan Date: Fri, 19 Jul 2019 19:13:55 -0700 Subject: Added Status Handler for Collectd Operator Added status handler for secodary resources like Daemonset updates Issue-ID: ONAPARC-461 Signed-off-by: Dileep Ranganathan Change-Id: I8b5cac7dde9afe355be9468fc5c925b658c78fc6 --- .../pkg/apis/onap/v1alpha1/collectdplugin_types.go | 21 +++++++++++++++++---- .../pkg/apis/onap/v1alpha1/zz_generated.openapi.go | 10 ++++++++-- 2 files changed, 25 insertions(+), 6 deletions(-) (limited to 'vnfs/DAaaS/microservices/collectd-operator/pkg/apis/onap/v1alpha1') diff --git a/vnfs/DAaaS/microservices/collectd-operator/pkg/apis/onap/v1alpha1/collectdplugin_types.go b/vnfs/DAaaS/microservices/collectd-operator/pkg/apis/onap/v1alpha1/collectdplugin_types.go index 5f1c0a83..065f14c4 100644 --- a/vnfs/DAaaS/microservices/collectd-operator/pkg/apis/onap/v1alpha1/collectdplugin_types.go +++ b/vnfs/DAaaS/microservices/collectd-operator/pkg/apis/onap/v1alpha1/collectdplugin_types.go @@ -4,6 +4,20 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) + +const ( + //Initial indicates the initial status of CollectdPlugin + Initial = "" + //Created indicates the status of CollectdPlugin after first reconcile + Created = "Created" + //Enabled indicates the status of CollectdPlugin after all the pods are reloaded + Enabled = "Enabled" + //Deleting state + Deleting = "Deleting" + //Deprecated state when a plugin with same name is created. Old plugin gets deprecated and deleted eventually. + Deprecated = "Deprecated" +) + // 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. @@ -20,11 +34,10 @@ type CollectdPluginSpec struct { // CollectdPluginStatus defines the observed state of CollectdPlugin // +k8s:openapi-gen=true type CollectdPluginStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file - // Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html // CollectdAgents are the collectd pods in the Daemonset - CollectdAgents []string `json:"collectdAgents"` + // Status can be one of "", Created, Deleting, Applied, Deprecated + CollectdAgents []string `json:"collectdAgents,omitempty"` + Status string `json:"status"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vnfs/DAaaS/microservices/collectd-operator/pkg/apis/onap/v1alpha1/zz_generated.openapi.go b/vnfs/DAaaS/microservices/collectd-operator/pkg/apis/onap/v1alpha1/zz_generated.openapi.go index d5821249..c58baaaf 100644 --- a/vnfs/DAaaS/microservices/collectd-operator/pkg/apis/onap/v1alpha1/zz_generated.openapi.go +++ b/vnfs/DAaaS/microservices/collectd-operator/pkg/apis/onap/v1alpha1/zz_generated.openapi.go @@ -97,7 +97,7 @@ func schema_pkg_apis_onap_v1alpha1_CollectdPluginStatus(ref common.ReferenceCall Properties: map[string]spec.Schema{ "collectdAgents": { SchemaProps: spec.SchemaProps{ - Description: "INSERT ADDITIONAL STATUS FIELD - define observed state of cluster Important: Run \"operator-sdk generate k8s\" to regenerate code after modifying this file Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html CollectdAgents are the collectd pods in the Daemonset", + Description: "CollectdAgents are the collectd pods in the Daemonset Status can be one of \"\", Created, Deleting, Applied, Deprecated", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -109,8 +109,14 @@ func schema_pkg_apis_onap_v1alpha1_CollectdPluginStatus(ref common.ReferenceCall }, }, }, + "status": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, }, - Required: []string{"collectdAgents"}, + Required: []string{"status"}, }, }, Dependencies: []string{}, -- cgit 1.2.3-korg