| 1 |
# Copyright 2015 Google Inc. All rights reserved. |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
# you may not use this file except in compliance with the License. |
| 5 |
# You may obtain a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
# See the License for the specific language governing permissions and |
| 13 |
# limitations under the License. |
| 14 |
|
| 15 |
local Kube = import "kube.libsonnet"; |
| 16 |
|
| 17 |
{ |
| 18 |
|
| 19 |
# The port that this service should serve on. |
| 20 |
redis_port:: 6379, |
| 21 |
# Change this to your project ID. |
| 22 |
project_id:: "cooltool-1009", |
| 23 |
|
| 24 |
# Change the following two settings to your BigQuery dataset and table. |
| 25 |
bq_dataset:: "rtda", |
| 26 |
bq_table:: "tweets", |
| 27 |
|
| 28 |
# Change the following four settings to your twitter credentials |
| 29 |
# information. |
| 30 |
twitter_consumer_key:: "xxxx", |
| 31 |
twitter_consumer_secret:: "xxxx", |
| 32 |
twitter_access_token:: "xxxx", |
| 33 |
twitter_access_token_sec:: "xxxx", |
| 34 |
|
| 35 |
"twitter-stream.new.yaml": Kube.v1.ReplicationController("twitter-stream") { |
| 36 |
spec: { |
| 37 |
replicas: 1, |
| 38 |
template: { |
| 39 |
metadata: { |
| 40 |
labels: { |
| 41 |
name: "twitter-stream", |
| 42 |
}, |
| 43 |
}, |
| 44 |
spec: { |
| 45 |
containers: [ |
| 46 |
{ |
| 47 |
name: "twitter-to-redis", |
| 48 |
image: "gcr.io/%s/pipeline_image:latest" % $.project_id, |
| 49 |
env: Kube.pair_list({ |
| 50 |
PROCESSINGSCRIPT: "twitter-to-redis", |
| 51 |
REDISLIST: "twitter-stream", |
| 52 |
CONSUMERKEY: $.twitter_consumer_key, |
| 53 |
CONSUMERSECRET: $.twitter_consumer_secret, |
| 54 |
ACCESSTOKEN: $.twitter_access_token, |
| 55 |
ACCESSTOKENSEC: $.twitter_access_token_sec, |
| 56 |
TWSTREAMMODE: "sample", |
| 57 |
}), |
| 58 |
}, |
| 59 |
], |
| 60 |
}, |
| 61 |
}, |
| 62 |
}, |
| 63 |
}, |
| 64 |
"redis-master-service.new.yaml": Kube.v1.Service("redis-master") { |
| 65 |
metadata+: { |
| 66 |
name: "redismaster", # Likely a typo in the original. |
| 67 |
}, |
| 68 |
spec: { |
| 69 |
ports: [ |
| 70 |
{ |
| 71 |
port: $.redis_port, |
| 72 |
# You don't need to specify the targetPort if it is the same as the port, |
| 73 |
# though here we include it anyway, to show the syntax. |
| 74 |
targetPort: $.redis_port, |
| 75 |
}, |
| 76 |
], |
| 77 |
selector: { |
| 78 |
name: "redis-master", |
| 79 |
}, |
| 80 |
}, |
| 81 |
}, |
| 82 |
"redis-master.new.yaml": Kube.v1.ReplicationController("redis-master") { |
| 83 |
spec: { |
| 84 |
replicas: 1, |
| 85 |
template: { |
| 86 |
metadata: { |
| 87 |
labels: { |
| 88 |
name: "redis-master", |
| 89 |
}, |
| 90 |
}, |
| 91 |
spec: { |
| 92 |
containers: [ |
| 93 |
{ |
| 94 |
name: "master", |
| 95 |
image: "redis", |
| 96 |
ports: [ |
| 97 |
{ |
| 98 |
containerPort: $.redis_port, |
| 99 |
}, |
| 100 |
], |
| 101 |
}, |
| 102 |
{ |
| 103 |
name: "collectd", |
| 104 |
image: "gcr.io/%s/collectd-redis:latest" % $.project_id, |
| 105 |
ports: [], |
| 106 |
}, |
| 107 |
], |
| 108 |
}, |
| 109 |
}, |
| 110 |
}, |
| 111 |
}, |
| 112 |
"bigquery-controller.new.yaml": Kube.v1.ReplicationController("bigquery-controller") { |
| 113 |
spec: { |
| 114 |
replicas: 2, |
| 115 |
template: { |
| 116 |
metadata: { |
| 117 |
labels: { |
| 118 |
name: "bigquery-controller", |
| 119 |
}, |
| 120 |
}, |
| 121 |
spec: { |
| 122 |
containers: [ |
| 123 |
{ |
| 124 |
name: "bigquery", |
| 125 |
image: "gcr.io/%s/pipeline_image:latest" % $.project_id, |
| 126 |
env: Kube.pair_list({ |
| 127 |
PROCESSINGSCRIPT: "redis-to-bigquery", |
| 128 |
REDISLIST: "twitter-stream", |
| 129 |
PROJECT_ID: $.project_id, |
| 130 |
# Change the following two settings to your dataset and table. |
| 131 |
BQ_DATASET: $.bq_dataset, |
| 132 |
BQ_TABLE: $.bq_table, |
| 133 |
}), |
| 134 |
}, |
| 135 |
], |
| 136 |
}, |
| 137 |
}, |
| 138 |
}, |
| 139 |
}, |
| 140 |
} |