This is an automated email from the ASF dual-hosted git repository. ywkim pushed a commit to branch cnb in repository https://gitbox.apache.org/repos/asf/bigtop.git
The following commit(s) were added to refs/heads/cnb by this push: new 2215c51 BIGTOP-3248: Smoke test for Minio on Kubernetes 2215c51 is described below commit 2215c511652103896f37e47bd1033ce5467dbf82 Author: Youngwoo Kim <yw...@apache.org> AuthorDate: Thu Oct 31 14:23:42 2019 +0900 BIGTOP-3248: Smoke test for Minio on Kubernetes --- README.md | 28 +++++++- .../smoke-tests/minio/TestMinioSmoke.groovy | 75 ++++++++++++++++++++++ bigtop-tests/smoke-tests/minio/build.gradle | 35 ++++++++++ storage/mc/minio-client.yaml | 34 ++++++++++ storage/minio/values.yaml | 4 +- 5 files changed, 172 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f4b93fc..1f31664 100755 --- a/README.md +++ b/README.md @@ -262,14 +262,14 @@ If you want to deploy Distributed Minio cluster, Increase the ```nodeCount``` in ### Minio -Standalone Minio: +Deploy a Standalone Minio: ``` $ cd $BIGTOP_HOME $ helm install --name bigtop-minio --namespace bigtop -f storage/minio/values.yaml stable/minio ``` -Distributed Minio: +Deploy a Distributed Minio: ``` $ cd $BIGTOP_HOME $ helm install --name bigtop-minio --namespace bigtop --set mode=distributed,replicas=4 -f storage/minio/values.yaml stable/minio @@ -300,6 +300,30 @@ Alternately, you can use your browser or the Minio SDK to access the server - ht ``` +### mc (Minio Client) + +Deploy mc pod: +``` +$ cd $BIGTOP_HOME +$ kubectl create -n bigtop -f storage/mc/minio-client.yaml +``` +``` +$ kubectl exec -n bigtop minio-client mc admin info server bigtop-minio +``` + +Make a bucket and remove the bucket: +``` +$ kubectl exec -n bigtop minio-client mc mb bigtop-minio/testbucket1 +Bucket created successfully `bigtop-minio/testbucket1`. + +$ kubectl exec -n bigtop minio-client mc ls bigtop-minio/ +[2019-10-31 04:46:44 UTC] 0B testbucket1/ + +$ kubectl exec -n bigtop minio-client mc rb bigtop-minio/testbucket1 +Removing `bigtop-minio/testbucket1`. + +``` + ## Zookeeper Deploy Zookeeper cluster on Kubernetes cluster via Helm chart: ``` diff --git a/bigtop-tests/smoke-tests/minio/TestMinioSmoke.groovy b/bigtop-tests/smoke-tests/minio/TestMinioSmoke.groovy new file mode 100644 index 0000000..98bb8fa --- /dev/null +++ b/bigtop-tests/smoke-tests/minio/TestMinioSmoke.groovy @@ -0,0 +1,75 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * 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 org.apache.bigtop.itest.minio + +import org.junit.BeforeClass +import org.junit.AfterClass +import org.apache.bigtop.itest.shell.Shell +import static org.junit.Assert.assertNotNull +import static org.junit.Assert.assertTrue +import org.junit.Test +import org.apache.bigtop.itest.JarContent +import org.apache.bigtop.itest.TestUtils +import org.junit.runner.RunWith + +import org.apache.commons.logging.LogFactory +import org.apache.commons.logging.Log + +import static org.apache.bigtop.itest.LogErrorsUtils.logError + +class TestKafkaSmoke { + static private Log LOG = LogFactory.getLog(Object.class) + + static Shell sh = new Shell("/bin/bash -s"); + + static String TEST_BUCKET = "testbucket123"; + static String NS = "bigtop"; + + @BeforeClass + static void minioSetUp() { + } + + @AfterClass + public static void deleteMinioTestBucket() { + sh.exec("kubectl exec -n " + NS + " minio-client mc rb bigtop-minio/" + TEST_BUCKET); + } + + @Test + public void testServerInfo() { + sh.exec("kubectl exec -n " + NS + " minio-client mc admin info server bigtop-minio"); + String out = sh.getOut().toString(); + LOG.info(out); + assertTrue( + out.contains("Uptime") || + out.contains("Version") || + out.contains("Storage") + ); + } + + @Test + public void testCreateTopics() { + sh.exec("kubectl exec -n " + NS + " minio-client mc mb bigtop-minio/" + TEST_BUCKET); + String out = sh.getOut().toString(); + assertTrue(out.contains("Bucket created successfully")); + + sh.exec("kubectl exec -n " + NS + " minio-client mc ls bigtop-minio/"); + String outLs = sh.getOut().toString(); + assertTrue(outLs.contains(TEST_BUCKET)); + } +} diff --git a/bigtop-tests/smoke-tests/minio/build.gradle b/bigtop-tests/smoke-tests/minio/build.gradle new file mode 100644 index 0000000..b45807f --- /dev/null +++ b/bigtop-tests/smoke-tests/minio/build.gradle @@ -0,0 +1,35 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * 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. + */ +def tests_to_include() { + return [ + "TestMinioSmoke.groovy" + ]; +} + +sourceSets { + test { + groovy { + srcDirs = ["${BIGTOP_HOME}/bigtop-tests/smoke-tests/minio/"] + exclude { FileTreeElement elem -> (doExclude(elem.getName())) } + } + } +} + +test.doFirst { + checkEnv(["BIGTOP_HOME"]) +} diff --git a/storage/mc/minio-client.yaml b/storage/mc/minio-client.yaml new file mode 100644 index 0000000..1f98d49 --- /dev/null +++ b/storage/mc/minio-client.yaml @@ -0,0 +1,34 @@ +apiVersion: v1 +kind: Pod +metadata: + name: minio-client + labels: + app: minio-client +spec: + containers: + - name: minio-client + image: minio/mc:latest + imagePullPolicy: IfNotPresent + command: ["/test/test-minio.sh"] + volumeMounts: + - name: test-minio + mountPath: "/test" + volumes: + - name: test-minio + configMap: + name: test-minio + defaultMode: 0745 +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: test-minio +data: + test-minio.sh: | + #!/bin/sh + mc + # If TLS is not enabled use the following URL: + mc config host add bigtop-minio http://bigtop-minio.bigtop.svc.cluster.local:9000 minio minio123 S3v4 + # If TLS is enabled for minio service, use the following URL. If certificate is self signed user --insecure + # mc config host add bigtop-minio https://<Minio Service Name>:9000 <ACCESSKEY> <SECRETKEY> S3v4 --insecure + sleep 3600 diff --git a/storage/minio/values.yaml b/storage/minio/values.yaml index 589127f..db64573 100644 --- a/storage/minio/values.yaml +++ b/storage/minio/values.yaml @@ -46,8 +46,8 @@ priorityClassName: "" ## Distributed Minio ref: https://docs.minio.io/docs/distributed-minio-quickstart-guide ## existingSecret: "" -accessKey: "AKIAIOSFODNN7EXAMPLE" -secretKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" +accessKey: "minio" +secretKey: "minio123" configPath: "/root/.minio/" configPathmc: "/root/.mc/" mountPath: "/export"