Skip to content

Commit 6f007b1

Browse files
committed
Changes to support use of lightspeed-stack
1 parent 87feb12 commit 6f007b1

File tree

8 files changed

+127
-59
lines changed

8 files changed

+127
-59
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,11 +1055,23 @@ spec:
10551055
description: The version of the image used for the deployed instance
10561056
type: string
10571057
chatbotImage:
1058-
description: URL of the chatbot image used for the deployed instance
1058+
description: URL of the Chatbot image used for the deployed instance
10591059
type: string
10601060
chatbotVersion:
10611061
description: The version of the Chatbot image used for the deployed instance
10621062
type: string
1063+
chatbotRAGDatabaseImage:
1064+
description: URL of the Chatbot RAG database image used for the deployed instance
1065+
type: string
1066+
chatbotMCPGatewayImage:
1067+
description: URL of the Chatbot MCP Gateway Server image used for the deployed instance
1068+
type: string
1069+
chatbotMCPControllerImage:
1070+
description: URL of the Chatbot MCP Controller Server image used for the deployed instance
1071+
type: string
1072+
chatbotMCPLightspeedImage:
1073+
description: URL of the Chatbot MCP Lightspeed Server image used for the deployed instance
1074+
type: string
10631075
URL:
10641076
description: URL to access the deployed instance
10651077
type: string

config/manager/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
44
kind: Kustomization
55
images:
66
- name: controller
7-
newName: quay.io/ansible/ansible-ai-connect-operator
8-
newTag: 0.1.0
7+
newName: quay.io/manstis/ansible-ai-connect-operator
8+
newTag: 0.0.1

roles/chatbot/tasks/deploy_chatbot_api.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
loop:
88
- 'chatbot.pvc'
99
- 'chatbot.service'
10+
- 'chatbot.configmap'
1011
- 'chatbot.deployment'
1112

1213
- name: Check for Chatbot Pod

roles/chatbot/tasks/main.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
- name: Deploy AnsibleAIConnect's Chatbot service
1818
ansible.builtin.include_tasks: deploy_chatbot_api.yml
1919

20-
- name: Register MCP servers
21-
ansible.builtin.include_tasks: register_mcp_servers.yml
22-
2320
when:
2421
- chatbot_config_secret_name is defined
2522
- chatbot_config_secret_name | length

roles/chatbot/tasks/register_mcp_servers.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: '{{ ansible_operator_meta.name }}-{{ deployment_type }}-lightspeed-stack-config'
6+
namespace: '{{ ansible_operator_meta.namespace }}'
7+
labels:
8+
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }}
9+
annotations:
10+
checksum-secret-chatbot_config: "{{ lookup('ansible.builtin.vars', 'chatbot_config', default='')["resources"][0]["data"] | default('') | sha1 }}"
11+
data:
12+
lightspeed-stack.yaml: |
13+
name: Ansible Lightspeed Intelligent Assistant
14+
service:
15+
host: 0.0.0.0
16+
port: 8080
17+
auth_enabled: false
18+
workers: 1
19+
color_log: true
20+
access_log: true
21+
llama_stack:
22+
use_as_library_client: true
23+
library_client_config_path: /.llama/distributions/ansible-chatbot/ansible-chatbot-run.yaml
24+
user_data_collection:
25+
feedback_disabled: true
26+
transcripts_disabled: true
27+
{% if _aap_gateway_url is defined or _aap_controller_url is defined %}
28+
mcp_servers:
29+
{% if _aap_gateway_url is defined and _aap_gateway_token is defined %}
30+
- name: mcp::aap-gateway
31+
provider_id: lightspeed
32+
url: http://127.0.0.1:8003/sse
33+
{% endif %}
34+
{% if _aap_gateway_url is defined and _aap_controller_url is defined %}
35+
- name: mcp::aap-controller
36+
provider_id: lightspeed
37+
url: http://127.0.0.1:8004/sse
38+
{% endif %}
39+
{% if _aap_gateway_url is defined %}
40+
- name: mcp::aap-lightspeed
41+
provider_id: lightspeed
42+
url: http://127.0.0.1:8005/sse
43+
{% endif %}
44+
{% endif %}

roles/chatbot/templates/chatbot.deployment.yaml.j2

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ spec:
3434
app.kubernetes.io/component: '{{ deployment_type }}-chatbot-api'
3535
annotations:
3636
kubectl.kubernetes.io/default-container: 'ansible-chatbot'
37+
checksum-chatbot.configmap: "{{ lookup('template', 'chatbot.configmap.yaml.j2') | sha1 }}"
3738
checksum-secret-chatbot_config: "{{ lookup('ansible.builtin.vars', 'chatbot_config', default='')["resources"][0]["data"] | default('') | sha1 }}"
3839
spec:
3940
serviceAccountName: '{{ ansible_operator_meta.name }}'
@@ -105,6 +106,9 @@ spec:
105106
ports:
106107
- containerPort: 8321
107108
volumeMounts:
109+
- name: lightspeed-stack-config
110+
mountPath: /.llama/data/lightspeed-stack.yaml
111+
subPath: lightspeed-stack.yaml
108112
- name: ansible-chatbot-storage
109113
mountPath: /.llama/data
110114
{% if is_openshift %}
@@ -268,6 +272,9 @@ spec:
268272
- name: ansible-chatbot-storage
269273
persistentVolumeClaim:
270274
claimName: "{{ ansible_operator_meta.name }}-chatbot-pvc"
275+
- name: lightspeed-stack-config
276+
configMap:
277+
name: '{{ ansible_operator_meta.name }}-{{ deployment_type }}-lightspeed-stack-config'
271278
{% if is_openshift %}
272279
- name: server-tls-certs
273280
configMap:

