Skip to content

Commit

Permalink
Rename APIMessageBusSecretName for NoVNCProxy
Browse files Browse the repository at this point in the history
Correct name to be more accurate and improve testing
  • Loading branch information
mrkisaolamb committed Jun 14, 2023
1 parent 8aaec5d commit 158ae6c
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 42 deletions.
42 changes: 21 additions & 21 deletions api/v1beta1/novanovncproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ type NovaNoVNCProxySpec struct {
ServiceAccount string `json:"serviceAccount"`

// +kubebuilder:validation:Required
// APIMessageBusSecretName - the name of the Secret containing the
// CellMessageBusSecretName - the name of the Secret containing the
// transport URL information to use when accessing the API message
// bus.
APIMessageBusSecretName string `json:"apiMessageBusSecretName"`
CellMessageBusSecretName string `json:"cellMessageBusSecretName"`
}

// NovaNoVNCProxyStatus defines the observed state of NovaNoVNCProxy
Expand Down Expand Up @@ -194,26 +194,26 @@ func NewNovaNoVNCProxySpec(
novaCell NovaCellSpec,
) NovaNoVNCProxySpec {
noVNCProxSpec := NovaNoVNCProxySpec{
CellName: novaCell.CellName,
Secret: novaCell.Secret,
CellDatabaseHostname: novaCell.CellDatabaseHostname,
CellDatabaseUser: novaCell.CellDatabaseUser,
Debug: novaCell.Debug,
APIMessageBusSecretName: novaCell.CellMessageBusSecretName,
NovaServiceBase: NovaServiceBase{
ContainerImage: novaCell.NoVNCProxyServiceTemplate.ContainerImage,
Replicas: novaCell.NoVNCProxyServiceTemplate.Replicas,
NodeSelector: novaCell.NoVNCProxyServiceTemplate.NodeSelector,
CustomServiceConfig: novaCell.NoVNCProxyServiceTemplate.CustomServiceConfig,
DefaultConfigOverwrite: novaCell.NoVNCProxyServiceTemplate.DefaultConfigOverwrite,
Resources: novaCell.NoVNCProxyServiceTemplate.Resources,
NetworkAttachments: novaCell.NoVNCProxyServiceTemplate.NetworkAttachments,
CellName: novaCell.CellName,
Secret: novaCell.Secret,
CellDatabaseHostname: novaCell.CellDatabaseHostname,
CellDatabaseUser: novaCell.CellDatabaseUser,
Debug: novaCell.Debug,
CellMessageBusSecretName: novaCell.CellMessageBusSecretName,
NovaServiceBase: NovaServiceBase{
ContainerImage: novaCell.NoVNCProxyServiceTemplate.ContainerImage,
Replicas: novaCell.NoVNCProxyServiceTemplate.Replicas,
NodeSelector: novaCell.NoVNCProxyServiceTemplate.NodeSelector,
CustomServiceConfig: novaCell.NoVNCProxyServiceTemplate.CustomServiceConfig,
DefaultConfigOverwrite: novaCell.NoVNCProxyServiceTemplate.DefaultConfigOverwrite,
Resources: novaCell.NoVNCProxyServiceTemplate.Resources,
NetworkAttachments: novaCell.NoVNCProxyServiceTemplate.NetworkAttachments,
},
KeystoneAuthURL: novaCell.KeystoneAuthURL,
ServiceUser: novaCell.ServiceUser,
PasswordSelectors: novaCell.PasswordSelectors,
ServiceAccount: novaCell.ServiceAccount,
ExternalEndpoints: novaCell.NoVNCProxyServiceTemplate.ExternalEndpoints,
KeystoneAuthURL: novaCell.KeystoneAuthURL,
ServiceUser: novaCell.ServiceUser,
PasswordSelectors: novaCell.PasswordSelectors,
ServiceAccount: novaCell.ServiceAccount,
ExternalEndpoints: novaCell.NoVNCProxyServiceTemplate.ExternalEndpoints,
}
return noVNCProxSpec
}
12 changes: 6 additions & 6 deletions config/crd/bases/nova.openstack.org_novanovncproxies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ spec:
spec:
description: NovaNoVNCProxySpec defines the desired state of NovaNoVNCProxy
properties:
apiMessageBusSecretName:
description: APIMessageBusSecretName - the name of the Secret containing
the transport URL information to use when accessing the API message
bus.
type: string
cellDatabaseHostname:
description: CellDatabaseHostname - hostname to use when accessing
the cell DB
Expand All @@ -62,6 +57,11 @@ spec:
description: CellDatabaseUser - username to use when accessing the
cell DB
type: string
cellMessageBusSecretName:
description: CellMessageBusSecretName - the name of the Secret containing
the transport URL information to use when accessing the API message
bus.
type: string
cellName:
description: CellName is the name of the Nova Cell this novncproxy
belongs to.
Expand Down Expand Up @@ -266,8 +266,8 @@ spec:
to register in keystone
type: string
required:
- apiMessageBusSecretName
- cellDatabaseHostname
- cellMessageBusSecretName
- cellName
- keystoneAuthURL
- secret
Expand Down
1 change: 1 addition & 0 deletions controllers/novacell_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,5 +336,6 @@ func (r *NovaCellReconciler) SetupWithManager(mgr ctrl.Manager) error {
For(&novav1.NovaCell{}).
Owns(&novav1.NovaConductor{}).
Owns(&novav1.NovaMetadata{}).
Owns(&novav1.NovaNoVNCProxy{}).
Complete(r)
}
10 changes: 5 additions & 5 deletions controllers/novanovncproxy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,16 @@ func (r *NovaNoVNCProxyReconciler) generateConfigs(
return err
}

apiMessageBusSecret := &corev1.Secret{}
cellMessageBusSecretName := &corev1.Secret{}
secretName = types.NamespacedName{
Namespace: instance.Namespace,
Name: instance.Spec.APIMessageBusSecretName,
Name: instance.Spec.CellMessageBusSecretName,
}
err = h.GetClient().Get(ctx, secretName, apiMessageBusSecret)
err = h.GetClient().Get(ctx, secretName, cellMessageBusSecretName)
if err != nil {
util.LogForObject(
h, "Failed reading Secret", instance,
"APIMessageBusSecretName", instance.Spec.APIMessageBusSecretName)
"CellMessageBusSecretName", instance.Spec.CellMessageBusSecretName)
return err
}

