Skip to content

Commit 964cd48

Browse files
committed
Use the namespace-wide CA bundle for OpenStackAssistant and rely on
lib-common helpers for MCP TLS volumes, Services, and restrictive security contexts. Publish the MCP endpoint in OpenStackClient status so consumers do not need to reconstruct its URL or infer whether TLS is enabled. Keep MCP certificate management in the OpenStackClient controller so standalone clients can enable the sidecar without requiring an owning control plane. Remove the unused Service hash annotation and expand the assistant's read-only RBAC coverage to the remaining OpenStack API groups. Also make the defaulted assistant image required, requeue while dependencies or terminating pods are pending, and refresh the generated CRDs and tests.
1 parent 7367bd1 commit 964cd48

19 files changed

Lines changed: 280 additions & 299 deletions

‎api/assistant/v1beta1/openstackassistant_types.go‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ package v1beta1
1818

1919
import (
2020
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
21+
"github.com/openstack-k8s-operators/lib-common/modules/common/tls"
2122
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
2223
corev1 "k8s.io/api/core/v1"
2324
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2425
)
2526

2627
const (
2728
// OpenStackAssistantContainerImage is the fall-back container image for OpenStackAssistant
28-
OpenStackAssistantContainerImage = "quay.io/dprince/goose:oc-centos"
29+
OpenStackAssistantContainerImage = "quay.io/openstack-s2i-containers/openstack-goose:master-latest"
2930
)
3031

3132
// ProviderType defines the AI agent provider
@@ -45,12 +46,6 @@ type LightspeedStackSpec struct {
4546
// +kubebuilder:validation:Required
4647
// +kubebuilder:validation:MinLength=1
4748
ProviderSecret string `json:"providerSecret"`
48-
49-
// CaBundleSecretName is the name of a Secret containing CA certs
50-
// to trust for TLS connections to the lightspeed-stack endpoint.
51-
// The Secret must contain a key "ca-bundle.crt" with PEM-encoded certs.
52-
// +kubebuilder:validation:Optional
53-
CaBundleSecretName string `json:"caBundleSecretName,omitempty"`
5449
}
5550

