Skip to content

Commit

Permalink
Merge pull request #40 from xco-sk/39-add-kibana-data-view-support
Browse files Browse the repository at this point in the history
#39 add kibana data view support
  • Loading branch information
xco-sk authored Oct 1, 2022
2 parents fb412e0 + 8a79508 commit b7e6a1e
Show file tree
Hide file tree
Showing 22 changed files with 786 additions and 27 deletions.
9 changes: 9 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,13 @@ resources:
kind: Lens
path: github.com/xco-sk/eck-custom-resources/apis/kibana.eck/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: github.com
group: kibana.eck
kind: DataView
path: github.com/xco-sk/eck-custom-resources/apis/kibana.eck/v1alpha1
version: v1alpha1
version: "3"
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Currently supported resources:
- [Visualization](docs/cr_visualization.md)
- [Lens](docs/cr_lens.md)
- [Dashboard](docs/cr_dashboard.md)
- [Data View](docs/cr_data_view.md)

## Installation

Expand All @@ -34,6 +35,15 @@ helm install eck-cr eck-custom-resources/eck-custom-resources-operator
```
Configuration options are documented in [chart README file](charts/eck-custom-resources-operator/README.md)

## Upgrade guide

### From 0.3.2 to 0.4.0
There is new `DataView` CRD present. To apply the CRD, run:
```
kubectl apply --server-side -f https://raw.githubusercontent.com/xco-sk/eck-custom-resources/eck-custom-resources-operator-0.4.0/config/crd/bases/kibana.eck.github.com_dataviews.yaml
```


## Uninstallation
To uninstall the eck-cr from Kubernetes cluster, run:

Expand Down
55 changes: 55 additions & 0 deletions apis/kibana.eck/v1alpha1/dataview_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
Copyright 2022.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// DataViewSpec defines the desired state of DataView
type DataViewSpec struct {
SavedObject `json:",inline"`
}

// DataViewStatus defines the observed state of DataView
type DataViewStatus struct {
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// DataView is the Schema for the dataviews API
type DataView struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec DataViewSpec `json:"spec,omitempty"`
Status DataViewStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// DataViewList contains a list of DataView
type DataViewList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []DataView `json:"items"`
}

func init() {
SchemeBuilder.Register(&DataView{}, &DataViewList{})
}
90 changes: 90 additions & 0 deletions apis/kibana.eck/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions charts/eck-custom-resources-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ maintainers:
email: marek@xco.sk
url: https://github.com/xco-sk
type: application
version: 0.3.2
appVersion: 0.3.0
version: 0.4.0
appVersion: 0.4.0
26 changes: 26 additions & 0 deletions charts/eck-custom-resources-operator/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -409,4 +409,30 @@ rules:
- get
- patch
- update
- apiGroups:
- kibana.eck.github.com
resources:
- dataviews
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- kibana.eck.github.com
resources:
- dataviews/finalizers
verbs:
- update
- apiGroups:
- kibana.eck.github.com
resources:
- dataviews/status
verbs:
- get
- patch
- update
{{- end }}
78 changes: 78 additions & 0 deletions config/crd/bases/kibana.eck.github.com_dataviews.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
creationTimestamp: null
name: dataviews.kibana.eck.github.com
spec:
group: kibana.eck.github.com
names:
kind: DataView
listKind: DataViewList
plural: dataviews
singular: dataview
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: DataView is the Schema for the dataviews API
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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: DataViewSpec defines the desired state of DataView
properties:
body:
type: string
dependencies:
items:
properties:
name:
type: string
space:
type: string
type:
enum:
- visualization
- dashboard
- search
- index-pattern
- lens
type: string
required:
- name
- type
type: object
type: array
space:
type: string
required:
- body
type: object
status:
description: DataViewStatus defines the observed state of DataView
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
3 changes: 3 additions & 0 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ resources:
- bases/es.eck.github.com_elasticsearchusers.yaml
- bases/kibana.eck.github.com_spaces.yaml
- bases/kibana.eck.github.com_lens.yaml
- bases/kibana.eck.github.com_dataviews.yaml
#+kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge:
Expand All @@ -35,6 +36,7 @@ patchesStrategicMerge:
#- patches/webhook_in_elasticsearchusers.yaml
#- patches/webhook_in_spaces.yaml
#- patches/webhook_in_lens.yaml
#- patches/webhook_in_dataviews.yaml
#+kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
Expand All @@ -53,6 +55,7 @@ patchesStrategicMerge:
#- patches/cainjection_in_elasticsearchusers.yaml
#- patches/cainjection_in_spaces.yaml
#- patches/cainjection_in_lens.yaml
#- patches/cainjection_in_dataviews.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

# the following config is for teaching kustomize how to do kustomization for CRDs.
Expand Down
7 changes: 7 additions & 0 deletions config/crd/patches/cainjection_in_dataviews.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# The following patch adds a directive for certmanager to inject CA into the CRD
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
name: dataviews.kibana.eck.github.com
16 changes: 16 additions & 0 deletions config/crd/patches/webhook_in_dataviews.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# The following patch enables a conversion webhook for the CRD
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: dataviews.kibana.eck.github.com
spec:
conversion:
strategy: Webhook
webhook:
clientConfig:
service:
namespace: system
name: webhook-service
path: /convert
conversionReviewVersions:
- v1
24 changes: 24 additions & 0 deletions config/rbac/dataview_editor_role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# permissions for end users to edit dataviews.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: dataview-editor-role
rules:
- apiGroups:
- kibana.eck.github.com
resources:
- dataviews
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- kibana.eck.github.com
resources:
- dataviews/status
verbs:
- get
Loading

0 comments on commit b7e6a1e

Please sign in to comment.