# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# 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: Service
metadata:
  name: accounts-db
  labels:
    app: accounts-db
    tier: db
spec:
  ports:
    - port: 5432
      name: tcp
      targetPort: 5432
      protocol: TCP
  selector:
    app: accounts-db
    tier: db
---
apiVersion: v1
kind: Service
metadata:
  name: balancereader
spec:
  type: ClusterIP
  selector:
    app: balancereader
  ports:
  - name: http
    port: 8080
    targetPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: contacts
spec:
  type: ClusterIP
  selector:
    app: contacts
  ports:
  - name: http
    port: 8080
    targetPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: frontend
spec:
  type: LoadBalancer
  selector:
    app: frontend
  ports:
  - name: http
    port: 80
    targetPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: ledger-db
spec:
  type: ClusterIP
  selector:
    app: ledger-db
  ports:
  - name: tcp
    port: 5432
    targetPort: 5432
---
apiVersion: v1
kind: Service
metadata:
  name: ledgerwriter
spec:
  type: ClusterIP
  selector:
    app: ledgerwriter
  ports:
  - name: http
    port: 8080
    targetPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: transactionhistory
spec:
  type: ClusterIP
  selector:
    app: transactionhistory
  ports:
  - name: http
    port: 8080
    targetPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: userservice
spec:
  type: ClusterIP
  selector:
    app: userservice
  ports:
  - name: http
    port: 8080
    targetPort: 8080