1+ apiVersion : v1
2+ kind : ConfigMap
3+ metadata :
4+ name : $name-ubbagent-config
5+ data :
6+ config.yaml : |
7+ # The identity section contains authentication information used
8+ # by the agent.
9+ identities:
10+ - name: gcp
11+ gcp:
12+ # This parameter accepts a base64-encoded JSON service
13+ # account key. The value comes from the reporting secret.
14+ encodedServiceAccountKey: $AGENT_ENCODED_KEY
15+
16+ # The metrics section defines the metric that will be reported.
17+ # Metric names should match verbatim the identifiers created
18+ # during pricing setup.
19+ metrics:
20+ - name: requests
21+ type: int
22+
23+ # The endpoints section of a metric defines which endpoints the
24+ # metric data is sent to.
25+ endpoints:
26+ - name: on_disk
27+ - name: servicecontrol
28+
29+ # The aggregation section indicates that reports that the agent
30+ # receives for this metric should be aggregated for a specified
31+ # period of time prior to being sent to the reporting endpoint.
32+ aggregation:
33+ bufferSeconds: 60
34+
35+ - name: instance_time
36+ type: int
37+ endpoints:
38+ - name: on_disk
39+ - name: servicecontrol
40+
41+ # The passthrough marker indicates that no aggregation should
42+ # occur for this metric. Reports received are immediately sent
43+ # to the reporting endpoint. We use passthrough for the
44+ # instance_time metric since reports are generated
45+ # automatically by a heartbeat source defined in a later
46+ # section.
47+ passthrough: {}
48+
49+ # The endpoints section defines where metering data is ultimately
50+ # sent. Currently supported endpoints include:
51+ # * disk - some directory on the local filesystem
52+ # * servicecontrol - Google Service Control
53+ endpoints:
54+ - name: on_disk
55+ # The disk endpoint is useful for debugging, but its inclusion
56+ # is not necessary in a production deployment.
57+ disk:
58+ reportDir: /var/lib/ubbagent/reports
59+ expireSeconds: 3600
60+ - name: servicecontrol
61+ servicecontrol:
62+ identity: gcp
63+ # The service name is unique to your application and will be
64+ # provided during onboarding.
65+ serviceName: my-application.mp-my-company.appspot.com
66+ consumerId: $AGENT_CONSUMER_ID # From the reporting secret.
67+
68+
69+ # The sources section lists metric data sources run by the agent
70+ # itself. The currently-supported source is 'heartbeat', which
71+ # sends a defined value to a metric at a defined interval. In
72+ # this example, the heartbeat sends a 60-second value through the
73+ # "instance_time" metric every minute.
74+ sources:
75+ - name: instance_time_heartbeat
76+ heartbeat:
77+ metric: instance_time
78+ intervalSeconds: 60
79+ value:
80+ int64Value: 60
81+ ---
82+ apiVersion : apps/v1beta2
83+ kind : Deployment
84+ metadata :
85+ name : $name-metered-app
86+ labels : &AppDeploymentLabels
87+ app.kubernetes.io/name : " $name"
88+ app.kubernetes.io/component : my-application
89+ spec :
90+ replicas : 1
91+ selector :
92+ matchLabels : *AppDeploymentLabels
93+ template :
94+ metadata :
95+ labels : *AppDeploymentLabels
96+ spec :
97+ containers :
98+ - name : my-app
99+ image : $imageMyApp
100+ # ... your app container's config ...
101+ - name : ubbagent
102+ image : $imageUbbagent
103+ env :
104+ - name : AGENT_CONFIG_FILE
105+ value : " /etc/ubbagent/config.yaml"
106+ - name : AGENT_LOCAL_PORT
107+ value : " 4567"
108+ - name : AGENT_ENCODED_KEY
109+ valueFrom :
110+ secretKeyRef :
111+ name : $reportingSecret
112+ key : reporting-key
113+ - name : AGENT_CONSUMER_ID
114+ valueFrom :
115+ secretKeyRef :
116+ name : $reportingSecret
117+ key : consumer-id
118+ volumeMounts :
119+ - name : ubbagent-config
120+ mountPath : /etc/ubbagent
121+ volumes :
122+ - name : ubbagent-config
123+ configMap :
124+ name : ubbagent-config
0 commit comments