- mysql = endpoint_from_flag("mysql.available")
-
- if mysql.host() is not None:
- spec = make_pod_spec(
- mysql.host(),
- mysql.port(),
- mysql.user(),
- mysql.password(),
- mysql.root_password(),
- )
-
- log("set pod spec:\n{}".format(spec))
- pod_spec_set(spec)
- layer.status.active("creating container")
- set_flag("ro-k8s.configured")
+ kafka = endpoint_from_flag("kafka.ready")
+ mongo = endpoint_from_flag("mongo.ready")
+
+ if kafka and mongo:
+ kafka_units = kafka.kafkas()
+ kafka_unit = kafka_units[0]
+
+ mongo_uri = mongo.connection_string()
+ log("Mongo URI: {}".format(mongo_uri))
+
+ if (
+ mongo_uri
+ and kafka_unit["host"]
+ and kafka_unit["port"]
+ and ro_unit["host"]
+ and ro_unit["port"]
+ ):
+ spec = make_pod_spec(
+ kafka_unit["host"],
+ kafka_unit["port"],
+ mongo_uri,
+ )
+
+ log("set pod spec:\n{}".format(spec))
+ pod_spec_set(spec)
+ layer.status.active("creating container")
+ set_flag("ro-k8s.configured")