5651
// MCPServerRef references an MCP server endpoint to configure as a Goose extension.
@@ -74,8 +69,8 @@ type MCPServerRef struct {
7469
URL string `json:"url,omitempty"`
7570

7671
// OpenStackClientRef is the name of an OpenStackClient CR in the same
77-
// namespace that has MCP enabled. The controller auto-computes the
78-
// correct service URL and TLS CA configuration.
72+
// namespace that has MCP enabled. The controller reads the service URL
73+
// published in the OpenStackClient status.
7974
// Mutually exclusive with URL.
8075
// +kubebuilder:validation:Optional
8176
// +kubebuilder:validation:MinLength=1
@@ -117,8 +112,8 @@ type GooseConfig struct {
117112
// OpenStackAssistantSpec defines the desired state of OpenStackAssistant
118113
type OpenStackAssistantSpec struct {
119114
// ContainerImage for the assistant container (will be set to environmental default if empty).
120-
// +kubebuilder:validation:Optional
121-
ContainerImage string `json:"containerImage,omitempty"`
115+
// +kubebuilder:validation:Required
116+
ContainerImage string `json:"containerImage"`
122117

123118
// Provider is the AI agent provider type. Currently only "goose" is supported.
124119
// +kubebuilder:validation:Optional
@@ -134,6 +129,11 @@ type OpenStackAssistantSpec struct {
134129
// +kubebuilder:validation:Optional
135130
Goose *GooseConfig `json:"goose,omitempty"`
136131

132+
// +kubebuilder:validation:Optional
133+
// +operator-sdk:csv:customresourcedefinitions:type=spec
134+
// Secret containing any CA certificates which should be added to the assistant pod.
135+
tls.Ca `json:",inline"`
136+
137137
// NodeSelector to target subset of worker nodes for pod scheduling.
138138
// +kubebuilder:validation:Optional
139139
NodeSelector *map[string]string `json:"nodeSelector,omitempty"`
@@ -235,4 +235,7 @@ func (r *OpenStackAssistant) Default() {
235235
if r.Spec.ContainerImage == "" {
236236
r.Spec.ContainerImage = openStackAssistantDefaults.ContainerImageURL
237237
}
238+
if r.Spec.CaBundleSecretName == "" {
239+
r.Spec.CaBundleSecretName = tls.CABundleSecret
240+
}
238241
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
Copyright 2026.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1beta1
18+
19+
import (
20+
"testing"
21+
22+
"github.com/onsi/gomega"
23+
"github.com/openstack-k8s-operators/lib-common/modules/common/tls"
24+
)
25+
26+
func TestOpenStackAssistantDefaultCABundle(t *testing.T) {
27+
g := gomega.NewWithT(t)
28+
assistant := &OpenStackAssistant{}
29+
30+
assistant.Default()
31+
32+
g.Expect(assistant.Spec.CaBundleSecretName).To(gomega.Equal(tls.CABundleSecret))
33+
}

‎api/assistant/v1beta1/zz_generated.deepcopy.go‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎api/bases/assistant.openstack.org_openstackassistants.yaml‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ spec:
5252
spec:
5353
description: OpenStackAssistantSpec defines the desired state of OpenStackAssistant
5454
properties:
55+
caBundleSecretName:
56+
description: CaBundleSecretName - holding the CA certs in a pre-created
57+
bundle file
58+
type: string
5559
containerImage:
5660
description: ContainerImage for the assistant container (will be set
5761
to environmental default if empty).
@@ -210,8 +214,8 @@ spec:
210214
openstackClientRef:
211215
description: |-
212216
OpenStackClientRef is the name of an OpenStackClient CR in the same
213-
namespace that has MCP enabled. The controller auto-computes the
214-
correct service URL and TLS CA configuration.
217+
namespace that has MCP enabled. The controller reads the service URL
218+
published in the OpenStackClient status.
215219
Mutually exclusive with URL.
216220
minLength: 1
217221
type: string
@@ -252,12 +256,6 @@ spec:
252256
lightspeedStack:
253257
description: LightspeedStack configuration for the AI backend.
254258
properties:
255-
caBundleSecretName:
256-
description: |-
257-
CaBundleSecretName is the name of a Secret containing CA certs
258-
to trust for TLS connections to the lightspeed-stack endpoint.
259-
The Secret must contain a key "ca-bundle.crt" with PEM-encoded certs.
260-
type: string
261259
providerSecret:
262260
description: |-
263261
ProviderSecret is the name of a Secret containing the lightspeed
@@ -282,6 +280,7 @@ spec:
282280
- goose
283281
type: string
284282
required:
283+
- containerImage
285284
- lightspeedStack
286285
type: object
287286
status:

‎api/bases/client.openstack.org_openstackclients.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ spec:
266266
type: string
267267
description: Map of hashes to track e.g. pod spec
268268
type: object
269+
mcpEndpoint:
270+
description: MCPEndpoint is the URL of the MCP server when the sidecar
271+
is enabled.
272+
type: string
269273
observedGeneration:
270274
description: ObservedGeneration - the most recent generation observed
271275
for this object.

‎api/client/v1beta1/openstackclient_types.go‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ limitations under the License.
1414
package v1beta1
1515

1616
import (
17+
"fmt"
18+
1719
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
1820
"github.com/openstack-k8s-operators/lib-common/modules/common/tls"
1921
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
@@ -100,6 +102,9 @@ type OpenStackClientStatus struct {
100102

101103
// Map of hashes to track e.g. pod spec
102104
Hash map[string]string `json:"hash,omitempty"`
105+
106+
// MCPEndpoint is the URL of the MCP server when the sidecar is enabled.
107+
MCPEndpoint string `json:"mcpEndpoint,omitempty"`
103108
}
104109

105110
// +kubebuilder:object:root=true
@@ -136,6 +141,14 @@ func (instance OpenStackClient) IsReady() bool {
136141
return instance.Status.Conditions.IsTrue(OpenStackClientReadyCondition)
137142
}
138143

144+
// GetMCPEndpoint returns the MCP server URL.
145+
func (instance OpenStackClient) GetMCPEndpoint() (string, error) {
146+
if instance.Status.MCPEndpoint == "" {
147+
return "", fmt.Errorf("MCP endpoint not found")
148+
}
149+
return instance.Status.MCPEndpoint, nil
150+
}
151+
139152
// RbacConditionsSet - set the conditions for the rbac object
140153
func (instance OpenStackClient) RbacConditionsSet(c *condition.Condition) {
141154
instance.Status.Conditions.Set(c)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
Copyright 2026.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1beta1
18+
19+
import (
20+
"testing"
21+
22+
"github.com/onsi/gomega"
23+
)
24+
25+
func TestGetMCPEndpoint(t *testing.T) {
26+
g := gomega.NewWithT(t)
27+
client := OpenStackClient{}
28+
29+
_, err := client.GetMCPEndpoint()
30+
g.Expect(err).To(gomega.MatchError("MCP endpoint not found"))
31+
32+
client.Status.MCPEndpoint = "https://openstackclient-mcp.openstack.svc:8080/openstack/"
33+
endpoint, err := client.GetMCPEndpoint()
34+
g.Expect(err).NotTo(gomega.HaveOccurred())
35+
g.Expect(endpoint).To(gomega.Equal(client.Status.MCPEndpoint))
36+
}

‎bindata/crds/crds.yaml‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ spec:
5151
spec:
5252
description: OpenStackAssistantSpec defines the desired state of OpenStackAssistant
5353
properties:
54+
caBundleSecretName:
55+
description: CaBundleSecretName - holding the CA certs in a pre-created
56+
bundle file
57+
type: string
5458
containerImage:
5559
description: ContainerImage for the assistant container (will be set
5660
to environmental default if empty).
@@ -209,8 +213,8 @@ spec:
209213
openstackClientRef:
210214
description: |-
211215
OpenStackClientRef is the name of an OpenStackClient CR in the same
212-
namespace that has MCP enabled. The controller auto-computes the
213-
correct service URL and TLS CA configuration.
216+
namespace that has MCP enabled. The controller reads the service URL
217+
published in the OpenStackClient status.
214218
Mutually exclusive with URL.
215219
minLength: 1
216220
type: string
@@ -251,12 +255,6 @@ spec:
251255
lightspeedStack:
252256
description: LightspeedStack configuration for the AI backend.
253257
properties:
254-
caBundleSecretName:
255-
description: |-
256-
CaBundleSecretName is the name of a Secret containing CA certs
257-
to trust for TLS connections to the lightspeed-stack endpoint.
258-
The Secret must contain a key "ca-bundle.crt" with PEM-encoded certs.
259-
type: string
260258
providerSecret:
261259
description: |-
262260
ProviderSecret is the name of a Secret containing the lightspeed
@@ -281,6 +279,7 @@ spec:
281279
- goose
282280
type: string
283281
required:
282+
- containerImage
284283
- lightspeedStack
285284
type: object
286285
status:
@@ -883,6 +882,10 @@ spec:
883882
type: string
884883
description: Map of hashes to track e.g. pod spec
885884
type: object
885+
mcpEndpoint:
886+
description: MCPEndpoint is the URL of the MCP server when the sidecar
887+
is enabled.
888+
type: string
886889
observedGeneration:
887890
description: ObservedGeneration - the most recent generation observed
888891
for this object.

‎config/crd/bases/assistant.openstack.org_openstackassistants.yaml‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ spec:
5252
spec:
5353
description: OpenStackAssistantSpec defines the desired state of OpenStackAssistant
5454
properties:
55+
caBundleSecretName:
56+
description: CaBundleSecretName - holding the CA certs in a pre-created
57+
bundle file
58+
type: string
5559
containerImage:
5660
description: ContainerImage for the assistant container (will be set
5761
to environmental default if empty).
@@ -210,8 +214,8 @@ spec:
210214
openstackClientRef:
211215
description: |-
212216
OpenStackClientRef is the name of an OpenStackClient CR in the same
213-
namespace that has MCP enabled. The controller auto-computes the
214-
correct service URL and TLS CA configuration.
217+
namespace that has MCP enabled. The controller reads the service URL
218+
published in the OpenStackClient status.
215219
Mutually exclusive with URL.
216220
minLength: 1
217221
type: string
@@ -252,12 +256,6 @@ spec:
252256
lightspeedStack:
253257
description: LightspeedStack configuration for the AI backend.
254258
properties:
255-
caBundleSecretName:
256-
description: |-
257-
CaBundleSecretName is the name of a Secret containing CA certs
258-
to trust for TLS connections to the lightspeed-stack endpoint.
259-
The Secret must contain a key "ca-bundle.crt" with PEM-encoded certs.
260-
type: string
261259
providerSecret:
262260
description: |-
263261
ProviderSecret is the name of a Secret containing the lightspeed
@@ -282,6 +280,7 @@ spec:
282280
- goose
283281
type: string
284282
required:
283+
- containerImage
285284
- lightspeedStack
286285
type: object
287286
status:

‎config/crd/bases/client.openstack.org_openstackclients.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ spec:
266266
type: string
267267
description: Map of hashes to track e.g. pod spec
268268
type: object
269+
mcpEndpoint:
270+
description: MCPEndpoint is the URL of the MCP server when the sidecar
271+
is enabled.
272+
type: string
269273
observedGeneration:
270274
description: ObservedGeneration - the most recent generation observed
271275
for this object.

0 commit comments

Comments
 (0)