Forum Discussion

Patrik_Jonsson's avatar
Nov 15, 2013

Have a member dedicated for softlaunch/test

Hi there!

We have a situation where the developers wants to have a pool member that's used only for testing purposes and only:

  1. From our external office IP.
  2. When it's up.

Here's a simplified version of the irule right now:

set [HTTP::host] host

switch $host {
    "subomain1.domain.com"          { pool subomain1.domain.com-5601_pool }
    "subomain2.domain.com"          { pool subomain2.domain.com-5602_pool }
    "subomain3.domain.com"          { pool subomain3.domain.com-5603_pool }
    default             { pool www.domain.com-5600_pool }
}

Suggestion 1:

A thought would be to add priority groups and set ie. 100 for the production servers and 0 for the test server. This would make me have to expand the pool selection irule:

if { [LB::status node 10.0.0.1] eq "up" && [IP::remote_addr] eq $office } {
    set testnode 1
} else {
    set testnode 0
}

set [HTTP::host] host

switch $host {
    "subomain1.domain.com"          { if{ $testnode } { pool subomain1.domain.com-5601_pool member 10.0.0.1 } else { pool subomain1.domain.com-5601_pool } }
    "subomain2.domain.com"          { if{ $testnode } { pool subomain2.domain.com-5601_pool member 10.0.0.1 } else { pool subomain2.domain.com-5601_pool } }
    "subomain3.domain.com"          { if{ $testnode } { pool subomain3.domain.com-5601_pool member 10.0.0.1 } else { pool subomain3.domain.com-5601_pool } }
    default             { if{ $testnode } { pool subomain1.domain.com-5601_pool member 10.0.0.1 } else { pool subomain1.domain.com-5601_pool } }
}

Suggestion 2:

Add http bindings on the sites for port 80 and the host header of domain.

set [HTTP::host] host   
if { [LB::status node 10.0.0.1] eq "up" && [IP::remote_addr] eq $office } {
    pool testpool.domain.com
} else {
    switch $host {
        "subomain1.domain.com"          { pool subomain1.domain.com-5601_pool }
        "subomain2.domain.com"          { pool subomain2.domain.com-5602_pool }
        "subomain3.domain.com"          { pool subomain3.domain.com-5603_pool }
    default             { pool www.domain.com-5600_pool }
}

This is still in the design phase and I already feel nausea when looking at option 1 and option 2 seems like a viable alternative but I can't get it out of my head that there has to be a better way. I'm a big fan of standardization and clean rules and try to avoid quick and dirty fixes in general.

Surely this must not be the first time someone got a request like this? Grateful for any suggestions or input!

Kind regards,

Patrik

3 Replies

  • Can you not just build a new Virtual Server with the server as the single member in the Pool assigned to it?

     

  • Just for clarification, do you mean a pool or a pool member? A separate pool, or separate VIP as Steve says, would be easier.

    when CLIENT_ACCEPTED {
         collect the default configured pool for the VIP
        set default_pool [LB::server pool]
    }
    when HTTP_REQUEST {
        switch [string tolower [HTTP::host]] {
            "localtest.domain.com" {
                 if request to test server, and is local IP, and test  pool is up
                if { ( [IP::addr [IP::client_addr] equals "x.x.x.x/x"] ) and ( [active_members localtest_pool] > 1 ) } {
                    pool localtest_pool
                } else {
                     otherwise send to regular pool
                    pool $default_pool
                }
            }    
            default {
                 send all regular traffic to assigned pool
                pool $default_pool
            }
        }
    }
    

    The above would trigger the IP and active_members evaluation if the request was for the "localtest.domain.com" host, assuming multiple host names resolved to the same VIP address. All other traffic would be routed to the VIP-assigned pool.

  • We went with suggestion 2 as it would mean the least change to our environment and iRules.