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

how to properly create a federation in apache traffic contorl ? #8095

Open
7ff5fC1E397d opened this issue Oct 27, 2024 · 3 comments
Open

how to properly create a federation in apache traffic contorl ? #8095

7ff5fC1E397d opened this issue Oct 27, 2024 · 3 comments
Labels
bug something isn't working as intended

Comments

@7ff5fC1E397d
Copy link

This Bug Report affects these Traffic Control components:

  • Traffic Ops
  • Documentation
  • CDN in a Box

What did you do?

I have setup CDN-in-a-Box to explore its features , using Portal I was not able to configure federation
Next I tried API

and

Confusingly, this method of this endpoint does not create a new Federation; to do that, the cdns/{{name}}/federations endpoint must be used. Furthermore, the Federation must properly be assigned to a Delivery Service using the federations/{{ID}}/deliveryservices and assigned to the user creating Resolvers using federations/{{ID}}/users.

I understood it that I should do

  1. cdns/{{name}}/federations to create
  2. federations/{{ID}}/deliveryservices to assign to a DS
  3. federations/{{ID}}/users. to assign to a USER

Continuing with 1. cdns/{{name}}/federations I did

curl -X POST ... api/5.0/cdns/CDN-in-a-Box/federations"  -H "Content-Type: application/json" --data @create.json

where create.json is

{
  "ttl": 300,
  "cname": "demo1.example.net.",
  "description": "Demo1 Your Federation Description",
}

and response was (sample, because I tired several times)

{
  "alerts": [
    {
      "text": "Federation was created",
      "level": "success"
    }
  ],
  "response": {
    "id": 12,
    "cname": "demo1.example.net.",
    "ttl": 300,
    "description": "Demo1 Your Federation Description",
    "lastUpdated": "2024-10-27T09:21:56.967206Z"
  }
}

Next I tried to GET the added ones , but it lists just the default one:

curl -X GET ... api/5.0/cdns/CDN-in-a-Box/federations"  -H "Content-Type: application/json"

or

curl -X GET api/5.0/federations/all"  -H "Content-Type: application/json"

and its response

{
  "response": [
    {
      "id": 1,
      "cname": "foo.kabletown.net.",
      "ttl": 60,
      "description": null,
      "lastUpdated": "2024-10-26T07:22:08.45335Z",
      "deliveryService": {
        "id": 2,
        "xmlID": "demo2"
      }
    }
  ]
}

Then I noticed another caution

Despite the URL of this endpoint, this does not create a Federation within any particular CDN. A Federation is associated with a CDN purely because any Delivery Service to which it is assigned is scoped to a CDN. Therefore, upon creation a Federation is not associated with any CDN in particular.

So if "this does not create a Federation within any particular CDN" why the URI address (API) includes a CDN name ?

What did you expect to happen?

  • if we create a federation , be able to get / list it/them
  • if a federation should be assigned to a CDN, we could set it using JSON data (?)

What actually happened?

List of federations only shows the fist (default) one added by CDN-in-a-Box demo . Mine are not listed

more info

I created a federation user . Also tired Admin , results are the same
It is about a week I am exploring ATC/ATS so see me as a newbie

Traffic Portal Info
Version: 8.1.0-12478.c27d3d99.el8
Build Date: 2024-10-21 08:23
API URL: https://trafficops.infra.ciab.test:443

Please guide me on how to properly create a federation , my final goal is to create a CNAME for a DS

Regards

@7ff5fC1E397d 7ff5fC1E397d added the bug something isn't working as intended label Oct 27, 2024
@7ff5fC1E397d
Copy link
Author

7ff5fC1E397d commented Oct 27, 2024

Testing 2 seems to be the part I missed

curl -X POST ... api/5.0/federations/2/deliveryservices"  -H "Content-Type: application/json"  --data '{"dsIds":[1,2,3,4],"replace":true}'

now I can get a list

{
  "response": [
    {
      "id": 1,
      "cname": "foo.kabletown.net.",
      "ttl": 60,
      "description": null,
      "lastUpdated": "2024-10-26T07:22:08.45335Z",
      "deliveryService": {
        "id": 2,
        "xmlID": "demo2"
      }
    },
    {
      "id": 2,
      "cname": "test.quest.",
      "ttl": 68,
      "description": "A test federation",
      "lastUpdated": "2024-10-27T08:27:23.48475Z",
      "deliveryService": {
        "id": 1,
        "xmlID": "demo1"
      }
    },
    {
      "id": 2,
      "cname": "test.quest.",
      "ttl": 68,
      "description": "A test federation",
      "lastUpdated": "2024-10-27T08:27:23.48475Z",
      "deliveryService": {
        "id": 2,
        "xmlID": "demo2"
      }
    },
    {
      "id": 2,
      "cname": "test.quest.",
      "ttl": 68,
      "description": "A test federation",
      "lastUpdated": "2024-10-27T08:27:23.48475Z",
      "deliveryService": {
        "id": 3,
        "xmlID": "site1"
      }
    },
    {
      "id": 2,
      "cname": "test.quest.",
      "ttl": 68,
      "description": "A test federation",
      "lastUpdated": "2024-10-27T08:27:23.48475Z",
      "deliveryService": {
        "id": 4,
        "xmlID": "site2"
      }
    }
  ]
}

I this correct ?

@7ff5fC1E397d
Copy link
Author

after 14 tries , could make it work

    {
      "id": 14,
      "cname": "site2.example.net.",
      "ttl": 300,
      "description": "Site2 My Federation Description",
      "lastUpdated": "2024-10-27T11:00:11.055082Z",
      "deliveryService": {
        "id": 4,
        "xmlID": "site2"
      }
    }

it feels to me that documents should be updated and at least gives a sample to get started with

@7ff5fC1E397d
Copy link
Author

7ff5fC1E397d commented Oct 27, 2024

I admit it is a bit confusing but finally worked

    {
      "mappings": [
        {
          "ttl": 300,
          "cname": "site2.example.net.",
          "resolve4": [
            "8.8.8.8/32",
            "8.8.4.4/32"
          ],
          "resolve6": [
            "2001:4860:4860::8888/128",
            "2001:4860:4860::8844"
          ]
        }
      ],
      "deliveryService": "site2"
    }

Now the issue is not being able to see the CNAME :| it seems I have overwritten something

### default 

dig +short @trafficrouter.infra.ciab.test -t CNAME video.demo2.mycdn.ciab.test

no output

;; QUESTION SECTION:
;video.demo2.mycdn.ciab.test.	IN	CNAME

;; AUTHORITY SECTION:
demo2.mycdn.ciab.test.	900	IN	SOA
### mine

dig cdn.site2.mycdn.ciab.test

;; ANSWER SECTION:
cdn.site2.mycdn.ciab.test. 30	IN	A	172.18.0.16

;; AUTHORITY SECTION:
site2.mycdn.ciab.test.	1268	IN	NS	trafficrouter.mycdn.ciab.test.

;; ADDITIONAL SECTION:
trafficrouter.mycdn.ciab.test. 1272 IN	A	172.18.0.12

trafficops infra ciab test_

Any idea ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working as intended
Projects
None yet
Development

No branches or pull requests

1 participant