From 8fde6bdb8a3ab49b449e87307780ed7d39ec803e Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Sat, 11 May 2019 13:35:36 +0300 Subject: [PATCH] Add SMI Istio adapter deployment --- Makefile | 6 ++ artifacts/smi/istio-adapter.yaml | 131 +++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 artifacts/smi/istio-adapter.yaml diff --git a/Makefile b/Makefile index 262f98b9..15771dcc 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,12 @@ run-nginx: -slack-url=https://hooks.slack.com/services/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 \ -slack-channel="devops-alerts" +run-smi: + go run cmd/flagger/* -kubeconfig=$$HOME/.kube/config -log-level=info -mesh-provider=smi:istio -namespace=smi \ + -metrics-server=https://prometheus.istio.weavedx.com \ + -slack-url=https://hooks.slack.com/services/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 \ + -slack-channel="devops-alerts" + build: docker build -t weaveworks/flagger:$(TAG) . -f Dockerfile diff --git a/artifacts/smi/istio-adapter.yaml b/artifacts/smi/istio-adapter.yaml new file mode 100644 index 00000000..ce40d9bf --- /dev/null +++ b/artifacts/smi/istio-adapter.yaml @@ -0,0 +1,131 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: trafficsplits.split.smi-spec.io +spec: + additionalPrinterColumns: + - JSONPath: .spec.service + description: The service + name: Service + type: string + group: split.smi-spec.io + names: + kind: TrafficSplit + listKind: TrafficSplitList + plural: trafficsplits + singular: trafficsplit + scope: Namespaced + subresources: + status: {} + version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: smi-adapter-istio + namespace: istio-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: smi-adapter-istio +rules: + - apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - events + - configmaps + - secrets + verbs: + - '*' + - apiGroups: + - apps + resources: + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - '*' + - apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - get + - create + - apiGroups: + - apps + resourceNames: + - smi-adapter-istio + resources: + - deployments/finalizers + verbs: + - update + - apiGroups: + - split.smi-spec.io + resources: + - '*' + verbs: + - '*' + - apiGroups: + - networking.istio.io + resources: + - '*' + verbs: + - '*' +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: smi-adapter-istio +subjects: + - kind: ServiceAccount + name: smi-adapter-istio + namespace: istio-system +roleRef: + kind: Role + name: smi-adapter-istio + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: smi-adapter-istio + namespace: istio-system +spec: + replicas: 1 + selector: + matchLabels: + name: smi-adapter-istio + template: + metadata: + labels: + name: smi-adapter-istio + annotations: + sidecar.istio.io/inject: "false" + spec: + serviceAccountName: smi-adapter-istio + containers: + - name: smi-adapter-istio + image: docker.io/stefanprodan/smi-adapter-istio:0.0.2-beta.1 + command: + - smi-adapter-istio + imagePullPolicy: Always + env: + - name: WATCH_NAMESPACE + value: "" + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: "smi-adapter-istio"