The purpose of this utility is to help automate steps on F5 for the purposes of Blue/Green and Canary deployments .
I-rule definition for a canary deployment is required for the utility to work
built and tested against BIGIP-15.1.0.2-0.0.9
-poolname = Big Ip target poolname
-action = enable pool , disablepool or updateirule
-username = admin user
-password = admin password
-host = Big IP ip address port combination i.e. 10.1.1.170:8443
-poolname=PoolA -action=disablepool -username=admin -password=******* -host=10.1.1.170:8443
-irulename=CanaryRule -action=updateirule -username=admin -password=******* -host=10.1.1.170:8443 -irulepayload="{"apiAnonymous": "when HTTP_REQUEST {\n log local0. \"[IP::client_addr]:[TCP::client_port]: Connected to [virtual name] [IP::local_addr]:[TCP::local_port]\" \n HTTP::respond 200 content \"Connected to [virtual name] [IP::local_addr]:[TCP::local_port] from [IP::client_addr]:[TCP::client_port]\"\n}"}"
Note this queries the first node in a given pool and returns enabled/disabled
On the shell step / commandline ecapsulate the JSON string with ' to escape the special characters and make it a string literal
i.e.
-irulepayload='{"apiAnonymous": "when HTTP_REQUEST {\n log local0. "[IP::client_addr]:[TCP::client_port]: Connected to [virtual name] [IP::local_addr]:[TCP::local_port]" \n HTTP::respond 200 content "Connected to [virtual name] [IP::local_addr]:[TCP::local_port] from [IP::client_addr]:[TCP::client_port]"\n}"}'
-
Create a delegate profile to pull go_build_main_go binary from the repo
S3 hosted binary here : https://f5utility.s3-ap-southeast-2.amazonaws.com/go_build_main_go_linux
-
Example Shell script step in Harness
Harness Variables :
${workflow.variables.irulename} = CanaryRule
${workflow.variables.action} = updateirule
${workflow.variables.username} = admin
${workflow.variables.password} = *****
${workflow.variables.host} = 10.1.1.170:8443
${workflow.variables.irulepayload} = '{"apiAnonymous": "when HTTP_REQUEST {\n log local0. "[IP::client_addr]:[TCP::client_port]: Connected to [virtual name] [IP::local_addr]:[TCP::local_port]" \n HTTP::respond 200 content "Connected to [virtual name] [IP::local_addr]:[TCP::local_port] from [IP::client_addr]:[TCP::client_port]"\n}"}'
Harness shell script command with variables :
Irule
cd /Users/gregorykroon/go/src/F5Utility/build
./go_build_main_go -irulename=${workflow.variables.irulename} -action=${workflow.variables.action} -username=${workflow.variables.username} -password=${workflow.variables.password} -host=${workflow.variables.host} -irulepayload=${workflow.variables.irulepayload}
Enable pool
cd /Users/gregorykroon/go/src/F5Utility/build
./go_build_main_go -poolname=PoolA -action=enablepool -username=${workflow.variables.username} -password=${workflow.variables.password} -host=${workflow.variables.host}
Disable pool
cd /Users/gregorykroon/go/src/F5Utility/build
./go_build_main_go -poolname=PoolA -action=disablepool -username=${workflow.variables.username} -password=${workflow.variables.password} -host=${workflow.variables.host}
For Linux build with GOOS=linux;GOARCH=amd64 environment variables