Skip to content

Commit

Permalink
Merge pull request #5 from dmarket/feature/devops-1896
Browse files Browse the repository at this point in the history
Feature/devops 1896
  • Loading branch information
dkhodakivskyi authored Jan 24, 2022
2 parents a615370 + 192c4ad commit 95539aa
Show file tree
Hide file tree
Showing 21 changed files with 440 additions and 5 deletions.
2 changes: 1 addition & 1 deletion k8s-manifests/base/dmbc-discovery/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resources:
- deployment.yaml
- configmap.yaml
- service.yaml
# - service.yaml
6 changes: 3 additions & 3 deletions k8s-manifests/base/dmbc00-common/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resources:
- ingress.yaml
- service.yaml
# - ingress.yaml
# - service.yaml
- serviceaccount.yaml
- role.yaml
- rolebinding.yaml
- secret.yaml
#- secret.yaml
23 changes: 23 additions & 0 deletions k8s-manifests/base/dmbc05/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
apiVersion: v1
data:
config.toml: |
[api]
current_node = "node05"
address = "0.0.0.0:8000"
private_address = "0.0.0.0:8001"
peer_address = "0.0.0.0:2000"
peers = []
keys_path = "./var/keys"
is_validator = false
[db]
path = "./var/db"
[nats]
enabled = false
[service_discovery]
address = "dmbc-discovery:3000/nodes"
kind: ConfigMap
metadata:
name: dmbc05-config
labels:
app: dmbc05
65 changes: 65 additions & 0 deletions k8s-manifests/base/dmbc05/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dmbc05
labels:
app: dmbc05
dmbc: "true"
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: dmbc05
strategy:
type: Recreate
template:
metadata:
name: dmbc05
labels:
app: dmbc05
dmbc: "true"
spec:
containers:
- name: dmarket-blockchain
image: globalgames/dmarket-blockchain:latest
imagePullPolicy: Always
env:
- name: RUST_LOG
value: info
- name: RUST_BACKTRACE
value: "1"
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
ports:
- containerPort: 8000
protocol: TCP
volumeMounts:
- mountPath: /src/app/var/keys
name: dmbc05-keys
- mountPath: /src/app/var/db
name: dmbc05
- mountPath: /src/app/etc
name: dmbc05-config
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: dockerhub
restartPolicy: Always
terminationGracePeriodSeconds: 30
volumes:
- name: dmbc05
persistentVolumeClaim:
claimName: dmbc05
- name: dmbc05-keys
secret:
defaultMode: 420
secretName: dmbc05-keys
- configMap:
defaultMode: 420
name: dmbc05-config
name: dmbc05-config

5 changes: 5 additions & 0 deletions k8s-manifests/base/dmbc05/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resources:
- deployment.yaml
- configmap.yaml
- secret.yaml
- persistentvolumeclaim.yaml
14 changes: 14 additions & 0 deletions k8s-manifests/base/dmbc05/persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: dmbc05
labels:
app: dmbc05
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1100Gi
storageClassName: standard
12 changes: 12 additions & 0 deletions k8s-manifests/base/dmbc05/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
data:
consensus:
consensus.pub:
service:
service.pub:
kind: Secret
metadata:
name: dmbc05-keys
labels:
app: dmbc05
type: Opaque
1 change: 1 addition & 0 deletions k8s-manifests/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ resources:
- dmbc02
- dmbc03
- dmbc04
#- dmbc05
- dmbc-discovery
28 changes: 28 additions & 0 deletions k8s-manifests/prod01/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
# - ../base
- ../base/dmbc00-common
# - ../base/dmbc01
# - ../base/dmbc02
# - ../base/dmbc03
# - ../base/dmbc04
- ../base/dmbc05
# - ../base/dmbc-discovery
namespace: dmbc-prod
images:
- name: globalgames/dmarket-blockchain
newName: globalgames/dmarket-blockchain
newTag: fat-wallets-125
patchesStrategicMerge:
# - patches/dmbc00-common/ingress.yaml
- patches/dmbc05/deployment.yaml
- patches/dmbc05/node-affinity.yaml
# - patches/dmbc04/deployment.yaml
# - patches/dmbc04/node-affinity.yaml
# - patches/dmbc03/deployment.yaml
# - patches/dmbc03/node-affinity.yaml
# - patches/dmbc02/deployment.yaml
# - patches/dmbc02/node-affinity.yaml
#- patches/dmbc01/deployment.yaml
#- patches/dmbc01/node-affinity.yaml
42 changes: 42 additions & 0 deletions k8s-manifests/prod01/patches/dmbc00-common/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dmbc
labels:
app: dmbc
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header X-GeoIP-Country $geoip_country_code;
proxy_set_header X-GeoIP-Country-Name $geoip_country_name;
proxy_set_header X-GeoIP-Region-Name $geoip_region_name;
proxy_set_header X-GeoIP-City $geoip_city;
proxy_set_header X-GeoIP-Postal-Code $geoip_postal_code;
proxy_set_header CF-IPCountry $http_cf_ipcountry;
more_set_headers "X-XSS-Protection: 1; mode=block";
more_set_headers "X-Frame-Options: SAMEORIGIN";
nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
nginx.ingress.kubernetes.io/cors-allow-headers:
Content-Type, Accept, Authorization,
Language, X-Forwarded-For, Set-Cookie, Payment-Session-Id, Access-Control-Allow-Origin
nginx.ingress.kubernetes.io/cors-allow-methods: GET, POST, OPTIONS, PUT, DELETE
nginx.ingress.kubernetes.io/cors-allow-origin: "*"
nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/whitelist-source-range: 92.60.189.125,212.90.166.94,94.176.196.244,34.90.237.96,35.189.83.42,35.233.1.160,104.199.34.31,35.233.1.160,34.76.42.79,93.74.83.220,185.143.147.206
spec:
rules:
- host: dm-blockchain-prod01.devss.xyz
http:
paths:
- backend:
service:
name: dmbc
port:
number: 8000
path: /
pathType: ImplementationSpecific
tls:
- hosts:
- dm-blockchain-prod01.devss.xyz
secretName: devss-tls
31 changes: 31 additions & 0 deletions k8s-manifests/prod01/patches/dmbc01/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dmbc01
spec:
template:
spec:
serviceAccountName: dmbc-configmap-updater
initContainers:
- command:
- sh
- -c
- |
#!/usr/bin/env bash -e
echo "Updating of dmbc04-config configmap"
echo "POD_IP: $POD_IP"
kubectl get cm dmbc01-config -o yaml | sed -e "0,/address = .*/ s/address = .*/address = \"$POD_IP:8000\"/g" | kubectl apply -f -
kubectl get cm dmbc01-config -o yaml | sed -e "s|private_address = .*|private_address = \"$POD_IP:8001\"|g" | kubectl apply -f -
kubectl get cm dmbc01-config -o yaml | sed -e "s|peer_address = .*|peer_address = \"$POD_IP:2000\"|g" | kubectl apply -f -
echo "End"
image: bitnami/kubectl:1.21.2
imagePullPolicy: IfNotPresent
name: configmap-updater
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
18 changes: 18 additions & 0 deletions k8s-manifests/prod01/patches/dmbc01/node-affinity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: dmbc01
labels:
app: dmbc01
spec:
template:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: cloud.google.com/gke-nodepool
operator: In
values:
- dmbc-pool
31 changes: 31 additions & 0 deletions k8s-manifests/prod01/patches/dmbc02/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dmbc02
spec:
template:
spec:
serviceAccountName: dmbc-configmap-updater
initContainers:
- command:
- sh
- -c
- |
#!/usr/bin/env bash -e
echo "Updating of dmbc02-config configmap"
echo "POD_IP: $POD_IP"
kubectl get cm dmbc02-config -o yaml | sed -e "0,/address = .*/ s/address = .*/address = \"$POD_IP:8000\"/g" | kubectl apply -f -
kubectl get cm dmbc02-config -o yaml | sed -e "s|private_address = .*|private_address = \"$POD_IP:8001\"|g" | kubectl apply -f -
kubectl get cm dmbc02-config -o yaml | sed -e "s|peer_address = .*|peer_address = \"$POD_IP:2000\"|g" | kubectl apply -f -
echo "End"
image: bitnami/kubectl:1.21.2
imagePullPolicy: IfNotPresent
name: configmap-updater
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
18 changes: 18 additions & 0 deletions k8s-manifests/prod01/patches/dmbc02/node-affinity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: dmbc02
labels:
app: dmbc02
spec:
template:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: cloud.google.com/gke-nodepool
operator: In
values:
- dmbc-pool
31 changes: 31 additions & 0 deletions k8s-manifests/prod01/patches/dmbc03/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dmbc03
spec:
template:
spec:
serviceAccountName: dmbc-configmap-updater
initContainers:
- command:
- sh
- -c
- |
#!/usr/bin/env bash -e
echo "Updating of dmbc04-config configmap"
echo "POD_IP: $POD_IP"
kubectl get cm dmbc03-config -o yaml | sed -e "0,/address = .*/ s/address = .*/address = \"$POD_IP:8000\"/g" | kubectl apply -f -
kubectl get cm dmbc03-config -o yaml | sed -e "s|private_address = .*|private_address = \"$POD_IP:8001\"|g" | kubectl apply -f -
kubectl get cm dmbc03-config -o yaml | sed -e "s|peer_address = .*|peer_address = \"$POD_IP:2000\"|g" | kubectl apply -f -
echo "End"
image: bitnami/kubectl:1.21.2
imagePullPolicy: IfNotPresent
name: configmap-updater
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
18 changes: 18 additions & 0 deletions k8s-manifests/prod01/patches/dmbc03/node-affinity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: dmbc03
labels:
app: dmbc03
spec:
template:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: cloud.google.com/gke-nodepool
operator: In
values:
- dmbc-pool
Loading

0 comments on commit 95539aa

Please sign in to comment.