Skip to content

Commit 3c08d96

Browse files
xekDeydra71cursoragent
committed
Application Credential support
Co-authored-by: Veronika Fisarova <vfisarov@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 1dcca25 commit 3c08d96

13 files changed

Lines changed: 262 additions & 12 deletions

api/bases/glance.openstack.org_glanceapis.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ spec:
6565
- single
6666
- edge
6767
type: string
68+
auth:
69+
description: Auth - Parameters related to authentication
70+
properties:
71+
applicationCredentialSecret:
72+
description: ApplicationCredentialSecret - Secret containing Application
73+
Credential ID and Secret
74+
type: string
75+
type: object
6876
containerImage:
6977
description: ContainerImage - GlanceAPI Container Image URL
7078
type: string

api/bases/glance.openstack.org_glances.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,14 @@ spec:
12291229
APITimeout
12301230
minimum: 1
12311231
type: integer
1232+
auth:
1233+
description: Auth - Parameters related to authentication
1234+
properties:
1235+
applicationCredentialSecret:
1236+
description: ApplicationCredentialSecret - Secret containing
1237+
Application Credential ID and Secret
1238+
type: string
1239+
type: object
12321240
customServiceConfig:
12331241
description: |-
12341242
CustomServiceConfig - customize the service config using this parameter to change service defaults,

api/v1beta1/common_types.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ package v1beta1
1919
import (
2020
"strings"
2121

22+
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
2223
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
2324
"github.com/openstack-k8s-operators/lib-common/modules/common/tls"
2425
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
25-
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
26-
"k8s.io/apimachinery/pkg/util/validation/field"
2726
corev1 "k8s.io/api/core/v1"
27+
"k8s.io/apimachinery/pkg/util/validation/field"
2828
)
2929

3030
const (
@@ -100,6 +100,11 @@ type GlanceAPITemplate struct {
100100
// TLS - Parameters related to the TLS
101101
TLS tls.API `json:"tls,omitempty"`
102102

103+
// +kubebuilder:validation:Optional
104+
// +operator-sdk:csv:customresourcedefinitions:type=spec
105+
// Auth - Parameters related to authentication
106+
Auth AuthSpec `json:"auth,omitempty"`
107+
103108
// ImageCache - It represents the struct to expose the ImageCache related
104109
// parameters (size of the PVC and cronJob schedule)
105110
// +kubebuilder:validation:Optional
@@ -147,6 +152,14 @@ type APIOverrideSpec struct {
147152
Service map[service.Endpoint]service.RoutedOverrideSpec `json:"service,omitempty"`
148153
}
149154

155+
// AuthSpec defines authentication parameters
156+
type AuthSpec struct {
157+
// +kubebuilder:validation:Optional
158+
// +operator-sdk:csv:customresourcedefinitions:type=spec
159+
// ApplicationCredentialSecret - Secret containing Application Credential ID and Secret
160+
ApplicationCredentialSecret string `json:"applicationCredentialSecret,omitempty"`
161+
}
162+
150163
// SetupDefaults - initializes any CRD field defaults based on environment variables (the defaulting mechanism itself is implemented via webhooks)
151164
func SetupDefaults() {
152165
// Acquire environmental defaults and initialize Glance defaults with them

api/v1beta1/glance_webhook.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"strings"
2222

2323
"github.com/google/go-cmp/cmp"
24+
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
2425
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
2526
apierrors "k8s.io/apimachinery/pkg/api/errors"
2627
"k8s.io/apimachinery/pkg/runtime"
@@ -29,7 +30,6 @@ import (
2930
logf "sigs.k8s.io/controller-runtime/pkg/log"
3031
"sigs.k8s.io/controller-runtime/pkg/webhook"
3132
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
32-
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
3333

3434
common_webhook "github.com/openstack-k8s-operators/lib-common/modules/common/webhook"
3535
)
@@ -157,7 +157,6 @@ func (r *GlanceSpecCore) Default() {
157157
}
158158
}
159159

160-
161160
// Check if File is used as a backend for Glance
162161
func isFileBackend(customServiceConfig string, topLevel bool) bool {
163162
availableBackends := GetEnabledBackends(customServiceConfig)

api/v1beta1/glanceapi_webhook.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20+
"fmt"
21+
22+
"github.com/google/go-cmp/cmp"
23+
apierrors "k8s.io/apimachinery/pkg/api/errors"
2024
"k8s.io/apimachinery/pkg/runtime"
2125
logf "sigs.k8s.io/controller-runtime/pkg/log"
2226
"sigs.k8s.io/controller-runtime/pkg/webhook"
23-
"fmt"
2427
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
25-
"github.com/google/go-cmp/cmp"
26-
apierrors "k8s.io/apimachinery/pkg/api/errors"
2728
)
2829

2930
// GlanceAPIDefaults -

api/v1beta1/zz_generated.deepcopy.go

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

config/crd/bases/glance.openstack.org_glanceapis.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ spec:
6565
- single
6666
- edge
6767
type: string
68+
auth:
69+
description: Auth - Parameters related to authentication
70+
properties:
71+
applicationCredentialSecret:
72+
description: ApplicationCredentialSecret - Secret containing Application
73+
Credential ID and Secret
74+
type: string
75+
type: object
6876
containerImage:
6977
description: ContainerImage - GlanceAPI Container Image URL
7078
type: string

config/crd/bases/glance.openstack.org_glances.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,14 @@ spec:
12291229
APITimeout
12301230
minimum: 1
12311231
type: integer
1232+
auth:
1233+
description: Auth - Parameters related to authentication
1234+
properties:
1235+
applicationCredentialSecret:
1236+
description: ApplicationCredentialSecret - Secret containing
1237+
Application Credential ID and Secret
1238+
type: string
1239+
type: object
12321240
customServiceConfig:
12331241
description: |-
12341242
CustomServiceConfig - customize the service config using this parameter to change service defaults,

go.mod

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ require (
1111
github.com/onsi/gomega v1.39.1
1212
github.com/openstack-k8s-operators/cinder-operator/api v0.6.1-0.20260128145454-bd999c6c83a3
1313
github.com/openstack-k8s-operators/glance-operator/api v0.0.0-00010101000000-000000000000
14+
<<<<<<< HEAD
1415
github.com/openstack-k8s-operators/horizon-operator/api v0.6.1-0.20260126110912-72d03020e1a5
1516
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260128074606-03b808364e4a
1617
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20260126175636-114b4c65a959
@@ -19,6 +20,16 @@ require (
1920
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20260128142552-e2c25eccae5a
2021
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20260128142552-e2c25eccae5a
2122
github.com/openstack-k8s-operators/mariadb-operator/api v0.6.1-0.20260127154438-ff95971883bb
23+
=======
24+
github.com/openstack-k8s-operators/horizon-operator/api v0.6.1-0.20260111154931-be9fdcb15911
25+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260115124008-0121df869109
26+
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20260120112029-cd452f0497ba
27+
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251230215914-6ba873b49a35
28+
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20251230215914-6ba873b49a35
29+
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20251230215914-6ba873b49a35
30+
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20251230215914-6ba873b49a35
31+
github.com/openstack-k8s-operators/mariadb-operator/api v0.6.1-0.20260105160121-f7a8ef85ce8d
32+
>>>>>>> d18bcb4 (Application Credential support)
2233
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67
2334
gopkg.in/ini.v1 v1.67.1
2435
gopkg.in/yaml.v3 v3.0.1

internal/controller/glance_common.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ import (
4848
// Common static errors for glance controllers
4949
var (
5050
ErrNetworkAttachmentConfig = errors.New("not all pods have interfaces with ips as configured in NetworkAttachments")
51+
ErrACSecretNotFound = errors.New("ApplicationCredential secret not found")
52+
ErrACSecretMissingKeys = errors.New("ApplicationCredential secret missing required keys")
5153
)
5254

5355
// fields to index to reconcile when change
@@ -58,6 +60,7 @@ const (
5860
tlsAPIPublicField = ".spec.tls.api.public.secretName"
5961
topologyField = ".spec.topologyRef.Name"
6062
notificationBusSecretField = ".spec.notificationBusSecret"
63+
authAppCredSecretField = ".spec.auth.applicationCredentialSecret" // #nosec G101
6164
)
6265

6366
var (
@@ -71,6 +74,7 @@ var (
7174
tlsAPIPublicField,
7275
topologyField,
7376
notificationBusSecretField,
77+
authAppCredSecretField,
7478
}
7579
)
7680

0 commit comments

Comments
 (0)