# 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: Namespace
metadata:
  name: ui
## RBAC
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: ui
rules:
- apiGroups:
  - ""
  resources:
  - namespaces
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - storage.k8s.io
  resources:
  - storageclasses
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - snapshot.storage.k8s.io
  resources:
  - volumesnapshotclasses
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - oracle.db.anthosapis.com
  resources:
  - backups
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - oracle.db.anthosapis.com
  resources:
  - backups/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - oracle.db.anthosapis.com
  resources:
  - configs
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - oracle.db.anthosapis.com
  resources:
  - configs/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - oracle.db.anthosapis.com
  resources:
  - databases
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - oracle.db.anthosapis.com
  resources:
  - databases/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - oracle.db.anthosapis.com
  resources:
  - instances
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - oracle.db.anthosapis.com
  resources:
  - instances/status
  verbs:
  - get
  - patch
  - update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: ui
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: ui
subjects:
- kind: ServiceAccount
  name: default
  namespace: ui
## Workload
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ui
  namespace: ui
spec:
  selector:
    matchLabels:
      app: ui
  template:
    metadata:
      labels:
        app: ui
    spec:
      containers:
      - name: ui
        image: gcr.io/elcarro/oracle.db.anthosapis.com/ui:v0.1.0-alpha
        imagePullPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
  name: ui
  namespace: ui
spec:
  selector:
    app: ui
  ports:
  - name: http
    port: 80
    targetPort: 8080

