Skip to content

Commit

Permalink
feat: update rbac and add default e2e test (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
whg517 authored Jul 26, 2024
1 parent ca5a886 commit 89df190
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 6 deletions.
7 changes: 4 additions & 3 deletions .chainsaw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ metadata:
spec:
namespace: kubedatastack
timeouts:
apply: 420s
assert: 420s
apply: 3000s
assert: 3000s
cleanup: 120s
delete: 120s
error: 300s
error: 240s
exec: 200s
skipDelete: false
failFast: true
forceTerminationGracePeriod: 10s
48 changes: 48 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,54 @@ kind: ClusterRole
metadata:
name: manager-role
rules:
- apiGroups:
- apps
resources:
- statefulsets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- secrets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- services
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- hbase.zncdata.dev
resources:
Expand Down
4 changes: 4 additions & 0 deletions internal/controller/hbasecluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ type HbaseClusterReconciler struct {
// +kubebuilder:rbac:groups=hbase.zncdata.dev,resources=hbaseclusters,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=hbase.zncdata.dev,resources=hbaseclusters/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=hbase.zncdata.dev,resources=hbaseclusters/finalizers,verbs=update
// +kubebuilder:rbac:groups=apps,resources=statefulsets,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=secrets,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=services,verbs=get;list;watch;create;update;patch;delete

func (r *HbaseClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/default/04-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ metadata:
name: hdfscluster-sample-default-datanode
status:
availableReplicas: 2
replicas: 2
replicas: 2
4 changes: 2 additions & 2 deletions test/e2e/default/04-hdfs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
repository: quay.io/zncdatadev/hadoop
tag: 3.3.4
clusterConfig:
zookeeperDiscoveryZNode: sample-hdfs-znode
zookeeperConfigMapName: sample-hdfs-znode
nameNode:
roleGroups:
default:
Expand All @@ -24,7 +24,7 @@ spec:
resources:
cpu:
min: 200m
max: 800m
max: 500m
memory:
limit: "500Mi"
logging:
Expand Down
28 changes: 28 additions & 0 deletions test/e2e/default/05-hbase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: hbase.zncdata.dev/v1alpha1
kind: HbaseCluster
metadata:
labels:
app.kubernetes.io/name: hbasecluster
app.kubernetes.io/instance: hbasecluster-sample
app.kubernetes.io/part-of: hbase-operator
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/created-by: hbase-operator
name: hbasecluster-sample
spec:
image:
custom: docker.stackable.tech/stackable/hbase:2.4.17-stackable24.3.0
clusterConfig:
zookeeperConfigMapName: sample-hbase-znode
hdfsConfigMapName: hdfscluster-sample
master:
roleGroups:
default:
replicas: 1
regionServer:
roleGroups:
default:
replicas: 1
restServer:
roleGroups:
default:
replicas: 1
24 changes: 24 additions & 0 deletions test/e2e/default/06-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: hbasecluster-sample-master-default
status:
availableReplicas: 1
replicas: 1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: hbasecluster-sample-regionserver-default
status:
availableReplicas: 1
replicas: 1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: hbasecluster-sample-restserver-default
status:
availableReplicas: 1
replicas: 1

0 comments on commit 89df190

Please sign in to comment.