[stable/weave-cloud] Replace Scope, Flux and Cortex with weave-agent daemon (#5163)

* Replace Scope, Flux and Cortex with weave-agent daemon
 - bump version to 0.2.0
 - use the weave namespace instead of kube-system
 - rename the token variable and store it as a kube secret

* Remove blank lines

* add empty token

* Add api and app version

* Remove duplicate chart yaml

* Add demo token value

* Add CI values with a demo token

* Make RBAC and service account optional

* Consistent indentation

* Use Github usernames

* Cleaup CI values

* Use chart fullname for RBAC resources

* Use a release version for weave-agent

* Remove deprecated service account
This commit is contained in:
Stefan Prodan
2018-05-10 09:08:54 -07:00
committed by k8s-ci-robot
parent 7f8237eb39
commit 3f56ab265b
15 changed files with 193 additions and 526 deletions
+6 -2
View File
@@ -1,10 +1,14 @@
apiVersion: v1
appVersion: "0.2.0"
name: weave-cloud
version: 0.1.3
version: 0.2.0
description: |
Weave Cloud is a add-on to Kubernetes which provides Continuous Delivery, along with hosted Prometheus Monitoring and a visual dashboard for exploring & debugging microservices
home: https://weave.works
maintainers:
- name: Ilya Dmitrichenko
- name: errordeveloper
email: ilya@weave.works
- name: stefanprodan
email: stefan@weave.works
engine: gotpl
icon: https://www.weave.works/assets/images/bltd108e8f850ae9e7c/weave-logo-512.png
+2
View File
@@ -1,4 +1,6 @@
approvers:
- errordeveloper
- stefanprodan
reviewers:
- errordeveloper
- stefanprodan
+15 -4
View File
@@ -15,12 +15,15 @@ You will need a service token which you can get from [cloud.weave.works](https:/
To install the chart:
```console
$ helm install --name weave-cloud --namespace kube-system --set ServiceToken=<YOUR_WEAVE_CLOUD_SERVICE_TOKEN> stable/weave-cloud
$ helm install --name weave-cloud \
--namespace weave \
--set token=<YOUR_WEAVE_CLOUD_SERVICE_TOKEN> \
stable/weave-cloud
```
To view the pods installed:
```console
$ kubectl get pods -n kube-system -l weave-cloud-component
$ kubectl get pods -n weave
```
To upgrade the chart:
@@ -33,7 +36,13 @@ $ helm upgrade --reuse-values weave-cloud stable/weave-cloud
To uninstall/delete the `weave-cloud` chart:
```console
$ helm delete weave-cloud
$ helm delete --purge weave-cloud
```
Delete the `weave` namespace:
```console
$ kubectl delete namespace weave
```
The command removes all the Kubernetes components associated with the chart and deletes the release.
@@ -44,4 +53,6 @@ The following tables lists the configurable parameters of the Weave Cloud Agents
| Parameter | Description | Default |
| --------- | ----------- | ------- |
| `ServiceToken` | Weave Cloud service token | _none_ _(**must be set**)_ |
| `token` | Weave Cloud service token | _none_ _(**must be set**)_ |
| `rbac.create` | If `true`, create and use RBAC resources | `true` |
| `serviceAccount.create` | If `true`, create a new service account | `true` |
+3
View File
@@ -0,0 +1,3 @@
# CI values for weave-cloud.
token: demo
+3 -3
View File
@@ -1,10 +1,10 @@
{{- if .Values.ServiceToken -}}
{{- if .Values.token -}}
Weave Cloud agents had been installed!
First, verify all Pods are running:
kubectl get pods -n {{ .Release.Namespace }} -l weave-cloud-component
kubectl get pods -n {{ .Release.Namespace }}
Next, login to Weave Cloud (https://cloud.weave.works) and verify the agents are connect to your instance.
@@ -23,6 +23,6 @@ To retrieve your Weave Cloud service token, log in to your instance first: https
Then run:
helm upgrade {{ .Release.Name }} --set ServiceToken=<YOUR_WEAVE_CLOUD_SERVICE_TOKEN> stable/weave-cloud
helm upgrade {{ .Release.Name }} --set token=<YOUR_WEAVE_CLOUD_SERVICE_TOKEN> stable/weave-cloud
{{- end }}
+43
View File
@@ -0,0 +1,43 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "weave-cloud.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "weave-cloud.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "weave-cloud.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "weave-cloud.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "weave-cloud.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
-273
View File
@@ -1,273 +0,0 @@
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: ServiceAccount
metadata:
name: weave-cortex
labels:
name: weave-cortex
- apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: weave-cortex
labels:
name: weave-cortex
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
- nonResourceURLs:
- '*'
verbs:
- '*'
- apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: weave-cortex
labels:
name: weave-cortex
roleRef:
kind: ClusterRole
name: weave-cortex
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: weave-cortex
namespace: kube-system
- apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: weave-cortex-agent
labels:
name: weave-cortex-agent
app: weave-cortex
weave-cloud-component: cortex
weave-cortex-component: agent
spec:
replicas: 1
template:
metadata:
labels:
name: weave-cortex-agent
app: weave-cortex
weave-cloud-component: cortex
weave-cortex-component: agent
spec:
containers:
- name: agent
args:
- '-config.file=/etc/prometheus/prometheus.yml'
- '-web.listen-address=:8080'
- '-storage.local.engine=none'
image: 'prom/prometheus:v1.7.1'
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
protocol: TCP
volumeMounts:
- name: agent-config-volume
mountPath: /etc/prometheus
serviceAccountName: weave-cortex
volumes:
- name: agent-config-volume
configMap:
name: weave-cortex-agent-config
- apiVersion: v1
kind: Service
metadata:
name: weave-cortex-agent
labels:
name: weave-cortex-agent
app: weave-cortex
weave-cloud-component: cortex
weave-cortex-component: agent
spec:
ports:
- name: agent
port: 80
protocol: TCP
targetPort: 8080
selector:
name: weave-cortex-agent
app: weave-cortex
weave-cloud-component: cortex
weave-cortex-component: agent
- apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: weave-cortex-node-exporter
labels:
name: weave-cortex-node-exporter
app: weave-cortex
weave-cloud-component: cortex
weave-cortex-component: node-exporter
spec:
template:
metadata:
annotations:
prometheus.io.scrape: 'true'
labels:
name: weave-cortex-node-exporter
app: weave-cortex
weave-cloud-component: cortex
weave-cortex-component: node-exporter
spec:
containers:
- name: agent
image: 'prom/node-exporter:v0.14.0'
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9100
protocol: TCP
securityContext:
privileged: true
hostNetwork: true
hostPID: true
serviceAccountName: weave-cortex
tolerations:
- effect: NoSchedule
operator: Exists
updateStrategy:
type: RollingUpdate
- apiVersion: v1
kind: ConfigMap
metadata:
name: weave-cortex-agent-config
labels:
name: weave-cortex-agent-config
app: weave-cortex
weave-cloud-component: cortex
weave-cortex-component: agent-config
data:
prometheus.yml: |
global:
scrape_interval: 15s
remote_write:
- url: 'https://cloud.weave.works/api/prom/push'
basic_auth:
password: '{{.Values.ServiceToken}}'
remote_read:
- url: 'https://cloud.weave.works/api/prom/read'
basic_auth:
password: '{{.Values.ServiceToken}}'
scrape_configs:
- job_name: kubernetes-service-endpoints
kubernetes_sd_configs:
- role: endpoints
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
relabel_configs:
- source_labels:
- __meta_kubernetes_service_label_component
regex: apiserver
action: replace
target_label: __scheme__
replacement: https
- source_labels:
- __meta_kubernetes_service_label_kubernetes_io_cluster_service
action: drop
regex: 'true'
- source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_scrape
action: drop
regex: 'false'
- source_labels:
- __meta_kubernetes_pod_container_port_name
action: drop
regex: .*-noscrape
- source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_scheme
action: replace
target_label: __scheme__
regex: ^(https?)$
replacement: $1
- source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_path
action: replace
target_label: __metrics_path__
regex: ^(.+)$
replacement: $1
- source_labels:
- __address__
- __meta_kubernetes_service_annotation_prometheus_io_port
action: replace
target_label: __address__
regex: '^(.+)(?::\d+);(\d+)$'
replacement: '$1:$2'
- action: labelmap
regex: ^__meta_kubernetes_service_label_(.+)$
replacement: $1
- source_labels:
- __meta_kubernetes_namespace
- __meta_kubernetes_service_name
separator: /
target_label: job
- job_name: kubernetes-pods
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels:
- __meta_kubernetes_pod_annotation_prometheus_io_scrape
action: keep
regex: 'true'
- source_labels:
- __meta_kubernetes_namespace
- __meta_kubernetes_pod_label_name
separator: /
target_label: job
- source_labels:
- __meta_kubernetes_pod_node_name
target_label: node
- job_name: kubernetes-nodes
kubernetes_sd_configs:
- role: node
tls_config:
insecure_skip_verify: true
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
relabel_configs:
- target_label: __scheme__
replacement: https
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
- source_labels:
- __meta_kubernetes_node_label_kubernetes_io_hostname
target_label: instance
- target_label: __address__
replacement: 'kubernetes.default.svc:443'
- source_labels:
- __meta_kubernetes_node_name
regex: (.+)
target_label: __metrics_path__
replacement: '/api/v1/nodes/${1}/proxy/metrics'
- job_name: weave
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels:
- __meta_kubernetes_namespace
- __meta_kubernetes_pod_label_name
action: keep
regex: ^kube-system;weave-net$
- source_labels:
- __meta_kubernetes_pod_container_name
- __address__
action: replace
target_label: __address__
regex: '^weave;(.+?)(?::\d+)?$'
replacement: '$1:6782'
- source_labels:
- __meta_kubernetes_pod_container_name
- __address__
action: replace
target_label: __address__
regex: '^weave-npc;(.+?)(?::\d+)?$'
replacement: '$1:6781'
- source_labels:
- __meta_kubernetes_pod_container_name
action: replace
target_label: job
@@ -0,0 +1,41 @@
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ .Values.agent.name }}
labels:
app: {{ template "weave-cloud.name" . }}
chart: {{ template "weave-cloud.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
minReadySeconds: 30
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
app: {{ template "weave-cloud.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "weave-cloud.name" . }}
release: {{ .Release.Name }}
spec:
{{- if .Values.serviceAccount.create }}
serviceAccountName: {{ template "weave-cloud.serviceAccountName" . }}
{{- end }}
terminationGracePeriodSeconds: 30
containers:
- name: {{ .Values.agent.name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- -agent.poll-url=https://get.weave.works/k8s/agent.yaml?instanceID={{"{{.InstanceID}}"}}
- -wc.hostname=cloud.weave.works
- -wc.token=$(WEAVE_CLOUD_TOKEN)
env:
- name: WEAVE_CLOUD_TOKEN
valueFrom:
secretKeyRef:
key: token
name: weave-cloud
-132
View File
@@ -1,132 +0,0 @@
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: ServiceAccount
metadata:
name: weave-flux
labels:
name: weave-flux
- apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: weave-flux
labels:
name: weave-flux
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
- nonResourceURLs:
- '*'
verbs:
- '*'
- apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: weave-flux
labels:
name: weave-flux
roleRef:
kind: ClusterRole
name: weave-flux
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: weave-flux
namespace: kube-system
- apiVersion: v1
kind: Secret
metadata:
name: flux-git-deploy
type: Opaque
- apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: weave-flux-memcached
labels:
name: weave-flux-memcached
app: weave-flux
weave-cloud-component: flux
weave-flux-component: memcached
spec:
replicas: 1
template:
metadata:
labels:
name: weave-flux-memcached
app: weave-flux
weave-cloud-component: flux
weave-flux-component: memcached
spec:
containers:
- name: memcached
args:
- '-m 64'
- '-p 11211'
- '-vv'
image: 'memcached:1.4.25'
imagePullPolicy: IfNotPresent
ports:
- name: clients
containerPort: 11211
- apiVersion: v1
kind: Service
metadata:
name: weave-flux-memcached
labels:
name: weave-flux-memcached
app: weave-flux
weave-cloud-component: flux
weave-flux-component: memcached
spec:
clusterIP: None
ports:
- name: memcached
port: 11211
selector:
name: weave-flux-memcached
app: weave-flux
weave-cloud-component: flux
weave-flux-component: memcached
- apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: weave-flux-agent
labels:
name: weave-flux-agent
app: weave-flux
weave-cloud-component: flux
weave-flux-component: agent
spec:
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
name: weave-flux-agent
app: weave-flux
weave-cloud-component: flux
weave-flux-component: agent
spec:
containers:
- name: agent
args:
- '--token={{.Values.ServiceToken}}'
- '--connect=wss://cloud.weave.works/api/flux'
- >-
--memcached-hostname=weave-flux-memcached.kube-system.svc.cluster.local
image: 'quay.io/weaveworks/flux:1.0.0'
imagePullPolicy: IfNotPresent
volumeMounts:
- name: git-key
mountPath: /etc/fluxd/ssh
serviceAccountName: weave-flux
volumes:
- name: git-key
secret:
secretName: flux-git-deploy
+40
View File
@@ -0,0 +1,40 @@
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: {{ template "weave-cloud.fullname" . }}
labels:
app: {{ template "weave-cloud.name" . }}
chart: {{ template "weave-cloud.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
- nonResourceURLs:
- '*'
verbs:
- '*'
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: {{ template "weave-cloud.fullname" . }}
labels:
app: {{ template "weave-cloud.name" . }}
chart: {{ template "weave-cloud.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "weave-cloud.fullname" . }}
subjects:
- name: {{ template "weave-cloud.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
kind: ServiceAccount
{{- end -}}
-95
View File
@@ -1,95 +0,0 @@
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: ServiceAccount
metadata:
name: weave-scope
labels:
name: weave-scope
- apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: weave-scope
labels:
name: weave-scope
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
- nonResourceURLs:
- '*'
verbs:
- '*'
- apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: weave-scope
labels:
name: weave-scope
roleRef:
kind: ClusterRole
name: weave-scope
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: weave-scope
namespace: kube-system
- apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: weave-scope-agent
labels:
name: weave-scope-agent
app: weave-scope
weave-cloud-component: scope
weave-scope-component: agent
spec:
template:
metadata:
labels:
name: weave-scope-agent
app: weave-scope
weave-cloud-component: scope
weave-scope-component: agent
spec:
containers:
- name: agent
args:
- '--no-app'
- '--probe.docker.bridge=docker0'
- '--probe.docker=true'
- '--probe.kubernetes=true'
- '--service-token={{.Values.ServiceToken}}'
image: 'weaveworks/scope:1.6.5'
imagePullPolicy: IfNotPresent
securityContext:
privileged: true
volumeMounts:
- name: docker-socket
mountPath: /var/run/docker.sock
- name: scope-plugins
mountPath: /var/run/scope/plugins
- name: sys-kernel-debug
mountPath: /sys/kernel/debug
hostNetwork: true
hostPID: true
serviceAccountName: weave-scope
tolerations:
- effect: NoSchedule
operator: Exists
volumes:
- name: docker-socket
hostPath:
path: /var/run/docker.sock
- name: scope-plugins
hostPath:
path: /var/run/scope/plugins
- name: sys-kernel-debug
hostPath:
path: /sys/kernel/debug
updateStrategy:
type: RollingUpdate
+7
View File
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: weave-cloud
data:
token: {{ .Values.token | b64enc }}
@@ -0,0 +1,11 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "weave-cloud.serviceAccountName" . }}
labels:
app: {{ template "weave-cloud.name" . }}
chart: {{ template "weave-cloud.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- end -}}
-16
View File
@@ -1,16 +0,0 @@
#!/bin/sh -eux
# A Weave Cloud user is usually expect to install the agents using one simple command like this:
# kubectl create -n kube-system 'https://cloud.weave.works/k8s/v1.6/weave-cloud?t=<service_token>'
#
# There is service that generates manifest based on the parameters passed in the URL.
# This chart simply checks-in the YAML manifest generated by the service, and this script is used to
# update the chart.
for manifest in flux scope cortex ; do
curl --silent --location \
--get "https://cloud.weave.works/k8s/v1.6/${manifest}" \
--data-urlencode "service-token={{.Values.ServiceToken}}" \
--data-urlencode "omit-support-info=true" \
--output "./templates/${manifest}.yaml"
done
+22 -1
View File
@@ -1 +1,22 @@
# ServiceToken: ""
# Default values for weave-cloud.
token: ""
agent:
name: weave-agent
image:
repository: quay.io/weaveworks/launcher-agent
tag: 1.0.0
pullPolicy: IfNotPresent
rbac:
# Specifies whether RBAC resources should be created
create: true
serviceAccount:
# Specifies whether a service account should be created
create: true
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: