From 982338e16296bfe9f882e7d2c93d4f94b154cf7c Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Thu, 4 Jul 2019 13:26:08 +0300 Subject: [PATCH] Kustomize installer: add Flagger base manifests --- kustomize/base/flagger/account.yaml | 6 + kustomize/base/flagger/crd.yaml | 172 ++++++++++++++++++++++ kustomize/base/flagger/deployment.yaml | 57 +++++++ kustomize/base/flagger/kustomization.yaml | 11 ++ kustomize/base/flagger/rbac.yaml | 90 +++++++++++ 5 files changed, 336 insertions(+) create mode 100644 kustomize/base/flagger/account.yaml create mode 100644 kustomize/base/flagger/crd.yaml create mode 100644 kustomize/base/flagger/deployment.yaml create mode 100644 kustomize/base/flagger/kustomization.yaml create mode 100644 kustomize/base/flagger/rbac.yaml diff --git a/kustomize/base/flagger/account.yaml b/kustomize/base/flagger/account.yaml new file mode 100644 index 00000000..95980a36 --- /dev/null +++ b/kustomize/base/flagger/account.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: flagger + namespace: flagger-system + diff --git a/kustomize/base/flagger/crd.yaml b/kustomize/base/flagger/crd.yaml new file mode 100644 index 00000000..b1467d67 --- /dev/null +++ b/kustomize/base/flagger/crd.yaml @@ -0,0 +1,172 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: canaries.flagger.app + annotations: + helm.sh/resource-policy: keep +spec: + group: flagger.app + version: v1alpha3 + versions: + - name: v1alpha3 + served: true + storage: true + - name: v1alpha2 + served: true + storage: false + - name: v1alpha1 + served: true + storage: false + names: + plural: canaries + singular: canary + kind: Canary + categories: + - all + scope: Namespaced + subresources: + status: {} + additionalPrinterColumns: + - name: Status + type: string + JSONPath: .status.phase + - name: Weight + type: string + JSONPath: .status.canaryWeight + - name: LastTransitionTime + type: string + JSONPath: .status.lastTransitionTime + validation: + openAPIV3Schema: + properties: + spec: + required: + - targetRef + - service + - canaryAnalysis + properties: + provider: + type: string + progressDeadlineSeconds: + type: number + targetRef: + type: object + required: ['apiVersion', 'kind', 'name'] + properties: + apiVersion: + type: string + kind: + type: string + name: + type: string + autoscalerRef: + anyOf: + - type: string + - type: object + required: ['apiVersion', 'kind', 'name'] + properties: + apiVersion: + type: string + kind: + type: string + name: + type: string + ingressRef: + anyOf: + - type: string + - type: object + required: ['apiVersion', 'kind', 'name'] + properties: + apiVersion: + type: string + kind: + type: string + name: + type: string + service: + type: object + required: ['port'] + properties: + port: + type: number + portName: + type: string + portDiscovery: + type: boolean + meshName: + type: string + timeout: + type: string + skipAnalysis: + type: boolean + canaryAnalysis: + properties: + interval: + type: string + pattern: "^[0-9]+(m|s)" + iterations: + type: number + threshold: + type: number + maxWeight: + type: number + stepWeight: + type: number + metrics: + type: array + properties: + items: + type: object + required: ['name', 'threshold'] + properties: + name: + type: string + interval: + type: string + pattern: "^[0-9]+(m|s)" + threshold: + type: number + query: + type: string + webhooks: + type: array + properties: + items: + type: object + required: ['name', 'url', 'timeout'] + properties: + name: + type: string + type: + type: string + enum: + - "" + - pre-rollout + - rollout + - post-rollout + url: + type: string + format: url + timeout: + type: string + pattern: "^[0-9]+(m|s)" + status: + properties: + phase: + type: string + enum: + - "" + - Initialized + - Progressing + - Succeeded + - Failed + canaryWeight: + type: number + failedChecks: + type: number + iterations: + type: number + lastAppliedSpec: + type: string + lastTransitionTime: + type: string diff --git a/kustomize/base/flagger/deployment.yaml b/kustomize/base/flagger/deployment.yaml new file mode 100644 index 00000000..17bcc3b2 --- /dev/null +++ b/kustomize/base/flagger/deployment.yaml @@ -0,0 +1,57 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: flagger + namespace: flagger-system +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app: flagger + template: + metadata: + labels: + app: flagger + annotations: + prometheus.io/scrape: "true" + spec: + serviceAccountName: flagger + containers: + - name: flagger + image: weaveworks/flagger:0.16.0 + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 8080 + livenessProbe: + exec: + command: + - wget + - --quiet + - --tries=1 + - --timeout=2 + - --spider + - http://localhost:8080/healthz + timeoutSeconds: 5 + readinessProbe: + exec: + command: + - wget + - --quiet + - --tries=1 + - --timeout=2 + - --spider + - http://localhost:8080/healthz + timeoutSeconds: 5 + resources: + limits: + memory: "512Mi" + cpu: "1000m" + requests: + memory: "32Mi" + cpu: "10m" + securityContext: + readOnlyRootFilesystem: true + runAsUser: 10001 diff --git a/kustomize/base/flagger/kustomization.yaml b/kustomize/base/flagger/kustomization.yaml new file mode 100644 index 00000000..620bece3 --- /dev/null +++ b/kustomize/base/flagger/kustomization.yaml @@ -0,0 +1,11 @@ +namespace: flagger-system +commonLabels: + app: flagger +resources: + - account.yaml + - rbac.yaml + - crd.yaml + - deployment.yaml +images: + - name: weaveworks/flagger + newTag: 0.16.0 diff --git a/kustomize/base/flagger/rbac.yaml b/kustomize/base/flagger/rbac.yaml new file mode 100644 index 00000000..3a7d0745 --- /dev/null +++ b/kustomize/base/flagger/rbac.yaml @@ -0,0 +1,90 @@ +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: flagger +rules: + - apiGroups: + - "" + resources: + - events + - configmaps + - secrets + - services + verbs: ["*"] + - apiGroups: + - apps + resources: + - deployments + verbs: ["*"] + - apiGroups: + - autoscaling + resources: + - horizontalpodautoscalers + verbs: ["*"] + - apiGroups: + - "extensions" + resources: + - ingresses + - ingresses/status + verbs: ["*"] + - apiGroups: + - flagger.app + resources: + - canaries + - canaries/status + verbs: ["*"] + - apiGroups: + - networking.istio.io + resources: + - virtualservices + - virtualservices/status + - destinationrules + - destinationrules/status + verbs: ["*"] + - apiGroups: + - appmesh.k8s.aws + resources: + - meshes + - meshes/status + - virtualnodes + - virtualnodes/status + - virtualservices + - virtualservices/status + verbs: ["*"] + - apiGroups: + - split.smi-spec.io + resources: + - trafficsplits + verbs: ["*"] + - apiGroups: + - gloo.solo.io + resources: + - settings + - upstreams + - upstreamgroups + - proxies + - virtualservices + verbs: ["*"] + - apiGroups: + - gateway.solo.io + resources: + - virtualservices + - gateways + verbs: ["*"] + - nonResourceURLs: + - /version + verbs: + - get +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: flagger +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: flagger +subjects: +- kind: ServiceAccount + name: flagger + namespace: flagger-system