Skip to content

Commit e26f7af

Browse files
authored
AAP-43385: On-prem: Automate provision and related configuration changes (#575)
1 parent f671838 commit e26f7af

18 files changed

+612
-223
lines changed

config/crd/bases/aiconnect.ansible.com_ansibleaiconnects.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,30 @@ spec:
6161
chatbot_image_version:
6262
description: Chatbot API container image tag or version to use
6363
type: string
64+
chatbot_rag_db_image:
65+
description: Registry path to Chatbot RAG database container image to use
66+
type: string
67+
chatbot_rag_db_image_version:
68+
description: Chatbot RAG database container image tag or version to use
69+
type: string
70+
chatbot_mcp_gateway_image:
71+
description: Registry path to AAP Gateway MCP server container image to use
72+
type: string
73+
chatbot_mcp_gateway_image_version:
74+
description: AAP Gateway MCP server container image tag or version to use
75+
type: string
76+
chatbot_mcp_controller_image:
77+
description: Registry path to AAP Controller MCP server container image to use
78+
type: string
79+
chatbot_mcp_controller_image_version:
80+
description: AAP Controller MCP server container image tag or version to use
81+
type: string
82+
chatbot_mcp_lightspeed_image:
83+
description: Registry path to AAP Lightspeed MCP server container image to use
84+
type: string
85+
chatbot_mcp_lightspeed_image_version:
86+
description: AAP Lightspeed MCP server container image tag or version to use
87+
type: string
6488
additional_labels:
6589
description: Additional labels defined on the resource, which should be propagated to child resources
6690
type: array

config/manifests/bases/ansible-ai-connect-operator.clusterserviceversion.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,38 @@ spec:
5353
path: chatbot_image_version
5454
x-descriptors:
5555
- urn:alm:descriptor:com.tectonic.ui:advanced
56+
- displayName: Chatbot RAG database container image
57+
path: chatbot_rag_db_image
58+
x-descriptors:
59+
- urn:alm:descriptor:com.tectonic.ui:advanced
60+
- displayName: Chatbot RAG database container image Version
61+
path: chatbot_rag_db_image_version
62+
x-descriptors:
63+
- urn:alm:descriptor:com.tectonic.ui:advanced
64+
- displayName: AAP Gateway MCP server container image
65+
path: chatbot_mcp_gateway_image
66+
x-descriptors:
67+
- urn:alm:descriptor:com.tectonic.ui:advanced
68+
- displayName: AAP Gateway MCP server container image Version
69+
path: chatbot_mcp_gateway_image_version
70+
x-descriptors:
71+
- urn:alm:descriptor:com.tectonic.ui:advanced
72+
- displayName: AAP Controller MCP server container image
73+
path: chatbot_mcp_controller_image
74+
x-descriptors:
75+
- urn:alm:descriptor:com.tectonic.ui:advanced
76+
- displayName: AAP Controller MCP server container image Version
77+
path: chatbot_mcp_controller_image_version
78+
x-descriptors:
79+
- urn:alm:descriptor:com.tectonic.ui:advanced
80+
- displayName: AAP Lightspeed MCP server container image
81+
path: chatbot_mcp_lightspeed_image
82+
x-descriptors:
83+
- urn:alm:descriptor:com.tectonic.ui:advanced
84+
- displayName: AAP Lightspeed MCP server container image Version
85+
path: chatbot_mcp_lightspeed_image_version
86+
x-descriptors:
87+
- urn:alm:descriptor:com.tectonic.ui:advanced
5688
- displayName: Additional labels defined on the resource, which should be propagated
5789
to child resources
5890
path: additional_labels

docs/using-external-configuration-secrets.md

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,8 @@ stringData:
8888
chatbot_url: <Chatbot LLM URL>
8989
chatbot_model: <Chatbot model name>
9090
chatbot_token: <Chatbot LLM access token>
91-
chatbot_llm_provider_type: <Chatbot LLM provider type>
92-
chatbot_llm_provider_project_id: <Chatbot LLM provider project id>
93-
chatbot_context_window_size: <Chatbot LLM context window size>
94-
chatbot_temperature_override: <Chatbot LLM temperature parameter>
91+
aap_gateway_url: <AAP Gateway URL>
92+
aap_controller_url: <AAP Controller URL>
9593
type: Opaque
9694
```
9795
**Required Parameters**
@@ -100,38 +98,21 @@ type: Opaque
10098
* `chatbot_model`
10199
* `chatbot_token`
102100

103-
**Optional Parameters**
101+
**Parameter combinations**
104102

105-
Both `chatbot_llm_provider_type` and `chatbot_context_window_size` are optional. If either is omitted, the
106-
following default values will be used:
103+
Providing `aap_gateway_url` and/or `aap_controller_url` affect how the Chatbot is provisioned.
107104

108-
* `chatbot_llm_provider_type`: `rhoai_vllm`
109-
* `chatbot_context_window_size`: `128000`
105+
If none of these parameters are provided no MCP servers will be provisioned or registered with the underlying LLM's tool runtime.
110106

111-
When `chatbot_llm_provider_type` is set to `watsonx`,
112-
`chatbot_llm_provider_project_id` is required to set to your watsonx.ai project ID.
107+
If only `aap_gateway_url` is set the following MCP server will be provisioned:
108+
- Ansible Lightspeed Service MCP server.
109+
- Authentication will attempt to use the JWT token associated with the User's authenticated context.
113110

114-
`chatbot_temperature_override` is also optional. It is provided for
115-
following Open AI models that do not support the default temperature setting used for
116-
other Open AI models:
117-
118-
* `o1`
119-
* `o3-mini`
120-
* `o4-mini`
121-
122-
When one of these models is used, set `chatbot_temperature_override` to `null`,
123-
which disables the default temperature setting.
124-
125-
126-
**_Azure AI_ Parameters**
127-
128-
In case of using the _Azure AI_ model provider, please also ensure the following required parameters are properly set:
129-
* `chatbot_llm_provider_type`: `azure_openai`
130-
* `chatbot_url`: `<<Azure AI project serving URL>>`
131-
* `chatbot_model`: `<<Azure AI model name>>`
132-
* `chatbot_token`: `<<Azure AI access token>>`
133-
* `chatbot_azure_deployment_name`: `<<Azure AI [deployment name](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal#deploy-a-model)>>`
134-
* `chatbot_azure_api_version`: `<<Optional - Azure AI API version>>`
111+
If `aap_gateway_url` and `aap_controller_url` are set the following MCP servers will be provisioned:
112+
- AAP Controller Service MCP server
113+
- Authentication will attempt to use either the JWT token associated with the User's authenticated context.
114+
- Ansible Lightspeed Service MCP server
115+
- Authentication will attempt to use either the JWT token associated with the User's authenticated context.
135116

136117
## Troubleshooting
137118

roles/chatbot/defaults/main.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,21 @@
77
api_version: 'aiconnect.ansible.com/v1alpha1'
88
deployment_type: 'ansible-ai-connect'
99

10-
_chatbot_image: quay.io/ansible/ansible-chatbot-service
10+
# Chatbot container image
11+
_chatbot_image: quay.io/ansible/ansible-chatbot-stack
1112
_chatbot_image_version: "{{ lookup('env', 'DEFAULT_CHATBOT_AI_CONNECT_VERSION') or 'latest' }}"
1213

14+
# Chatbot RAG database container images
15+
_chatbot_rag_db_image: quay.io/ansible/aap-rag-content
16+
_chatbot_rag_db_image_version: "{{ lookup('env', 'DEFAULT_CHATBOT_RAG_DB_VERSION') or 'latest' }}"
17+
18+
# Chatbot MCP Server container images
19+
_chatbot_mcp_gateway_image: quay.io/ansible/ansible-mcp-gateway
20+
_chatbot_mcp_gateway_image_version: "{{ lookup('env', 'DEFAULT_CHATBOT_MCP_GATEWAY_VERSION') or 'latest' }}"
21+
_chatbot_mcp_controller_image: quay.io/ansible/ansible-mcp-controller
22+
_chatbot_mcp_controller_image_version: "{{ lookup('env', 'DEFAULT_CHATBOT_MCP_CONTROLLER_VERSION') or 'latest' }}"
23+
_chatbot_mcp_lightspeed_image: quay.io/ansible/ansible-mcp-lightspeed
24+
_chatbot_mcp_lightspeed_image_version: "{{ lookup('env', 'DEFAULT_CHATBOT_MCP_LIGHTSPEED_VERSION') or 'latest' }}"
1325
# ========================================
1426

1527

roles/chatbot/tasks/deploy_chatbot_api.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
---
2-
- name: Apply Chatbot ConfigMap resources
3-
kubernetes.core.k8s:
4-
apply: yes
5-
definition: "{{ lookup('template', 'chatbot.configmap.yaml.j2') }}"
6-
wait: yes
7-
82
- name: Apply Chatbot deployment resources
93
kubernetes.core.k8s:
104
apply: yes
115
definition: "{{ lookup('template', item + '.yaml.j2') }}"
126
wait: no
137
loop:
8+
- 'chatbot.pvc'
149
- 'chatbot.service'
10+
- 'chatbot.configmap_lightspeed_stack_config'
11+
- 'chatbot.configmap_llama_stack_config'
12+
- 'chatbot.configmap_system_prompt'
1513
- 'chatbot.deployment'
1614

1715
- name: Check for Chatbot Pod
@@ -30,7 +28,7 @@
3028
- "chatbot_api_pod['resources'] | length"
3129
- "chatbot_api_pod['resources'][0]['status']['phase'] == 'Running'"
3230
- "chatbot_api_pod['resources'][0]['status']['containerStatuses'][0]['ready'] == true"
33-
retries: 60
31+
retries: 30
3432
delay: 5
3533

3634
- name: Set the Chatbot API Pod name as a variable.

roles/chatbot/tasks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
- name: Set AnsibleAIConnect's Chatbot service images
99
ansible.builtin.include_tasks: set_images.yml
1010

11+
- name: Set AnsibleAIConnect and AnsibleAIConnect's Chatbot service URLs
12+
ansible.builtin.include_tasks: set_service_urls.yml
13+
1114
- name: Read AnsibleAIConnect's Chatbot secret
1215
ansible.builtin.include_tasks: read_chatbot_configuration_secret.yml
1316

roles/chatbot/tasks/read_chatbot_configuration_secret.yml

Lines changed: 12 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -43,82 +43,28 @@
4343
You must specify a 'chatbot_token' in your Secret.
4444
when: not _chatbot_config_resource["resources"][0]["data"].chatbot_token
4545

46-
- name: Set Chatbot Configuration
46+
- name: Set Chatbot Token
4747
ansible.builtin.set_fact:
48-
chatbot_config: '{{ _chatbot_config_resource }}'
48+
chatbot_token: '{{ _chatbot_config_resource["resources"][0]["data"].chatbot_token | b64decode }}'
4949
no_log: "{{ no_log }}"
5050

51-
- name: Set LLM provider type if it is defined in the config
51+
- name: Set AAP Gateway URL
5252
ansible.builtin.set_fact:
53-
chatbot_llm_provider_type: '{{ _chatbot_config_resource["resources"][0]["data"].chatbot_llm_provider_type | b64decode }}'
53+
_aap_gateway_url: '{{ _chatbot_config_resource["resources"][0]["data"].aap_gateway_url | b64decode }}'
5454
no_log: "{{ no_log }}"
55-
when: _chatbot_config_resource["resources"][0]["data"].chatbot_llm_provider_type is defined
56-
57-
- name: Validate watsonx.ai project ID if LLM provider type is set to "watsonx"
58-
ansible.builtin.fail:
59-
msg: |
60-
You must specify a 'chatbot_llm_provider_project_id' in your Secret when 'chatbot_llm_provider_type' is set to 'watsonx'
6155
when:
62-
- chatbot_llm_provider_type is defined
63-
- chatbot_llm_provider_type == "watsonx"
64-
- not _chatbot_config_resource["resources"][0]["data"].chatbot_llm_provider_project_id is defined
65-
66-
- name: Set watsonx.ai project ID if it is defined in the config
67-
ansible.builtin.set_fact:
68-
chatbot_llm_provider_project_id: '{{ _chatbot_config_resource["resources"][0]["data"].chatbot_llm_provider_project_id | b64decode }}'
69-
no_log: "{{ no_log }}"
70-
when: _chatbot_config_resource["resources"][0]["data"].chatbot_llm_provider_project_id is defined
56+
- _chatbot_config_resource["resources"][0]["data"].aap_gateway_url is defined
57+
- _chatbot_config_resource["resources"][0]["data"].aap_gateway_url | length
7158

72-
- name: Set context window size if it is defined in the config
59+
- name: Set AAP Controller URL
7360
ansible.builtin.set_fact:
74-
chatbot_context_window_size: '{{ _chatbot_config_resource["resources"][0]["data"].chatbot_context_window_size | b64decode | int }}'
75-
no_log: "{{ no_log }}"
76-
when: _chatbot_config_resource["resources"][0]["data"].chatbot_context_window_size is defined
77-
78-
- name: Set LLM temperature parameter override if it is defined in the config
79-
ansible.builtin.set_fact:
80-
chatbot_temperature_override: '{{ _chatbot_config_resource["resources"][0]["data"].chatbot_temperature_override | b64decode }}'
81-
no_log: "{{ no_log }}"
82-
when: _chatbot_config_resource["resources"][0]["data"].chatbot_temperature_override is defined
83-
84-
- name: Set Azure AI deployment name if it is defined in the config
85-
ansible.builtin.set_fact:
86-
chatbot_azure_deployment_name: '{{ _chatbot_config_resource["resources"][0]["data"].chatbot_azure_deployment_name | b64decode }}'
61+
_aap_controller_url: '{{ _chatbot_config_resource["resources"][0]["data"].aap_controller_url | b64decode }}'
8762
no_log: "{{ no_log }}"
8863
when:
89-
- chatbot_llm_provider_type is defined
90-
- chatbot_llm_provider_type is search("azure_openai")
91-
- _chatbot_config_resource["resources"][0]["data"].chatbot_azure_deployment_name is defined
64+
- _chatbot_config_resource["resources"][0]["data"].aap_controller_url is defined
65+
- _chatbot_config_resource["resources"][0]["data"].aap_controller_url | length
9266

93-
- name: Set Azure AI API version if it is defined in the config
94-
ansible.builtin.set_fact:
95-
chatbot_azure_api_version: '{{ _chatbot_config_resource["resources"][0]["data"].chatbot_azure_api_version | b64decode }}'
96-
no_log: "{{ no_log }}"
97-
when:
98-
- chatbot_llm_provider_type is defined
99-
- chatbot_llm_provider_type is search("azure_openai")
100-
- _chatbot_config_resource["resources"][0]["data"].chatbot_azure_api_version is defined
101-
102-
- name: Set Chatbot Include Fake LLMs to false if it is not defined in the config
103-
ansible.builtin.set_fact:
104-
chatbot_include_fake_llms: false
105-
no_log: "{{ no_log }}"
106-
when: not _chatbot_config_resource["resources"][0]["data"].chatbot_include_fake_llms is defined
107-
108-
- name: Set Chatbot Include Fake LLMs if it is defined in the config
109-
ansible.builtin.set_fact:
110-
chatbot_include_fake_llms: '{{ _chatbot_config_resource["resources"][0]["data"].chatbot_include_fake_llms | default(false) | b64decode }}'
111-
no_log: "{{ no_log }}"
112-
when: _chatbot_config_resource["resources"][0]["data"].chatbot_include_fake_llms is defined
113-
114-
- name: Set Chatbot Fake Streaming Chunks
115-
ansible.builtin.set_fact:
116-
chatbot_fake_streaming_chunks: '{{ _chatbot_config_resource["resources"][0]["data"].chatbot_fake_streaming_chunks | b64decode }}'
117-
no_log: "{{ no_log }}"
118-
when: _chatbot_config_resource["resources"][0]["data"].chatbot_fake_streaming_chunks is defined
119-
120-
- name: Set Chatbot Fake Streaming Sleep
67+
- name: Set Chatbot Configuration
12168
ansible.builtin.set_fact:
122-
chatbot_fake_streaming_sleep: '{{ _chatbot_config_resource["resources"][0]["data"].chatbot_fake_streaming_sleep | b64decode }}'
69+
chatbot_config: '{{ _chatbot_config_resource }}'
12370
no_log: "{{ no_log }}"
124-
when: _chatbot_config_resource["resources"][0]["data"].chatbot_fake_streaming_sleep is defined

roles/chatbot/tasks/remove_chatbot_api.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
---
2-
- name: Remove Chatbot ConfigMap resources
2+
- name: Remove Chatbot Lightspeed Stack ConfigMap resources
33
kubernetes.core.k8s:
44
state: absent
55
kind: ConfigMap
6-
name: '{{ ansible_operator_meta.name }}-{{ deployment_type }}-chatbot-env-properties'
6+
name: '{{ ansible_operator_meta.name }}-{{ deployment_type }}-lightspeed-stack-config'
7+
namespace: '{{ ansible_operator_meta.namespace }}'
8+
wait: yes
9+
10+
- name: Remove Chatbot Llama Stack ConfigMap resources
11+
kubernetes.core.k8s:
12+
state: absent
13+
kind: ConfigMap
14+
name: '{{ ansible_operator_meta.name }}-{{ deployment_type }}-llama-stack-config'
15+
namespace: '{{ ansible_operator_meta.namespace }}'
16+
wait: yes
17+
18+
- name: Remove Chatbot System Prompt ConfigMap resources
19+
kubernetes.core.k8s:
20+
state: absent
21+
kind: ConfigMap
22+
name: '{{ ansible_operator_meta.name }}-{{ deployment_type }}-system-prompt'
723
namespace: '{{ ansible_operator_meta.namespace }}'
824
wait: yes
925

@@ -22,3 +38,10 @@
2238
name: '{{ ansible_operator_meta.name }}-chatbot-api'
2339
namespace: '{{ ansible_operator_meta.namespace }}'
2440
wait: yes
41+
42+
- name: Remove Chatbot PVC
43+
kubernetes.core.k8s:
44+
state: absent
45+
kind: PersistentVolumeClaim
46+
name: "{{ ansible_operator_meta.name }}-chatbot-pvc"
47+
namespace: "{{ ansible_operator_meta.namespace }}"

0 commit comments

Comments
 (0)