-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): refactor e2e test case for test coverage (#144)
* refactor: remove deprecated e2e configuration and test files * test(e2e): add kerberos e2e test case * test(e2e): add oidc loggin test case * test(e2e): add oidc e2e test case * test(e2e): add HDFS access and installation configuration * test(e2e): add smoke tests for HDFS cluster operations and override PDB * refactor: remove the static redirect URL, add cookie secure for dynamic http redirect URL * feat(discovery): retrieve listener name from pod labels in getListenerAddress * ci: add product version matrix and update resource limits * chore: update chainsaw configuration with commented namespace and skipDelete options
- Loading branch information
Showing
37 changed files
with
948 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
name: kerberos | ||
spec: | ||
bindings: | ||
- name: relam | ||
value: KUBEDOOP.DEV # kerberos relam, should be uppercase, see hdfs also | ||
- name: kadminPassword | ||
value: kubedoopdev | ||
- name: kadminKeytabSecret | ||
value: kadmin-keytab | ||
steps: | ||
- name: install krb5 kdc | ||
try: | ||
- apply: # create a krb5 deployment and service, both named "krb5" | ||
file: krb5-install.yaml | ||
- assert: | ||
file: krb5-assert.yaml | ||
- script: | ||
env: | ||
- name: RELAM | ||
value: ($relam) | ||
- name: NAMESPACE | ||
value: ($namespace) | ||
- name: DEPLOYMENT_NAME | ||
value: krb5 | ||
- name: KADMIN_KEYTAB_SECRET | ||
value: ($kadminKeytabSecret) | ||
content: | | ||
# debug node info | ||
kubectl get node | ||
# get pod of deploment by label | ||
POD_NAME=$(kubectl get pod -n $NAMESPACE -l app=$DEPLOYMENT_NAME -o jsonpath="{.items[0].metadata.name}") | ||
# check pod exist | ||
if [ -z "$POD_NAME" ]; then | ||
echo "pod not found" | ||
exit 1 | ||
fi | ||
# get kadmin keytab | ||
KADMIN_KEYTAB=$(kubectl exec -n $NAMESPACE $POD_NAME -- sh -c "cat /var/kerberos/krb5kdc/kadmin.keytab | base64 -w 0") | ||
# create secret, name is $KADMIN_KEYTAB_SECRET | ||
cat <<EOF | kubectl apply -f - | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: $KADMIN_KEYTAB_SECRET | ||
namespace: $NAMESPACE | ||
data: | ||
keytab: $KADMIN_KEYTAB | ||
- assert: # assert kadmin keytab secret | ||
resource: | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: ($kadminKeytabSecret) | ||
data: | ||
(keytab != ""): true | ||
- apply: | ||
file: krb5-secretclass.yaml | ||
- name: install zookeeper | ||
try: | ||
- apply: | ||
file: ../setup/zookeeper.yaml | ||
- assert: | ||
file: ../setup/zookeeper-assert.yaml | ||
cleanup: | ||
- sleep: | ||
duration: 30s | ||
- name: install hdfs | ||
try: | ||
- apply: | ||
file: krb5-secretclass.yaml | ||
- apply: | ||
file: hdfs.yaml | ||
- assert: | ||
file: hdfs-assert.yaml | ||
- name: access hdfs | ||
try: | ||
- apply: | ||
file: krb5-hdfs-access-script.yaml | ||
- apply: | ||
file: ../setup/access-hdfs-install.yaml | ||
- assert: | ||
file: ../setup/access-hdfs-assert.yaml | ||
catch: | ||
- podLogs: | ||
name: access-hdfs | ||
container: access-hdfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
# hdfs access assert script configmap | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: krb5-hdfs-access | ||
data: | ||
hdfs-access-assert.sh: | | ||
#!/bin/bash | ||
set -ex | ||
|
||
echo "Running HDFS access test" | ||
|
||
echo "list credential in krb5 keytab" | ||
klist -k /kubedoop/kerberos/keytab | ||
|
||
# Extract unique principals from keytab | ||
principals=$(klist -k /kubedoop/kerberos/keytab | grep -v "Keytab name:" | awk '{print $2}' | sort -u) | ||
|
||
for principal in $principals; do | ||
echo "Testing with principal: $principal" | ||
|
||
echo "Authenticating with keytab" | ||
kdestroy | ||
kinit -kt /kubedoop/kerberos/keytab "$principal" | ||
|
||
# Test HDFS operations | ||
TEST_DIR="/tmp/test-$(date +%s)" | ||
TEST_FILE="$TEST_DIR/test.txt" | ||
|
||
echo "Creating test directory" | ||
bin/hdfs dfs -mkdir -p "$TEST_DIR" | ||
|
||
echo "Writing test data" | ||
echo "Hello HDFS" | bin/hdfs dfs -put - "$TEST_FILE" | ||
|
||
echo "Reading test data" | ||
bin/hdfs dfs -cat "$TEST_FILE" | ||
|
||
echo "Listing directory" | ||
bin/hdfs dfs -ls "$TEST_DIR" | ||
|
||
echo "Cleaning up" | ||
bin/hdfs dfs -rm -r "$TEST_DIR" | ||
|
||
echo "Test completed for $principal" | ||
done | ||
|
||
echo "All HDFS access tests completed successfully" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: krb5 | ||
status: | ||
availableReplicas: 1 | ||
readyReplicas: 1 | ||
replicas: 1 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: krb5 |
Oops, something went wrong.