Skip to content

test(omid): added omid kuttl test #515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/templates/kuttl/omid/00-limit-range.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: v1
kind: LimitRange
metadata:
name: limit-request-ratio
spec:
limits:
- type: "Container"
maxLimitRequestRatio:
cpu: 5
memory: 1
9 changes: 9 additions & 0 deletions tests/templates/kuttl/omid/00-patch-ns.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% if test_scenario['values']['openshift'] == 'true' %}
# see https://github.com/stackabletech/issues/issues/566
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: kubectl patch namespace $NAMESPACE -p '{"metadata":{"labels":{"pod-security.kubernetes.io/enforce":"privileged"}}}'
timeout: 120
{% endif %}
10 changes: 10 additions & 0 deletions tests/templates/kuttl/omid/01-assert.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
{% if lookup('env', 'VECTOR_AGGREGATOR') %}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: vector-aggregator-discovery
{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% if lookup('env', 'VECTOR_AGGREGATOR') %}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: vector-aggregator-discovery
data:
ADDRESS: {{ lookup('env', 'VECTOR_AGGREGATOR') }}
{% endif %}
12 changes: 12 additions & 0 deletions tests/templates/kuttl/omid/10-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 600
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: test-zk-server-default
status:
readyReplicas: 1
replicas: 1
34 changes: 34 additions & 0 deletions tests/templates/kuttl/omid/10-install-zookeeper.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
apiVersion: zookeeper.stackable.tech/v1alpha1
kind: ZookeeperCluster
metadata:
name: test-zk
spec:
image:
{% if test_scenario['values']['zookeeper-latest'].find(",") > 0 %}
custom: "{{ test_scenario['values']['zookeeper-latest'].split(',')[1] }}"
productVersion: "{{ test_scenario['values']['zookeeper-latest'].split(',')[0] }}"
{% else %}
productVersion: "{{ test_scenario['values']['zookeeper-latest'] }}"
{% endif %}
pullPolicy: IfNotPresent
clusterConfig:
listenerClass: cluster-internal
{% if lookup('env', 'VECTOR_AGGREGATOR') %}
vectorAggregatorConfigMapName: vector-aggregator-discovery
{% endif %}
servers:
config:
logging:
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
roleGroups:
default:
replicas: 1
---
apiVersion: zookeeper.stackable.tech/v1alpha1
kind: ZookeeperZnode
metadata:
name: test-znode
spec:
clusterRef:
name: test-zk
28 changes: 28 additions & 0 deletions tests/templates/kuttl/omid/20-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 600
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: test-hdfs-namenode-default
status:
readyReplicas: 2
replicas: 2
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: test-hdfs-journalnode-default
status:
readyReplicas: 1
replicas: 1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: test-hdfs-datanode-default
status:
readyReplicas: 1
replicas: 1
42 changes: 42 additions & 0 deletions tests/templates/kuttl/omid/20-install-hdfs.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
apiVersion: hdfs.stackable.tech/v1alpha1
kind: HdfsCluster
metadata:
name: test-hdfs
spec:
image:
{% if test_scenario['values']['hdfs-latest'].find(",") > 0 %}
custom: "{{ test_scenario['values']['hdfs-latest'].split(',')[1] }}"
productVersion: "{{ test_scenario['values']['hdfs-latest'].split(',')[0] }}"
{% else %}
productVersion: "{{ test_scenario['values']['hdfs-latest'] }}"
{% endif %}
pullPolicy: IfNotPresent
clusterConfig:
zookeeperConfigMapName: test-znode
{% if lookup('env', 'VECTOR_AGGREGATOR') %}
vectorAggregatorConfigMapName: vector-aggregator-discovery
{% endif %}
nameNodes:
config:
listenerClass: cluster-internal
logging:
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
roleGroups:
default:
replicas: 2
dataNodes:
config:
listenerClass: cluster-internal
logging:
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
roleGroups:
default:
replicas: 1
journalNodes:
config:
logging:
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
roleGroups:
default:
replicas: 1
42 changes: 42 additions & 0 deletions tests/templates/kuttl/omid/30-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
metadata:
name: install-hbase
timeout: 600
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: test-hbase-master-default
spec:
template:
spec:
terminationGracePeriodSeconds: 1200
status:
readyReplicas: 2
replicas: 2
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: test-hbase-regionserver-default
spec:
template:
spec:
terminationGracePeriodSeconds: 3600
status:
readyReplicas: 1
replicas: 1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: test-hbase-restserver-default
spec:
template:
spec:
terminationGracePeriodSeconds: 300
status:
readyReplicas: 1
replicas: 1
42 changes: 42 additions & 0 deletions tests/templates/kuttl/omid/30-install-hbase.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
apiVersion: hbase.stackable.tech/v1alpha1
kind: HbaseCluster
metadata:
name: test-hbase
spec:
image:
{% if test_scenario['values']['hbase'].find(",") > 0 %}
custom: "{{ test_scenario['values']['hbase'].split(',')[1] }}"
productVersion: "{{ test_scenario['values']['hbase'].split(',')[0] }}"
{% else %}
productVersion: "{{ test_scenario['values']['hbase'] }}"
{% endif %}
pullPolicy: IfNotPresent
clusterConfig:
hdfsConfigMapName: test-hdfs
zookeeperConfigMapName: test-znode
listenerClass: cluster-internal
{% if lookup('env', 'VECTOR_AGGREGATOR') %}
vectorAggregatorConfigMapName: vector-aggregator-discovery
{% endif %}
masters:
config:
logging:
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
roleGroups:
default:
replicas: 2
regionServers:
config:
logging:
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
roleGroups:
default:
replicas: 1
restServers:
config:
logging:
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
roleGroups:
default:
replicas: 1
12 changes: 12 additions & 0 deletions tests/templates/kuttl/omid/40-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 240
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: omid-tso-server
status:
readyReplicas: 1
replicas: 1
106 changes: 106 additions & 0 deletions tests/templates/kuttl/omid/40-install-omid.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would leave the review of this file to @soenkeliebau, as it differs from the one our customer is using and I have no clue about omid.

