Skip to content

Instantly share code, notes, and snippets.

@johnsom
Last active February 21, 2019 22:23
Show Gist options
  • Save johnsom/1a988866d32ead9dc47841c3910eff0c to your computer and use it in GitHub Desktop.
Save johnsom/1a988866d32ead9dc47841c3910eff0c to your computer and use it in GitHub Desktop.
openstack project create --description "Project for testing barbican health" barbican-health-project
+-------------+-------------------------------------+
| Field | Value |
+-------------+-------------------------------------+
| description | Project for testing barbican health |
| domain_id | default |
| enabled | True |
| id | 3fc84df4d3334292b46a452d74cc96db |
| is_domain | False |
| name | barbican-health-project |
| parent_id | default |
| tags | [] |
+-------------+-------------------------------------+
openstack user create --project-domain default --project barbican-health-project --password 5f9eefb8-89b6-420a-bd49-1b102c371a25 --description "Barbican health check user" barbican-health-check
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| default_project_id | 3fc84df4d3334292b46a452d74cc96db |
| description | Barbican health check user |
| domain_id | default |
| enabled | True |
| id | 25cb2bac8a0240b5a4f7d077c22c03aa |
| name | barbican-health-check |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
openstack role add --project barbican-health-project --user barbican-health-check creator
#!/bin/bash
# Fail on any error
set -e
export OS_USER_DOMAIN_ID=default
export OS_AUTH_URL=http://10.21.21.62/identity/
export OS_PROJECT_DOMAIN_ID=default
export OS_REGION_NAME=RegionOne
export OS_PROJECT_NAME=barbican-health-project
export OS_IDENTITY_API_VERSION=3
export OS_TENANT_NAME=barbican-health-project
export OS_AUTH_TYPE=password
export OS_PASSWORD="5f9eefb8-89b6-420a-bd49-1b102c371a25"
export OS_USERNAME=barbican-health-check
export OS_CACERT=
TEST_PAYLOAD="test-string"
HREF=$(openstack secret store -f value -c 'Secret href' --name barbican-health-check-secret --payload $TEST_PAYLOAD)
PAYLOAD=$(openstack secret get $HREF --payload -f value)
openstack secret delete $HREF
if [[ $TEST_PAYLOAD == $PAYLOAD ]] ; then
exit 0
else
exit 1
fi
HAProxy settings:
global
external-check
backend <backend ID>
option external-check
external-check command <path to test script>
HAProxy example config:
# Configuration for loadbalancer 803cbc04-2da4-4392-a456-3724bb40bdc4
global
daemon
user nobody
log /dev/log local0
log /dev/log local1 notice
stats socket /var/lib/octavia/19ea322c-05b9-4da2-9adb-52ea59d57dcd.sock mode 0666 level user
maxconn 1000000
external-check
defaults
log global
retries 3
option redispatch
option splice-request
option splice-response
option http-keep-alive
frontend 19ea322c-05b9-4da2-9adb-52ea59d57dcd
option httplog
maxconn 1000000
bind 10.0.0.22:80
mode http
default_backend 7667a848-9bba-4874-910d-966e95ef488d
timeout client 50000
backend 7667a848-9bba-4874-910d-966e95ef488d
mode http
http-reuse safe
balance roundrobin
timeout check 2s
option external-check
external-check command /var/lib/octavia/ping-wrapper.sh
fullconn 1000000
option allbackups
timeout connect 5000
timeout server 50000
server 74602b0a-1c57-4704-aba0-dfe7acce7b45 172.21.1.51:80 weight 1 check inter 5s fall 3 rise 1
server 7b6abad9-a735-494c-bdc4-595bdbe39bc0 172.21.2.121:80 weight 1 check inter 5s fall 3 rise 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment