diff --git a/k8s-test/00-namespace.yml b/k8s-test/00-deployment/00-namespace.yml similarity index 100% rename from k8s-test/00-namespace.yml rename to k8s-test/00-deployment/00-namespace.yml diff --git a/k8s-test/00-deployment/01-rbac.yml b/k8s-test/00-deployment/01-rbac.yml new file mode 100644 index 0000000..3b17d4c --- /dev/null +++ b/k8s-test/00-deployment/01-rbac.yml @@ -0,0 +1,36 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: volm + namespace: volm-test +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: volm + namespace: volm-test +rules: + - apiGroups: + - "" + resources: + - pods + - persistentvolumeclaims + verbs: + - watch + - get + - list + - delete +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: volm + namespace: volm-test +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: volm +subjects: + - kind: ServiceAccount + name: volm + namespace: volm-test \ No newline at end of file diff --git a/k8s-test/00-deployment/10-service.yml b/k8s-test/00-deployment/10-service.yml new file mode 100644 index 0000000..89df74f --- /dev/null +++ b/k8s-test/00-deployment/10-service.yml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: volm + namespace: volm-test + labels: + app: volm + component: api +spec: + selector: + app: volm + ports: + - name: http-int + protocol: "TCP" + port: 8070 + targetPort: http-int + type: ClusterIP diff --git a/k8s-test/00-deployment/30-deployment.yml b/k8s-test/00-deployment/30-deployment.yml new file mode 100644 index 0000000..cb95c93 --- /dev/null +++ b/k8s-test/00-deployment/30-deployment.yml @@ -0,0 +1,69 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: volm + namespace: volm-test + labels: + app: volm + component: api +spec: + replicas: 1 + revisionHistoryLimit: 1 + selector: + matchLabels: + app: volm + template: + metadata: + labels: + app: volm + component: api + annotations: + prometheus.io/scrape: 'true' + prometheus.io/port: '2112' + spec: + serviceAccountName: api-volm + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - volm + topologyKey: kubernetes.io/hostname + containers: + - name: volm + image: txn2/volm:v0.1.1 + imagePullPolicy: IfNotPresent + env: + - name: IP + value: "0.0.0.0" + - name: PORT + value: "8070" + - name: MODE + value: "release" # "release" for prod + - name: PVC_NAMESPACE + value: "volm-test" + - name: PVC_SELECTOR + value: "pvci.txn2.com/service=pvci" + ports: + - name: http-int + containerPort: 8070 + - name: http-mtx + containerPort: 2112 + startupProbe: + httpGet: + path: / + port: http-int + failureThreshold: 3 + periodSeconds: 5 + resources: + requests: + cpu: ".2" + memory: 256Mi + limits: + cpu: "1" + memory: 1Gi \ No newline at end of file diff --git a/k8s-test/11-pvc-1.yml b/k8s-test/10-pvc-pod/11-pvc-1.yml similarity index 100% rename from k8s-test/11-pvc-1.yml rename to k8s-test/10-pvc-pod/11-pvc-1.yml diff --git a/k8s-test/12-pod1.yml b/k8s-test/10-pvc-pod/12-pod1.yml similarity index 100% rename from k8s-test/12-pod1.yml rename to k8s-test/10-pvc-pod/12-pod1.yml diff --git a/k8s-test/21-pvc-2.yml b/k8s-test/10-pvc-pod/21-pvc-2.yml similarity index 100% rename from k8s-test/21-pvc-2.yml rename to k8s-test/10-pvc-pod/21-pvc-2.yml diff --git a/k8s-test/22-pod2.yml b/k8s-test/10-pvc-pod/22-pod2.yml similarity index 100% rename from k8s-test/22-pod2.yml rename to k8s-test/10-pvc-pod/22-pod2.yml diff --git a/k8s-test/31-pvc-3.yml b/k8s-test/10-pvc-pod/31-pvc-3.yml similarity index 100% rename from k8s-test/31-pvc-3.yml rename to k8s-test/10-pvc-pod/31-pvc-3.yml diff --git a/k8s-test/32-pod3.yml b/k8s-test/10-pvc-pod/32-pod3.yml similarity index 100% rename from k8s-test/32-pod3.yml rename to k8s-test/10-pvc-pod/32-pod3.yml