diff --git a/deploy/kubernetes/adapter.yaml b/deploy/kubernetes/adapter.yaml new file mode 100644 index 0000000..d2d2d23 --- /dev/null +++ b/deploy/kubernetes/adapter.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: adapter +spec: + replicas: 1 + selector: + matchLabels: + app: adapter + strategy: + type: Recreate # Specify the Recreate strategy + template: + metadata: + labels: + app: adapter + spec: + containers: + - name: adapter + image: oktopusp/adapter:latest + resources: + requests: + memory: 64Mi + cpu: 0.1 + limits: + memory: 128Mi + cpu: 0.2 + imagePullPolicy: IfNotPresent + env: + - name: NATS_URL + value: "nats://nats:4222" + - name: NATS_NAME + value: "adapter" + - name: NATS_VERIFY_CERTIFICATES + value: "false" + - name: MONGO_URI + value: "mongodb://oktopusp:oktopusp@mongodb-0.mongodb-svc.mongodb.svc.cluster.local:27017,mongodb-1.mongodb-svc.mongodb.svc.cluster.local:27017,mongodb-2.mongodb-svc.mongodb.svc.cluster.local:27017/adapter?replicaSet=mongodb&ssl=false" + - name: CONTROLLER_ID + value: "oktopusController" + diff --git a/deploy/kubernetes/controller.yaml b/deploy/kubernetes/controller.yaml new file mode 100644 index 0000000..02d3416 --- /dev/null +++ b/deploy/kubernetes/controller.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: controller +spec: + replicas: 1 + selector: + matchLabels: + app: controller + strategy: + type: Recreate # Specify the Recreate strategy + template: + metadata: + labels: + app: controller + spec: + containers: + - name: controller + image: oktopusp/controller:latest + resources: + #requests: + # memory: 64Mi + # cpu: 0.5 + #limits: + # memory: 256Mi + # cpu: 1 + imagePullPolicy: IfNotPresent + env: + - name: NATS_URL + value: "nats://nats:4222" + - name: NATS_NAME + value: "adapter" + - name: NATS_VERIFY_CERTIFICATES + value: "false" + - name: MONGO_URI + value: "mongodb://oktopusp:oktopusp@mongodb-0.mongodb-svc.mongodb.svc.cluster.local:27017,mongodb-1.mongodb-svc.mongodb.svc.cluster.local:27017,mongodb-2.mongodb-svc.mongodb.svc.cluster.local:27017/adapter?replicaSet=mongodb&ssl=false" + - name: REST_API_PORT + value: "8000" + diff --git a/deploy/kubernetes/frontend.yaml b/deploy/kubernetes/frontend.yaml new file mode 100644 index 0000000..d698898 --- /dev/null +++ b/deploy/kubernetes/frontend.yaml @@ -0,0 +1,36 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: frontend +spec: + replicas: 1 + selector: + matchLabels: + app: frontend + strategy: + type: Recreate # Specify the Recreate strategy + template: + metadata: + labels: + app: frontend + spec: + containers: + - name: frontend + image: oktopusp/frontend:latest + ports: + - containerPort: 3000 + imagePullPolicy: IfNotPresent +--- +apiVersion: v1 +kind: Service +metadata: + name: frontend-svc +spec: + selector: + app: frontend + ports: + - protocol: TCP + port: 3000 + targetPort: 3000 + nodePort: 30001 + type: NodePort diff --git a/deploy/kubernetes/mongodb.yaml b/deploy/kubernetes/mongodb.yaml new file mode 100644 index 0000000..aeb36b0 --- /dev/null +++ b/deploy/kubernetes/mongodb.yaml @@ -0,0 +1,36 @@ +--- +apiVersion: mongodbcommunity.mongodb.com/v1 +kind: MongoDBCommunity +metadata: + name: mongodb +spec: + members: 3 + type: ReplicaSet + version: "6.0.5" + security: + authentication: + modes: ["SCRAM"] + users: + - name: oktopusp + db: admin + passwordSecretRef: # a reference to the secret that will be used to generate the user's password + name: mongo-secret + roles: + - name: clusterAdmin + db: admin + - name: userAdminAnyDatabase + db: admin + scramCredentialsSecretName: my-scram + additionalMongodConfig: + storage.wiredTiger.engineConfig.journalCompressor: zlib + +# the user credentials will be generated from this secret +# once the credentials are generated, this secret is no longer required +--- +apiVersion: v1 +kind: Secret +metadata: + name: mongo-secret +type: Opaque +stringData: + password: oktopusp diff --git a/deploy/kubernetes/mqtt-adapter.yaml b/deploy/kubernetes/mqtt-adapter.yaml new file mode 100644 index 0000000..3d7b7b5 --- /dev/null +++ b/deploy/kubernetes/mqtt-adapter.yaml @@ -0,0 +1,44 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mqtt-adapter +spec: + replicas: 1 + selector: + matchLabels: + app: mqtt-adapter + template: + metadata: + labels: + app: mqtt-adapter + spec: + containers: + - name: mqtt-adapter + image: oktopusp/mqtt-adapter:latest + resources: + requests: + memory: 64Mi + cpu: 0.1 + limits: + memory: 128Mi + cpu: 0.2 + imagePullPolicy: IfNotPresent + env: + - name: NATS_URL + value: "nats:4222" + - name: NATS_NAME + value: "mqtt-adapter" + - name: NATS_VERIFY_CERTIFICATES + value: "false" + - name: MQTT_URL + value: "tcp://mqtt:1883" + - name: MQTT_CLIENT_ID + value: "mqtt-adapter" + - name: MQTT_USERNAME + value: "" + - name: MQTT_PASSWORD + value: "" + - name: MQTT_QOS + value: "1" + - name: MQTT_SERVICE_HOST + value: "mqtt" diff --git a/deploy/kubernetes/mqtt.yaml b/deploy/kubernetes/mqtt.yaml new file mode 100644 index 0000000..8ff06c7 --- /dev/null +++ b/deploy/kubernetes/mqtt.yaml @@ -0,0 +1,48 @@ +apiVersion: v1 +kind: Service +metadata: + name: mqtt +spec: + selector: + app: mqtt + ports: + - protocol: TCP + port: 1883 + targetPort: 1883 + nodePort: 30000 + type: NodePort +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mqtt +spec: + replicas: 1 + selector: + matchLabels: + app: mqtt + template: + metadata: + labels: + app: mqtt + spec: + containers: + - name: mqtt + image: rogersacchelli/mqtt:latest + ports: + - containerPort: 1883 + resources: + requests: + memory: 64Mi + cpu: 0.1 + limits: + memory: 128Mi + cpu: 0.2 + imagePullPolicy: IfNotPresent + env: + - name: MQTT_PORT + value: ":1883" + - name: MQTT_TLS + value: "false" + - name: LOG_LEVEL + value: "0" # 0 - DEBUG diff --git a/deploy/kubernetes/socketio.yaml b/deploy/kubernetes/socketio.yaml new file mode 100644 index 0000000..86a9e5a --- /dev/null +++ b/deploy/kubernetes/socketio.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: socketio +spec: + replicas: 1 + selector: + matchLabels: + app: socketio + template: + metadata: + labels: + app: socketio + spec: + containers: + - name: socketio + image: oktopusp/socketio:latest + imagePullPolicy: IfNotPresent + env: + - name: NATS_URL + value: "nats:4222"