apiVersion: v1
kind: ConfigMap
metadata:
name: omid-examples-client-config
data:
hbase-omid-client-config.yml: |
# Secure HBase credentials, core-site.xml and hbase-site.xml are expected to be in the classpath
# It's used for secure HBase only and ignored otherwise
# principal: omid_hbase_client
# keytab: /path/to/hbase/client/keytab
omidClientConfiguration: !!org.apache.omid.tso.client.OmidClientConfiguration
connectionString: "localhost:54758"
log4j2.properties: |
status = warn
dest = err
name = PropertiesConfig

# console
appender.console.type = Console
appender.console.target = SYSTEM_OUT
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{ISO8601} %-5p [%t] %c{2}: %m%n

rootLogger = WARN,console
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: omid-tso-server
labels:
app: omid-tso-server
spec:
replicas: 1
selector:
matchLabels:
app: omid-tso-server
template:
metadata:
labels:
app: omid-tso-server
spec:
containers:
- name: omid-tso-server
{% if test_scenario['values']['omid'].find(",") > 0 %}
image: "{{ test_scenario['values']['omid'].split(',')[1] }}"
{% else %}
image: docker.stackable.tech/stackable/omid:"{{ test_scenario['values']['omid'] }}"-stackable0.0.0-dev
{% endif %}
imagePullPolicy: IfNotPresent
command:
- /bin/bash
- -x
- -euo
- pipefail
- -c
args:
- ./bin/omid.sh create-hbase-commit-table && ./bin/omid.sh create-hbase-timestamp-table && ./bin/omid.sh tso
resources:
# The TSO server seems to be extremely memory hungry.
# We arrived at these (minimal) settings after much trial and error.
# See also the JVM_FLAGS environment variable below.
requests:
memory: "4Gi"
cpu: "500m"
limits:
memory: "4Gi"
cpu: "1"
volumeMounts:
- name: hbase-config
mountPath: /stackable/conf/hbase
- name: hdfs-config
mountPath: /stackable/conf/hdfs
- name: omid-examples-client-config
mountPath: /stackable/omid-examples/conf
env:
- name: HBASE_CONF_DIR
value: /stackable/conf/hbase
- name: HADOOP_CONF_DIR
value: /stackable/conf/hdfs
- name: JVM_FLAGS
value: "-Xmx3g -Xms3g"
ports:
# See also hbase-omid-client-config.yml above where the client is configured with this port
- containerPort: 54758
name: tso
protocol: TCP
readinessProbe:
# The tso server takes a while to start up, so we need to be patient.
failureThreshold: 3
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: tso
timeoutSeconds: 2
volumes:
- name: hbase-config
configMap:
name: test-hbase
- name: hdfs-config
configMap:
name: test-hdfs
- name: omid-examples-client-config
configMap:
name: omid-examples-client-config
6 changes: 6 additions & 0 deletions tests/templates/kuttl/omid/50-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: kubectl exec --namespace=$NAMESPACE omid-tso-server-0 -- bash -c "/stackable/omid-examples/run.sh basic"
timeout: 240
6 changes: 6 additions & 0 deletions tests/templates/kuttl/omid/50-setup-example-tx-table.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: kubectl exec --namespace=$NAMESPACE test-hbase-master-default-0 -- bash -c "echo -e \"create 'MY_TX_TABLE', {NAME => 'MY_CF', VERSIONS => '2147483647', TTL => '2147483647'}\" | /stackable/hbase/bin/hbase shell"
timeout: 240
Loading
Loading