1
0
Fork 0

added NFS server to share files

This commit is contained in:
Christian Kühnel 2019-10-05 10:35:32 +02:00
parent 8008eaed06
commit cc1b61309a
7 changed files with 172 additions and 14 deletions

View file

@ -1,2 +1,6 @@
FROM nginx:1.17
COPY index.html /usr/share/nginx/html
RUN mkdir -p /scripts
COPY index.html run_nginx.sh /scripts/
COPY default.conf /etc/nginx/conf.d/
CMD ["/scripts/run_nginx.sh"]

View file

@ -0,0 +1,38 @@
server {
listen 80;
server_name results.llvm-merge-guard.org;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /mnt/nfs/results;
index index.html index.htm;
autoindex on;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

View file

@ -0,0 +1,6 @@
#!/bin/bash
set -eux
mkdir -p /mnt/nfs/results
cp /scripts/*.html /mnt/nfs/results
nginx -g "daemon off;"

View file

@ -15,6 +15,7 @@
set -eux
# results needs to be deployed first, as it creates the shared storage
# nfs needs to be deployed first, as it creates the presistent volumes
kubectl apply -f nfs.yaml
kubectl apply -f results.yaml
kubectl apply -f jenkins.yaml

View file

@ -25,4 +25,10 @@ gcloud compute disks create jenkins-home \
--description="storage for jenkins master" \
--size=200GB \
--type=pd-standard \
--zone=${GCP_ZONE} \
--zone=${GCP_ZONE} \
gcloud compute disks create results \
--description="storage build results" \
--size=20GB \
--type=pd-standard \
--zone=${GCP_ZONE}

107
kubernetes/nfs.yaml Normal file
View file

@ -0,0 +1,107 @@
# Copyright 2019 Google LLC
#
# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://llvm.org/LICENSE.txt
#
# 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: Namespace
metadata:
name: results
labels:
name: results
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nfs-server
namespace: results
spec:
replicas: 1
selector:
matchLabels:
role: nfs-server
template:
metadata:
labels:
role: nfs-server
spec:
containers:
- name: nfs-server
image: gcr.io/google_containers/volume-nfs
ports:
- name: nfs
containerPort: 2049
- name: mountd
containerPort: 20048
- name: rpcbind
containerPort: 111
securityContext:
privileged: true
volumeMounts:
- mountPath: /exports
name: result-pvc
resources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 500m
memory: 500Mi
volumes:
- name: result-pvc
gcePersistentDisk:
pdName: results
fsType: ext4
---
apiVersion: v1
kind: Service
metadata:
name: nfs-service
namespace: results
spec:
ports:
- name: nfs
port: 2049
- name: mountd
port: 20048
- name: rpcbind
port: 111
selector:
role: nfs-server
---
# apiVersion: v1
# kind: PersistentVolume
# metadata:
# name: nfs
# namespace: results
# spec:
# capacity:
# storage: 20Gi
# accessModes:
# - ReadWriteMany
# nfs:
# server: nfs-service.results.svc.cluster.local
# path: "/exports"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: nfs
namespace: results
spec:
accessModes:
- ReadWriteMany
storageClassName: ""
resources:
requests:
storage: 20Gi

View file

@ -12,14 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
---
apiVersion: v1
kind: Namespace
metadata:
name: results
labels:
name: results
---
apiVersion: apps/v1
kind: Deployment
metadata:
@ -48,9 +40,9 @@ spec:
timeoutSeconds: 5
successThreshold: 2
failureThreshold: 5
# volumeMounts:
# - mountPath: /var/jenkins_home
# name: jenkins-home
volumeMounts:
- mountPath: /mnt/nfs
name: nfs-pvc
resources:
limits:
cpu: 500m
@ -58,6 +50,10 @@ spec:
requests:
cpu: 500m
memory: 1500Mi
volumes:
- name: nfs-pvc
persistentVolumeClaim:
claimName: nfs
---
kind: Service
apiVersion: v1