diff options
author | Dileep Ranganathan <dileep.ranganathan@intel.com> | 2019-05-28 15:02:54 -0700 |
---|---|---|
committer | Gary Wu <gwu@futurewei.com> | 2019-05-30 20:40:06 +0000 |
commit | 20d2faee7b9a36a50371854a3688b6421a70ebcb (patch) | |
tree | 0aaf24c7f69e1efe3190ddd146e3d26ce234c6b0 | |
parent | d3d776d1260f6ba6dbaa483399ed8e2889d72a59 (diff) |
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 <dileep.ranganathan@intel.com>
Change-Id: I10bc198976b415efcfab01258342abbd2b4dfcc9
14 files changed, 442 insertions, 22 deletions
diff --git a/vnfs/DAaaS/collectd-operator/Makefile b/vnfs/DAaaS/collectd-operator/Makefile index 3471b9cc..2d9a4cf6 100644 --- a/vnfs/DAaaS/collectd-operator/Makefile +++ b/vnfs/DAaaS/collectd-operator/Makefile @@ -19,6 +19,8 @@ export GO111MODULE=on all: clean GOOS=linux GOARCH=amd64 + operator-sdk generate k8s --verbose + operator-sdk generate openapi --verbose #@go build -o ${COP} -gcflags all=-trimpath=${GOPATH} -asmflags all=-trimpath=${GOPATH} -mod=vendor demo/vnfs/DAaaS/collectd-operator/cmd/manager @operator-sdk build ${IMAGE_NAME} --verbose @@ -41,9 +43,6 @@ format: clean: @echo "Deleting the collectd-operator binary" @rm -rf ${PWD}/build/_output/bin/collectd-operator - if [ -x "${OUTDIR}" ]; then \ - rm -r ${OUTDIR}; \ - fi \ @echo "Deleting the collectd-operator docker image" @docker rmi ${IMAGE_NAME} diff --git a/vnfs/DAaaS/collectd-operator/deploy/crds/onap_v1alpha1_collectdplugin_cr.yaml b/vnfs/DAaaS/collectd-operator/deploy/crds/onap_v1alpha1_collectdplugin_cr.yaml new file mode 100644 index 00000000..a4684293 --- /dev/null +++ b/vnfs/DAaaS/collectd-operator/deploy/crds/onap_v1alpha1_collectdplugin_cr.yaml @@ -0,0 +1,10 @@ +apiVersion: onap.org/v1alpha1 +kind: CollectdPlugin +metadata: + name: example-collectdplugin +spec: + # Add fields here + pluginName: "cpu" + pluginConf: | + <Plugin "cpu"> + </Plugin> diff --git a/vnfs/DAaaS/collectd-operator/deploy/crds/onap_v1alpha1_collectdplugin_crd.yaml b/vnfs/DAaaS/collectd-operator/deploy/crds/onap_v1alpha1_collectdplugin_crd.yaml new file mode 100644 index 00000000..9b944f48 --- /dev/null +++ b/vnfs/DAaaS/collectd-operator/deploy/crds/onap_v1alpha1_collectdplugin_crd.yaml @@ -0,0 +1,65 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: collectdplugins.onap.org +spec: + group: onap.org + names: + kind: CollectdPlugin + listKind: CollectdPluginList + plural: collectdplugins + singular: collectdplugin + scope: Namespaced + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + 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 + kind: + 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 + metadata: + type: object + spec: + properties: + pluginConf: + type: string + pluginName: + 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 + required: + - pluginName + - pluginConf + type: object + status: + properties: + collectdAgents: + 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' + items: + type: string + type: array + collectdConf: + type: object + required: + - collectdAgents + - collectdConf + type: object + version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true diff --git a/vnfs/DAaaS/collectd-operator/deploy/operator.yaml b/vnfs/DAaaS/collectd-operator/deploy/operator.yaml index 14f7d2aa..108719ab 100644 --- a/vnfs/DAaaS/collectd-operator/deploy/operator.yaml +++ b/vnfs/DAaaS/collectd-operator/deploy/operator.yaml @@ -16,15 +16,13 @@ spec: containers: - name: collectd-operator # Replace this with the built image name - image: REPLACE_IMAGE + image: dcr.cluster.local:31976/collectd-operator:latest command: - collectd-operator imagePullPolicy: Always env: - name: WATCH_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace + value: "" - name: POD_NAME valueFrom: fieldRef: diff --git a/vnfs/DAaaS/collectd-operator/deploy/role.yaml b/vnfs/DAaaS/collectd-operator/deploy/role.yaml index c748132c..d7aba353 100644 --- a/vnfs/DAaaS/collectd-operator/deploy/role.yaml +++ b/vnfs/DAaaS/collectd-operator/deploy/role.yaml @@ -1,6 +1,7 @@ -kind: Role apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole metadata: + creationTimestamp: null name: collectd-operator rules: - apiGroups: @@ -14,7 +15,7 @@ rules: - configmaps - secrets verbs: - - "*" + - '*' - apiGroups: - apps resources: @@ -23,19 +24,25 @@ rules: - replicasets - statefulsets verbs: - - "*" + - '*' - apiGroups: - monitoring.coreos.com resources: - servicemonitors verbs: - - "get" - - "create" + - get + - create - apiGroups: - apps - resources: - - deployments/finalizers resourceNames: - collectd-operator + resources: + - deployments/finalizers + verbs: + - update +- apiGroups: + - onap.org + resources: + - '*' verbs: - - "update" + - '*' diff --git a/vnfs/DAaaS/collectd-operator/deploy/role_binding.yaml b/vnfs/DAaaS/collectd-operator/deploy/role_binding.yaml index e24a9511..5f425081 100644 --- a/vnfs/DAaaS/collectd-operator/deploy/role_binding.yaml +++ b/vnfs/DAaaS/collectd-operator/deploy/role_binding.yaml @@ -1,4 +1,4 @@ -kind: RoleBinding +kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: collectd-operator @@ -6,6 +6,6 @@ subjects: - kind: ServiceAccount name: collectd-operator roleRef: - kind: Role + kind: ClusterRole name: collectd-operator apiGroup: rbac.authorization.k8s.io diff --git a/vnfs/DAaaS/collectd-operator/go.mod b/vnfs/DAaaS/collectd-operator/go.mod index 082beadd..3adbdc2b 100644 --- a/vnfs/DAaaS/collectd-operator/go.mod +++ b/vnfs/DAaaS/collectd-operator/go.mod @@ -9,11 +9,10 @@ require ( github.com/emicklei/go-restful v2.8.1+incompatible // indirect github.com/go-logr/logr v0.1.0 // indirect github.com/go-logr/zapr v0.1.0 // indirect - github.com/go-openapi/spec v0.18.0 // indirect + github.com/go-openapi/spec v0.19.0 github.com/golang/groupcache v0.0.0-20180924190550-6f2cf27854a4 // indirect github.com/golang/mock v1.2.0 // indirect github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c // indirect - github.com/google/uuid v1.0.0 // indirect github.com/googleapis/gnostic v0.2.0 // indirect github.com/gophercloud/gophercloud v0.0.0-20190318015731-ff9851476e98 // indirect github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect @@ -28,13 +27,15 @@ require ( go.uber.org/multierr v1.1.0 // indirect go.uber.org/zap v1.9.1 // indirect golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 // indirect - k8s.io/apimachinery v0.0.0-20190221213512-86fb29eff628 - k8s.io/client-go v2.0.0-alpha.0.0.20181126152608-d082d5923d3c+incompatible + k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b + k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d + k8s.io/client-go v11.0.0+incompatible k8s.io/code-generator v0.0.0-20180823001027-3dcf91f64f63 k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6 - k8s.io/kube-openapi v0.0.0-20180711000925-0cf8f7e6ed1d + k8s.io/kube-openapi v0.0.0-20190510232812-a01b7d5d6c22 sigs.k8s.io/controller-runtime v0.1.10 sigs.k8s.io/controller-tools v0.1.10 + sigs.k8s.io/kind v0.3.0 // indirect sigs.k8s.io/testing_frameworks v0.1.0 // indirect ) diff --git a/vnfs/DAaaS/collectd-operator/go.sum b/vnfs/DAaaS/collectd-operator/go.sum index 17550f00..ea13f2aa 100644 --- a/vnfs/DAaaS/collectd-operator/go.sum +++ b/vnfs/DAaaS/collectd-operator/go.sum @@ -36,6 +36,8 @@ github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFP github.com/emicklei/go-restful v2.8.1+incompatible h1:AyDqLHbJ1quqbWr/OWDw+PlIP8ZFoTmYrGYaxzrLbNg= github.com/emicklei/go-restful v2.8.1+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/evanphx/json-patch v4.0.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v4.2.0+incompatible h1:fUDGZCv/7iAN7u0puUVhvKCcsR6vRfwrJatElLBEf0I= +github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -51,6 +53,8 @@ github.com/go-openapi/jsonreference v0.17.0 h1:yJW3HCkTHg7NOA+gZ83IPHzUSnUzGXhGm github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/spec v0.18.0 h1:aIjeyG5mo5/FrvDkpKKEGZPmF9MPHahS72mzfVqeQXQ= github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= +github.com/go-openapi/spec v0.19.0 h1:A4SZ6IWh3lnjH0rG0Z5lkxazMGBECtrZcbyYQi+64k4= +github.com/go-openapi/spec v0.19.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/swag v0.17.0 h1:iqrgMg7Q7SvtbWLlltPrkMs0UBJI6oTSs79JFRUi880= github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -77,8 +81,12 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf h1:+RRA9JqSOZFfKrOeqr2z77+8R2RKyh8PG66dcu1V0ck= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gnostic v0.2.0 h1:l6N3VoaVzTncYYW+9yOz2LJJammFZGBO13sqgEhpy9g= github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/gophercloud/gophercloud v0.0.0-20190318015731-ff9851476e98 h1:yVCQl8LUAduuT+xe+Wo+kq1lXQtMSPo+4EoOD9AIY0k= @@ -153,8 +161,11 @@ github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.2.2 h1:J7U/N7eRtzjhs26d6GqMh2HBuXP8/Z64Densiiieafo= github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -194,6 +205,8 @@ golang.org/x/net v0.0.0-20190206173232-65e2d4e15006/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190514140710-3ec191127204 h1:4yG6GqBtw9C+UrLp6s2wtSniayy/Vd/3F7ffLE427XI= +golang.org/x/net v0.0.0-20190514140710-3ec191127204/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421 h1:Wo7BWFiOk0QRFMLYMqJGFMd9CgUAcGx7V+qEg/h5IBI= @@ -271,12 +284,18 @@ k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6 h1:4s3/R4+OYYYUKptXPhZKjQ04WJ6Eh k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.2.0 h1:0ElL0OHzF3N+OhoJTL0uca20SxtYt4X4+bzHeqrB83c= k8s.io/klog v0.2.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= +k8s.io/klog v0.3.0 h1:0VPpR+sizsiivjIfIAQH/rl8tan6jvWkS7lU+0di3lE= +k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/kube-openapi v0.0.0-20180711000925-0cf8f7e6ed1d h1:mn2F9UzCk6KGa7M/d2ibLyRtBQm7n6QvbCjDe/cDWSg= k8s.io/kube-openapi v0.0.0-20180711000925-0cf8f7e6ed1d/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc= sigs.k8s.io/controller-runtime v0.1.10 h1:amLOmcekVdnsD1uIpmgRqfTbQWJ2qxvQkcdeFhcotn4= sigs.k8s.io/controller-runtime v0.1.10/go.mod h1:HFAYoOh6XMV+jKF1UjFwrknPbowfyHEHHRdJMf2jMX8= sigs.k8s.io/controller-tools v0.1.11-0.20190411181648-9d55346c2bde h1:ZkaHf5rNYzIB6CB82keKMQNv7xxkqT0ylOBdfJPfi+k= sigs.k8s.io/controller-tools v0.1.11-0.20190411181648-9d55346c2bde/go.mod h1:ATWLRP3WGxuAN9HcT2LaKHReXIH+EZGzRuMHuxjXfhQ= +sigs.k8s.io/kind v0.3.0 h1:TUIRsJZy123ejyWECuYOU2XzSsIsauoqaeoUGsfdj6k= +sigs.k8s.io/kind v0.3.0/go.mod h1:bgGo2cWxKGQ7esVxtGp9H17Ttlexju92CTMjCg08HNQ= +sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0= +sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU= sigs.k8s.io/testing_frameworks v0.1.0/go.mod h1:VVBKrHmJ6Ekkfz284YKhQePcdycOzNH9qL6ht1zEr/U= sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= diff --git a/vnfs/DAaaS/collectd-operator/pkg/apis/addtoscheme_onap_v1alpha1.go b/vnfs/DAaaS/collectd-operator/pkg/apis/addtoscheme_onap_v1alpha1.go new file mode 100644 index 00000000..711a1182 --- /dev/null +++ b/vnfs/DAaaS/collectd-operator/pkg/apis/addtoscheme_onap_v1alpha1.go @@ -0,0 +1,10 @@ +package apis + +import ( + "demo/vnfs/DAaaS/collectd-operator/pkg/apis/onap/v1alpha1" +) + +func init() { + // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back + AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme) +} 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"}, + } +} |