Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove init flow #135

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,105 changes: 600 additions & 505 deletions controllers/placementapi_controller.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion kuttl-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ kind: TestSuite
reportFormat: JSON
reportName: kuttl-test-placement
namespace: placement-kuttl-tests
timeout: 180
timeout: 300
parallel: 1
suppress:
- events
3 changes: 3 additions & 0 deletions pkg/placement/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const (
// DatabaseName -
DatabaseName = "placement"

//config secret name
ConfigSecretName = "placement-config-data"

// PlacementPublicPort -
PlacementPublicPort int32 = 8778
// PlacementInternalPort -
Expand Down
11 changes: 0 additions & 11 deletions pkg/placement/dbsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,5 @@ func DbSyncJob(
},
}

initContainerDetails := APIDetails{
ContainerImage: instance.Spec.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,
}
job.Spec.Template.Spec.InitContainers = initContainer(initContainerDetails)

return job
}
12 changes: 0 additions & 12 deletions pkg/placement/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,5 @@ func Deployment(
deployment.Spec.Template.Spec.NodeSelector = instance.Spec.NodeSelector
}

initContainerDetails := APIDetails{
ContainerImage: instance.Spec.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(),
}
deployment.Spec.Template.Spec.InitContainers = initContainer(initContainerDetails)

return deployment, nil
}
96 changes: 0 additions & 96 deletions pkg/placement/initcontainer.go

This file was deleted.

58 changes: 11 additions & 47 deletions pkg/placement/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,27 @@ import (
// getVolumes - service volumes
func getVolumes(name string) []corev1.Volume {
var scriptsVolumeDefaultMode int32 = 0755
var config0640AccessMode int32 = 0640
var configMode int32 = 0640

return []corev1.Volume{
{
Name: "scripts",
VolumeSource: corev1.VolumeSource{
ConfigMap: &corev1.ConfigMapVolumeSource{
Secret: &corev1.SecretVolumeSource{
DefaultMode: &scriptsVolumeDefaultMode,
LocalObjectReference: corev1.LocalObjectReference{
Name: name + "-scripts",
},
SecretName: name + "-scripts",
},
},
},
{
Name: "config-data",
VolumeSource: corev1.VolumeSource{
ConfigMap: &corev1.ConfigMapVolumeSource{
DefaultMode: &config0640AccessMode,
LocalObjectReference: corev1.LocalObjectReference{
Name: name + "-config-data",
},
Secret: &corev1.SecretVolumeSource{
DefaultMode: &configMode,
SecretName: name + "-config-data",
},
},
},
{
Name: "config-data-merged",
VolumeSource: corev1.VolumeSource{
EmptyDir: &corev1.EmptyDirVolumeSource{Medium: ""},
},
},
{
Name: "logs",
VolumeSource: corev1.VolumeSource{
Expand All @@ -63,55 +53,29 @@ func getVolumes(name string) []corev1.Volume {

}

// getInitVolumeMounts - general init task VolumeMounts
func getInitVolumeMounts() []corev1.VolumeMount {
// getVolumeMounts - general VolumeMounts
func getVolumeMounts(serviceName string) []corev1.VolumeMount {
return []corev1.VolumeMount{
{
Name: "scripts",
MountPath: "/usr/local/bin/container-scripts",
ReadOnly: true,
},
{
Name: "config-data",
MountPath: "/var/lib/config-data/default",
ReadOnly: true,
},
{
Name: "config-data-merged",
MountPath: "/var/lib/config-data/merged",
ReadOnly: false,
},
{
Name: "logs",
MountPath: "/var/log/placement",
ReadOnly: false,
},
}
}

// getVolumeMounts - general VolumeMounts
func getVolumeMounts(serviceName string) []corev1.VolumeMount {
return []corev1.VolumeMount{
{
Name: "scripts",
MountPath: "/usr/local/bin/container-scripts",
ReadOnly: true,
},
{
Name: "config-data-merged",
MountPath: "/var/lib/config-data/merged",
Name: "config-data",
MountPath: "/var/lib/openstack/config",
ReadOnly: false,
},
{
Name: "config-data-merged",
Name: "config-data",
MountPath: "/var/lib/kolla/config_files/config.json",
SubPath: "placement-" + serviceName + "-config.json",
ReadOnly: true,
},
{
Name: "logs",
MountPath: "/var/log/placement",
ReadOnly: false,
},
}
}
36 changes: 0 additions & 36 deletions templates/common/common.sh

This file was deleted.

46 changes: 0 additions & 46 deletions templates/placementapi/bin/init.sh

This file was deleted.

19 changes: 9 additions & 10 deletions templates/placementapi/config/placement-api-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
"command": "/usr/sbin/httpd -DFOREGROUND",
"config_files": [
{
"source": "/var/lib/config-data/merged/placement.conf",
"source": "/var/lib/openstack/config/placement.conf",
"dest": "/etc/placement/placement.conf",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually we want to use /etc/placement/placement.conf.d/ but that can be done separately. Also at that point we want to put an empty file to /etc/placement/placement.conf as the container image put the generated sample config file there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack, should I create new issue or this will be handle as a part of different feature/issue?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please either create an issue or a quick follow up PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 826dafd

"owner": "placement",
"perm": "0600"
},
{
"source": "/var/lib/config-data/merged/custom.conf",
"dest": "/etc/placement/placement.conf.d/custom.conf",
"owner": "placement",
"perm": "0600"
},
{
"source": "/var/lib/config-data/merged/httpd.conf",
"source": "/var/lib/openstack/config/httpd.conf",
"dest": "/etc/httpd/conf/httpd.conf",
"owner": "apache",
"perm": "0644"
},
{
"source": "/var/lib/config-data/merged/ssl.conf",
"source": "/var/lib/openstack/config/custom.conf",
"dest": "/etc/placement/placement.conf.d/custom.conf",
"owner": "placement",
"perm": "0600"
},
{
"source": "/var/lib/openstack/config/ssl.conf",
"dest": "/etc/httpd/conf.d/ssl.conf",
"owner": "apache",
"perm": "0644"
Expand All @@ -41,7 +41,6 @@
"optional": true,
"merge": true
}

],
"permissions": [
{
Expand Down
4 changes: 2 additions & 2 deletions templates/placementapi/config/placement-dbsync-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"command": "placement-manage db sync",
"config_files": [
{
"source": "/var/lib/config-data/merged/placement.conf",
"source": "/var/lib/openstack/config/placement.conf",
"dest": "/etc/placement/placement.conf",
"owner": "placement",
"perm": "0600"
},
{
"source": "/var/lib/config-data/merged/custom.conf",
"source": "/var/lib/openstack/config/custom.conf",
"dest": "/etc/placement/placement.conf.d/custom.conf",
"owner": "placement",
"perm": "0600"
Expand Down
Loading
Loading