Skip to content

Commit 2ab318b

Browse files
committed
HDDS-1412. Provide example k8s deployment files as part of the release package
Closes #719
1 parent f682a17 commit 2ab318b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1192
-352
lines changed

hadoop-ozone/common/pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,28 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
169169
</plugin>
170170
</plugins>
171171
</build>
172+
<profiles>
173+
<profile>
174+
<id>k8s-dev</id>
175+
<build>
176+
<plugins>
177+
<plugin>
178+
<groupId>io.fabric8</groupId>
179+
<artifactId>docker-maven-plugin</artifactId>
180+
<version>0.29.0</version>
181+
<configuration>
182+
<images>
183+
<image>
184+
<name>${user.name}/ozone:${project.version}</name>
185+
<build>
186+
<dockerFileDir>${project.basedir}</dockerFileDir>
187+
</build>
188+
</image>
189+
</images>
190+
</configuration>
191+
</plugin>
192+
</plugins>
193+
</build>
194+
</profile>
195+
</profiles>
172196
</project>

hadoop-ozone/dist/dev-support/bin/dist-layout-stitching

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,5 @@ cp -r "${ROOT}/hadoop-hdds/docs/target/classes/docs" ./
120120
run cp -p -R "${ROOT}/hadoop-ozone/dist/target/compose" .
121121
run cp -p -r "${ROOT}/hadoop-ozone/dist/src/main/smoketest" .
122122
run cp -p -r "${ROOT}/hadoop-ozone/dist/src/main/blockade" .
123+
run cp -p -r "${ROOT}/hadoop-ozone/dist/target/k8s" kubernetes
124+
run cp -p -r "${ROOT}/hadoop-ozone/dist/src/main/Dockerfile" .

hadoop-ozone/dist/pom.xml

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<properties>
2929
<file.encoding>UTF-8</file.encoding>
3030
<downloadSources>true</downloadSources>
31+
<docker.image>apache/hadoop:${project.version}</docker.image>
3132
</properties>
3233

3334
<build>
@@ -139,7 +140,7 @@
139140
<version>3.1.0</version>
140141
<executions>
141142
<execution>
142-
<id>copy-resources</id>
143+
<id>copy-compose</id>
143144
<phase>compile</phase>
144145
<goals>
145146
<goal>copy-resources</goal>
@@ -154,6 +155,22 @@
154155
</resources>
155156
</configuration>
156157
</execution>
158+
<execution>
159+
<id>copy-k8s</id>
160+
<phase>compile</phase>
161+
<goals>
162+
<goal>copy-resources</goal>
163+
</goals>
164+
<configuration>
165+
<outputDirectory>${basedir}/target/k8s</outputDirectory>
166+
<resources>
167+
<resource>
168+
<directory>src/main/k8s</directory>
169+
<filtering>true</filtering>
170+
</resource>
171+
</resources>
172+
</configuration>
173+
</execution>
157174
</executions>
158175
</plugin>
159176
<plugin>
@@ -267,4 +284,62 @@
267284
<artifactId>hadoop-ozone-upgrade</artifactId>
268285
</dependency>
269286
</dependencies>
287+
<profiles>
288+
<profile>
289+
<id>k8s-dev</id>
290+
<properties>
291+
<docker.image>${user.name}/ozone:${project.version}</docker.image>
292+
</properties>
293+
<build>
294+
<plugins>
295+
<plugin>
296+
<groupId>io.fabric8</groupId>
297+
<artifactId>docker-maven-plugin</artifactId>
298+
<version>0.29.0</version>
299+
<executions>
300+
<execution>
301+
<goals>
302+
<goal>build</goal>
303+
</goals>
304+
<phase>package</phase>
305+
</execution>
306+
</executions>
307+
<configuration>
308+
<images>
309+
<image>
310+
<name>${docker.image}</name>
311+
<build>
312+
<dockerFileDir>
313+
${project.build.directory}/ozone-${project.version}
314+
</dockerFileDir>
315+
</build>
316+
</image>
317+
</images>
318+
</configuration>
319+
</plugin>
320+
</plugins>
321+
</build>
322+
</profile>
323+
<profile>
324+
<id>k8s-dev-push</id>
325+
<build>
326+
<plugins>
327+
<plugin>
328+
<groupId>io.fabric8</groupId>
329+
<artifactId>docker-maven-plugin</artifactId>
330+
<version>0.29.0</version>
331+
<executions>
332+
<execution>
333+
<goals>
334+
<goal>push</goal>
335+
</goals>
336+
<phase>package</phase>
337+
</execution>
338+
</executions>
339+
</plugin>
340+
</plugins>
341+
</build>
342+
</profile>
343+
</profiles>
344+
270345
</project>

hadoop-ozone/dist/Dockerfile renamed to hadoop-ozone/dist/src/main/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616

1717
FROM apache/hadoop-runner:latest
1818

19-
ADD --chown=hadoop target/ozone-0.4.0-SNAPSHOT /opt/hadoop
19+
ADD --chown=hadoop . /opt/hadoop
2020

2121
WORKDIR /opt/hadoop

