added NFS server to share files
This commit is contained in:
parent
8008eaed06
commit
cc1b61309a
7 changed files with 172 additions and 14 deletions
|
@ -1,2 +1,6 @@
|
||||||
FROM nginx:1.17
|
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"]
|
38
containers/nginx-results/default.conf
Normal file
38
containers/nginx-results/default.conf
Normal 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;
|
||||||
|
#}
|
||||||
|
}
|
6
containers/nginx-results/run_nginx.sh
Executable file
6
containers/nginx-results/run_nginx.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
mkdir -p /mnt/nfs/results
|
||||||
|
cp /scripts/*.html /mnt/nfs/results
|
||||||
|
nginx -g "daemon off;"
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
set -eux
|
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 results.yaml
|
||||||
kubectl apply -f jenkins.yaml
|
kubectl apply -f jenkins.yaml
|
|
@ -25,4 +25,10 @@ gcloud compute disks create jenkins-home \
|
||||||
--description="storage for jenkins master" \
|
--description="storage for jenkins master" \
|
||||||
--size=200GB \
|
--size=200GB \
|
||||||
--type=pd-standard \
|
--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
107
kubernetes/nfs.yaml
Normal 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
|
|
@ -12,14 +12,6 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Namespace
|
|
||||||
metadata:
|
|
||||||
name: results
|
|
||||||
labels:
|
|
||||||
name: results
|
|
||||||
---
|
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
|
@ -48,9 +40,9 @@ spec:
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
successThreshold: 2
|
successThreshold: 2
|
||||||
failureThreshold: 5
|
failureThreshold: 5
|
||||||
# volumeMounts:
|
volumeMounts:
|
||||||
# - mountPath: /var/jenkins_home
|
- mountPath: /mnt/nfs
|
||||||
# name: jenkins-home
|
name: nfs-pvc
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpu: 500m
|
cpu: 500m
|
||||||
|
@ -58,6 +50,10 @@ spec:
|
||||||
requests:
|
requests:
|
||||||
cpu: 500m
|
cpu: 500m
|
||||||
memory: 1500Mi
|
memory: 1500Mi
|
||||||
|
volumes:
|
||||||
|
- name: nfs-pvc
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: nfs
|
||||||
---
|
---
|
||||||
kind: Service
|
kind: Service
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
|
Loading…
Reference in a new issue