Expand All @@ -316,7 +316,7 @@ func (r *NovaNoVNCProxyReconciler) generateConfigs(
"nova_novncproxy_listen_port": novncproxy.NoVNCProxyPort,
"api_interface_address": "", // fixme
"public_protocol": "http", // fixme
"transport_url": string(apiMessageBusSecret.Data["transport_url"]),
"transport_url": string(cellMessageBusSecretName.Data["transport_url"]),
"openstack_cacert": "", // fixme
"openstack_region_name": "regionOne", // fixme
"default_project_domain": "Default", // fixme
Expand Down
1 change: 1 addition & 0 deletions templates/libvirt_virtqemud/qemu.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ max_files = 32768
max_processes = 131072
vnc_tls = 0
vnc_tls_x509_verify = 0
vnc_listen = 0.0.0.0
default_tls_x509_verify = 1
nbd_tls = 0
migration_port_min = 61152
Expand Down
16 changes: 8 additions & 8 deletions test/functional/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -742,14 +742,14 @@ func GetNovaNoVNCProxy(name types.NamespacedName) *novav1.NovaNoVNCProxy {

func GetDefaultNovaNoVNCProxySpec() map[string]interface{} {
return map[string]interface{}{
"secret": SecretName,
"cellDatabaseHostname": "nova-cell-db-hostname",
"containerImage": ContainerImage,
"keystoneAuthURL": "keystone-auth-url",
"apiMessageBusSecretName": MessageBusSecretName,
"serviceAccount": "nova",
"cellName": "cell1",
"registeredCells": map[string]string{},
"secret": SecretName,
"cellDatabaseHostname": "nova-cell-db-hostname",
"containerImage": ContainerImage,
"keystoneAuthURL": "keystone-auth-url",
"cellMessageBusSecretName": MessageBusSecretName,
"serviceAccount": "nova",
"cellName": "cell1",
"registeredCells": map[string]string{},
}
}

Expand Down
8 changes: 6 additions & 2 deletions test/functional/nova_novncproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ var _ = Describe("NovaNoVNCProxy controller", func() {
Expect(instance.Status.ReadyCount).To(Equal(int32(0)))
})
It("is missing the secret", func() {
th.ExpectCondition(
th.ExpectConditionWithDetails(
novaNames.NoVNCProxyName,
ConditionGetterFunc(NoVNCProxyConditionGetter),
condition.InputReadyCondition,
corev1.ConditionFalse,
condition.RequestedReason,
"Input data resources missing: secret/test-secret",
)
})
})
Expand Down Expand Up @@ -120,11 +122,13 @@ var _ = Describe("NovaNoVNCProxy controller", func() {
})

It("reports that the inputs are not ready", func() {
th.ExpectCondition(
th.ExpectConditionWithDetails(
novaNames.NoVNCProxyName,
ConditionGetterFunc(NoVNCProxyConditionGetter),
condition.InputReadyCondition,
corev1.ConditionFalse,
condition.ErrorReason,
"Input data error occurred field 'NovaPassword' not found in secret/test-secret",
)
})
})
Expand Down

0 comments on commit 158ae6c

Please sign in to comment.