Skip to content

Commit

Permalink
issue-439, added support for batch of users for opensearch
Browse files Browse the repository at this point in the history
  • Loading branch information
worryg0d committed Jul 13, 2023
1 parent 7de1b3d commit 6835c7e
Show file tree
Hide file tree
Showing 12 changed files with 469 additions and 199 deletions.
7 changes: 5 additions & 2 deletions apis/clusterresources/v1beta1/opensearchuser_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ type OpenSearchUserSpec struct {

// OpenSearchUserStatus defines the observed state of OpenSearchUser
type OpenSearchUserStatus struct {
State string `json:"state"`
ClusterID string `json:"clusterId"`
ClustersEvents map[string]string `json:"clustersEvents,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down Expand Up @@ -70,6 +69,10 @@ func (u *OpenSearchUser) NewPatch() client.Patch {
return client.MergeFrom(old)
}

func (u *OpenSearchUser) GetDeletionFinalizer() string {
return models.DeletionFinalizer + "_" + u.Namespace + "_" + u.Name
}

func init() {
SchemeBuilder.Register(&OpenSearchUser{}, &OpenSearchUserList{})
}
9 changes: 8 additions & 1 deletion apis/clusterresources/v1beta1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion apis/clusters/v1beta1/opensearch_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type OpenSearchSpec struct {
IndexManagementPlugin bool `json:"indexManagementPlugin,omitempty"`
AlertingPlugin bool `json:"alertingPlugin,omitempty"`
BundledUseOnly bool `json:"bundleUseOnly,omitempty"`
UserRef *UserReference `json:"userRef,omitempty"`
UserRefs []*UserReference `json:"userRefs,omitempty"`
}

type OpenSearchDataCentre struct {
Expand Down
14 changes: 10 additions & 4 deletions apis/clusters/v1beta1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,10 @@ spec:
status:
description: OpenSearchUserStatus defines the observed state of OpenSearchUser
properties:
clusterId:
type: string
state:
type: string
required:
- clusterId
- state
clustersEvents:
additionalProperties:
type: string
type: object
type: object
type: object
served: true
Expand Down
22 changes: 12 additions & 10 deletions config/crd/bases/clusters.instaclustr.com_opensearches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,18 @@ spec:
- email
type: object
type: array
userRef:
properties:
name:
type: string
namespace:
type: string
required:
- name
- namespace
type: object
userRefs:
items:
properties:
name:
type: string
namespace:
type: string
required:
- name
- namespace
type: object
type: array
version:
type: string
required:
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/clusters.instaclustr.com_redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ spec:
- email
type: object
type: array
userRef:
userRefs:
items:
properties:
name:
Expand Down
19 changes: 18 additions & 1 deletion config/samples/clusterresources_v1beta1_opensearchuser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,21 @@ metadata:
spec:
secretRef:
name: "test-secret-1"
namespace: "default"
namespace: "default"
---
apiVersion: v1
kind: Secret
metadata:
name: test-secret-2
data:
username: dGVzdC11c2VyLTIK # test-user-2
password: VGVzdFBhc3MxMjMhCg== # TestPass123!
---
apiVersion: clusterresources.instaclustr.com/v1beta1
kind: OpenSearchUser
metadata:
name: test-user-2
spec:
secretRef:
name: "test-secret-2"
namespace: "default"
10 changes: 6 additions & 4 deletions config/samples/clusters_v1beta1_opensearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ spec:
alertingPlugin: false
anomalyDetectionPlugin: false
asynchronousSearchPlugin: false
# userRef:
# name: "test-user-1"
# namespace: "default"
# userRefs:
# - name: "test-user-1"
# namespace: "default"
# - name: "test-user-2"
# namespace: "default"
clusterManagerNodes:
- dedicatedManager: false
nodeSize: SRH-DEV-t4g.small-5
Expand All @@ -34,7 +36,7 @@ spec:
indexManagementPlugin: true
knnPlugin: false
loadBalancer: false
name: bohdan-test
name: OpenSearch-example
notificationsPlugin: false
# opensearchDashboards:
# - nodeSize: SRH-DEV-t4g.small-5
Expand Down
Loading

0 comments on commit 6835c7e

Please sign in to comment.