Skip to content

Commit 2486fc8

Browse files
committed
Application Credential Support
Adds the end-to-end support for consuming Keystone ApplicationCredentials (AC) in the watcher-operator, enabling WatcherAPI, WatcherApplier, and WatcherDecisionEngine pods to use AC-based authentication when available. Signed-off-by: Veronika Fisarova <[email protected]>
1 parent 1a504a2 commit 2486fc8

18 files changed

+361
-5
lines changed

api/bases/watcher.openstack.org_watchers.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ spec:
5656
replicas: 1
5757
description: APIServiceTemplate - define the watcher-api service
5858
properties:
59+
auth:
60+
description: Auth - Parameters related to authentication
61+
properties:
62+
applicationCredentialSecret:
63+
description: ApplicationCredentialSecret - Secret containing
64+
Application Credential ID and Secret
65+
type: string
66+
type: object
5967
customServiceConfig:
6068
description: |-
6169
CustomServiceConfig - customize the service config using this parameter to change service defaults,
@@ -460,6 +468,15 @@ spec:
460468
type: string
461469
type: object
462470
type: object
471+
auth:
472+
description: Auth - Parameters related to authentication (shared by
473+
all Watcher components)
474+
properties:
475+
applicationCredentialSecret:
476+
description: ApplicationCredentialSecret - Secret containing Application
477+
Credential ID and Secret
478+
type: string
479+
type: object
463480
customServiceConfig:
464481
description: |-
465482
CustomServiceConfig - customize the service config using this parameter to change service defaults,

api/go.mod

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ toolchain go1.24.6
66

