Skip to content

Commit

Permalink
Eliminate init containers and their artifacts
Browse files Browse the repository at this point in the history
Init containers are no longer required now that the controllers
fully maintain the each service's config files.
  • Loading branch information
ASBishop committed Jun 9, 2023
1 parent 4b5685e commit d177df3
Show file tree
Hide file tree
Showing 26 changed files with 6 additions and 548 deletions.
3 changes: 0 additions & 3 deletions api/bases/cinder.openstack.org_cinderapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ spec:
type: string
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down
3 changes: 0 additions & 3 deletions api/bases/cinder.openstack.org_cinderbackups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ spec:
type: string
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down
15 changes: 0 additions & 15 deletions api/bases/cinder.openstack.org_cinders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ spec:
type: array
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down Expand Up @@ -143,9 +140,6 @@ spec:
type: array
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down Expand Up @@ -212,9 +206,6 @@ spec:
type: array
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down Expand Up @@ -282,9 +273,6 @@ spec:
type: array
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down Expand Up @@ -350,9 +338,6 @@ spec:
type: string
debug:
properties:
dbInitContainer:
default: false
type: boolean
dbSync:
default: false
type: boolean
Expand Down
3 changes: 0 additions & 3 deletions api/bases/cinder.openstack.org_cinderschedulers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ spec:
type: string
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down
3 changes: 0 additions & 3 deletions api/bases/cinder.openstack.org_cindervolumes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ spec:
type: string
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down
8 changes: 0 additions & 8 deletions api/v1beta1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ type PasswordSelector struct {
// CinderDebug indicates whether certain stages of Cinder deployment should
// pause in debug mode
type CinderDebug struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default=false
// dbInitContainer enable debug (waits until /tmp/stop-init-container disappears)
DBInitContainer bool `json:"dbInitContainer"`
// +kubebuilder:validation:Optional
// +kubebuilder:default=false
// dbSync enable debug
Expand All @@ -118,10 +114,6 @@ type CinderDebug struct {
// CinderServiceDebug indicates whether certain stages of Cinder service
// deployment should pause in debug mode
type CinderServiceDebug struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default=false
// initContainer enable debug (waits until /tmp/stop-init-container disappears)
InitContainer bool `json:"initContainer"`
// +kubebuilder:validation:Optional
// +kubebuilder:default=false
// service enable debug
Expand Down
3 changes: 0 additions & 3 deletions config/crd/bases/cinder.openstack.org_cinderapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ spec:
type: string
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down
3 changes: 0 additions & 3 deletions config/crd/bases/cinder.openstack.org_cinderbackups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ spec:
type: string
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down
15 changes: 0 additions & 15 deletions config/crd/bases/cinder.openstack.org_cinders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ spec:
type: array
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down Expand Up @@ -143,9 +140,6 @@ spec:
type: array
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down Expand Up @@ -212,9 +206,6 @@ spec:
type: array
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down Expand Up @@ -282,9 +273,6 @@ spec:
type: array
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down Expand Up @@ -350,9 +338,6 @@ spec:
type: string
debug:
properties:
dbInitContainer:
default: false
type: boolean
dbSync:
default: false
type: boolean
Expand Down
3 changes: 0 additions & 3 deletions config/crd/bases/cinder.openstack.org_cinderschedulers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ spec:
type: string
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down
3 changes: 0 additions & 3 deletions config/crd/bases/cinder.openstack.org_cindervolumes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ spec:
type: string
debug:
properties:
initContainer:
default: false
type: boolean
service:
default: false
type: boolean
Expand Down
11 changes: 5 additions & 6 deletions controllers/cinder_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -825,12 +825,11 @@ func (r *CinderReconciler) generateServiceConfigMaps(
cms := []util.Template{
// ScriptsConfigMap
{
Name: fmt.Sprintf("%s-scripts", instance.Name),
Namespace: instance.Namespace,
Type: util.TemplateTypeScripts,
InstanceType: instance.Kind,
AdditionalTemplate: map[string]string{"common.sh": "/common/common.sh"},
Labels: cmLabels,
Name: fmt.Sprintf("%s-scripts", instance.Name),
Namespace: instance.Namespace,
Type: util.TemplateTypeScripts,
InstanceType: instance.Kind,
Labels: cmLabels,
},
// ConfigMap
{
Expand Down
13 changes: 0 additions & 13 deletions pkg/cinder/dbsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,5 @@ func DbSyncJob(instance *cinderv1beta1.Cinder, labels map[string]string, annotat
},
}

initContainerDetails := APIDetails{
ContainerImage: instance.Spec.CinderAPI.ContainerImage,
DatabaseHost: instance.Status.DatabaseHostname,
DatabaseUser: instance.Spec.DatabaseUser,
DatabaseName: DatabaseName,
OSPSecret: instance.Spec.Secret,
DBPasswordSelector: instance.Spec.PasswordSelectors.Database,
UserPasswordSelector: instance.Spec.PasswordSelectors.Service,
VolumeMounts: GetInitVolumeMounts(dbSyncExtraMounts, DbsyncPropagation),
Debug: instance.Spec.Debug.DBInitContainer,
}
job.Spec.Template.Spec.InitContainers = InitContainer(initContainerDetails)

return job
}
128 changes: 0 additions & 128 deletions pkg/cinder/initcontainer.go

This file was deleted.

25 changes: 1 addition & 24 deletions pkg/cinder/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,30 +131,7 @@ func GetVolumes(name string, storageSvc bool, extraVol []cinderv1beta1.CinderExt
return res
}

// GetInitVolumeMounts - Nova Control Plane init task VolumeMounts
func GetInitVolumeMounts(extraVol []cinderv1beta1.CinderExtraVolMounts, svc []storage.PropagationType) []corev1.VolumeMount {
vm := []corev1.VolumeMount{
{
Name: "scripts",
MountPath: "/usr/local/bin/container-scripts",
ReadOnly: true,
},
{
Name: "config-data",
MountPath: "/var/lib/config-data/default",
ReadOnly: true,
},
}

for _, exv := range extraVol {
for _, vol := range exv.Propagate(svc) {
vm = append(vm, vol.Mounts...)
}
}
return vm
}

// GetVolumeMounts - Nova Control Plane VolumeMounts
// GetVolumeMounts - Cinder Control Plane VolumeMounts
func GetVolumeMounts(storageSvc bool, extraVol []cinderv1beta1.CinderExtraVolMounts, svc []storage.PropagationType) []corev1.VolumeMount {
res := []corev1.VolumeMount{
{
Expand Down
Loading

0 comments on commit d177df3

Please sign in to comment.