Skip to content

Commit

Permalink
Introduce OpenStackClientSpecCore
Browse files Browse the repository at this point in the history
Aligns OpenStackClient api with other services and introduce an
OpenStackClientSpecCore to hide the `containerImage` from the
OpenStackControlPlane CRD.

before:
  openstackclient:
    template:
      containerImage: ""
      openStackConfigMap: openstack-config
      openStackConfigSecret: openstack-config-secret
after:
  openstackclient:
    template:
      openStackConfigMap: openstack-config
      openStackConfigSecret: openstack-config-secret

Signed-off-by: Martin Schuppert <[email protected]>
  • Loading branch information
stuggi committed Jun 12, 2024
1 parent 9351c6f commit 733c087
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
3 changes: 0 additions & 3 deletions apis/bases/core.openstack.org_openstackcontrolplanes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11041,8 +11041,6 @@ spec:
properties:
caBundleSecretName:
type: string
containerImage:
type: string
nodeSelector:
additionalProperties:
type: string
Expand All @@ -11054,7 +11052,6 @@ spec:
default: openstack-config-secret
type: string
required:
- containerImage
- openStackConfigMap
- openStackConfigSecret
type: object
Expand Down
5 changes: 5 additions & 0 deletions apis/client/v1beta1/openstackclient_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ const (

// OpenStackClientSpec defines the desired state of OpenStackClient
type OpenStackClientSpec struct {
OpenStackClientSpecCore `json:",inline"`

// +kubebuilder:validation:Required
// ContainerImage for the the OpenstackClient container (will be set to environmental default if empty)
ContainerImage string `json:"containerImage"`
}

// OpenStackClientSpecCore defines the desired state of OpenStackClient
type OpenStackClientSpecCore struct {
// +kubebuilder:validation:Required
// +kubebuilder:default=openstack-config
// OpenStackConfigMap is the name of the ConfigMap containing the clouds.yaml
Expand Down
22 changes: 19 additions & 3 deletions apis/client/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apis/core/v1beta1/openstackcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ type OpenStackClientSection struct {
// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
// Template - Overrides to use when creating the OpenStackClient Resource
Template v1beta1.OpenStackClientSpec `json:"template,omitempty"`
Template v1beta1.OpenStackClientSpecCore `json:"template,omitempty"`
}

// OpenStackControlPlaneStatus defines the observed state of OpenStackControlPlane
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11041,8 +11041,6 @@ spec:
properties:
caBundleSecretName:
type: string
containerImage:
type: string
nodeSelector:
additionalProperties:
type: string
Expand All @@ -11054,7 +11052,6 @@ spec:
default: openstack-config-secret
type: string
required:
- containerImage
- openStackConfigMap
- openStackConfigSecret
type: object
Expand Down
2 changes: 1 addition & 1 deletion pkg/openstack/openstackclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func ReconcileOpenStackClient(ctx context.Context, instance *corev1.OpenStackCon

Log.Info("Reconciling OpenStackClient", "OpenStackClient.Namespace", instance.Namespace, "OpenStackClient.Name", openstackclient.Name)
op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), openstackclient, func() error {
instance.Spec.OpenStackClient.Template.DeepCopyInto(&openstackclient.Spec)
instance.Spec.OpenStackClient.Template.DeepCopyInto(&openstackclient.Spec.OpenStackClientSpecCore)

openstackclient.Spec.ContainerImage = *version.Status.ContainerImages.OpenstackClientImage

Expand Down

0 comments on commit 733c087

Please sign in to comment.