roles/model/tasks/update_status.yml

Lines changed: 60 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
dbFieldsEncryptionSecret: "{{ __db_fields_encryption_secret_name }}"
1616
image: "{{ _image }}"
1717
version: ""
18-
chatbotImage: ""
19-
chatbotVersion: ""
20-
chatbotConfigurationSecret: ""
2118

2219
# ============================================
2320
# Retrieve and update AnsibleAIConnect status
@@ -80,14 +77,17 @@
8077

8178
# ============================================
8279
# Retrieve and update Chatbot status
83-
# --------------------------------------------
84-
# There is no mechanism to handle the chatbot version
85-
# See https://issues.redhat.com/browse/AAP-48026
8680
# ============================================
8781
- block:
88-
- name: Set Chatbot instance version
89-
ansible.builtin.set_fact:
90-
chatbot_instance_version: '0.0.1'
82+
- name: Retrieve Chatbot instance version
83+
kubernetes.core.k8s_exec:
84+
namespace: "{{ ansible_operator_meta.namespace }}"
85+
pod: "{{ chatbot_api_pod_name }}"
86+
container: "ansible-chatbot"
87+
command: >-
88+
bash -c "cat /.llama/distributions/ansible-chatbot/ansible-chatbot-version-info.json | jq -r .version"
89+
register: chatbot_instance_version
90+
changed_when: false
9191
no_log: "{{ no_log }}"
9292

9393
- name: Update Chatbot version status
@@ -98,8 +98,58 @@
9898
namespace: "{{ ansible_operator_meta.namespace }}"
9999
status:
100100
chatbotImage: "{{ _chatbot_image }}"
101-
chatbotVersion: "{{ chatbot_instance_version }}"
101+
chatbotVersion: "{{ chatbot_instance_version.stdout | trim }}"
102102
chatbotConfigurationSecret: "{{ chatbot_config_secret_name }}"
103+
104+
- name: Update Chatbot RAG database image status
105+
operator_sdk.util.k8s_status:
106+
api_version: '{{ api_version }}'
107+
kind: "{{ kind }}"
108+
name: "{{ ansible_operator_meta.name }}"
109+
namespace: "{{ ansible_operator_meta.namespace }}"
110+
status:
111+
chatbotRAGDatabaseImage: "{{ _chatbot_rag_db_image }}"
112+
113+
- name: Update MCP Gateway Server image status
114+
operator_sdk.util.k8s_status:
115+
api_version: '{{ api_version }}'
116+
kind: "{{ kind }}"
117+
name: "{{ ansible_operator_meta.name }}"
118+
namespace: "{{ ansible_operator_meta.namespace }}"
119+
status:
120+
chatbotMCPGatewayImage: "{{ _chatbot_mcp_gateway_image }}"
121+
when:
122+
- _aap_gateway_url is defined
123+
- _aap_gateway_url | length
124+
- _aap_gateway_token is defined
125+
- _aap_gateway_token | length
126+
127+
- name: Update MCP Controller Server image status
128+
operator_sdk.util.k8s_status:
129+
api_version: '{{ api_version }}'
130+
kind: "{{ kind }}"
131+
name: "{{ ansible_operator_meta.name }}"
132+
namespace: "{{ ansible_operator_meta.namespace }}"
133+
status:
134+
chatbotMCPControllerImage: "{{ _chatbot_mcp_controller_image }}"
135+
when:
136+
- _aap_gateway_url is defined
137+
- _aap_gateway_url | length
138+
- _aap_controller_url is defined
139+
- _aap_controller_url | length
140+
141+
- name: Update MCP Lightspeed Server image status
142+
operator_sdk.util.k8s_status:
143+
api_version: '{{ api_version }}'
144+
kind: "{{ kind }}"
145+
name: "{{ ansible_operator_meta.name }}"
146+
namespace: "{{ ansible_operator_meta.namespace }}"
147+
status:
148+
chatbotMCPLightspeedImage: "{{ _chatbot_mcp_lightspeed_image }}"
149+
when:
150+
- _aap_gateway_url is defined
151+
- _aap_gateway_url | length
152+
103153
when:
104154
- chatbot_api_pod_name is defined
105155
- chatbot_api_pod_name | length

0 commit comments

Comments
 (0)