hadoop-ozone/dist/src/main/k8s/ozone/config-configmap.yaml renamed to hadoop-ozone/dist/src/main/k8s/definitions/ozone/config.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,15 @@ apiVersion: v1
1717
kind: ConfigMap
1818
metadata:
1919
name: config
20-
labels: {}
21-
annotations: {}
2220
data:
21+
OZONE-SITE.XML_hdds.datanode.dir: "/data/storage"
2322
OZONE-SITE.XML_ozone.scm.datanode.id: "/data/datanode.id"
2423
OZONE-SITE.XML_ozone.metadata.dirs: "/data/metadata"
2524
OZONE-SITE.XML_ozone.scm.block.client.address: "scm-0.scm"
2625
OZONE-SITE.XML_ozone.om.address: "om-0.om"
2726
OZONE-SITE.XML_ozone.scm.client.address: "scm-0.scm"
2827
OZONE-SITE.XML_ozone.scm.names: "scm-0.scm"
2928
OZONE-SITE.XML_ozone.enabled: "true"
30-
OZONE-SITE.XML_hdds.prometheus.endpoint.enabled: "true"
3129
LOG4J.PROPERTIES_log4j.rootLogger: "INFO, stdout"
3230
LOG4J.PROPERTIES_log4j.appender.stdout: "org.apache.log4j.ConsoleAppender"
3331
LOG4J.PROPERTIES_log4j.appender.stdout.layout: "org.apache.log4j.PatternLayout"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
apiVersion: apps/v1
17+
kind: DaemonSet
18+
metadata:
19+
name: datanode
20+
labels:
21+
app.kubernetes.io/component: ozone
22+
spec:
23+
selector:
24+
matchLabels:
25+
app: ozone
26+
component: datanode
27+
template:
28+
metadata:
29+
annotations:
30+
prometheus.io/scrape: "true"
31+
prometheus.io/port: "9882"
32+
prometheus.io/path: "/prom"
33+
labels:
34+
app: ozone
35+
component: datanode
36+
spec:
37+
containers:
38+
- name: datanode
39+
image: "@docker.image@"
40+
args: ["ozone","datanode"]
41+
ports:
42+
- containerPort: 9870
43+
name: rpc

hadoop-ozone/dist/src/main/k8s/ozone/datanode-public-service.yaml renamed to hadoop-ozone/dist/src/main/k8s/definitions/ozone/definitions/prometheus.yaml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,14 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
apiVersion: v1
17-
kind: Service
18-
metadata:
19-
name: datanode-public
20-
labels: {}
21-
annotations: {}
22-
spec:
23-
selector:
24-
app: ozone
25-
component: datanode
26-
ports:
27-
- port: 9870
28-
name: rpc
29-
type: NodePort
16+
name: ozone/prometheus
17+
description: Enable prometheus monitoring in Ozone
18+
---
19+
- type: Add
20+
trigger:
21+
metadata:
22+
name: config
23+
path:
24+
- data
25+
value:
26+
OZONE-SITE.XML_hdds.prometheus.endpoint.enabled: true

hadoop-ozone/dist/src/main/k8s/prometheus/service-account.yaml renamed to hadoop-ozone/dist/src/main/k8s/definitions/ozone/flekszible.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,4 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
apiVersion: v1
17-
kind: ServiceAccount
18-
metadata:
19-
name: prometheus-operator
16+
description: Apache Hadoop Ozone

hadoop-ozone/dist/skaffold.yaml renamed to hadoop-ozone/dist/src/main/k8s/definitions/ozone/freon/flekszible.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,4 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
17-
apiVersion: skaffold/v1alpha5
18-
kind: Config
19-
build:
20-
artifacts:
21-
- image: apache/ozone
22-
deploy:
23-
kubectl:
24-
manifests:
25-
- src/main/k8s/ozone/*
16+
description: Load test tool for Apache Hadoop Ozone

hadoop-ozone/dist/src/main/k8s/ozone/datanode-statefulset.yaml renamed to hadoop-ozone/dist/src/main/k8s/definitions/ozone/freon/freon.yaml

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,27 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616
apiVersion: apps/v1
17-
kind: StatefulSet
17+
kind: Deployment
1818
metadata:
19-
name: datanode
20-
labels: {}
21-
annotations: {}
19+
name: freon
20+
labels:
21+
app.kubernetes.io/component: ozone
2222
spec:
23+
replicas: 1
2324
selector:
2425
matchLabels:
2526
app: ozone
26-
component: datanode
27+
component: freon
2728
template:
2829
metadata:
2930
labels:
3031
app: ozone
31-
component: datanode
32+
component: freon
3233
spec:
3334
containers:
34-
- name: datanode
35-
image: apache/ozone
36-
args:
37-
- ozone
38-
- datanode
39-
ports:
40-
- containerPort: 9870
41-
name: rpc
42-
volumeMounts:
43-
- name: "data"
44-
mountPath: "/data"
35+
- name: freon
36+
image: "@docker.image@"
37+
args: ["ozone","freon", "rk", "--factor=THREE", "--replicationType=RATIS"]
4538
envFrom:
4639
- configMapRef:
4740
name: config
48-
volumes:
49-
- name: "data"
50-
emptyDir: {}
51-
serviceName: datanode
52-
replicas: 3

0 commit comments

Comments
 (0)