← Back to team overview

wordpress-charmers team mailing list archive

[Merge] ~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress:operator into charm-k8s-wordpress:master

 

Thomas Cuthbert has proposed merging ~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress:operator into charm-k8s-wordpress:master.

Requested reviews:
  Wordpress Charmers (wordpress-charmers)

For more details, see:
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress/+merge/384516
-- 
Your team Wordpress Charmers is requested to review the proposed merge of ~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress:operator into charm-k8s-wordpress:master.
diff --git a/config.yaml b/config.yaml
index 7bc9cb2..94a3dcf 100644
--- a/config.yaml
+++ b/config.yaml
@@ -70,6 +70,10 @@ options:
     type: string
     description: Blog hostname
     default: "myblog.example.com"
+  probe_regex:
+    type: string
+    description: "Regex used by Kubernetes readiness probe against the Blog index page."
+    default: "Test Blog"
   wp_plugin_akismet_key:
     type: string
     description: Akismet key. If empty, akismet will not be automatically enabled
diff --git a/src/charm.py b/src/charm.py
index 69c317d..ad7dd44 100755
--- a/src/charm.py
+++ b/src/charm.py
@@ -173,7 +173,12 @@ class WordpressK8sCharm(CharmBase):
                     "imageDetails": {"imagePath": config["image"]},
                     "ports": ports,
                     "config": secure_pod_config,
-                    "readinessProbe": {"exec": {"command": ["/bin/cat", "/srv/wordpress-helpers/.ready"]}},
+                    "readinessProbe": {"exec": {"command": [
+                        "/bin/sh",
+                        "-c",
+                        "curl --silent http://localhost/ | grep -P '{probe_regex}'".format(
+                            probe_regex=config["probe_regex"])
+                    ]}},
                 }
             ]
         }

Follow ups