---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: servicecomb-service-center-istio
  namespace: istio-system
  labels:
    app: servicecomb-service-center-istio
spec:
  selector:
    matchLabels:
      app: servicecomb-service-center-istio
  replicas: 1
  template:
    metadata:
      labels:
        app: servicecomb-service-center-istio
      annotations:
        sidecar.istio.io/inject: "false"
    spec:
      serviceAccountName: servicecomb-service-center-istio
      containers:
        - name: servicecomb-service-center-istio
          image: servicecomb-service-center-istio:dev
          args: ["--sc-addr", "local-service-center.default.svc.cluster.local:30100"] 
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: servicecomb-service-center-istio
  namespace: istio-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  labels:
    app: servicecomb-service-center-istio
  name: servicecomb-service-center-istio
  namespace: istio-system
rules:
  - apiGroups:
      - ""
    resources:
      - configmaps
      - events
    verbs:
      - '*'
  - verbs:
      - '*'
    apiGroups:
      - coordination.k8s.io
    resources:
      - '*'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  labels:
    app: servicecomb-service-center-istio
  name: servicecomb-service-center-istio
  namespace: istio-system
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: servicecomb-service-center-istio
subjects:
  - kind: ServiceAccount
    name: servicecomb-service-center-istio
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  labels:
    app: servicecomb-service-center-istio
  name: servicecomb-service-center-istio
  namespace: istio-system
rules:
  - apiGroups:
      - ""
    resources:
      - secrets
    verbs:
      - get
  - apiGroups:
      - networking.istio.io
    resources:
      - '*'
    verbs:
      - get
      - watch
      - list
  - apiGroups:
      - networking.istio.io
    resources:
      - virtualservices
      - destinationrules
      - envoyfilters
      - serviceentries
    verbs:
      - get
      - watch
      - list
      - update
      - patch
      - create
      - delete
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  labels:
    app: servicecomb-service-center-istio
  name: servicecomb-service-center-istio
  namespace: istio-system
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: servicecomb-service-center-istio
subjects:
  - kind: ServiceAccount
    name: servicecomb-service-center-istio
    namespace: istio-system