# Copyright 2017 The Openstack-Helm Authors.
#
# 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: ReplicationController
metadata:
  name: glance-client
spec:
  replicas: 1
  selector:
    app: glance-client
  template:
    metadata:
      name: glance-client
      labels:
        app: glance-client
    spec:
      restartPolicy: Always
      containers:
        - name: glance-bootstrap
          image: kolla/ubuntu-source-kolla-toolbox:4.0.0
          imagePullPolicy: ""
          command: ["bash"]
          args: ["-c", "while true; do echo hello; sleep 10;done"]
          env:
          - name: OS_IDENTITY_API_VERSION
            value: "3"
          - name: OS_AUTH_URL
            valueFrom:
              secretKeyRef:
                key: OS_AUTH_URL
                name: glance-env-keystone-admin
          - name: OS_REGION_NAME
            valueFrom:
              secretKeyRef:
                key: OS_REGION_NAME
                name: glance-env-keystone-admin
          - name: OS_PROJECT_DOMAIN_NAME
            valueFrom:
              secretKeyRef:
                key: OS_PROJECT_DOMAIN_NAME
                name: glance-env-keystone-admin
          - name: OS_PROJECT_NAME
            valueFrom:
              secretKeyRef:
                key: OS_PROJECT_NAME
                name: glance-env-keystone-admin
          - name: OS_USER_DOMAIN_NAME
            valueFrom:
              secretKeyRef:
                key: OS_USER_DOMAIN_NAME
                name: glance-env-keystone-admin
          - name: OS_USERNAME
            valueFrom:
              secretKeyRef:
                key: OS_USERNAME
                name: glance-env-keystone-admin
          - name: OS_PASSWORD
            valueFrom:
              secretKeyRef:
                key: OS_PASSWORD
                name: glance-env-keystone-admin
          volumeMounts:
            - name: imagedir
              mountPath: /tmp/images
            - name: glance-bin
              mountPath: /tmp/bootstrap.sh
              subPath: bootstrap.sh
            - name: glance-etc
              mountPath: /etc/glance/glance-api.conf
              subPath: glance-api.conf
      volumes:
        - name: imagedir
          emptyDir: {}
        - name: glance-bin
          configMap:
            name: glance-bin
        - name: glance-etc
          configMap:
            name: glance-etc
