From f5149f95683e7e2ed863f108146396348536bbbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=5F=5F=5F=5F=5F=5F=E9=BD=90=E5=A4=A9=E5=A4=A7=E5=9C=A3?= Date: Wed, 21 Nov 2018 21:31:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=98=E5=8C=96k8s=20YAML?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mysql-cloud.yaml | 81 ++++++++++----------------------------- mysql.yaml | 99 ++---------------------------------------------- naftis.yaml | 7 ---- 3 files changed, 25 insertions(+), 162 deletions(-) diff --git a/mysql-cloud.yaml b/mysql-cloud.yaml index ecd488d9f..bbf645673 100644 --- a/mysql-cloud.yaml +++ b/mysql-cloud.yaml @@ -1,6 +1,11 @@ --- +# Source: naftis/templates/namespace.yaml +apiVersion: v1 +kind: Namespace +metadata: + name: naftis +--- # Source: mysql/templates/secrets.yaml - apiVersion: v1 kind: Secret metadata: @@ -12,15 +17,10 @@ metadata: heritage: "Tiller" type: Opaque data: - mysql-root-password: "V2xSbmNHaDNVV1k1VlE9PQ==" - - mysql-password: "bmFmdGlzSXNBd2Vzb21l" - --- # Source: mysql/templates/initializationFiles-configmap.yaml - apiVersion: v1 kind: ConfigMap metadata: @@ -147,7 +147,6 @@ data: KEY `idx_cfgs_deleted_at` (`deleted_at`), KEY `task_tmpl_id` (`task_tmpl_id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=147 DEFAULT CHARSET=utf8mb4; - --- # Source: mysql/templates/tests/test-configmap.yaml apiVersion: v1 @@ -164,11 +163,23 @@ data: @test "Testing MySQL Connection" { mysql --host=naftis-mysql --port=3306 -u root -pWlRncGh3UWY5VQ== } - - --- # Source: mysql/templates/pvc.yaml - +kind: PersistentVolume +apiVersion: v1 +metadata: + name: naftis-pv + labels: + type: local +spec: + storageClassName: manual + capacity: + storage: 10Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/data" +--- kind: PersistentVolumeClaim apiVersion: v1 metadata: @@ -185,7 +196,6 @@ spec: requests: storage: "8Gi" storageClassName: "manual" - --- # Source: mysql/templates/svc.yaml apiVersion: v1 @@ -205,52 +215,6 @@ spec: targetPort: mysql selector: app: naftis-mysql - ---- -# Source: mysql/templates/tests/test.yaml -apiVersion: v1 -kind: Pod -metadata: - name: naftis-mysql-test - labels: - app: naftis-mysql - chart: "mysql-0.8.2" - heritage: "Tiller" - release: "naftis" - annotations: - "helm.sh/hook": test-success -spec: - initContainers: - - name: test-framework - image: dduportal/bats:0.4.0 - command: - - "bash" - - "-c" - - | - set -ex - # copy bats to tools dir - cp -R /usr/local/libexec/ /tools/bats/ - volumeMounts: - - mountPath: /tools - name: tools - containers: - - name: naftis-test - image: "mysql:5.7.14" - command: ["/tools/bats/bats", "-t", "/tests/run.sh"] - volumeMounts: - - mountPath: /tests - name: tests - readOnly: true - - mountPath: /tools - name: tools - volumes: - - name: tests - configMap: - name: naftis-mysql-test - - name: tools - emptyDir: {} - restartPolicy: Never - --- # Source: mysql/templates/deployment.yaml apiVersion: extensions/v1beta1 @@ -284,7 +248,6 @@ spec: requests: cpu: 100m memory: 256Mi - env: - name: MYSQL_ROOT_PASSWORD valueFrom: @@ -337,6 +300,4 @@ spec: - name: data persistentVolumeClaim: claimName: naftis-mysql ---- -# Source: mysql/templates/configurationFiles-configmap.yaml diff --git a/mysql.yaml b/mysql.yaml index 50a87a059..daeb9458f 100644 --- a/mysql.yaml +++ b/mysql.yaml @@ -1,25 +1,11 @@ - --- -kind: PersistentVolume +# Source: naftis/templates/namespace.yaml apiVersion: v1 +kind: Namespace metadata: - name: naftis-pv - labels: - type: local -spec: - storageClassName: manual - capacity: - storage: 10Gi - accessModes: - - ReadWriteOnce - hostPath: - path: "/mnt/data" ---- - - + name: naftis --- # Source: mysql/templates/secrets.yaml - apiVersion: v1 kind: Secret metadata: @@ -31,15 +17,10 @@ metadata: heritage: "Tiller" type: Opaque data: - mysql-root-password: "V2xSbmNHaDNVV1k1VlE9PQ==" - - mysql-password: "bmFmdGlzSXNBd2Vzb21l" - --- # Source: mysql/templates/initializationFiles-configmap.yaml - apiVersion: v1 kind: ConfigMap metadata: @@ -183,28 +164,6 @@ data: @test "Testing MySQL Connection" { mysql --host=naftis-mysql --port=3306 -u root -pWlRncGh3UWY5VQ== } - - ---- -# Source: mysql/templates/pvc.yaml - -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: naftis-mysql - labels: - app: naftis-mysql - chart: "mysql-0.8.2" - release: "naftis" - heritage: "Tiller" -spec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: "8Gi" - storageClassName: "manual" - --- # Source: mysql/templates/svc.yaml apiVersion: v1 @@ -224,52 +183,6 @@ spec: targetPort: mysql selector: app: naftis-mysql - ---- -# Source: mysql/templates/tests/test.yaml -apiVersion: v1 -kind: Pod -metadata: - name: naftis-mysql-test - labels: - app: naftis-mysql - chart: "mysql-0.8.2" - heritage: "Tiller" - release: "naftis" - annotations: - "helm.sh/hook": test-success -spec: - initContainers: - - name: test-framework - image: dduportal/bats:0.4.0 - command: - - "bash" - - "-c" - - | - set -ex - # copy bats to tools dir - cp -R /usr/local/libexec/ /tools/bats/ - volumeMounts: - - mountPath: /tools - name: tools - containers: - - name: naftis-test - image: "mysql:5.7.14" - command: ["/tools/bats/bats", "-t", "/tests/run.sh"] - volumeMounts: - - mountPath: /tests - name: tests - readOnly: true - - mountPath: /tools - name: tools - volumes: - - name: tests - configMap: - name: naftis-mysql-test - - name: tools - emptyDir: {} - restartPolicy: Never - --- # Source: mysql/templates/deployment.yaml apiVersion: extensions/v1beta1 @@ -303,7 +216,6 @@ spec: requests: cpu: 100m memory: 256Mi - env: - name: MYSQL_ROOT_PASSWORD valueFrom: @@ -354,8 +266,5 @@ spec: configMap: name: naftis-mysql-initialization - name: data - persistentVolumeClaim: - claimName: naftis-mysql ---- -# Source: mysql/templates/configurationFiles-configmap.yaml + emptyDir: {} diff --git a/naftis.yaml b/naftis.yaml index 7f6086cf9..f6f5fb162 100644 --- a/naftis.yaml +++ b/naftis.yaml @@ -1,10 +1,4 @@ --- -# Source: naftis/templates/namespace.yaml -apiVersion: v1 -kind: Namespace -metadata: - name: naftis ---- # Source: naftis/templates/configmap.yaml apiVersion: v1 kind: ConfigMap @@ -169,7 +163,6 @@ spec: requests: cpu: 20m memory: 32Mi - volumes: - name: naftis-config configMap: From b3d12129420fbab685c1d6ddd7d3a1fc4831798a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=5F=5F=5F=5F=5F=5F=E9=BD=90=E5=A4=A9=E5=A4=A7=E5=9C=A3?= Date: Wed, 21 Nov 2018 21:40:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96k8s=20YAML?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mysql.yaml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/mysql.yaml b/mysql.yaml index daeb9458f..f36d092b3 100644 --- a/mysql.yaml +++ b/mysql.yaml @@ -149,22 +149,6 @@ data: ) ENGINE=InnoDB AUTO_INCREMENT=147 DEFAULT CHARSET=utf8mb4; --- -# Source: mysql/templates/tests/test-configmap.yaml -apiVersion: v1 -kind: ConfigMap -metadata: - name: naftis-mysql-test - labels: - app: naftis-mysql - chart: "mysql-0.8.2" - heritage: "Tiller" - release: "naftis" -data: - run.sh: |- - @test "Testing MySQL Connection" { - mysql --host=naftis-mysql --port=3306 -u root -pWlRncGh3UWY5VQ== - } ---- # Source: mysql/templates/svc.yaml apiVersion: v1 kind: Service