SlideShare a Scribd company logo
1 of 46
1
TREATING LOAD
BALANCER
CONFIGURATION
LIKE CODE
Presented By: Jesse Mauntel
6/19/2015SAN DIEGO DEVOPS MEETUP 1
2
WHO AM I?
Operations Engineer who’s been in the industry
15+ years and has an extreme dislike for
configuration drift, system snowflakes, manual
administration, and time pirates.
@maunteljw
devopslove.blogspot.com
github.com/jmauntel
6/19/2015SAN DIEGO DEVOPS MEETUP 2
3
AGENDA
So what’s the problem?
iRule Tester
Object cloner & orphan object audit
Self-service website redirects
6/19/2015SAN DIEGO DEVOPS MEETUP 3
4
SO WHAT’S THE PROBLEM?
Work in a world of poorly written iRules
Little to no testability of iRules
Code promotion process that requires a
human to manually make iRule changes
for each environment
6/19/2015SAN DIEGO DEVOPS MEETUP 4
5
CHALLENGES
The current iRule logic includes
environment-specific definitions in the
logic, which makes promotion of whole
iRules through environments impossible
6/19/2015SAN DIEGO DEVOPS MEETUP 5
6
EXAMPLE
acme-qa-irule:
# Force sensitive acmeCommerce traffic to SSL
if { [class match [HTTP::uri] starts_with acmeCommerce-qa-class] } {
HTTP::redirect https://[HTTP::host][HTTP::uri]
# Send requests for Acme Information to the information tier
} elseif { [HTTP::uri] starts_with "/AcmeInformation/"} {
pool acmeInformation-qa-pool
}
6/19/2015SAN DIEGO DEVOPS MEETUP 6
7
CHALLENGES
iRule changes are made by hand in all
environments, which is error-prone
6/19/2015SAN DIEGO DEVOPS MEETUP 7
8
EXAMPLE
acme-dev-irule:
# Force sensitive acmeCommerce traffic to SSL
if { [class match [HTTP::uri] starts_with acmeCommerce-dev-class] } {
HTTP::redirect https://[HTTP::host][HTTP::uri]
acme-qa-irule:
# Force sensitive acmeCommerce traffic to SSL
if { [class match [HTTP::uri] starts_with acmeCommerce-dev-class] } {
HTTP::redirect https://[HTTP::host][HTTP::uri]
6/19/2015SAN DIEGO DEVOPS MEETUP 8
9
CHALLENGES
Creating new environments is a manual,
time-consuming, and tedious process
bleh
6/19/2015SAN DIEGO DEVOPS MEETUP 9
10
EXAMPLE
acme-dev-irule:
# Send all URIs that begin with /Website/ to acmeWeb pool
} elseif { [HTTP::uri] starts_with "/Website/" } {
pool acmeWeb-dev-pool
acme-qa-irule:
# Send all URIs that begin with /Website/ to acmeWeb pool
} elseif { [HTTP::uri] starts_with "/Website/" } {
pool acmeWeb-qa-pool
6/19/2015SAN DIEGO DEVOPS MEETUP 10
11
CHALLENGES
Existing iRules do not have functional
tests, so there is no guarantee that a
change to an iRule won't break other pre-
existing logic
6/19/2015SAN DIEGO DEVOPS MEETUP 11
12
EXAMPLE
acme-dev-irule:
# Send all URIs that begin with /Website/ to acmeWeb pool
} elseif { [HTTP::uri] starts_with "/Website/" } {
pool acmeWeb-dev-pool
> # Send store location details page to content tier
> } elseif { [HTTP::uri] contains "storelocation" } {
> pool acmeContent-dev-pool
# Send REST requests to acmeAPI tier
} elseif { ([HTTP::uri] starts_with "/rest/storelocation/allstores") } {
pool acmeAPI-dev-pool
6/19/2015SAN DIEGO DEVOPS MEETUP 12
13
SOLUTIONS TO CHALLENGES
Revisited
The current iRule logic includes
environment-specific definitions in the
logic, which makes promotion of whole
iRules through environments impossible
6/19/2015SAN DIEGO DEVOPS MEETUP 13
14
SOLUTION EXAMPLE
New iRule standards require environment
detection for variable assignment and
environment-agnostic logic
github.com/jmauntel/irule-standards
6/19/2015SAN DIEGO DEVOPS MEETUP 14
15
SOLUTIONS TO CHALLENGES
Revisited
iRule changes are made by hand in all
environments, which is error-prone
6/19/2015SAN DIEGO DEVOPS MEETUP 15
16
SOLUTION EXAMPLE
Since all new iRule logic is environment-
agnostic, environments no longer use
copies of iRules, but rather the exact same
iRule
Also, because iRule logic is identical in all
environments, automated promotion is now
possible
6/19/2015SAN DIEGO DEVOPS MEETUP 16
17
SOLUTION EXAMPLE (CONT)
ltm virtual acme-dev-vs {
rules {
acmeVars-1.0.0-irule
acme-1.0.0-irule
insertPoolCookie-1.0.0-irule
}
}
ltm virtual acme-qa-vs {
rules {
acmeVars-1.0.0-irule
acme-1.0.0-irule
insertPoolCookie-1.0.0-irule
}
}
6/19/2015SAN DIEGO DEVOPS MEETUP 17
18
SOLUTIONS TO CHALLENGES
Revisited
Creating new environments is a manual,
time-consuming, and tedious process
6/19/2015SAN DIEGO DEVOPS MEETUP 18
19
SOLUTION EXAMPLE
acmeVars-1.0.0-irule:
# Assign environment
if { [IP::local_addr] equals "10.0.0.50" } { set my_env "prd" }
elseif { [IP::local_addr] equals "10.254.1.136" } { set my_env "qa" }
else { [IP::local_addr] equals "10.254.1.137" } { set my_env "dev" }
# Pool definitions, sorted alphabetically
if { $my_env equals "prd" } { set acmeWeb-pool "acmeWeb-prd-pool" }
elseif { $my_env equals "qa" } { set acmeWeb-pool "acmeWeb-qa-pool" }
else { $my_env equals "dev" } { set acmeWeb-pool "acmeWeb-dev-pool" }
6/19/2015SAN DIEGO DEVOPS MEETUP 19
20
SOLUTION EXAMPLE (CONT)
acmeVars-1.0.0-irule – (applied to acme-dev-vs)
# Send all URIs that begin with /Website/ to acmeWeb pool
} elseif { [HTTP::uri] starts_with "/Website/" } {
pool ${acmeWeb-pool}
acmeVars-1.0.0-irule – (applied to acme-qa-vs)
# Send all URIs that begin with /Website/ to acmeWeb pool
} elseif { [HTTP::uri] starts_with "/Website/" } {
pool ${acmeWeb-pool}
6/19/2015SAN DIEGO DEVOPS MEETUP 20
21
SOLUTIONS TO CHALLENGES
Revisited
Existing iRules do not have functional
tests, so there is no guarantee that a
change to an iRule won't break other pre-
existing logic
6/19/2015SAN DIEGO DEVOPS MEETUP 21
22
SOLUTION EXAMPLE
After searching online and not finding an
existing iRule testing tool, I wrote one
irule-tester is written in Bash and leverages Curl
to make web requests, and then validates that
the response matches an expectation
github.com/jmauntel/irule-tester
6/19/2015SAN DIEGO DEVOPS MEETUP 22
23
IRULE TESTER
6/19/2015SAN DIEGO DEVOPS MEETUP 23
24
IRULE TESTER: OVERVIEW
 Written in Bash and uses Curl for requests
 Has simple and extended testing modes
 Supports multiple output formats, including TAP
 All tests are stored in source control
 Changes to any test are validated with Jenkins
6/19/2015SAN DIEGO DEVOPS MEETUP 24
25
IRULE TESTER: JENKINS
INTEGRATION
 Tests are executed after any change in source, or at least daily
 Test failures notify the team via email
 Tests are executed before and after iRule changes in all
environments
6/19/2015SAN DIEGO DEVOPS MEETUP 25
26
IRULE TESTER
DEMO
6/19/2015SAN DIEGO DEVOPS MEETUP 26
27
F5 OBJECT CLONER
6/19/2015SAN DIEGO DEVOPS MEETUP 27
28
F5 OBJECT CLONER
So if I’m versioning iRules and data
groups now, is there an easy way to
clone them?
Copy/paste is error-prone and lame
6/19/2015SAN DIEGO DEVOPS MEETUP 28
29
F5 OBJECT CLONER
I wrote a utility for that
Clones iRules and data-groups on a
single F5 unit or between two different
units
github.com/jmauntel/f5-utils
6/19/2015SAN DIEGO DEVOPS MEETUP 29
30
F5 OBJECT CLONER
Usage: clone-object.sh -o {data-group,rule} -s <SOURCE_OBJECT> -d <DEST_OBJECT> -S
<SOURCE_F5> -D <DEST_F5>
-d destination object name
-D destination F5
-o object type
-s source object name
-S source F5
All arguments are REQUIRED
Example:
# clone-object.sh –o data-group –s UserIPs-1.0.0-class –d UserIPs-1.1.0-class –S
10.0.0.1 –D 10.0.0.1
6/19/2015SAN DIEGO DEVOPS MEETUP 30
31
F5 OBJECT CLONER
DEMO
6/19/2015SAN DIEGO DEVOPS MEETUP 31
32
F5 ORPHAN OBJECT AUDIT
6/19/2015SAN DIEGO DEVOPS MEETUP 32
33
F5 ORPHAN OBJECT AUDIT
As time passes, a collection of F5
objects can build up, cluttering your
F5 config
Why not use a tool to audit for unused
objects and purge them?
6/19/2015SAN DIEGO DEVOPS MEETUP 33
34
F5 ORPHAN OBJECT AUDIT
Locates objects of a given type that only
have a single reference in the bigip.conf
file
Usage: ./f5orphan.pl -f <filename> -i <configuration item>
Valid configuration items:
rule | data-group | profile | snatpool | pool | node | monitor
Example:
# f5orphan.pl –f /config/bigip.conf –i rule
6/19/2015SAN DIEGO DEVOPS MEETUP 34
35
F5 ORPHAN OBJECT AUDIT
DEMO
6/19/2015SAN DIEGO DEVOPS MEETUP 35
36
SELF-SERVICE WEBSITE
REDIRECTS
6/19/2015SAN DIEGO DEVOPS MEETUP 36
37
WEBSITE REDIRECTS
Our WebOps team was constantly asking
us to add vanity redirects to the website in
support of marketing campaigns…
6/19/2015SAN DIEGO DEVOPS MEETUP 37
38
WEBSITE REDIRECTS
…so we made it self-service
6/19/2015SAN DIEGO DEVOPS MEETUP 38
39
REDIRECTS: STEP ONE (MANUAL)
Created a git repo that contains
redirects.config
WebOps team adds redirects to the
redirects.config file and pushes changes
6/19/2015SAN DIEGO DEVOPS MEETUP 39
40
REDIRECTS: STEP ONE (MANUAL)
Example of redirects.config:
# Redirects are defined as Key|Value - The Key is the origin and the Value is the
destination
# Example:
# Somewhere|Somewhere/Else
# Result:
# 24hourfitness.com/Somewhere would redirect to 24hourfitness.com/Somewhere/Else
/blog|/community/blog/
6/19/2015SAN DIEGO DEVOPS MEETUP 40
41
REDIRECTS: STEP TWO
(AUTOMATED)
Bamboo build job:
 Notices a change to the repo and gets latest updates
 Retrieves data-group creation script
 Uses data-group creation script to lint redirects.config
and create environment-specific LTM config files for
later merge
 Creates iRule Tester seed file for redirect validations
 Stages files for later deployment
6/19/2015SAN DIEGO DEVOPS MEETUP 41
42
REDIRECTS: STEP THREE
(AUTOMATED)
Bamboo deployment job (DEV):
 Automatically triggers based on successful build
 Copies LTM config file to target LTM and merges with
running configuration
 Executes iRule Tester script to verify all redirects work
as expected
 Notifies WebOps team via email that the deployment
to DEV was successful
6/19/2015SAN DIEGO DEVOPS MEETUP 42
43
REDIRECTS: STEP FOUR
(MANUAL)
Bamboo deployment job (QA):
 WebOps pushes button to launch deploy of the DEV
release to QA which:
 Copies LTM config file to target LTM and merges
with running configuration
 Executes iRule Tester script to verify all redirects
work as expected
 Notifies WebOps team via email that the
deployment to QA was successful
6/19/2015SAN DIEGO DEVOPS MEETUP 43
44
REDIRECTS: STEP FIVE (MANUAL)
Bamboo deployment job (PRD):
 WebOps notifies Operations team of the release that needs to be
promoted to PRD.
 Operations team keys in the required change control
documentation
 Operations team presses button to launch deploy of the QA
release to PRD which:
 Copies LTM config file to target LTM and merges with running
configuration
 Executes iRule Tester script to verify all redirects work as expected
 Notifies WebOps team via email that the deployment to PRD was
successful
6/19/2015SAN DIEGO DEVOPS MEETUP 44
45
WEBSITE REDIRECTS
DEMO
6/19/2015SAN DIEGO DEVOPS MEETUP 45
46
QUESTIONS?
Contact Info:
Jesse Mauntel
@maunteljw
devopslove.blogspot.com
github.com/jmauntel
6/19/2015SAN DIEGO DEVOPS MEETUP 46

More Related Content

Viewers also liked

All 50 Ways to Use BIG-IP
All 50 Ways to Use BIG-IP All 50 Ways to Use BIG-IP
All 50 Ways to Use BIG-IP F5 Networks
 
Cisco Wireless LAN Controller Palo Alto Networks Config Guide
Cisco Wireless LAN Controller Palo Alto Networks Config GuideCisco Wireless LAN Controller Palo Alto Networks Config Guide
Cisco Wireless LAN Controller Palo Alto Networks Config GuideAlberto Rivai
 
Palo alto networks NAT flow logic
Palo alto networks NAT flow logicPalo alto networks NAT flow logic
Palo alto networks NAT flow logicAlberto Rivai
 
BIG IP F5 GTM Presentation
BIG IP F5 GTM PresentationBIG IP F5 GTM Presentation
BIG IP F5 GTM PresentationPCCW GLOBAL
 
Checkpoint Firewall for Dummies
Checkpoint Firewall for Dummies Checkpoint Firewall for Dummies
Checkpoint Firewall for Dummies sushmil123
 
Presentation f5 – beyond load balancer
Presentation   f5 – beyond load balancerPresentation   f5 – beyond load balancer
Presentation f5 – beyond load balancerxKinAnx
 

Viewers also liked (6)

All 50 Ways to Use BIG-IP
All 50 Ways to Use BIG-IP All 50 Ways to Use BIG-IP
All 50 Ways to Use BIG-IP
 
Cisco Wireless LAN Controller Palo Alto Networks Config Guide
Cisco Wireless LAN Controller Palo Alto Networks Config GuideCisco Wireless LAN Controller Palo Alto Networks Config Guide
Cisco Wireless LAN Controller Palo Alto Networks Config Guide
 
Palo alto networks NAT flow logic
Palo alto networks NAT flow logicPalo alto networks NAT flow logic
Palo alto networks NAT flow logic
 
BIG IP F5 GTM Presentation
BIG IP F5 GTM PresentationBIG IP F5 GTM Presentation
BIG IP F5 GTM Presentation
 
Checkpoint Firewall for Dummies
Checkpoint Firewall for Dummies Checkpoint Firewall for Dummies
Checkpoint Firewall for Dummies
 
Presentation f5 – beyond load balancer
Presentation   f5 – beyond load balancerPresentation   f5 – beyond load balancer
Presentation f5 – beyond load balancer
 

Recently uploaded

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 

Recently uploaded (20)

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

Treating Load Balancer Configuration Like Code

  • 1. 1 TREATING LOAD BALANCER CONFIGURATION LIKE CODE Presented By: Jesse Mauntel 6/19/2015SAN DIEGO DEVOPS MEETUP 1
  • 2. 2 WHO AM I? Operations Engineer who’s been in the industry 15+ years and has an extreme dislike for configuration drift, system snowflakes, manual administration, and time pirates. @maunteljw devopslove.blogspot.com github.com/jmauntel 6/19/2015SAN DIEGO DEVOPS MEETUP 2
  • 3. 3 AGENDA So what’s the problem? iRule Tester Object cloner & orphan object audit Self-service website redirects 6/19/2015SAN DIEGO DEVOPS MEETUP 3
  • 4. 4 SO WHAT’S THE PROBLEM? Work in a world of poorly written iRules Little to no testability of iRules Code promotion process that requires a human to manually make iRule changes for each environment 6/19/2015SAN DIEGO DEVOPS MEETUP 4
  • 5. 5 CHALLENGES The current iRule logic includes environment-specific definitions in the logic, which makes promotion of whole iRules through environments impossible 6/19/2015SAN DIEGO DEVOPS MEETUP 5
  • 6. 6 EXAMPLE acme-qa-irule: # Force sensitive acmeCommerce traffic to SSL if { [class match [HTTP::uri] starts_with acmeCommerce-qa-class] } { HTTP::redirect https://[HTTP::host][HTTP::uri] # Send requests for Acme Information to the information tier } elseif { [HTTP::uri] starts_with "/AcmeInformation/"} { pool acmeInformation-qa-pool } 6/19/2015SAN DIEGO DEVOPS MEETUP 6
  • 7. 7 CHALLENGES iRule changes are made by hand in all environments, which is error-prone 6/19/2015SAN DIEGO DEVOPS MEETUP 7
  • 8. 8 EXAMPLE acme-dev-irule: # Force sensitive acmeCommerce traffic to SSL if { [class match [HTTP::uri] starts_with acmeCommerce-dev-class] } { HTTP::redirect https://[HTTP::host][HTTP::uri] acme-qa-irule: # Force sensitive acmeCommerce traffic to SSL if { [class match [HTTP::uri] starts_with acmeCommerce-dev-class] } { HTTP::redirect https://[HTTP::host][HTTP::uri] 6/19/2015SAN DIEGO DEVOPS MEETUP 8
  • 9. 9 CHALLENGES Creating new environments is a manual, time-consuming, and tedious process bleh 6/19/2015SAN DIEGO DEVOPS MEETUP 9
  • 10. 10 EXAMPLE acme-dev-irule: # Send all URIs that begin with /Website/ to acmeWeb pool } elseif { [HTTP::uri] starts_with "/Website/" } { pool acmeWeb-dev-pool acme-qa-irule: # Send all URIs that begin with /Website/ to acmeWeb pool } elseif { [HTTP::uri] starts_with "/Website/" } { pool acmeWeb-qa-pool 6/19/2015SAN DIEGO DEVOPS MEETUP 10
  • 11. 11 CHALLENGES Existing iRules do not have functional tests, so there is no guarantee that a change to an iRule won't break other pre- existing logic 6/19/2015SAN DIEGO DEVOPS MEETUP 11
  • 12. 12 EXAMPLE acme-dev-irule: # Send all URIs that begin with /Website/ to acmeWeb pool } elseif { [HTTP::uri] starts_with "/Website/" } { pool acmeWeb-dev-pool > # Send store location details page to content tier > } elseif { [HTTP::uri] contains "storelocation" } { > pool acmeContent-dev-pool # Send REST requests to acmeAPI tier } elseif { ([HTTP::uri] starts_with "/rest/storelocation/allstores") } { pool acmeAPI-dev-pool 6/19/2015SAN DIEGO DEVOPS MEETUP 12
  • 13. 13 SOLUTIONS TO CHALLENGES Revisited The current iRule logic includes environment-specific definitions in the logic, which makes promotion of whole iRules through environments impossible 6/19/2015SAN DIEGO DEVOPS MEETUP 13
  • 14. 14 SOLUTION EXAMPLE New iRule standards require environment detection for variable assignment and environment-agnostic logic github.com/jmauntel/irule-standards 6/19/2015SAN DIEGO DEVOPS MEETUP 14
  • 15. 15 SOLUTIONS TO CHALLENGES Revisited iRule changes are made by hand in all environments, which is error-prone 6/19/2015SAN DIEGO DEVOPS MEETUP 15
  • 16. 16 SOLUTION EXAMPLE Since all new iRule logic is environment- agnostic, environments no longer use copies of iRules, but rather the exact same iRule Also, because iRule logic is identical in all environments, automated promotion is now possible 6/19/2015SAN DIEGO DEVOPS MEETUP 16
  • 17. 17 SOLUTION EXAMPLE (CONT) ltm virtual acme-dev-vs { rules { acmeVars-1.0.0-irule acme-1.0.0-irule insertPoolCookie-1.0.0-irule } } ltm virtual acme-qa-vs { rules { acmeVars-1.0.0-irule acme-1.0.0-irule insertPoolCookie-1.0.0-irule } } 6/19/2015SAN DIEGO DEVOPS MEETUP 17
  • 18. 18 SOLUTIONS TO CHALLENGES Revisited Creating new environments is a manual, time-consuming, and tedious process 6/19/2015SAN DIEGO DEVOPS MEETUP 18
  • 19. 19 SOLUTION EXAMPLE acmeVars-1.0.0-irule: # Assign environment if { [IP::local_addr] equals "10.0.0.50" } { set my_env "prd" } elseif { [IP::local_addr] equals "10.254.1.136" } { set my_env "qa" } else { [IP::local_addr] equals "10.254.1.137" } { set my_env "dev" } # Pool definitions, sorted alphabetically if { $my_env equals "prd" } { set acmeWeb-pool "acmeWeb-prd-pool" } elseif { $my_env equals "qa" } { set acmeWeb-pool "acmeWeb-qa-pool" } else { $my_env equals "dev" } { set acmeWeb-pool "acmeWeb-dev-pool" } 6/19/2015SAN DIEGO DEVOPS MEETUP 19
  • 20. 20 SOLUTION EXAMPLE (CONT) acmeVars-1.0.0-irule – (applied to acme-dev-vs) # Send all URIs that begin with /Website/ to acmeWeb pool } elseif { [HTTP::uri] starts_with "/Website/" } { pool ${acmeWeb-pool} acmeVars-1.0.0-irule – (applied to acme-qa-vs) # Send all URIs that begin with /Website/ to acmeWeb pool } elseif { [HTTP::uri] starts_with "/Website/" } { pool ${acmeWeb-pool} 6/19/2015SAN DIEGO DEVOPS MEETUP 20
  • 21. 21 SOLUTIONS TO CHALLENGES Revisited Existing iRules do not have functional tests, so there is no guarantee that a change to an iRule won't break other pre- existing logic 6/19/2015SAN DIEGO DEVOPS MEETUP 21
  • 22. 22 SOLUTION EXAMPLE After searching online and not finding an existing iRule testing tool, I wrote one irule-tester is written in Bash and leverages Curl to make web requests, and then validates that the response matches an expectation github.com/jmauntel/irule-tester 6/19/2015SAN DIEGO DEVOPS MEETUP 22
  • 24. 24 IRULE TESTER: OVERVIEW  Written in Bash and uses Curl for requests  Has simple and extended testing modes  Supports multiple output formats, including TAP  All tests are stored in source control  Changes to any test are validated with Jenkins 6/19/2015SAN DIEGO DEVOPS MEETUP 24
  • 25. 25 IRULE TESTER: JENKINS INTEGRATION  Tests are executed after any change in source, or at least daily  Test failures notify the team via email  Tests are executed before and after iRule changes in all environments 6/19/2015SAN DIEGO DEVOPS MEETUP 25
  • 27. 27 F5 OBJECT CLONER 6/19/2015SAN DIEGO DEVOPS MEETUP 27
  • 28. 28 F5 OBJECT CLONER So if I’m versioning iRules and data groups now, is there an easy way to clone them? Copy/paste is error-prone and lame 6/19/2015SAN DIEGO DEVOPS MEETUP 28
  • 29. 29 F5 OBJECT CLONER I wrote a utility for that Clones iRules and data-groups on a single F5 unit or between two different units github.com/jmauntel/f5-utils 6/19/2015SAN DIEGO DEVOPS MEETUP 29
  • 30. 30 F5 OBJECT CLONER Usage: clone-object.sh -o {data-group,rule} -s <SOURCE_OBJECT> -d <DEST_OBJECT> -S <SOURCE_F5> -D <DEST_F5> -d destination object name -D destination F5 -o object type -s source object name -S source F5 All arguments are REQUIRED Example: # clone-object.sh –o data-group –s UserIPs-1.0.0-class –d UserIPs-1.1.0-class –S 10.0.0.1 –D 10.0.0.1 6/19/2015SAN DIEGO DEVOPS MEETUP 30
  • 31. 31 F5 OBJECT CLONER DEMO 6/19/2015SAN DIEGO DEVOPS MEETUP 31
  • 32. 32 F5 ORPHAN OBJECT AUDIT 6/19/2015SAN DIEGO DEVOPS MEETUP 32
  • 33. 33 F5 ORPHAN OBJECT AUDIT As time passes, a collection of F5 objects can build up, cluttering your F5 config Why not use a tool to audit for unused objects and purge them? 6/19/2015SAN DIEGO DEVOPS MEETUP 33
  • 34. 34 F5 ORPHAN OBJECT AUDIT Locates objects of a given type that only have a single reference in the bigip.conf file Usage: ./f5orphan.pl -f <filename> -i <configuration item> Valid configuration items: rule | data-group | profile | snatpool | pool | node | monitor Example: # f5orphan.pl –f /config/bigip.conf –i rule 6/19/2015SAN DIEGO DEVOPS MEETUP 34
  • 35. 35 F5 ORPHAN OBJECT AUDIT DEMO 6/19/2015SAN DIEGO DEVOPS MEETUP 35
  • 37. 37 WEBSITE REDIRECTS Our WebOps team was constantly asking us to add vanity redirects to the website in support of marketing campaigns… 6/19/2015SAN DIEGO DEVOPS MEETUP 37
  • 38. 38 WEBSITE REDIRECTS …so we made it self-service 6/19/2015SAN DIEGO DEVOPS MEETUP 38
  • 39. 39 REDIRECTS: STEP ONE (MANUAL) Created a git repo that contains redirects.config WebOps team adds redirects to the redirects.config file and pushes changes 6/19/2015SAN DIEGO DEVOPS MEETUP 39
  • 40. 40 REDIRECTS: STEP ONE (MANUAL) Example of redirects.config: # Redirects are defined as Key|Value - The Key is the origin and the Value is the destination # Example: # Somewhere|Somewhere/Else # Result: # 24hourfitness.com/Somewhere would redirect to 24hourfitness.com/Somewhere/Else /blog|/community/blog/ 6/19/2015SAN DIEGO DEVOPS MEETUP 40
  • 41. 41 REDIRECTS: STEP TWO (AUTOMATED) Bamboo build job:  Notices a change to the repo and gets latest updates  Retrieves data-group creation script  Uses data-group creation script to lint redirects.config and create environment-specific LTM config files for later merge  Creates iRule Tester seed file for redirect validations  Stages files for later deployment 6/19/2015SAN DIEGO DEVOPS MEETUP 41
  • 42. 42 REDIRECTS: STEP THREE (AUTOMATED) Bamboo deployment job (DEV):  Automatically triggers based on successful build  Copies LTM config file to target LTM and merges with running configuration  Executes iRule Tester script to verify all redirects work as expected  Notifies WebOps team via email that the deployment to DEV was successful 6/19/2015SAN DIEGO DEVOPS MEETUP 42
  • 43. 43 REDIRECTS: STEP FOUR (MANUAL) Bamboo deployment job (QA):  WebOps pushes button to launch deploy of the DEV release to QA which:  Copies LTM config file to target LTM and merges with running configuration  Executes iRule Tester script to verify all redirects work as expected  Notifies WebOps team via email that the deployment to QA was successful 6/19/2015SAN DIEGO DEVOPS MEETUP 43
  • 44. 44 REDIRECTS: STEP FIVE (MANUAL) Bamboo deployment job (PRD):  WebOps notifies Operations team of the release that needs to be promoted to PRD.  Operations team keys in the required change control documentation  Operations team presses button to launch deploy of the QA release to PRD which:  Copies LTM config file to target LTM and merges with running configuration  Executes iRule Tester script to verify all redirects work as expected  Notifies WebOps team via email that the deployment to PRD was successful 6/19/2015SAN DIEGO DEVOPS MEETUP 44