From 9c4b15d2f4ef6eb600a3f2b36902f232536d7120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Elek?= Date: Thu, 20 Jun 2019 16:33:59 +0200 Subject: [PATCH] HDDS-1508. Provide example k8s deployment files for the new CSI server Closes #905 --- .../definitions/ozone-csi/csi-controller.yaml | 53 ++++++++++ .../k8s/definitions/ozone-csi/csi-crd.yaml | 21 ++++ .../k8s/definitions/ozone-csi/csi-node.yaml | 95 ++++++++++++++++++ .../k8s/definitions/ozone-csi/csi-rbac.yaml | 66 +++++++++++++ .../ozone-csi/csi-storageclass.yaml | 20 ++++ .../ozone-csi/definitions/csi.yaml | 28 ++++++ .../src/main/k8s/definitions/ozone/om-ss.yaml | 2 +- .../main/k8s/definitions/ozone/scm-ss.yaml | 2 +- .../k8s/definitions/pv-test/flekszible.yaml | 16 +++ .../pv-test/nginx-conf-configmap.yaml | 37 +++++++ .../definitions/pv-test/nginx-deployment.yaml | 49 ++++++++++ .../pv-test/nginx-service-service.yaml | 28 ++++++ .../nginx-storage-persistentvolumeclaim.yaml | 28 ++++++ .../main/k8s/examples/ozone-csi/Flekszible | 25 +++++ .../k8s/examples/ozone-csi/LICENSE.header | 15 +++ .../examples/ozone-csi/config-configmap.yaml | 37 +++++++ .../ozone-csi/csi-node-daemonset.yaml | 97 ++++++++++++++++++ .../ozone-csi/csi-ozone-clusterrole.yaml | 98 +++++++++++++++++++ .../csi-ozone-clusterrolebinding.yaml | 28 ++++++ .../ozone-csi/csi-ozone-serviceaccount.yaml | 21 ++++ .../ozone-csi/csi-provisioner-deployment.yaml | 54 ++++++++++ .../ozone-csi/datanode-daemonset.yaml | 56 +++++++++++ .../k8s/examples/ozone-csi/om-service.yaml | 28 ++++++ .../examples/ozone-csi/om-statefulset.yaml | 73 ++++++++++++++ .../org.apache.hadoop.ozone-csidriver.yaml | 22 +++++ .../ozone-csi/ozone-storageclass.yaml | 21 ++++ .../pv-test/nginx-conf-configmap.yaml | 38 +++++++ .../ozone-csi/pv-test/nginx-deployment.yaml | 50 ++++++++++ .../pv-test/nginx-service-service.yaml | 29 ++++++ .../nginx-storage-persistentvolumeclaim.yaml | 29 ++++++ .../k8s/examples/ozone-csi/s3g-service.yaml | 28 ++++++ .../examples/ozone-csi/s3g-statefulset.yaml | 51 ++++++++++ .../k8s/examples/ozone-csi/scm-service.yaml | 28 ++++++ .../examples/ozone-csi/scm-statefulset.yaml | 67 +++++++++++++ 34 files changed, 1338 insertions(+), 2 deletions(-) create mode 100644 hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-controller.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-crd.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-node.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-rbac.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-storageclass.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/definitions/csi.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/definitions/pv-test/flekszible.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-conf-configmap.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-deployment.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-service-service.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-storage-persistentvolumeclaim.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/Flekszible create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/LICENSE.header create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/config-configmap.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-node-daemonset.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-ozone-clusterrole.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-ozone-clusterrolebinding.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-ozone-serviceaccount.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-provisioner-deployment.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/datanode-daemonset.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/om-service.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/om-statefulset.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/org.apache.hadoop.ozone-csidriver.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/ozone-storageclass.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-conf-configmap.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-deployment.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-service-service.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-storage-persistentvolumeclaim.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/s3g-service.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/s3g-statefulset.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/scm-service.yaml create mode 100644 hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/scm-statefulset.yaml diff --git a/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-controller.yaml b/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-controller.yaml new file mode 100644 index 00000000000..e7c22226010 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-controller.yaml @@ -0,0 +1,53 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +kind: Deployment +apiVersion: apps/v1 +metadata: + name: csi-provisioner +spec: + replicas: 1 + selector: + matchLabels: + app: csi-provisioner + template: + metadata: + labels: + app: csi-provisioner + spec: + serviceAccount: csi-ozone + containers: + - name: csi-provisioner + image: quay.io/k8scsi/csi-provisioner:v1.0.1 + args: + - "--csi-address=/var/lib/csi/csi.sock" + volumeMounts: + - name: socket-dir + mountPath: /var/lib/csi/ + - name: ozone-csi + image: "@docker.image@" + volumeMounts: + - name: socket-dir + mountPath: /var/lib/csi/ + imagePullPolicy: Always + envFrom: + - configMapRef: + name: config + args: + - ozone + - csi + volumes: + - name: socket-dir + emptyDir: diff --git a/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-crd.yaml b/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-crd.yaml new file mode 100644 index 00000000000..f0ca37c30aa --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-crd.yaml @@ -0,0 +1,21 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +apiVersion: storage.k8s.io/v1beta1 +kind: CSIDriver +metadata: + name: org.apache.hadoop.ozone +spec: + attachRequired: false diff --git a/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-node.yaml b/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-node.yaml new file mode 100644 index 00000000000..6c3a1ac36b7 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-node.yaml @@ -0,0 +1,95 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +kind: DaemonSet +apiVersion: apps/v1beta2 +metadata: + name: csi-node +spec: + selector: + matchLabels: + app: csi-node + template: + metadata: + labels: + app: csi-node + spec: + serviceAccount: csi-ozone + containers: + - name: driver-registrar + image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.2 + args: + - "--v=4" + - "--csi-address=/var/lib/csi/csi.sock" + - "--kubelet-registration-path=/var/lib/kubelet/plugins/org.apache.hadoop.ozone/csi.sock" + env: + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + volumeMounts: + - name: plugin-dir + mountPath: /var/lib/csi + - name: registration-dir + mountPath: /registration/ + - name: csi-node + image: "@docker.image@" + securityContext: + runAsUser: 0 + privileged: true + capabilities: + add: ["SYS_ADMIN"] + allowPrivilegeEscalation: true + args: + - ozone + - csi + envFrom: + - configMapRef: + name: config + imagePullPolicy: "Always" + volumeMounts: + - name: plugin-dir + mountPath: /var/lib/csi + - name: pods-mount-dir + mountPath: /var/lib/kubelet/pods + mountPropagation: "Bidirectional" + - name: fuse-device + mountPath: /dev/fuse + - name: dbus + mountPath: /var/run/dbus + - name: systemd + mountPath: /run/systemd + volumes: + - name: plugin-dir + hostPath: + path: /var/lib/kubelet/plugins/org.apache.hadoop.ozone + type: DirectoryOrCreate + - name: registration-dir + hostPath: + path: /var/lib/kubelet/plugins_registry/ + type: DirectoryOrCreate + - name: pods-mount-dir + hostPath: + path: /var/lib/kubelet/pods + type: Directory + - name: fuse-device + hostPath: + path: /dev/fuse + - name: dbus + hostPath: + path: /var/run/dbus + - name: systemd + hostPath: + path: /run/systemd diff --git a/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-rbac.yaml b/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-rbac.yaml new file mode 100644 index 00000000000..d83ffb3e1f1 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-rbac.yaml @@ -0,0 +1,66 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +apiVersion: v1 +kind: ServiceAccount +metadata: + namespace: default + name: csi-ozone +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-ozone +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "list"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "update","watch"] + - apiGroups: [""] + resources: ["namespaces"] + verbs: ["get", "list"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update", "create"] + - apiGroups: ["storage.k8s.io"] + resources: ["volumeattachments"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-ozone +subjects: + - kind: ServiceAccount + name: csi-ozone + namespace: default +roleRef: + kind: ClusterRole + name: csi-ozone + apiGroup: rbac.authorization.k8s.io diff --git a/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-storageclass.yaml b/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-storageclass.yaml new file mode 100644 index 00000000000..97801605509 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/csi-storageclass.yaml @@ -0,0 +1,20 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: ozone +provisioner: org.apache.hadoop.ozone diff --git a/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/definitions/csi.yaml b/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/definitions/csi.yaml new file mode 100644 index 00000000000..14c2ea30aff --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/definitions/ozone-csi/definitions/csi.yaml @@ -0,0 +1,28 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +name: ozone/csi +description: Configuration for CSI interface +--- +- type: Add + trigger: + metadata: + name: config + path: + - data + value: + OZONE-SITE.XML_ozone.csi.s3g.address: http://s3g-0.s3g:9878 + OZONE-SITE.XML_ozone.csi.socket: /var/lib/csi/csi.sock + OZONE-SITE.XML_ozone.csi.owner: hadoop diff --git a/hadoop-ozone/dist/src/main/k8s/definitions/ozone/om-ss.yaml b/hadoop-ozone/dist/src/main/k8s/definitions/ozone/om-ss.yaml index 820d5622811..9f9d87df7dd 100644 --- a/hadoop-ozone/dist/src/main/k8s/definitions/ozone/om-ss.yaml +++ b/hadoop-ozone/dist/src/main/k8s/definitions/ozone/om-ss.yaml @@ -38,7 +38,7 @@ spec: spec: initContainers: - name: init - image: elek/ozone + image: "@docker.image@" args: ["ozone","om","--init"] env: - name: WAITFOR diff --git a/hadoop-ozone/dist/src/main/k8s/definitions/ozone/scm-ss.yaml b/hadoop-ozone/dist/src/main/k8s/definitions/ozone/scm-ss.yaml index a87111ca85d..9329a5ffe1a 100644 --- a/hadoop-ozone/dist/src/main/k8s/definitions/ozone/scm-ss.yaml +++ b/hadoop-ozone/dist/src/main/k8s/definitions/ozone/scm-ss.yaml @@ -42,5 +42,5 @@ spec: args: ["ozone","scm", "--init"] containers: - name: scm - image: elek/ozone + image: "@docker.image@" args: ["ozone","scm"] diff --git a/hadoop-ozone/dist/src/main/k8s/definitions/pv-test/flekszible.yaml b/hadoop-ozone/dist/src/main/k8s/definitions/pv-test/flekszible.yaml new file mode 100644 index 00000000000..bfe82ff6336 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/definitions/pv-test/flekszible.yaml @@ -0,0 +1,16 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +description: Nginx example deployment with persistent volume claim. diff --git a/hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-conf-configmap.yaml b/hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-conf-configmap.yaml new file mode 100644 index 00000000000..1fd8941bc77 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-conf-configmap.yaml @@ -0,0 +1,37 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-conf + labels: {} + annotations: {} +data: + default.conf: |- + server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + } diff --git a/hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-deployment.yaml b/hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-deployment.yaml new file mode 100644 index 00000000000..b6cafc5b5ee --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-deployment.yaml @@ -0,0 +1,49 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx + labels: + app: nginx + annotations: {} +spec: + replicas: 1 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + annotations: {} + spec: + containers: + - name: nginx + image: nginx + volumeMounts: + - mountPath: /var/lib/www/html + name: webroot + env: [] + envFrom: [] + volumes: + - name: webroot + persistentVolumeClaim: + claimName: nginx-storage + readOnly: false + - name: config + configMap: + name: nginx-conf diff --git a/hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-service-service.yaml b/hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-service-service.yaml new file mode 100644 index 00000000000..3a338bac7ff --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-service-service.yaml @@ -0,0 +1,28 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +apiVersion: v1 +kind: Service +metadata: + name: nginx-service + labels: {} + annotations: {} +spec: + type: NodePort + ports: + - port: 80 + name: web + selector: + app: csi-s3-test-nginx diff --git a/hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-storage-persistentvolumeclaim.yaml b/hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-storage-persistentvolumeclaim.yaml new file mode 100644 index 00000000000..ec0d76b2da0 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/definitions/pv-test/nginx-storage-persistentvolumeclaim.yaml @@ -0,0 +1,28 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nginx-storage + labels: {} + annotations: {} +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + storageClassName: ozone diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/Flekszible b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/Flekszible new file mode 100644 index 00000000000..7e4f3f19275 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/Flekszible @@ -0,0 +1,25 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +source: + - path: ../../definitions +import: + - path: ozone-csi + - path: ozone + transformations: + - type: ozone/csi + - path: pv-test + destination: pv-test diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/LICENSE.header b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/LICENSE.header new file mode 100644 index 00000000000..635f0d9e60e --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/LICENSE.header @@ -0,0 +1,15 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/config-configmap.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/config-configmap.yaml new file mode 100644 index 00000000000..e554145bac6 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/config-configmap.yaml @@ -0,0 +1,37 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +apiVersion: v1 +kind: ConfigMap +metadata: + name: config +data: + OZONE-SITE.XML_hdds.datanode.dir: /data/storage + OZONE-SITE.XML_ozone.scm.datanode.id.dir: /data + OZONE-SITE.XML_ozone.metadata.dirs: /data/metadata + OZONE-SITE.XML_ozone.scm.block.client.address: scm-0.scm + OZONE-SITE.XML_ozone.om.address: om-0.om + OZONE-SITE.XML_ozone.scm.client.address: scm-0.scm + OZONE-SITE.XML_ozone.scm.names: scm-0.scm + OZONE-SITE.XML_ozone.enabled: "true" + LOG4J.PROPERTIES_log4j.rootLogger: INFO, stdout + LOG4J.PROPERTIES_log4j.appender.stdout: org.apache.log4j.ConsoleAppender + LOG4J.PROPERTIES_log4j.appender.stdout.layout: org.apache.log4j.PatternLayout + LOG4J.PROPERTIES_log4j.appender.stdout.layout.ConversionPattern: '%d{yyyy-MM-dd + HH:mm:ss} %-5p %c{1}:%L - %m%n' + OZONE-SITE.XML_ozone.csi.s3g.address: http://s3g-0.s3g:9878 + OZONE-SITE.XML_ozone.csi.socket: /var/lib/csi/csi.sock + OZONE-SITE.XML_ozone.csi.owner: hadoop diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-node-daemonset.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-node-daemonset.yaml new file mode 100644 index 00000000000..fe4453232d2 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-node-daemonset.yaml @@ -0,0 +1,97 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +kind: DaemonSet +apiVersion: apps/v1beta2 +metadata: + name: csi-node +spec: + selector: + matchLabels: + app: csi-node + template: + metadata: + labels: + app: csi-node + spec: + serviceAccount: csi-ozone + containers: + - name: driver-registrar + image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.2 + args: + - --v=4 + - --csi-address=/var/lib/csi/csi.sock + - --kubelet-registration-path=/var/lib/kubelet/plugins/org.apache.hadoop.ozone/csi.sock + env: + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + volumeMounts: + - name: plugin-dir + mountPath: /var/lib/csi + - name: registration-dir + mountPath: /registration/ + - name: csi-node + image: '@docker.image@' + securityContext: + runAsUser: 0 + privileged: true + capabilities: + add: + - SYS_ADMIN + allowPrivilegeEscalation: true + args: + - ozone + - csi + envFrom: + - configMapRef: + name: config + imagePullPolicy: Always + volumeMounts: + - name: plugin-dir + mountPath: /var/lib/csi + - name: pods-mount-dir + mountPath: /var/lib/kubelet/pods + mountPropagation: Bidirectional + - name: fuse-device + mountPath: /dev/fuse + - name: dbus + mountPath: /var/run/dbus + - name: systemd + mountPath: /run/systemd + volumes: + - name: plugin-dir + hostPath: + path: /var/lib/kubelet/plugins/org.apache.hadoop.ozone + type: DirectoryOrCreate + - name: registration-dir + hostPath: + path: /var/lib/kubelet/plugins_registry/ + type: DirectoryOrCreate + - name: pods-mount-dir + hostPath: + path: /var/lib/kubelet/pods + type: Directory + - name: fuse-device + hostPath: + path: /dev/fuse + - name: dbus + hostPath: + path: /var/run/dbus + - name: systemd + hostPath: + path: /run/systemd diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-ozone-clusterrole.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-ozone-clusterrole.yaml new file mode 100644 index 00000000000..efcd51f0724 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-ozone-clusterrole.yaml @@ -0,0 +1,98 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-ozone +rules: +- apiGroups: + - "" + resources: + - secrets + verbs: + - get + - list +- apiGroups: + - "" + resources: + - events + verbs: + - list + - watch + - create + - update + - patch +- apiGroups: + - "" + resources: + - nodes + verbs: + - get + - list + - update + - watch +- apiGroups: + - "" + resources: + - namespaces + verbs: + - get + - list +- apiGroups: + - storage.k8s.io + resources: + - storageclasses + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - persistentvolumeclaims + verbs: + - get + - list + - watch + - update +- apiGroups: + - "" + resources: + - persistentvolumes + verbs: + - get + - list + - watch + - update + - create +- apiGroups: + - storage.k8s.io + resources: + - volumeattachments + verbs: + - get + - list + - watch + - update +- apiGroups: + - storage.k8s.io + resources: + - csinodes + verbs: + - get + - list + - watch diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-ozone-clusterrolebinding.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-ozone-clusterrolebinding.yaml new file mode 100644 index 00000000000..2f2537ca740 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-ozone-clusterrolebinding.yaml @@ -0,0 +1,28 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-ozone +subjects: +- kind: ServiceAccount + name: csi-ozone + namespace: default +roleRef: + kind: ClusterRole + name: csi-ozone + apiGroup: rbac.authorization.k8s.io diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-ozone-serviceaccount.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-ozone-serviceaccount.yaml new file mode 100644 index 00000000000..628d2a1c595 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-ozone-serviceaccount.yaml @@ -0,0 +1,21 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +apiVersion: v1 +kind: ServiceAccount +metadata: + namespace: default + name: csi-ozone diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-provisioner-deployment.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-provisioner-deployment.yaml new file mode 100644 index 00000000000..03478ffeee2 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/csi-provisioner-deployment.yaml @@ -0,0 +1,54 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +kind: Deployment +apiVersion: apps/v1 +metadata: + name: csi-provisioner +spec: + replicas: 1 + selector: + matchLabels: + app: csi-provisioner + template: + metadata: + labels: + app: csi-provisioner + spec: + serviceAccount: csi-ozone + containers: + - name: csi-provisioner + image: quay.io/k8scsi/csi-provisioner:v1.0.1 + args: + - --csi-address=/var/lib/csi/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /var/lib/csi/ + - name: ozone-csi + image: '@docker.image@' + volumeMounts: + - name: socket-dir + mountPath: /var/lib/csi/ + imagePullPolicy: Always + envFrom: + - configMapRef: + name: config + args: + - ozone + - csi + volumes: + - name: socket-dir + emptyDir: null diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/datanode-daemonset.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/datanode-daemonset.yaml new file mode 100644 index 00000000000..6e3b3b96cf0 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/datanode-daemonset.yaml @@ -0,0 +1,56 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: datanode + labels: + app.kubernetes.io/component: ozone +spec: + selector: + matchLabels: + app: ozone + component: datanode + template: + metadata: + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "9882" + prometheus.io/path: /prom + labels: + app: ozone + component: datanode + spec: + containers: + - name: datanode + image: '@docker.image@' + args: + - ozone + - datanode + ports: + - containerPort: 9870 + name: rpc + envFrom: + - configMapRef: + name: config + volumeMounts: + - name: data + mountPath: /data + initContainers: [] + volumes: + - name: data + emptyDir: {} diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/om-service.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/om-service.yaml new file mode 100644 index 00000000000..617277d9b85 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/om-service.yaml @@ -0,0 +1,28 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +apiVersion: v1 +kind: Service +metadata: + name: om +spec: + ports: + - port: 9874 + name: ui + clusterIP: None + selector: + app: ozone + component: om diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/om-statefulset.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/om-statefulset.yaml new file mode 100644 index 00000000000..884dd462417 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/om-statefulset.yaml @@ -0,0 +1,73 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: om + labels: + app.kubernetes.io/component: ozone +spec: + selector: + matchLabels: + app: ozone + component: om + serviceName: om + replicas: 1 + template: + metadata: + labels: + app: ozone + component: om + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "9874" + prometheus.io/path: /prom + spec: + initContainers: + - name: init + image: '@docker.image@' + args: + - ozone + - om + - --init + env: + - name: WAITFOR + value: scm-0.scm:9876 + envFrom: + - configMapRef: + name: config + volumeMounts: + - name: data + mountPath: /data + containers: + - name: om + image: '@docker.image@' + args: + - ozone + - om + env: + - name: WAITFOR + value: scm-0.scm:9876 + envFrom: + - configMapRef: + name: config + volumeMounts: + - name: data + mountPath: /data + volumes: + - name: data + emptyDir: {} diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/org.apache.hadoop.ozone-csidriver.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/org.apache.hadoop.ozone-csidriver.yaml new file mode 100644 index 00000000000..e657c50f758 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/org.apache.hadoop.ozone-csidriver.yaml @@ -0,0 +1,22 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +apiVersion: storage.k8s.io/v1beta1 +kind: CSIDriver +metadata: + name: org.apache.hadoop.ozone +spec: + attachRequired: false diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/ozone-storageclass.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/ozone-storageclass.yaml new file mode 100644 index 00000000000..c6c1c6c9d1e --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/ozone-storageclass.yaml @@ -0,0 +1,21 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: ozone +provisioner: org.apache.hadoop.ozone diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-conf-configmap.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-conf-configmap.yaml new file mode 100644 index 00000000000..2f1813c5534 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-conf-configmap.yaml @@ -0,0 +1,38 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-conf + labels: {} + annotations: {} +data: + default.conf: |- + server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + } diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-deployment.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-deployment.yaml new file mode 100644 index 00000000000..db6eb107edb --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-deployment.yaml @@ -0,0 +1,50 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx + labels: + app: nginx + annotations: {} +spec: + replicas: 1 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + annotations: {} + spec: + containers: + - name: nginx + image: nginx + volumeMounts: + - mountPath: /var/lib/www/html + name: webroot + env: [] + envFrom: [] + volumes: + - name: webroot + persistentVolumeClaim: + claimName: nginx-storage + readOnly: false + - name: config + configMap: + name: nginx-conf diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-service-service.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-service-service.yaml new file mode 100644 index 00000000000..b31a5106890 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-service-service.yaml @@ -0,0 +1,29 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +apiVersion: v1 +kind: Service +metadata: + name: nginx-service + labels: {} + annotations: {} +spec: + type: NodePort + ports: + - port: 80 + name: web + selector: + app: csi-s3-test-nginx diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-storage-persistentvolumeclaim.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-storage-persistentvolumeclaim.yaml new file mode 100644 index 00000000000..5968b926a9f --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/pv-test/nginx-storage-persistentvolumeclaim.yaml @@ -0,0 +1,29 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nginx-storage + labels: {} + annotations: {} +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + storageClassName: ozone diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/s3g-service.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/s3g-service.yaml new file mode 100644 index 00000000000..dd1ca834799 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/s3g-service.yaml @@ -0,0 +1,28 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +apiVersion: v1 +kind: Service +metadata: + name: s3g +spec: + ports: + - port: 9878 + name: rest + clusterIP: None + selector: + app: ozone + component: s3g diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/s3g-statefulset.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/s3g-statefulset.yaml new file mode 100644 index 00000000000..b608cde832e --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/s3g-statefulset.yaml @@ -0,0 +1,51 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: s3g + labels: + app.kubernetes.io/component: ozone +spec: + selector: + matchLabels: + app: ozone + component: s3g + serviceName: s3g + replicas: 1 + template: + metadata: + labels: + app: ozone + component: s3g + spec: + containers: + - name: s3g + image: '@docker.image@' + args: + - ozone + - s3g + envFrom: + - configMapRef: + name: config + volumeMounts: + - name: data + mountPath: /data + initContainers: [] + volumes: + - name: data + emptyDir: {} diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/scm-service.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/scm-service.yaml new file mode 100644 index 00000000000..0df15d64531 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/scm-service.yaml @@ -0,0 +1,28 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +apiVersion: v1 +kind: Service +metadata: + name: scm +spec: + ports: + - port: 9876 + name: ui + clusterIP: None + selector: + app: ozone + component: scm diff --git a/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/scm-statefulset.yaml b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/scm-statefulset.yaml new file mode 100644 index 00000000000..55b56722d10 --- /dev/null +++ b/hadoop-ozone/dist/src/main/k8s/examples/ozone-csi/scm-statefulset.yaml @@ -0,0 +1,67 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: scm + labels: + app.kubernetes.io/component: ozone +spec: + selector: + matchLabels: + app: ozone + component: scm + serviceName: scm + replicas: 1 + template: + metadata: + labels: + app: ozone + component: scm + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "9876" + prometheus.io/path: /prom + spec: + initContainers: + - name: init + image: '@docker.image@' + args: + - ozone + - scm + - --init + envFrom: + - configMapRef: + name: config + volumeMounts: + - name: data + mountPath: /data + containers: + - name: scm + image: '@docker.image@' + args: + - ozone + - scm + envFrom: + - configMapRef: + name: config + volumeMounts: + - name: data + mountPath: /data + volumes: + - name: data + emptyDir: {}