Bläddra i källkod

HDDS-1646. Support real persistence in the k8s example files (#945)

* HDDS-1646. Support real persistence in the k8s example files

* ephemeral clusters can be scaled up
Elek, Márton 5 år sedan
förälder
incheckning
d023f1f864
42 ändrade filer med 994 tillägg och 89 borttagningar
  1. 27 0
      hadoop-ozone/dist/src/main/k8s/definitions/ozone/datanode-ss-service.yaml
  2. 54 0
      hadoop-ozone/dist/src/main/k8s/definitions/ozone/datanode-ss.yaml
  3. 4 16
      hadoop-ozone/dist/src/main/k8s/definitions/ozone/definitions/emptydir.yaml
  4. 66 0
      hadoop-ozone/dist/src/main/k8s/definitions/ozone/definitions/persistence.yaml
  5. 2 0
      hadoop-ozone/dist/src/main/k8s/definitions/ozone/om-ss.yaml
  6. 2 0
      hadoop-ozone/dist/src/main/k8s/definitions/ozone/scm-ss.yaml
  7. 2 2
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/Flekszible
  8. 15 0
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/LICENSE.header
  9. 34 0
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/config-configmap.yaml
  10. 28 0
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/datanode-public-service.yaml
  11. 28 0
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/datanode-service.yaml
  12. 66 0
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/datanode-statefulset.yaml
  13. 17 14
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/freon/freon-deployment.yaml
  14. 28 0
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/om-public-service.yaml
  15. 28 0
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/om-service.yaml
  16. 75 0
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/om-statefulset.yaml
  17. 28 0
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/s3g-public-service.yaml
  18. 28 0
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/s3g-service.yaml
  19. 8 14
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/s3g-statefulset.yaml
  20. 28 0
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/scm-public-service.yaml
  21. 28 0
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/scm-service.yaml
  22. 69 0
      hadoop-ozone/dist/src/main/k8s/examples/getting-started/scm-statefulset.yaml
  23. 45 0
      hadoop-ozone/dist/src/main/k8s/examples/minikube/Flekszible
  24. 28 0
      hadoop-ozone/dist/src/main/k8s/examples/minikube/datanode-public-service.yaml
  25. 3 0
      hadoop-ozone/dist/src/main/k8s/examples/minikube/datanode-service.yaml
  26. 18 10
      hadoop-ozone/dist/src/main/k8s/examples/minikube/datanode-statefulset.yaml
  27. 8 0
      hadoop-ozone/dist/src/main/k8s/examples/minikube/om-statefulset.yaml
  28. 0 1
      hadoop-ozone/dist/src/main/k8s/examples/minikube/s3g-statefulset.yaml
  29. 2 0
      hadoop-ozone/dist/src/main/k8s/examples/minikube/scm-statefulset.yaml
  30. 3 2
      hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/Flekszible
  31. 28 0
      hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/datanode-public-service.yaml
  32. 28 0
      hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/datanode-service.yaml
  33. 22 12
      hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/datanode-statefulset.yaml
  34. 2 0
      hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/om-statefulset.yaml
  35. 3 4
      hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/s3g-statefulset.yaml
  36. 5 3
      hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/scm-statefulset.yaml
  37. 2 1
      hadoop-ozone/dist/src/main/k8s/examples/ozone/Flekszible
  38. 28 0
      hadoop-ozone/dist/src/main/k8s/examples/ozone/datanode-service.yaml
  39. 72 0
      hadoop-ozone/dist/src/main/k8s/examples/ozone/datanode-statefulset.yaml
  40. 12 3
      hadoop-ozone/dist/src/main/k8s/examples/ozone/om-statefulset.yaml
  41. 9 4
      hadoop-ozone/dist/src/main/k8s/examples/ozone/s3g-statefulset.yaml
  42. 11 3
      hadoop-ozone/dist/src/main/k8s/examples/ozone/scm-statefulset.yaml

+ 27 - 0
hadoop-ozone/dist/src/main/k8s/definitions/ozone/datanode-ss-service.yaml

@@ -0,0 +1,27 @@
+# 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: datanode
+spec:
+  ports:
+  - port: 9870
+    name: rpc
+  clusterIP: None
+  selector:
+     app: ozone
+     component: datanode

+ 54 - 0
hadoop-ozone/dist/src/main/k8s/definitions/ozone/datanode-ss.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 cdatanodepliance
+# 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: datanode
+  labels:
+    app.kubernetes.io/component: ozone
+spec:
+  selector:
+    matchLabels:
+      app: ozone
+      component: datanode
+  serviceName: datanode
+  replicas: 3
+  template:
+    metadata:
+      labels:
+        app: ozone
+        component: datanode
+      annotations:
+        prdatanodeetheus.io/scrape: "true"
+        prdatanodeetheus.io/port: "9882"
+        prdatanodeetheus.io/path: "/prom"
+    spec:
+      affinity:
+        podAntiAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+          - labelSelector:
+              matchExpressions:
+              - key: component
+                operator: In
+                values:
+                - datanode
+            topologyKey: "kubernetes.io/hostname"
+      securityContext:
+        fsGroup: 1000
+      containers:
+      - name: datanode
+        image: "@docker.image@"
+        args: ["ozone","datanode"]

+ 4 - 16
hadoop-ozone/dist/src/main/k8s/definitions/ozone/transformations/emptydir.yaml → hadoop-ozone/dist/src/main/k8s/definitions/ozone/definitions/emptydir.yaml

@@ -13,6 +13,9 @@
 # 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/emptydir
+description: Add empty dir based ephemeral persistence
+---
 - type: Add
   trigger:
     metadata:
@@ -22,22 +25,7 @@
     - spec
     - template
     - spec
-    - containers
-    - "*"
-    - volumeMounts
-  value:
-    - name: data
-      mountPath: /data
-- type: Add
-  trigger:
-    metadata:
-      labels:
-        app.kubernetes.io/component: ozone
-  path:
-    - spec
-    - template
-    - spec
-    - initContainers
+    - (initContainers|containers)
     - "*"
     - volumeMounts
   value:

+ 66 - 0
hadoop-ozone/dist/src/main/k8s/definitions/ozone/definitions/persistence.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.
+name: ozone/persistence
+description: Add real PVC based persistence
+---
+- type: Add
+  path:
+    - spec
+  trigger:
+    kind: StatefulSet
+  value:
+      volumeClaimTemplates:
+      - metadata:
+          name: data
+        spec:
+          accessModes: [ "ReadWriteOnce" ]
+          resources:
+            requests:
+              storage: 2Gi
+- type: Add
+  trigger:
+     metadata:
+        name: datanode
+  path:
+    - spec
+    - template
+    - spec
+  value:
+    affinity:
+      podAntiAffinity:
+        requiredDuringSchedulingIgnoredDuringExecution:
+        - labelSelector:
+            matchExpressions:
+            - key: component
+              operator: In
+              values:
+              - datanode
+          topologyKey: kubernetes.io/hostname
+- type: Add
+  trigger:
+    metadata:
+      labels:
+        app.kubernetes.io/component: ozone
+  path:
+    - spec
+    - template
+    - spec
+    - (initContainers|containers)
+    - "*"
+    - volumeMounts
+  value:
+    - name: data
+      mountPath: /data

+ 2 - 0
hadoop-ozone/dist/src/main/k8s/definitions/ozone/om-ss.yaml

@@ -36,6 +36,8 @@ spec:
         prometheus.io/port: "9874"
         prometheus.io/path: "/prom"
     spec:
+      securityContext:
+        fsGroup: 1000
       initContainers:
       - name: init
         image: "@docker.image@"

+ 2 - 0
hadoop-ozone/dist/src/main/k8s/definitions/ozone/scm-ss.yaml

@@ -36,6 +36,8 @@ spec:
         prometheus.io/port: "9876"
         prometheus.io/path: "/prom"
     spec:
+      securityContext:
+        fsGroup: 1000
       initContainers:
       - name: init
         image: "@docker.image@"

+ 2 - 2
hadoop-ozone/dist/src/main/k8s/examples/minikube/flekszible/flekszible.yaml → hadoop-ozone/dist/src/main/k8s/examples/getting-started/Flekszible

@@ -14,14 +14,14 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 source:
-  - path: ../../../definitions
+  - path: ../../definitions
 import:
   - path: ozone
     transformations:
     - type: Image
       image: "@docker.image@"
-    - type: DaemonToStatefulSet
     - type: PublishStatefulSet
+    - type: ozone/emptydir
   - path: ozone/freon
     destination: freon
     transformations:

+ 15 - 0
hadoop-ozone/dist/src/main/k8s/examples/getting-started/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.

+ 34 - 0
hadoop-ozone/dist/src/main/k8s/examples/getting-started/config-configmap.yaml

@@ -0,0 +1,34 @@
+# 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'

+ 28 - 0
hadoop-ozone/dist/src/main/k8s/examples/getting-started/datanode-public-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: datanode-public
+spec:
+  ports:
+  - port: 9870
+    name: rpc
+  selector:
+    app: ozone
+    component: datanode
+  type: NodePort

+ 28 - 0
hadoop-ozone/dist/src/main/k8s/examples/getting-started/datanode-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: datanode
+spec:
+  ports:
+  - port: 9870
+    name: rpc
+  clusterIP: None
+  selector:
+    app: ozone
+    component: datanode

+ 66 - 0
hadoop-ozone/dist/src/main/k8s/examples/getting-started/datanode-statefulset.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: apps/v1
+kind: StatefulSet
+metadata:
+  name: datanode
+  labels:
+    app.kubernetes.io/component: ozone
+spec:
+  selector:
+    matchLabels:
+      app: ozone
+      component: datanode
+  serviceName: datanode
+  replicas: 3
+  template:
+    metadata:
+      labels:
+        app: ozone
+        component: datanode
+      annotations:
+        prdatanodeetheus.io/scrape: "true"
+        prdatanodeetheus.io/port: "9882"
+        prdatanodeetheus.io/path: /prom
+    spec:
+      affinity:
+        podAntiAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+          - labelSelector:
+              matchExpressions:
+              - key: component
+                operator: In
+                values:
+                - datanode
+            topologyKey: kubernetes.io/hostname
+      securityContext:
+        fsGroup: 1000
+      containers:
+      - name: datanode
+        image: '@docker.image@'
+        args:
+        - ozone
+        - datanode
+        envFrom:
+        - configMapRef:
+            name: config
+        volumeMounts:
+        - name: data
+          mountPath: /data
+      volumes:
+      - name: data
+        emptyDir: {}

+ 17 - 14
hadoop-ozone/dist/src/main/k8s/definitions/ozone/datanode-ds.yaml → hadoop-ozone/dist/src/main/k8s/examples/getting-started/freon/freon-deployment.yaml

@@ -13,31 +13,34 @@
 # 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
+kind: Deployment
 metadata:
-  name: datanode
+  name: freon
   labels:
     app.kubernetes.io/component: ozone
 spec:
+  replicas: 1
   selector:
     matchLabels:
       app: ozone
-      component: datanode
+      component: freon
   template:
     metadata:
-      annotations:
-        prometheus.io/scrape: "true"
-        prometheus.io/port: "9882"
-        prometheus.io/path: "/prom"
       labels:
         app: ozone
-        component: datanode
+        component: freon
     spec:
       containers:
-      - name: datanode
-        image: "@docker.image@"
-        args: ["ozone","datanode"]
-        ports:
-           - containerPort: 9870
-             name: rpc
+      - name: freon
+        image: '@docker.image@'
+        args:
+        - ozone
+        - freon
+        - rk
+        - --factor=THREE
+        - --replicationType=RATIS
+        envFrom:
+        - configMapRef:
+            name: config

+ 28 - 0
hadoop-ozone/dist/src/main/k8s/examples/getting-started/om-public-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-public
+spec:
+  ports:
+  - port: 9874
+    name: ui
+  selector:
+    app: ozone
+    component: om
+  type: NodePort

+ 28 - 0
hadoop-ozone/dist/src/main/k8s/examples/getting-started/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

+ 75 - 0
hadoop-ozone/dist/src/main/k8s/examples/getting-started/om-statefulset.yaml

@@ -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
+#
+#     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:
+      securityContext:
+        fsGroup: 1000
+      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: {}

+ 28 - 0
hadoop-ozone/dist/src/main/k8s/examples/getting-started/s3g-public-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-public
+spec:
+  ports:
+  - port: 9878
+    name: rest
+  selector:
+    app: ozone
+    component: s3g
+  type: NodePort

+ 28 - 0
hadoop-ozone/dist/src/main/k8s/examples/getting-started/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

+ 8 - 14
hadoop-ozone/dist/src/main/k8s/examples/ozone/datanode-daemonset.yaml → hadoop-ozone/dist/src/main/k8s/examples/getting-started/s3g-statefulset.yaml

@@ -15,42 +15,36 @@
 # limitations under the License.
 
 apiVersion: apps/v1
-kind: DaemonSet
+kind: StatefulSet
 metadata:
-  name: datanode
+  name: s3g
   labels:
     app.kubernetes.io/component: ozone
 spec:
   selector:
     matchLabels:
       app: ozone
-      component: datanode
+      component: s3g
+  serviceName: s3g
+  replicas: 1
   template:
     metadata:
-      annotations:
-        prometheus.io/scrape: "true"
-        prometheus.io/port: "9882"
-        prometheus.io/path: /prom
       labels:
         app: ozone
-        component: datanode
+        component: s3g
     spec:
       containers:
-      - name: datanode
+      - name: s3g
         image: '@docker.image@'
         args:
         - ozone
-        - datanode
-        ports:
-        - containerPort: 9870
-          name: rpc
+        - s3g
         envFrom:
         - configMapRef:
             name: config
         volumeMounts:
         - name: data
           mountPath: /data
-      initContainers: []
       volumes:
       - name: data
         emptyDir: {}

+ 28 - 0
hadoop-ozone/dist/src/main/k8s/examples/getting-started/scm-public-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-public
+spec:
+  ports:
+  - port: 9876
+    name: ui
+  selector:
+    app: ozone
+    component: scm
+  type: NodePort

+ 28 - 0
hadoop-ozone/dist/src/main/k8s/examples/getting-started/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

+ 69 - 0
hadoop-ozone/dist/src/main/k8s/examples/getting-started/scm-statefulset.yaml

@@ -0,0 +1,69 @@
+# 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:
+      securityContext:
+        fsGroup: 1000
+      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: {}

+ 45 - 0
hadoop-ozone/dist/src/main/k8s/examples/minikube/Flekszible

@@ -0,0 +1,45 @@
+# 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
+    transformations:
+    - type: Image
+      image: "@docker.image@"
+    - type: PublishStatefulSet
+    - type: ozone/emptydir
+  - path: ozone/freon
+    destination: freon
+    transformations:
+    - type: Image
+      image: "@docker.image@"
+header: |-
+  # 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.

+ 28 - 0
hadoop-ozone/dist/src/main/k8s/examples/minikube/datanode-public-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: datanode-public
+spec:
+  ports:
+  - port: 9870
+    name: rpc
+  selector:
+    app: ozone
+    component: datanode
+  type: NodePort

+ 3 - 0
hadoop-ozone/dist/src/main/k8s/examples/minikube/datanode-service.yaml

@@ -19,6 +19,9 @@ kind: Service
 metadata:
   name: datanode
 spec:
+  ports:
+  - port: 9870
+    name: rpc
   clusterIP: None
   selector:
     app: ozone

+ 18 - 10
hadoop-ozone/dist/src/main/k8s/examples/minikube/datanode-statefulset.yaml

@@ -25,34 +25,42 @@ spec:
     matchLabels:
       app: ozone
       component: datanode
+  serviceName: datanode
+  replicas: 3
   template:
     metadata:
-      annotations:
-        prometheus.io/scrape: "true"
-        prometheus.io/port: "9882"
-        prometheus.io/path: /prom
       labels:
         app: ozone
         component: datanode
+      annotations:
+        prdatanodeetheus.io/scrape: "true"
+        prdatanodeetheus.io/port: "9882"
+        prdatanodeetheus.io/path: /prom
     spec:
+      affinity:
+        podAntiAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+          - labelSelector:
+              matchExpressions:
+              - key: component
+                operator: In
+                values:
+                - datanode
+            topologyKey: kubernetes.io/hostname
+      securityContext:
+        fsGroup: 1000
       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: {}
-  serviceName: datanode
-  replicas: 3

+ 8 - 0
hadoop-ozone/dist/src/main/k8s/examples/minikube/om-statefulset.yaml

@@ -37,6 +37,8 @@ spec:
         prometheus.io/port: "9874"
         prometheus.io/path: /prom
     spec:
+      securityContext:
+        fsGroup: 1000
       initContainers:
       - name: init
         image: '@docker.image@'
@@ -44,6 +46,9 @@ spec:
         - ozone
         - om
         - --init
+        env:
+        - name: WAITFOR
+          value: scm-0.scm:9876
         envFrom:
         - configMapRef:
             name: config
@@ -56,6 +61,9 @@ spec:
         args:
         - ozone
         - om
+        env:
+        - name: WAITFOR
+          value: scm-0.scm:9876
         envFrom:
         - configMapRef:
             name: config

+ 0 - 1
hadoop-ozone/dist/src/main/k8s/examples/minikube/s3g-statefulset.yaml

@@ -45,7 +45,6 @@ spec:
         volumeMounts:
         - name: data
           mountPath: /data
-      initContainers: []
       volumes:
       - name: data
         emptyDir: {}

+ 2 - 0
hadoop-ozone/dist/src/main/k8s/examples/minikube/scm-statefulset.yaml

@@ -37,6 +37,8 @@ spec:
         prometheus.io/port: "9876"
         prometheus.io/path: /prom
     spec:
+      securityContext:
+        fsGroup: 1000
       initContainers:
       - name: init
         image: '@docker.image@'

+ 3 - 2
hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/flekszible/flekszible.yaml → hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/Flekszible

@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 source:
-  - path: ../../../definitions
+  - path: ../../definitions
 import:
   - path: ozone
     transformations:
@@ -24,6 +24,7 @@ import:
     - type: PublishStatefulSet
     - type: ozone/tracing
     - type: ozone/profiler
+    - type: ozone/emptydir
   - path: prometheus
   - path: jaeger
     transformations:
@@ -33,4 +34,4 @@ import:
     transformations:
     - type: Image
       image: "@docker.image@"
-    - type: ozone/tracing
+    - type: ozone/tracing

+ 28 - 0
hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/datanode-public-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: datanode-public
+spec:
+  ports:
+  - port: 9870
+    name: rpc
+  selector:
+    app: ozone
+    component: datanode
+  type: NodePort

+ 28 - 0
hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/datanode-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: datanode
+spec:
+  ports:
+  - port: 9870
+    name: rpc
+  clusterIP: None
+  selector:
+    app: ozone
+    component: datanode

+ 22 - 12
hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/datanode-daemonset.yaml → hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/datanode-statefulset.yaml

@@ -15,7 +15,7 @@
 # limitations under the License.
 
 apiVersion: apps/v1
-kind: DaemonSet
+kind: StatefulSet
 metadata:
   name: datanode
   labels:
@@ -25,25 +25,39 @@ spec:
     matchLabels:
       app: ozone
       component: datanode
+  serviceName: datanode
+  replicas: 3
   template:
     metadata:
-      annotations:
-        prometheus.io/scrape: "true"
-        prometheus.io/port: "9882"
-        prometheus.io/path: /prom
       labels:
         app: ozone
         component: datanode
+      annotations:
+        prdatanodeetheus.io/scrape: "true"
+        prdatanodeetheus.io/port: "9882"
+        prdatanodeetheus.io/path: /prom
     spec:
+      affinity:
+        podAntiAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+          - labelSelector:
+              matchExpressions:
+              - key: component
+                operator: In
+                values:
+                - datanode
+            topologyKey: kubernetes.io/hostname
+      securityContext:
+        fsGroup: 1000
       containers:
       - name: datanode
         image: '@docker.image@'
         args:
         - ozone
         - datanode
-        ports:
-        - containerPort: 9870
-          name: rpc
+        envFrom:
+        - configMapRef:
+            name: config
         env:
         - name: JAEGER_SAMPLER_TYPE
           value: probabilistic
@@ -51,13 +65,9 @@ spec:
           value: "0.01"
         - name: JAEGER_AGENT_HOST
           value: jaeger-0.jaeger
-        envFrom:
-        - configMapRef:
-            name: config
         volumeMounts:
         - name: data
           mountPath: /data
-      initContainers: []
       volumes:
       - name: data
         emptyDir: {}

+ 2 - 0
hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/om-statefulset.yaml

@@ -37,6 +37,8 @@ spec:
         prometheus.io/port: "9874"
         prometheus.io/path: /prom
     spec:
+      securityContext:
+        fsGroup: 1000
       initContainers:
       - name: init
         image: '@docker.image@'

+ 3 - 4
hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/s3g-statefulset.yaml

@@ -39,6 +39,9 @@ spec:
         args:
         - ozone
         - s3g
+        envFrom:
+        - configMapRef:
+            name: config
         env:
         - name: JAEGER_SAMPLER_TYPE
           value: probabilistic
@@ -46,13 +49,9 @@ spec:
           value: "0.01"
         - name: JAEGER_AGENT_HOST
           value: jaeger-0.jaeger
-        envFrom:
-        - configMapRef:
-            name: config
         volumeMounts:
         - name: data
           mountPath: /data
-      initContainers: []
       volumes:
       - name: data
         emptyDir: {}

+ 5 - 3
hadoop-ozone/dist/src/main/k8s/examples/ozone-dev/scm-statefulset.yaml

@@ -37,6 +37,8 @@ spec:
         prometheus.io/port: "9876"
         prometheus.io/path: /prom
     spec:
+      securityContext:
+        fsGroup: 1000
       initContainers:
       - name: init
         image: '@docker.image@'
@@ -56,6 +58,9 @@ spec:
         args:
         - ozone
         - scm
+        envFrom:
+        - configMapRef:
+            name: config
         env:
         - name: JAEGER_SAMPLER_TYPE
           value: probabilistic
@@ -63,9 +68,6 @@ spec:
           value: "0.01"
         - name: JAEGER_AGENT_HOST
           value: jaeger-0.jaeger
-        envFrom:
-        - configMapRef:
-            name: config
         volumeMounts:
         - name: data
           mountPath: /data

+ 2 - 1
hadoop-ozone/dist/src/main/k8s/examples/ozone/flekszible/flekszible.yaml → hadoop-ozone/dist/src/main/k8s/examples/ozone/Flekszible

@@ -14,12 +14,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 source:
-  - path: ../../../definitions
+  - path: ../../definitions
 import:
   - path: ozone
     transformations:
     - type: Image
       image: "@docker.image@"
+    - type: ozone/persistence
   - path: ozone/freon
     destination: freon
     transformations:

+ 28 - 0
hadoop-ozone/dist/src/main/k8s/examples/ozone/datanode-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: datanode
+spec:
+  ports:
+  - port: 9870
+    name: rpc
+  clusterIP: None
+  selector:
+    app: ozone
+    component: datanode

+ 72 - 0
hadoop-ozone/dist/src/main/k8s/examples/ozone/datanode-statefulset.yaml

@@ -0,0 +1,72 @@
+# 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: datanode
+  labels:
+    app.kubernetes.io/component: ozone
+spec:
+  selector:
+    matchLabels:
+      app: ozone
+      component: datanode
+  serviceName: datanode
+  replicas: 3
+  template:
+    metadata:
+      labels:
+        app: ozone
+        component: datanode
+      annotations:
+        prdatanodeetheus.io/scrape: "true"
+        prdatanodeetheus.io/port: "9882"
+        prdatanodeetheus.io/path: /prom
+    spec:
+      affinity:
+        podAntiAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+          - labelSelector:
+              matchExpressions:
+              - key: component
+                operator: In
+                values:
+                - datanode
+            topologyKey: kubernetes.io/hostname
+      securityContext:
+        fsGroup: 1000
+      containers:
+      - name: datanode
+        image: '@docker.image@'
+        args:
+        - ozone
+        - datanode
+        envFrom:
+        - configMapRef:
+            name: config
+        volumeMounts:
+        - name: data
+          mountPath: /data
+  volumeClaimTemplates:
+  - metadata:
+      name: data
+    spec:
+      accessModes:
+      - ReadWriteOnce
+      resources:
+        requests:
+          storage: 2Gi

+ 12 - 3
hadoop-ozone/dist/src/main/k8s/examples/ozone/om-statefulset.yaml

@@ -37,6 +37,8 @@ spec:
         prometheus.io/port: "9874"
         prometheus.io/path: /prom
     spec:
+      securityContext:
+        fsGroup: 1000
       initContainers:
       - name: init
         image: '@docker.image@'
@@ -68,6 +70,13 @@ spec:
         volumeMounts:
         - name: data
           mountPath: /data
-      volumes:
-      - name: data
-        emptyDir: {}
+      volumes: []
+  volumeClaimTemplates:
+  - metadata:
+      name: data
+    spec:
+      accessModes:
+      - ReadWriteOnce
+      resources:
+        requests:
+          storage: 2Gi

+ 9 - 4
hadoop-ozone/dist/src/main/k8s/examples/ozone/s3g-statefulset.yaml

@@ -45,7 +45,12 @@ spec:
         volumeMounts:
         - name: data
           mountPath: /data
-      initContainers: []
-      volumes:
-      - name: data
-        emptyDir: {}
+  volumeClaimTemplates:
+  - metadata:
+      name: data
+    spec:
+      accessModes:
+      - ReadWriteOnce
+      resources:
+        requests:
+          storage: 2Gi

+ 11 - 3
hadoop-ozone/dist/src/main/k8s/examples/ozone/scm-statefulset.yaml

@@ -37,6 +37,8 @@ spec:
         prometheus.io/port: "9876"
         prometheus.io/path: /prom
     spec:
+      securityContext:
+        fsGroup: 1000
       initContainers:
       - name: init
         image: '@docker.image@'
@@ -62,6 +64,12 @@ spec:
         volumeMounts:
         - name: data
           mountPath: /data
-      volumes:
-      - name: data
-        emptyDir: {}
+  volumeClaimTemplates:
+  - metadata:
+      name: data
+    spec:
+      accessModes:
+      - ReadWriteOnce
+      resources:
+        requests:
+          storage: 2Gi