diff --git a/README.md b/README.md deleted file mode 100644 index 96ca8c917..000000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# a433-microservices -Repository ini digunakan untuk kebutuhan kelas Belajar Membangun Arsitektur Microservices diff --git a/order-service/order-service-deployment.yaml b/order-service/order-service-deployment.yaml new file mode 100644 index 000000000..364d6bbb5 --- /dev/null +++ b/order-service/order-service-deployment.yaml @@ -0,0 +1,27 @@ + apiVersion: apps/v1 # Specifies the API version being used (apps/v1 in this case). + kind: Deployment # Defines the Kubernetes resource type as a Deployment. + metadata: + name: order-service-deploy # Name of the Deployment resource + spec: + replicas: 1 # Specifies the desired number of replicas for the Deployment + selector: + matchLabels: + app: order-service # Selects Pods based on the app label with the value order-service + template: + metadata: + labels: + app: order-service # Labels the Pods created by this template with the app label and value order-service + spec: + containers: + - name: order-service # Name of the container within the Pod + image: ghcr.io/irvanfebri/order-service:latest # Docker image used for the container + ports: + - containerPort: 3000 # Port on which the container listens for incoming traffic + env: + - name: AMQP_PASSWORD # Environmental variable name for the RabbitMQ password + valueFrom: + secretKeyRef: + name: my-rabbitmq # Name of the Secret containing the RabbitMQ password + key: rabbitmq-password # Key within the Secret to retrieve the RabbitMQ password + - name: AMQP_URL # Environmental variable name for the RabbitMQ URL + value: "amqp://user:$(AMQP_PASSWORD)@my-rabbitmq:5672" # Value for the RabbitMQ URL, including the username, password, and host diff --git a/order-service/order-service-gateway.yaml b/order-service/order-service-gateway.yaml new file mode 100644 index 000000000..883a40ea0 --- /dev/null +++ b/order-service/order-service-gateway.yaml @@ -0,0 +1,14 @@ + apiVersion: networking.istio.io/v1alpha3 # Specifies the API version being used (networking.istio.io/v1alpha3 in this case). + kind: Gateway # Defines the Kubernetes resource type as a Gateway. + metadata: + name: order-service-gw # Name of the Istio Gateway for the order service. + spec: + selector: + istio: ingressgateway # Selector for the ingress gateway. + servers: + - port: + number: 80 # Port number for HTTP traffic. + name: http # Name of the HTTP protocol. + protocol: HTTP # Protocol used for this port (HTTP). + hosts: + - "*" # Accepting requests from all hosts. diff --git a/order-service/order-service-service.yaml b/order-service/order-service-service.yaml new file mode 100644 index 000000000..aeac6724c --- /dev/null +++ b/order-service/order-service-service.yaml @@ -0,0 +1,9 @@ + apiVersion: v1 # Specifies the API version being used (v1 in this case). + kind: Service # Defines the Kubernetes resource type as a Service. + metadata: + name: order-service-svc # Name assigned to this Service resource. + spec: + selector: + app: order-service # Selects pods labeled with 'app: order-service'. + ports: + - port: 3000 # Exposes the Service on port 3000 using TCP protocol. diff --git a/order-service/order-service-virtualservice.yaml b/order-service/order-service-virtualservice.yaml new file mode 100644 index 000000000..253a3d0ff --- /dev/null +++ b/order-service/order-service-virtualservice.yaml @@ -0,0 +1,18 @@ + apiVersion: networking.istio.io/v1alpha3 # Specifies the API version being used (networking.istio.io/v1alpha3 in this case). + kind: VirtualService # Defines that this YAML describes a VirtualService Service. + metadata: + name: order-service-vs # Name of the VirtualService + spec: + hosts: + - "*" # Match all hosts + gateways: + - order-service-gw # Use the order-service-gw gateway + http: + - match: + - uri: + exact: "/order" # Match exact URI "/order" + route: + - destination: + host: order-service-svc # Send traffic to order-service-svc + port: + number: 3000 # Use port 3000 diff --git a/shipping-service/shipping-service-deployment.yaml b/shipping-service/shipping-service-deployment.yaml new file mode 100644 index 000000000..429a637ed --- /dev/null +++ b/shipping-service/shipping-service-deployment.yaml @@ -0,0 +1,27 @@ + apiVersion: apps/v1 # Specifies the API version being used (apps/v1 in this case). + kind: Deployment # Defines that this YAML describes a Kubernetes Deployment. + metadata: + name: shipping-service-deploy # Deployment name for the shipping service + spec: + replicas: 1 # Desired number of replicas for the shipping service + selector: + matchLabels: + app: shipping-service # Selector label for the shipping service app + template: + metadata: + labels: + app: shipping-service # Label for the shipping service app + spec: + containers: + - name: shipping-service # Container name for the shipping service + image: ghcr.io/irvanfebri/shipping-service:latest # Container image for the shipping service + ports: + - containerPort: 3001 # Port on which the shipping service container listens + env: + - name: AMQP_PASSWORD # Environment variable for AMQP password + valueFrom: + secretKeyRef: + name: my-rabbitmq # Secret name for RabbitMQ credentials + key: rabbitmq-password # Secret key for RabbitMQ password + - name: AMQP_URL # Environment variable for AMQP URL + value: "amqp://user:$(AMQP_PASSWORD)@my-rabbitmq:5672" # Value for the AMQP URL diff --git a/shipping-service/shipping-service-service.yaml b/shipping-service/shipping-service-service.yaml new file mode 100644 index 000000000..d05c25bd6 --- /dev/null +++ b/shipping-service/shipping-service-service.yaml @@ -0,0 +1,9 @@ + apiVersion: v1 # Specifies the API version being used (v1 in this case). + kind: Service # Defines that this YAML describes a Kubernetes Service. + metadata: + name: shipping-service-svc # Specifies the name of the Service. + spec: + selector: + app: shipping-service # Defines the selector to identify the pods targeted by this service. + ports: + - port: 3001 # Specifies the port number (3001 in this case).