From 20d2faee7b9a36a50371854a3688b6421a70ebcb Mon Sep 17 00:00:00 2001 From: Dileep Ranganathan Date: Tue, 28 May 2019 15:02:54 -0700 Subject: Collectd Operator API Define spec for CollectdPlugin CRD. Create CRD and sample CR for CollectdPlugin and autogenerated code. Updated Makefile and deployment artifacts. Issue-ID: ONAPARC-461 Signed-off-by: Dileep Ranganathan Change-Id: I10bc198976b415efcfab01258342abbd2b4dfcc9 --- .../pkg/apis/onap/v1alpha1/collectdplugin_types.go | 56 ++++++++++ .../pkg/apis/onap/v1alpha1/doc.go | 4 + .../pkg/apis/onap/v1alpha1/register.go | 19 ++++ .../apis/onap/v1alpha1/zz_generated.deepcopy.go | 108 ++++++++++++++++++ .../pkg/apis/onap/v1alpha1/zz_generated.openapi.go | 124 +++++++++++++++++++++ 5 files changed, 311 insertions(+) create mode 100644 vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/collectdplugin_types.go create mode 100644 vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/doc.go create mode 100644 vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/register.go create mode 100644 vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/zz_generated.deepcopy.go create mode 100644 vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/zz_generated.openapi.go (limited to 'vnfs/DAaaS/collectd-operator/pkg/apis/onap') diff --git a/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/collectdplugin_types.go b/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/collectdplugin_types.go new file mode 100644 index 00000000..d29498e8 --- /dev/null +++ b/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/collectdplugin_types.go @@ -0,0 +1,56 @@ +package v1alpha1 + +import ( + corev1 "k8s.io/api/core/v1" + 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. + +// CollectdPluginSpec defines the desired state of CollectdPlugin +// +k8s:openapi-gen=true +type CollectdPluginSpec struct { + // INSERT ADDITIONAL SPEC FIELDS - desired 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 + PluginName string `json:"pluginName"` + PluginConf string `json:"pluginConf"` +} + +// 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"` + CollectdConf corev1.ConfigMap `json:"collectdConf"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// CollectdPlugin is the Schema for the collectdplugins API +// +k8s:openapi-gen=true +// +kubebuilder:subresource:status +type CollectdPlugin struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec CollectdPluginSpec `json:"spec,omitempty"` + Status CollectdPluginStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// CollectdPluginList contains a list of CollectdPlugin +type CollectdPluginList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []CollectdPlugin `json:"items"` +} + +func init() { + SchemeBuilder.Register(&CollectdPlugin{}, &CollectdPluginList{}) +} diff --git a/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/doc.go b/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/doc.go new file mode 100644 index 00000000..29b3493e --- /dev/null +++ b/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/doc.go @@ -0,0 +1,4 @@ +// Package v1alpha1 contains API Schema definitions for the onap v1alpha1 API group +// +k8s:deepcopy-gen=package,register +// +groupName=onap.org +package v1alpha1 diff --git a/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/register.go b/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/register.go new file mode 100644 index 00000000..c670eea4 --- /dev/null +++ b/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/register.go @@ -0,0 +1,19 @@ +// NOTE: Boilerplate only. Ignore this file. + +// Package v1alpha1 contains API Schema definitions for the onap v1alpha1 API group +// +k8s:deepcopy-gen=package,register +// +groupName=onap.org +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/runtime/scheme" +) + +var ( + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: "onap.org", Version: "v1alpha1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} +) diff --git a/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/zz_generated.deepcopy.go b/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 00000000..0fe1dcc3 --- /dev/null +++ b/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,108 @@ +// +build !ignore_autogenerated + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CollectdPlugin) DeepCopyInto(out *CollectdPlugin) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CollectdPlugin. +func (in *CollectdPlugin) DeepCopy() *CollectdPlugin { + if in == nil { + return nil + } + out := new(CollectdPlugin) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CollectdPlugin) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CollectdPluginList) DeepCopyInto(out *CollectdPluginList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CollectdPlugin, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CollectdPluginList. +func (in *CollectdPluginList) DeepCopy() *CollectdPluginList { + if in == nil { + return nil + } + out := new(CollectdPluginList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CollectdPluginList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CollectdPluginSpec) DeepCopyInto(out *CollectdPluginSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CollectdPluginSpec. +func (in *CollectdPluginSpec) DeepCopy() *CollectdPluginSpec { + if in == nil { + return nil + } + out := new(CollectdPluginSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CollectdPluginStatus) DeepCopyInto(out *CollectdPluginStatus) { + *out = *in + if in.CollectdAgents != nil { + in, out := &in.CollectdAgents, &out.CollectdAgents + *out = make([]string, len(*in)) + copy(*out, *in) + } + in.CollectdConf.DeepCopyInto(&out.CollectdConf) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CollectdPluginStatus. +func (in *CollectdPluginStatus) DeepCopy() *CollectdPluginStatus { + if in == nil { + return nil + } + out := new(CollectdPluginStatus) + in.DeepCopyInto(out) + return out +} diff --git a/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/zz_generated.openapi.go b/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/zz_generated.openapi.go new file mode 100644 index 00000000..a1d401b7 --- /dev/null +++ b/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1/zz_generated.openapi.go @@ -0,0 +1,124 @@ +// +build !ignore_autogenerated + +// Code generated by openapi-gen. DO NOT EDIT. + +// This file was autogenerated by openapi-gen. Do not edit it manually! + +package v1alpha1 + +import ( + spec "github.com/go-openapi/spec" + common "k8s.io/kube-openapi/pkg/common" +) + +func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { + return map[string]common.OpenAPIDefinition{ + "demo/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1.CollectdPlugin": schema_pkg_apis_onap_v1alpha1_CollectdPlugin(ref), + "demo/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1.CollectdPluginSpec": schema_pkg_apis_onap_v1alpha1_CollectdPluginSpec(ref), + "demo/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1.CollectdPluginStatus": schema_pkg_apis_onap_v1alpha1_CollectdPluginStatus(ref), + } +} + +func schema_pkg_apis_onap_v1alpha1_CollectdPlugin(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CollectdPlugin is the Schema for the collectdplugins API", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Ref: ref("demo/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1.CollectdPluginSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Ref: ref("demo/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1.CollectdPluginStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "demo/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1.CollectdPluginSpec", "demo/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1.CollectdPluginStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_onap_v1alpha1_CollectdPluginSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CollectdPluginSpec defines the desired state of CollectdPlugin", + Properties: map[string]spec.Schema{ + "pluginName": { + SchemaProps: spec.SchemaProps{ + Description: "INSERT ADDITIONAL SPEC FIELDS - desired 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", + Type: []string{"string"}, + Format: "", + }, + }, + "pluginConf": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"pluginName", "pluginConf"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_onap_v1alpha1_CollectdPluginStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CollectdPluginStatus defines the observed state of CollectdPlugin", + 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", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "collectdConf": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.ConfigMap"), + }, + }, + }, + Required: []string{"collectdAgents", "collectdConf"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ConfigMap"}, + } +} -- cgit 1.2.3-korg