## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements.  See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You 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:
  # original docker-compose link: "database:postgresql.servicecomb.io"
  # Since kubernetes doesn't allow a namespace with dot like "servicecomb.io", make sure the Pod and Service are under the default namespace to be accessible
  name: postgresql
  namespace: servicecomb
  labels:
    app: database
spec:
  ports:
  - port: 5432
    name: postgresql # The name cannot be 'http'
  selector:
    app: database
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: database
  namespace: servicecomb
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: database
        version: v1
    spec:
      containers:
      - name: postgresql
        image: postgres
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 5432
        env:
        - name: POSTGRES_DB
          value: saga
        - name: POSTGRES_USER
          value: saga
        - name: POSTGRES_PASSWORD
          value: password
---
