| 
 | 1 | +<!--  | 
 | 2 | +SPDX-FileCopyrightText: Copyright 2022-2025 SAP SE or an SAP affiliate company and andromeda contributors  | 
 | 3 | +
  | 
 | 4 | +SPDX-License-Identifier: Apache-2.0  | 
 | 5 | +-->  | 
 | 6 | + | 
 | 7 | +# `andromeda-akamai-agent` app  | 
 | 8 | + | 
 | 9 | +This worker will continuously run an Andromeda / Akamai reconciliation loop.  | 
 | 10 | + | 
 | 11 | +## Manually testing the reconciliation loop  | 
 | 12 | + | 
 | 13 | +Pre-requisites for testing each flow:  | 
 | 14 | +* Ensure the `akamai.yaml` file points to the desired Akamai domain (`akamai.domain` property).  | 
 | 15 | +* Ensure that the local database is in a fresh state: run `andromeda-migrate` on an empty Andromeda database.  | 
 | 16 | + | 
 | 17 | +### Flow: creating a property and server  | 
 | 18 | + | 
 | 19 | +On shell 1, start the Andromeda API Server:  | 
 | 20 | + | 
 | 21 | +```sh  | 
 | 22 | +go run cmd/andromemeda-server/main.go --config-file ./tmp/andromeda.yaml --config-file ./tmp/akamai.yaml  | 
 | 23 | +```  | 
 | 24 | + | 
 | 25 | +On shell 2, ensure the appropriate `OS_` environment variables are in place, then perform the following operations in turn, adjusting values to your actual needs, if needed.  | 
 | 26 | + | 
 | 27 | +```sh  | 
 | 28 | +m31ctl datacenter create --name eu-de-1 --provider akamai  | 
 | 29 | +datacenter_id="$(m31ctl datacenter list -f json | jq -r '.[] | select(.name == "eu-de-1") | .id')"  | 
 | 30 | + | 
 | 31 | +m31ctl domain create --name my-test-domain.de --fqdn my-test-domain.de --provider akamai  | 
 | 32 | +domain_id="$(m31ctl domain list -f json | jq -r '.[] | select(.name == "my-test-domain.de") | .id')"  | 
 | 33 | + | 
 | 34 | +m31ctl pool create --name my-test-domain.de-pool-1 --domain "$domain_id"  | 
 | 35 | +pool_id="$(m31ctl pool list -f json | jq -r '.[] | select(.name == "my-test-domain.de-pool-1") | .id')"  | 
 | 36 | + | 
 | 37 | +m31ctl member create --name member-1 --address '200.100.0.1' --port 8080 --datacenter "$datacenter_id" "$pool_id"  | 
 | 38 | + | 
 | 39 | +# Start the Andromeda / Akamai reconciliation loop  | 
 | 40 | +PROMETHEUS_LISTEN=0.0.0.0:9091 go run cmd/andromemeda-akamai-agent/main.go \  | 
 | 41 | +    --config-file ./tmp/andromeda.yaml \  | 
 | 42 | +    --config-file ./tmp/akamai.yaml  | 
 | 43 | +```  | 
 | 44 | + | 
 | 45 | +If the reconciliation loop succeeds, you should be able to navigate to the domain page and see that `my-test-domain.de` property was added under the domain configured in your local `akamai.yaml` file. The property should have one server with IP `200.100.0.1`.  | 
 | 46 | + | 
 | 47 | +### Flow: deleting a property (by deleting all its servers)  | 
 | 48 | + | 
 | 49 | +When the reconciliation loop detects that a property in the local database has no associated servers, it deletes it from Akamai. For testing this flow, please first follow the instructions for flow [creating a property and server](#creating-a-property-and-server).  | 
 | 50 | + | 
 | 51 | +On shell 1, start the Andromeda API Server:  | 
 | 52 | + | 
 | 53 | +```sh  | 
 | 54 | +go run cmd/andromemeda-server/main.go --config-file ./tmp/andromeda.yaml --config-file ./tmp/akamai.yaml  | 
 | 55 | +```  | 
 | 56 | + | 
 | 57 | +On shell 2, ensure the appropriate `OS_` environment variables are in place, then:  | 
 | 58 | + | 
 | 59 | +```sh  | 
 | 60 | +member_id="$(m31ctl member list -f json | jq -r '.[] | .id')"  | 
 | 61 | +m31ctl member delete "$member_id"  | 
 | 62 | + | 
 | 63 | +# Start the Andromeda / Akamai reconciliation loop  | 
 | 64 | +PROMETHEUS_LISTEN=0.0.0.0:9091 go run cmd/andromemeda-akamai-agent/main.go \  | 
 | 65 | +    --config-file ./tmp/andromeda.yaml \  | 
 | 66 | +    --config-file ./tmp/akamai.yaml  | 
 | 67 | +```  | 
 | 68 | + | 
 | 69 | +If the reconciliation loop succeeds, you should be able to navigate to the domain page and see that `my-test-domain.de` property under the domain configured in your local `akamai.yaml` file is no longer there.  | 
0 commit comments