Lab 3.2 - Deploy and Roll Over New iRule Version

In this lab exercise you will learn about how to deploy and roll over a new iRule version.

3.2.1 - Create iRule v2

First we will create a new version of our iRule

  1. Navigate to Applications

    Navigate to Applications by clicking the workspace switcher next to the F5 icon

    ../../_images/top-left.png

    Then click on Applications

    ../../_images/central-manager-menu.png
  2. Click on iRules followed by insert_xff_iRule

    ../../_images/irules-menu.png
  3. You will need to next click on the v1 at the top of the screen and select Stage from this version

    ../../_images/irules-stage-from-this-version.png
  4. Using the built-in text editor, modify the iRule to add the following lines after the 4th line, and click Commit Changes

    } else {
        HTTP::header insert "X-Forwarded-For" [IP::client_addr]
    
    ../../_images/irules-v2.png
  5. Click on More Commit options

    ../../_images/irules-more-commit-options.png
  6. Click on Commit without any attached applications. then click on Yes, Commit

    ../../_images/irules-commit-with-any-attached-applications.png

Congratulations! You have created a new version of your iRule. Note that this iRule has not been deployed yet. Continue the lab to learn about how to deploy your new version.

3.2.2 - Deploying a New iRule Version from iRules

There are two different ways that you can attach an iRule to an application. In this next exercise we will attach the iRule to the application from the iRule itself.

  1. Start on the Properties page of your iRule. You should already be on this screen from the previous lab exercise. If not, you can re-open the iRule as needed.

    ../../_images/irules-attach-v2-to-application.png

    Please ensure the selected version is v2 and that you can see Attach Applications (you may need to scroll the window to see the button).

    Select Attach Applications

  2. You should only see one available application: “irule_demo_app”. Click on the checkbox next to the name and then select Attach

    ../../_images/irules-attach-v2-to-application-attach.png
  3. On the next screen you should see a warning and a button to Deploy Changes. Click on Deploy Changes.

    ../../_images/irules-v2-deploy-changes.png
  4. You will be asked to confirm the change. Click on Yes, Continue

    ../../_images/irules-v2-attached-applications.png

You will see a list of applications that currently have the v2 iRule attached and also it will display the version that was previouslly attached.

Congratulations! You have deployed version 2 of your iRule. Notice that you had the option to select which application(s) you wanted attached to the iRule.

3.2.3 - Viewing the differences between versions of an iRule

When troubleshooting an iRule, it can be useful to compare it to a previous version. This can also be done prior to deploying as a peer review step.

  1. Select the v2 at the top of the page and change it back to v1 in order to see the first version of this iRule.

    ../../_images/irules-select-v1.png
  2. Select iRule on the left side to open the preview window.

    ../../_images/irules-preview-select.png
  3. Update the Mode dropdown to Compare (Diff).

    ../../_images/irules-compare-diff.png

In this view you are able to identify exact changes within the iRule from v1 and v2.

In the next exercise we will learn how to “roll over” a bad version if there was a change you were not expecting.

3.2.4 - Rolling Over Bad Changes

In this exercise we will “roll over” a bad version. This is not a “roll back”; instead we will update the latest version with the last known “good” version.

  1. From the previous exercise you should still be on the iRule page for version 1 of your iRule. You can re-open the iRule as needed.

  2. Switch the Mode back to Single Edit

    ../../_images/irules-single-edit.png
  3. Click on the v1 at the top and select Stage from this version. This will base the new updates to the iRule on the original v1 version.

    ../../_images/irules-v1-stage-from-version-to-v3.png
  4. Click on Commit Changes

  5. Click on More Commit options

    ../../_images/irules-more-commit-options.png
  6. Click on Commit without any attached applications, then click on Yes, Commit

    ../../_images/irules-commit-with-any-attached-applications.png
  7. You should now see v3 (ignore any warnings about viewing an older version of the iRule)

    ../../_images/irules-v3.png

3.2.5 - Updating Application iRule version

Previously we updated the application from the iRules menu. We will next update the iRule version from the My Apps menu

  1. Click on My Apps under Applications and click on the irule_demo_app application

    ../../_images/irules-demo-app-new.png
  2. Click on edit icon in the top right of the screen to modify the Application Service Properties

    ../../_images/irules_demo_app-edit-application-services-properties.png
  3. Click on the edit icon next to iRules

    ../../_images/irules-application-service-properties-edit-irule.png
  4. Change the version from v2 to v3 and click Save

  5. Click on Review & Deploy

  6. Click on Deploy Changes

  7. You will be prompted to confirm your changes. Click on Yes, Deploy

You have now “rolled over” the bad “v2” version to “v3”. Yes, it’s possible to have selected “v1” again, but by “rolling over” we ensure that the latest version is the correct version.