Hello, world!

Can not read the token file. Exiting.

\n"); exit(); } $token = file_get_contents($tfile);; print("

Using token " . $token . ".

\n"); $errors = 0; if (!isset($_ENV["NAMESPACE"])) { print("

Namespace variable not set (NAMESPACE).

\n"); $errors++; } if (!isset($_ENV["APP_LABEL"])) { print("

App label variable not set (APP_LABEL).

\n"); $errors++; } if ($errors == 0) { $cs = curl_init("https://kubernetes.default/api/v1/namespaces/" . $_ENV["NAMESPACE"] . "/pods?labelSelector=app=" . $_ENV["APP_LABEL"]); curl_setopt($cs, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($cs, CURLOPT_RETURNTRANSFER, true); curl_setopt($cs, CURLOPT_HTTPHEADER, [ "Authorization: Bearer " . $token, "Accept: application/json" ]); $response = curl_exec($cs); print("

Got pod list response:

\n"); ?> Skipping pod list due to errors.

\n"); } $errors = 0; if (!isset($_ENV["NAMESPACE"])) { print("

Namespace variable not set (NAMESPACE).

\n"); $errors++; } if (!isset($_ENV["SERVICE_NAME"])) { print("

Service name variable not set (SERVICE_NAME).

\n"); $errors++; } if ($errors == 0) { $cs = curl_init("https://kubernetes.default/api/v1/namespaces/" . $_ENV["NAMESPACE"] . "/endpoints/" . $_ENV["SERVICE_NAME"]); curl_setopt($cs, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($cs, CURLOPT_RETURNTRANSFER, true); curl_setopt($cs, CURLOPT_HTTPHEADER, [ "Authorization: Bearer " . $token, "Accept: application/json" ]); $response = curl_exec($cs); print("

Got endpoint list response:

\n"); ?> Got dns query response:

\n\n"); var_dump($dnsrec); print("\n\n"); } else { print("

Could not look up DNS record for service.

\n"); } } else { print("

Skipping service test due to errors.

\n"); } ?>