Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Referencing embedded irules in AS3 declarations #227

Open
m-kratochvil opened this issue Jun 2, 2023 · 2 comments
Open

Referencing embedded irules in AS3 declarations #227

m-kratochvil opened this issue Jun 2, 2023 · 2 comments

Comments

@m-kratochvil
Copy link
Contributor

m-kratochvil commented Jun 2, 2023

I'm proposing merely cosmetic change in how we reference irules within AS3 declarations.

How we currently reference irules from under a listener in AS3 declaration:

{
  "net_c3ebca8a_8c12_443c_9a8d_b0098c271c6f": {
    "class": "Tenant",
    "lb_8d8d5869-62c7-47a1-a3f1-9febad079266": {
      "template": "generic",
      "class": "Application",
      "irule_proxy_protocol_initiator": {
        "iRule": "<irule body here>",
        "class": "iRule"
      },
      "listener_ddc041f3-7c03-40c7-bedd-3c10388247ef": {
        "iRules": [
          "irule_proxy_protocol_initiator"
        ],
        <rest omitted>

Better (arguably), more "clear" way to reference irules, recommended by F5:

{
  "net_c3ebca8a_8c12_443c_9a8d_b0098c271c6f": {
    "class": "Tenant",
    "lb_8d8d5869-62c7-47a1-a3f1-9febad079266": {
      "template": "generic",
      "class": "Application",
      "irule_proxy_protocol_initiator": {
        "iRule": "<irule body here>",
        "class": "iRule"
      },
     "listener_ddc041f3-7c03-40c7-bedd-3c10388247ef": {
       "iRules": [
         { "use": "irule_proxy_protocol_initiator" }
       ],

The only difference is the keyword "use:" in the proposed way.

@BenjaminLudwigSAP
Copy link
Collaborator

BenjaminLudwigSAP commented Jun 2, 2023

I don't think it's "clearer" in any way. The first example already reads like "Here is a list of iRules", while the second one reads "Here is a list of iRules, but each element is not an iRule for some reason, but another object that contains a 'use' parameter which points to the iRule". Why does F5 recommend this way? It's just confusing.

Is there any advantage to this besides supposed readability?

@m-kratochvil m-kratochvil changed the title Referencing irules in AS3 declarations Referencing embedded irules in AS3 declarations Jun 23, 2023
@m-kratochvil
Copy link
Contributor Author

Apart from the readability which, I agree, is arguable and subjective, depending on the person who reads the code, there is also a question of consistency in using irules and other objects in declarations. There are basically two ways to refer to irules, depending on the irule location.

iRule embedded in the same declaration as the listener using it:

Current method:
                    "iRules": [
                        "irule_name"
                    ]
Proposed method:
                    "iRules": [
                        { "use": "irule_name" }
                    ]

Shared iRule, installed in the /Common partition on the Big-IP:

                    "iRules": [
                        { "bigip": "/Common/cc_proxy_protocol_V2_e8f6_v1_0" }
                    ]

Since the shared irules are referred to as "bigip": "irule_name", it looks to me more consistent to refer to an irule the same way (keyword: object_name).

Plus, there are also other objects that can be defined in a declaration and then referred to in that same declaration - for example health monitors. For those we already utilize the "use:" keyword and so this would be another point for the consistency reason. Example:

      "pool_72536662-ee13-4705-af87-dba0a02ddca7": {
        "monitors": [
          {
            "use": "hm_c4e9fa25-9463-4045-81a7-fee61a671d32"
          }
        ],
        "class": "Pool"
      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants