Skip to content

Commit a23b480

Browse files
authored
Merge pull request #473 from opsani/OPTSERV-298-merge-the-appd-auth-api-changes
Optserv 298 merge the appd auth api changes
2 parents 6662229 + f44af8e commit a23b480

33 files changed

+1089
-801
lines changed

README.md

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ There are a few key components that form the foundation of the architecture:
146146
config files directly from the connectors.
147147
* **Optimizer** - The Optimizer class represents an Opsani optimization engine
148148
that the servo interacts with via an API. The optimizer can be configured via
149-
CLI arguments, from the environment, or via assets such as Kubernetes secrets.
149+
config file or from the environment; both of these support Kubernetes secrets.
150150
* **Events** - The Event subsystem provides the primary interaction point
151151
between the Servo and Connectors in a loosely coupled manner. Events are
152152
simple string values that have connector defined semantics and can optionally
@@ -207,16 +207,16 @@ activity. These commands are dispatched to the connectors via events.
207207
The default events are available on the `servo.servo.Events` enumeration and
208208
include:
209209

210-
| Event | Category | Description |
211-
|-------|----------|-------------|
212-
| startup | Lifecycle | Dispatched when the servo is assembled. |
213-
| shutdown | Lifecycle | Dispatched when the servo is being shutdown. |
214-
| metrics | Informational | Dispatched to gather the metrics being measured. |
215-
| components | Informational | Dispatched to gather the components & settings available for adjustment. |
216-
| check | Operational | Asks connectors to check if they are ready to run by validating settings, etc. |
217-
| describe | Operational | Gathers the current state of the application under optimization. |
218-
| measure | Operational | Takes a measurement of target metrics and reports them to the optimizer. |
219-
| adjust | Operational | Applies a change to the components/settings of the application under optimization and reports status to the optimizer. |
210+
| Event | Category | Description |
211+
| ---------- | ------------- | ---------------------------------------------------------------------------------------------------------------------- |
212+
| startup | Lifecycle | Dispatched when the servo is assembled. |
213+
| shutdown | Lifecycle | Dispatched when the servo is being shutdown. |
214+
| metrics | Informational | Dispatched to gather the metrics being measured. |
215+
| components | Informational | Dispatched to gather the components & settings available for adjustment. |
216+
| check | Operational | Asks connectors to check if they are ready to run by validating settings, etc. |
217+
| describe | Operational | Gathers the current state of the application under optimization. |
218+
| measure | Operational | Takes a measurement of target metrics and reports them to the optimizer. |
219+
| adjust | Operational | Applies a change to the components/settings of the application under optimization and reports status to the optimizer. |
220220

221221
#### Event Handlers & Prepositions
222222

@@ -708,16 +708,45 @@ During local development, you may wish to invoke these tools as follows:
708708
Linting is automatically performed when a new branch is pushed or a PR is opened
709709
and conformance can be remediated during post-implementation code review.
710710

711-
### Connecting to Development APIs
711+
### Connecting to Optimization APIs
712+
713+
Optimizer API and authentication can configured be inline with your config yaml (servo.yaml)
714+
715+
```
716+
optimizer:
717+
base_url: some_url
718+
id: org.domain/app
719+
...
720+
```
721+
722+
These details can also be configured via environment variables as highlighted in the following sections.
723+
Note these sections are mutually exclusive: Opsani API refers to Opsani managed endpoints wheras the Appdynamics
724+
API refers to upcoming FSO Optimization. Which API type is used is dynamically derived during configuration/env var parsing by
725+
the [pydantic configuration model (see BaseServoConfiguration.optimizer)](https://github.com/opsani/servox/blob/main/servo/configuration.py).
726+
727+
#### Opsani API
712728
713729
By default, the servo will connect to the primary Opsani API hosted on
714730
[https://api.opsani.com](https://api.opsani.com). This behavior can be
715731
overridden via CLI options and environment variables:
716732
717-
| Option | Environment Variable | Description | Example |
718-
|--------|----------------------|-------------|---------|
719-
| `--base-url` | `OPSANI_BASE_URL` | Sets an alternate base URL. The path is computed using the optimizer. Useful for staging deployments and integration tests. | `servo --base-url https://staging-api.opsani.com:3456 run` |
720-
| `--url` | `OPSANI_URL` | Sets an explicit URL target. When given, the base URL is ignored and paths are not computed. Useful in unit tests and workstation development with a partial server stack. | `servo --url http://localhost:1234 run` |
733+
| Config Option | Environment Variable | Description | Example |
734+
| -------------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
735+
| `optimizer.base-url` | `OPSANI_BASE_URL` | Sets an alternate base URL. The path is computed using the provided optimizer id. Useful for staging deployments and integration tests. | `OPSANI_BASE_URL=https://staging-api.opsani.com:3456 servo run` |
736+
| `optimizer.url` | `OPSANI_URL` | Sets an explicit URL target. When given, the base URL is ignored and paths are not computed. Useful in unit tests and workstation development with a partial server stack. | `OPSANI_URL=http://localhost:1234 servo run` |
737+
| `optimizer.id` | `OPSANI_ID` | Identifier of the application as provided by the Opsani optimizer provisioned for your application | `OPSANI_ID=newco.com/awesome-app1 servo run` |
738+
| `optimizer.token` | `OPSANI_TOKEN` | Authentication token as provided by the Opsani optimizer provisioned for your application | `OPSANI_TOKEN=00000000-0000-0000-0000-000000000000 servo run` |
739+
740+
#### AppDynamics API
741+
742+
| Config Option | Environment Variable | Description | Example |
743+
| ------------------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
744+
| `optimizer.base-url` | `APPD_BASE_URL` | Sets an alternate base URL. The path is computed using the provided workload and tenant ids. | `APPD_BASE_URL=https://optimize-ignite-test.saas.appd-test.com/ servo run` |
745+
| `optimizer.url` | `APPD_URL` | Sets an explicit URL target. When given, the base URL is ignored and paths are not computed. Useful in unit tests and workstation development with a partial server stack. | `APPD_URL=http://localhost:1234 servo run` |
746+
| `optimizer.tenant_id` | `APPD_TENANT_ID` | Identifier of the application tenant | `APPD_TENANT_ID=00000000-0000-0000-0000-000000000000 servo run` |
747+
| `optimizer.workload_id` | `APPD_WORKLOAD_ID` | Base64 encoded identifier of the workload to be optimized as provided by the provisioned optimizer tenant | `APPD_WORKLOAD_ID=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==== servo run` |
748+
| `optimizer.client_id` | `APPD_CLIENT_ID` | Authentication client ID as provided by the Opsani optimizer provisioned for your application | `APPD_CLIENT_ID=<client id text> servo run` |
749+
| `optimizer.client_secret` | `APPD_CLIENT_SECRET` | Authentication client secret as provided by the Opsani optimizer provisioned for your application | `APPD_CLIENT_SECRET=<client secret text> servo run` |
721750
722751
### Docker & Compose
723752

docs/telemetry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class KubernetesConnector(servo.BaseConnector):
5151
## Metadata Serialization
5252

5353
On HELLO requests to the Opsani OCO API, the telemetry backing dictionary is serialized and sent as json within the
54-
`servo.api._post_event()` method
54+
`servo._api_client.post_event()` method
5555

5656
See the following for an example of the out of the box telemetry as serialized with the HELLO request:
5757

entrypoint.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,5 @@
1515

1616
set -e
1717

18-
# Allow literal or volume mounted tokens based on env
1918
# In multi-servo mode, the config file contains optimizer + token details
20-
OPSANI_TOKEN_FILE=${OPSANI_TOKEN_FILE:-/servo/opsani.token}
21-
exec servo \
22-
--config-file ${SERVO_CONFIG_FILE:-/servo/servo.yaml} \
23-
$(if [ ! -z ${OPSANI_OPTIMIZER} ]; then \
24-
echo "--optimizer ${OPSANI_OPTIMIZER}"; \
25-
fi) \
26-
$(if [ ! -z ${OPSANI_TOKEN} ]; then \
27-
echo "--token ${OPSANI_TOKEN}"; \
28-
elif [ -f ${OPSANI_TOKEN_FILE} ]; then \
29-
echo "--token-file ${OPSANI_TOKEN_FILE}"; \
30-
fi) \
31-
"$@"
19+
exec servo "$@"

0 commit comments

Comments
 (0)