Skip to content

Commit

Permalink
Update kuttl tests and config/samples
Browse files Browse the repository at this point in the history
This patch updates the kuttl tests related references to match the new
data structure, and, at the same time, all the documentation has been
updated to reflect the last changes introduced in the previous commits.

Signed-off-by: Francesco Pantano <[email protected]>
  • Loading branch information
fmount committed Oct 24, 2023
1 parent 7219776 commit b750f93
Show file tree
Hide file tree
Showing 27 changed files with 78 additions and 126 deletions.
15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,7 @@ spec:
rbd_store_user = openstack
databaseInstance: openstack
databaseUser: glance
glanceAPIInternal:
debug:
service: false
preserveJobs: false
replicas: 1
glanceAPIExternal:
glanceAPI:
debug:
service: false
preserveJobs: false
Expand Down Expand Up @@ -336,11 +331,7 @@ metadata:
name: glance
spec:
...
glanceAPIInternal:
...
networkAttachents:
- storage
glanceAPIExternal:
glanceAPI:
...
networkAttachents:
- storage
Expand Down Expand Up @@ -411,7 +402,7 @@ metadata:
name: glance
spec:
...
glanceAPIInternal:
glanceAPI:
...
override:
service:
Expand Down
3 changes: 2 additions & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: quay.io/fpantano/glance-operator
newName: quay.io/openstack-k8s-operators/glance-operator
newTag: latest
7 changes: 1 addition & 6 deletions config/samples/backends/ceph/ceph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ spec:
rbd_store_user = openstack
databaseInstance: openstack
databaseUser: glance
glanceAPIInternal:
debug:
service: false
preserveJobs: false
replicas: 1
glanceAPIExternal:
glanceAPI:
debug:
service: false
preserveJobs: false
Expand Down
7 changes: 1 addition & 6 deletions config/samples/backends/cinder/glance-common/glance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ spec:
customServiceConfigSecrets:
- osp-glance-cinder-secret
databaseInstance: openstack
glanceAPIInternal:
debug:
service: false
preserveJobs: false
replicas: 1
glanceAPIExternal:
glanceAPI:
debug:
service: false
preserveJobs: false
Expand Down
7 changes: 1 addition & 6 deletions config/samples/backends/multibackends/multibackend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ spec:
filesystem_store_datadir = /var/lib/glance/images/
databaseInstance: openstack
databaseUser: glance
glanceAPIInternal:
debug:
service: false
preserveJobs: false
replicas: 1
glanceAPIExternal:
glanceAPI:
debug:
service: false
preserveJobs: false
Expand Down
7 changes: 1 addition & 6 deletions config/samples/backends/nfs/nfs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ spec:
filesystem_store_datadir = /var/lib/glance/images/
databaseInstance: openstack
databaseUser: glance
glanceAPIInternal:
debug:
service: false
preserveJobs: false
replicas: 1
glanceAPIExternal:
glanceAPI:
debug:
service: false
preserveJobs: false
Expand Down
7 changes: 1 addition & 6 deletions config/samples/backends/swift/glance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ spec:
customServiceConfigSecrets:
- osp-glance-swift-secret
databaseInstance: openstack
glanceAPIInternal:
debug:
service: false
preserveJobs: false
replicas: 1
glanceAPIExternal:
glanceAPI:
debug:
service: false
preserveJobs: false
Expand Down
2 changes: 1 addition & 1 deletion config/samples/glance_v1beta1_glance_single_instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ spec:
databaseUser: glance
glanceAPI:
containerImage: quay.io/podified-antelope-centos9/openstack-glance-api:current-podified
type: "single"
debug:
service: false
preserveJobs: false
replicas: 1
type: "single"
secret: osp-secret
storageClass: local-storage
storageRequest: 10G
4 changes: 1 addition & 3 deletions config/samples/image-cache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ parameter:
storageClass: ""
imageCacheSize: 10G
storageRequest: 10G
glanceAPIInternal:
...
glanceAPIExternal:
glanceAPI:
...
...
...
Expand Down
7 changes: 1 addition & 6 deletions config/samples/image-cache/image-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ spec:
rbd_store_pool = images
rbd_store_user = openstack
databaseUser: glance
glanceAPIInternal:
debug:
service: false
preserveJobs: false
replicas: 1
glanceAPIExternal:
glanceAPI:
debug:
service: false
preserveJobs: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ spec:
output_format = raw
databaseInstance: openstack
databaseUser: glance
glanceAPIInternal:
debug:
service: false
preserveJobs: false
replicas: 1
glanceAPIExternal:
glanceAPI:
debug:
service: false
preserveJobs: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ spec:
image_import_plugins = [image_decompression]
databaseInstance: openstack
databaseUser: glance
glanceAPIInternal:
debug:
service: false
preserveJobs: false
replicas: 1
glanceAPIExternal:
glanceAPI:
debug:
service: false
preserveJobs: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ spec:
inject = "property1":"value1","property2":"value2"
databaseInstance: openstack
databaseUser: glance
glanceAPIInternal:
debug:
service: false
preserveJobs: false
replicas: 1
glanceAPIExternal:
glanceAPI:
debug:
service: false
preserveJobs: false
Expand Down
5 changes: 1 addition & 4 deletions config/samples/policy/glance_v1beta_glance_apply_policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ spec:
enforce_new_defaults=true
databaseInstance: openstack
databaseUser: glance
glanceAPIInternal:
preserveJobs: false
replicas: 1
glanceAPIExternal:
glanceAPI:
preserveJobs: false
replicas: 1
secret: osp-secret
Expand Down
7 changes: 1 addition & 6 deletions config/samples/quotas/glance_v1beta1_glance_quota.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ spec:
serviceUser: glance
databaseInstance: openstack
databaseUser: glance
glanceAPIInternal:
debug:
service: false
preserveJobs: false
replicas: 1
glanceAPIExternal:
glanceAPI:
debug:
service: false
preserveJobs: false
Expand Down
10 changes: 7 additions & 3 deletions controllers/glance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ func (r *GlanceReconciler) reconcileNormal(ctx context.Context, instance *glance
func (r *GlanceReconciler) apiDeployment(ctx context.Context, instance *glancev1.Glance, current glancev1.GlanceAPITemplate, helper *helper.Helper) error {

// By default internal and external points to diff instances, but we might
// want to override "external" in case of single instance and skip the
// want to override "external" in case of a "single" instance and skip the
// internal one
var internal string = glancev1.APIInternal
var external string = glancev1.APIExternal
Expand All @@ -646,9 +646,13 @@ func (r *GlanceReconciler) apiDeployment(ctx context.Context, instance *glancev1
r.Log.Info(fmt.Sprintf("Deployment %s successfully reconciled - operation: %s", instance.Name, string(op)))
}

// Mirror external GlanceAPI status' APIEndpoints and ReadyCount to this parent CR
// Mirror single/external GlanceAPI status' APIEndpoints and ReadyCount to this parent CR
if glanceAPI.Status.APIEndpoints != nil {
instance.Status.APIEndpoints[string(endpoint.EndpointPublic)] = glanceAPI.Status.APIEndpoints[string(endpoint.EndpointPublic)]
// if we don't split, update apiEndpoint to include the internal service
if current.Type == "single" {
instance.Status.APIEndpoints[string(endpoint.EndpointInternal)] = glanceAPI.Status.APIEndpoints[string(endpoint.EndpointInternal)]
}
}
instance.Status.GlanceAPIExternalReadyCount = glanceAPI.Status.ReadyCount

Expand Down Expand Up @@ -681,7 +685,7 @@ func (r *GlanceReconciler) apiDeployment(ctx context.Context, instance *glancev1

// Mirror internal GlanceAPI status' APIEndpoints and ReadyCount to this parent CR
if glanceAPI.Status.APIEndpoints != nil {
instance.Status.APIEndpoints = glanceAPI.Status.APIEndpoints
instance.Status.APIEndpoints[string(endpoint.EndpointInternal)] = glanceAPI.Status.APIEndpoints[string(endpoint.EndpointInternal)]
}
instance.Status.GlanceAPIInternalReadyCount = glanceAPI.Status.ReadyCount

Expand Down
2 changes: 1 addition & 1 deletion docs/dev/debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ here we want to launch a user facing container (External) in debug mode.
```
(path to file: install_yamls/out/openstack/glance/cr/glance_v1beta1_glance.yaml)
glanceAPIExternal:
glanceAPI:
debug:
service: true # Change it to true if it is false
preserveJobs: false
Expand Down
41 changes: 35 additions & 6 deletions docs/dev/design-decisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ or symlinked. In our case we instruct kolla to use the copying mechanism in
To be able to use `nsenter` the pod needs to share the PID namespace with the
host.


## GlanceAPI deployment

When a Glance CR is created, at last two `GlanceAPI` deployments are triggered:
When a Glance CR is created, by default two `GlanceAPI` deployments are triggered:

```
...
Expand All @@ -120,9 +121,7 @@ spec:
serviceUser: glance
databaseInstance: openstack
databaseUser: glance
glanceAPIInternal:
..
glanceAPIExternal:
glanceAPI:
..
secret: osp-secret
storageClass: ""
Expand All @@ -149,8 +148,38 @@ glance-internal True Setup complete
```

and they can be inspected as regular k8s objects.
Each GlanceAPI deployment resulting from the process above will deploy three
containers within the same Pod:
However, it's possible to not split the deployment between internal and external
API deployment, and reduce everything to a single API instance.
To do that, a Glance CR spec like the following should be created:

```
...
...
spec:
serviceUser: glance
databaseInstance: openstack
databaseUser: glance
glanceAPI:
replicas=1
type: "single"
secret: osp-secret
storageClass: ""
...
...
```

By passing `type: single` to the `glanceAPI` section, the main Glance controller
will only generate a single deployment. Both internal and external `Services`
will point to the single instance.

```
$ oc get glanceapi
NAME NETWORKATTACHMENTS STATUS MESSAGE
glance-single True Setup complete
```

In general, a `GlanceAPI` deployment resulting from one of the processes above
will deploy three containers within the same Pod:

```
+-------------------------------------+
Expand Down
23 changes: 10 additions & 13 deletions test/functional/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,21 @@ func GetGlanceDefaultSpec() map[string]interface{} {
"databaseUser": glanceTest.GlanceDatabaseUser,
"serviceUser": glanceName.Name,
"secret": SecretName,
//"glanceAPIInternal": GetGlanceAPIDefaultSpec(GlanceAPITypeInternal),
//"glanceAPIExternal": GetGlanceAPIDefaultSpec(GlanceAPITypeExternal),
"glances": GetGlanceAPIDefaultSpec(GlanceAPITypeExternal),
"type": "split",
"storageRequest": glanceTest.GlancePVCSize,
"glanceAPI": GetGlanceAPIDefaultSpec(GlanceAPITypeSingle),
"type": "split",
"storageRequest": glanceTest.GlancePVCSize,
}
}

func GetGlanceDefaultSpecWithQuota() map[string]interface{} {
return map[string]interface{}{
"databaseInstance": "openstack",
"databaseUser": glanceTest.GlanceDatabaseUser,
"serviceUser": glanceName.Name,
"secret": SecretName,
"glanceAPIInternal": GetGlanceAPIDefaultSpec(GlanceAPITypeInternal),
"glanceAPIExternal": GetGlanceAPIDefaultSpec(GlanceAPITypeExternal),
"storageRequest": glanceTest.GlancePVCSize,
"quotas": glanceTest.GlanceQuotas,
"databaseInstance": "openstack",
"databaseUser": glanceTest.GlanceDatabaseUser,
"serviceUser": glanceName.Name,
"secret": SecretName,
"glanceAPI": GetGlanceAPIDefaultSpec(GlanceAPITypeSingle),
"storageRequest": glanceTest.GlancePVCSize,
"quotas": glanceTest.GlanceQuotas,
}
}

Expand Down
1 change: 0 additions & 1 deletion test/functional/glance_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ var _ = Describe("Glance controller", func() {
glance := GetGlance(glanceName)
Expect(glance.Spec.ContainerImage).To(Equal(glancev1.GlanceAPIContainerImage))
Expect(glance.Spec.GlanceAPI.ContainerImage).To(Equal(glancev1.GlanceAPIContainerImage))
//Expect(glance.Spec.GlanceAPIs.GlanceAPIExternal.ContainerImage).To(Equal(glancev1.GlanceAPIContainerImage))
})
It("should not have a pvc yet", func() {
AssertPVCDoesNotExist(glanceTest.Instance)
Expand Down
7 changes: 1 addition & 6 deletions test/kuttl/tests/glance_scale/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ spec:
debug = true
databaseInstance: openstack
databaseUser: glance
glanceAPIInternal:
containerImage: quay.io/podified-antelope-centos9/openstack-glance-api:current-podified
debug:
service: false
replicas: 1
glanceAPIExternal:
glanceAPI:
containerImage: quay.io/podified-antelope-centos9/openstack-glance-api:current-podified
debug:
service: false
Expand Down
4 changes: 1 addition & 3 deletions test/kuttl/tests/glance_scale/02-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ kind: Glance
metadata:
name: glance
spec:
glanceAPIInternal:
replicas: 2
glanceAPIExternal:
glanceAPI:
replicas: 2
status:
glanceAPIExternalReadyCount: 2
Expand Down
3 changes: 1 addition & 2 deletions test/kuttl/tests/glance_scale/02-scale-glanceapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
oc patch Glance -n $NAMESPACE glance --type='json' -p='[{"op": "replace", "path": "/spec/glanceAPIInternal/replicas", "value":2}]'
oc patch Glance -n $NAMESPACE glance --type='json' -p='[{"op": "replace", "path": "/spec/glanceAPIExternal/replicas", "value":2}]'
oc patch Glance -n $NAMESPACE glance --type='json' -p='[{"op": "replace", "path": "/spec/glanceAPI/replicas", "value":2}]'
Loading

0 comments on commit b750f93

Please sign in to comment.