77
require (
88
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251223124749-eedb97238c5f
9+
github.com/openstack-k8s-operators/keystone-operator/api v0.0.0-00010101000000-000000000000
910
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251230215914-6ba873b49a35
1011
k8s.io/api v0.31.14
1112
k8s.io/apimachinery v0.31.14
@@ -18,7 +19,6 @@ require (
1819
github.com/cespare/xxhash/v2 v2.3.0 // indirect
1920
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2021
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
21-
github.com/evanphx/json-patch v5.9.11+incompatible // indirect
2222
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
2323
github.com/fsnotify/fsnotify v1.9.0 // indirect
2424
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
@@ -33,13 +33,17 @@ require (
3333
github.com/google/go-cmp v0.7.0 // indirect
3434
github.com/google/gofuzz v1.2.0 // indirect
3535
github.com/google/uuid v1.6.0 // indirect
36+
github.com/gophercloud/gophercloud/v2 v2.8.0 // indirect
3637
github.com/imdario/mergo v0.3.16 // indirect
3738
github.com/josharian/intern v1.0.0 // indirect
3839
github.com/json-iterator/go v1.1.12 // indirect
3940
github.com/mailru/easyjson v0.9.0 // indirect
4041
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
4142
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
4243
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
44+
github.com/openshift/api v3.9.0+incompatible // indirect
45+
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20251122131503-b76943960b6c // indirect
46+
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20251122131503-b76943960b6c // indirect
4347
github.com/pkg/errors v0.9.1 // indirect
4448
github.com/prometheus/client_golang v1.22.0 // indirect
4549
github.com/prometheus/client_model v0.6.2 // indirect
@@ -91,3 +95,5 @@ replace k8s.io/component-base => k8s.io/component-base v0.31.13 //allow-merging
9195
replace github.com/rabbitmq/cluster-operator/v2 => github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec //allow-merging
9296

9397
replace k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20250627150254-e9823e99808e //allow-merging
98+
99+
replace github.com/openstack-k8s-operators/keystone-operator/api => github.com/Deydra71/keystone-operator/api v0.0.0-20251211085602-3e1a3e022c81

api/go.sum

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
github.com/Deydra71/keystone-operator/api v0.0.0-20251211085602-3e1a3e022c81 h1:plax+NFgJJL1SrERyXAnf3jOHRhLTtBlJ2oc7d84EoU=
2+
github.com/Deydra71/keystone-operator/api v0.0.0-20251211085602-3e1a3e022c81/go.mod h1:b98Jl8eyUw8V07l9YiuQnoMlnWC748oV8IhXH15NCC4=
13
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
24
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
35
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
@@ -48,6 +50,8 @@ github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J
4850
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
4951
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
5052
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
53+
github.com/gophercloud/gophercloud/v2 v2.8.0 h1:of2+8tT6+FbEYHfYC8GBu8TXJNsXYSNm9KuvpX7Neqo=
54+
github.com/gophercloud/gophercloud/v2 v2.8.0/go.mod h1:Ki/ILhYZr/5EPebrPL9Ej+tUg4lqx71/YH2JWVeU+Qk=
5155
github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
5256
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
5357
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
@@ -78,10 +82,16 @@ github.com/onsi/ginkgo/v2 v2.27.3 h1:ICsZJ8JoYafeXFFlFAG75a7CxMsJHwgKwtO+82SE9L8
7882
github.com/onsi/ginkgo/v2 v2.27.3/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
7983
github.com/onsi/gomega v1.38.3 h1:eTX+W6dobAYfFeGC2PV6RwXRu/MyT+cQguijutvkpSM=
8084
github.com/onsi/gomega v1.38.3/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4=
85+
github.com/openshift/api v3.9.0+incompatible h1:fJ/KsefYuZAjmrr3+5U9yZIZbTOpVkDDLDLFresAeYs=
86+
github.com/openshift/api v3.9.0+incompatible/go.mod h1:dh9o4Fs58gpFXGSYfnVxGR9PnV53I8TW84pQaJDdGiY=
8187
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251223124749-eedb97238c5f h1:xcCGJ/g5vvbWhtEJCbv8UeBneI5yrMawm+CXRsJrJZo=
8288
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251223124749-eedb97238c5f/go.mod h1:ex8ou6/3ms6ovR+CMXD6XhTlNakm1GhB6UZgagVRNW8=
8389
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251230215914-6ba873b49a35 h1:pF3mJ3nwq6r4qwom+rEWZNquZpcQW/iftHlJ1KPIDsk=
8490
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251230215914-6ba873b49a35/go.mod h1:kycZyoe7OZdW1HUghr2nI3N7wSJtNahXf6b/ypD14f4=
91+
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20251122131503-b76943960b6c h1:l7FO+XoQRnD4aT5p/JXVY2uezQLdC7D50KrwrTmzCfg=
92+
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20251122131503-b76943960b6c/go.mod h1:zOX7Y05keiSppIvLabuyh42QHBMhCcoskAtxFRbwXKo=
93+
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20251122131503-b76943960b6c h1:dVIaDL5BeIdJjERGaN/XlcvZVplfkzh0uUfiVUHj/6Q=
94+
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20251122131503-b76943960b6c/go.mod h1:fy1lvz3uuzzh01DKKdgroXvmJgMpJBsvl2r9eTtAll0=
8595
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
8696
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
8797
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=

api/v1beta1/common_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ type WatcherSpecCore struct {
129129
// APITimeout for Route and Apache
130130
APITimeout *int `json:"apiTimeout"`
131131

132+
// +kubebuilder:validation:Optional
133+
// +operator-sdk:csv:customresourcedefinitions:type=spec
134+
// Auth - Parameters related to authentication (shared by all Watcher components)
135+
Auth AuthSpec `json:"auth,omitempty"`
136+
132137
// +kubebuilder:validation:Optional
133138
// NotificationsBusInstance is the name of the RabbitMqCluster CR to select
134139
// the Message Bus Service instance used by the Watcher service to publish and consume notifications

api/v1beta1/watcher_webhook.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"fmt"
2121

2222
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
23+
keystonev1 "github.com/openstack-k8s-operators/keystone-operator/api/v1beta1"
2324
apierrors "k8s.io/apimachinery/pkg/api/errors"
2425
"k8s.io/apimachinery/pkg/runtime"
2526
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -65,6 +66,11 @@ func (spec *WatcherSpec) Default() {
6566
// Default - set defaults for this WatcherSpecCore spec.
6667
func (spec *WatcherSpecCore) Default() {
6768
// no validations . Placeholder for defaulting webhook integrated in the OpenStackControlPlane
69+
70+
// Default ApplicationCredentialSecret to standard AC secret name if not specified
71+
if spec.Auth.ApplicationCredentialSecret == "" {
72+
spec.Auth.ApplicationCredentialSecret = keystonev1.GetACSecretName("watcher")
73+
}
6874
}
6975

7076
var _ webhook.Validator = &Watcher{}

api/v1beta1/watcherapi_types.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ type APIOverrideSpec struct {
9191
Service map[service.Endpoint]service.RoutedOverrideSpec `json:"service,omitempty"`
9292
}
9393

94+
// AuthSpec defines authentication parameters
95+
type AuthSpec struct {
96+
// +kubebuilder:validation:Optional
97+
// +operator-sdk:csv:customresourcedefinitions:type=spec
98+
// ApplicationCredentialSecret - Secret containing Application Credential ID and Secret
99+
ApplicationCredentialSecret string `json:"applicationCredentialSecret,omitempty"`
100+
}
101+
94102
// WatcherAPITemplate defines the input parameters specified by the user to
95103
// create a WatcherAPI via higher level CRDs.
96104
type WatcherAPITemplate struct {
@@ -112,6 +120,11 @@ type WatcherAPITemplate struct {
112120
// +operator-sdk:csv:customresourcedefinitions:type=spec
113121
// TLS - Parameters related to the TLS
114122
TLS tls.API `json:"tls,omitempty"`
123+
124+
// +kubebuilder:validation:Optional
125+
// +operator-sdk:csv:customresourcedefinitions:type=spec
126+
// Auth - Parameters related to authentication
127+
Auth AuthSpec `json:"auth,omitempty"`
115128
}
116129

117130
//+kubebuilder:object:root=true

api/v1beta1/zz_generated.deepcopy.go

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

config/crd/bases/watcher.openstack.org_watchers.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ spec:
5656
replicas: 1
5757
description: APIServiceTemplate - define the watcher-api service
5858
properties:
59+
auth:
60+
description: Auth - Parameters related to authentication
61+
properties:
62+
applicationCredentialSecret:
63+
description: ApplicationCredentialSecret - Secret containing
64+
Application Credential ID and Secret
65+
type: string
66+
type: object
5967
customServiceConfig:
6068
description: |-
6169
CustomServiceConfig - customize the service config using this parameter to change service defaults,
@@ -460,6 +468,15 @@ spec:
460468
type: string
461469
type: object
462470
type: object
471+
auth:
472+
description: Auth - Parameters related to authentication (shared by
473+
all Watcher components)
474+
properties:
475+
applicationCredentialSecret:
476+
description: ApplicationCredentialSecret - Secret containing Application
477+
Credential ID and Secret
478+
type: string
479+
type: object
463480
customServiceConfig:
464481
description: |-
465482
CustomServiceConfig - customize the service config using this parameter to change service defaults,

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,5 @@ replace k8s.io/component-base => k8s.io/component-base v0.31.13 //allow-merging
142142
replace github.com/rabbitmq/cluster-operator/v2 => github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec //allow-merging
143143

144144
replace k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20250627150254-e9823e99808e //allow-merging
145+
146+
replace github.com/openstack-k8s-operators/keystone-operator/api => github.com/Deydra71/keystone-operator/api v0.0.0-20251211085602-3e1a3e022c81

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
github.com/Deydra71/keystone-operator/api v0.0.0-20251211085602-3e1a3e022c81 h1:plax+NFgJJL1SrERyXAnf3jOHRhLTtBlJ2oc7d84EoU=
2+
github.com/Deydra71/keystone-operator/api v0.0.0-20251211085602-3e1a3e022c81/go.mod h1:b98Jl8eyUw8V07l9YiuQnoMlnWC748oV8IhXH15NCC4=
13
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
24
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
35
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
@@ -120,8 +122,6 @@ github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e h1:E1OdwSpqWuDPCedyU
120122
github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e/go.mod h1:Shkl4HanLwDiiBzakv+con/aMGnVE2MAGvoKp5oyYUo=
121123
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251223124749-eedb97238c5f h1:xcCGJ/g5vvbWhtEJCbv8UeBneI5yrMawm+CXRsJrJZo=
122124
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251223124749-eedb97238c5f/go.mod h1:ex8ou6/3ms6ovR+CMXD6XhTlNakm1GhB6UZgagVRNW8=
123-
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20251206133124-593df0a7a9e1 h1:qcgbrF9c0axkaDcFGfIA2wGz8bkaxPuXHj3mdKAyz6M=
124-
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20251206133124-593df0a7a9e1/go.mod h1:0XsZ6Fc4hTV6a/BBP8+jiH8LR+IP5z9aStdPTDHALNk=
125125
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251230215914-6ba873b49a35 h1:pF3mJ3nwq6r4qwom+rEWZNquZpcQW/iftHlJ1KPIDsk=
126126
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251230215914-6ba873b49a35/go.mod h1:kycZyoe7OZdW1HUghr2nI3N7wSJtNahXf6b/ypD14f4=
127127
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20251122131503-b76943960b6c h1:l7FO+XoQRnD4aT5p/JXVY2uezQLdC7D50KrwrTmzCfg=

0 commit comments

Comments
 (0)