Skip to content

Commit

Permalink
Drop container-scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Fabricio Aguiar <[email protected]>
  • Loading branch information
fao89 committed Sep 27, 2024
1 parent 5840157 commit d5ee8a8
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 105 deletions.
21 changes: 2 additions & 19 deletions controllers/heat_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,6 @@ func (r *HeatReconciler) reconcileNormal(ctx context.Context, instance *heatv1be

//
// create Secret required for Heat input
// - %-scripts secret holding scripts to e.g. bootstrap the service
// - %-config secret holding minimal heat config required to get the service up, user can add additional files to be added to the service
// - parameters which has passwords gets added from the OpenStack secret via the init container
//
Expand Down Expand Up @@ -895,7 +894,7 @@ func (r *HeatReconciler) engineDeploymentCreateOrUpdate(
return deployment, op, err
}

// generateServiceSecrets - create create secrets which hold scripts and service configuration
// generateServiceSecrets - create secrets which hold service configuration
func (r *HeatReconciler) generateServiceSecrets(
ctx context.Context,
instance *heatv1beta1.Heat,
Expand All @@ -906,7 +905,6 @@ func (r *HeatReconciler) generateServiceSecrets(
) error {
//
// create Secret required for heat input
// - %-scripts secret holding scripts to e.g. bootstrap the service
// - %-config secret holding minimal heat config required to get the service up, user can add additional files to be added to the service
// - parameters which has passwords gets added from the ospSecret via the init container
//
Expand Down Expand Up @@ -1277,25 +1275,10 @@ func generateCustomData(instance *heatv1beta1.Heat, tlsCfg *tls.Service, db *mar
// createSecretsTemplates - Takes inputs and renders the templates that will be used for our Secrets
func createSecretTemplates(instance *heatv1beta1.Heat, customData map[string]string, templateParameters map[string]interface{}, secretLabels map[string]string) []util.Template {
var (
scriptsSecretName = fmt.Sprintf("%s-scripts", instance.Name)
commonScriptPath = "/common/common.sh"
commonScriptName = "common.sh"
secretName = fmt.Sprintf("%s-config-data", instance.Name)
commonScriptMap = map[string]string{
commonScriptName: commonScriptPath,
}
secretName = fmt.Sprintf("%s-config-data", instance.Name)
)

return []util.Template{
// ScriptsSecret
{
Name: scriptsSecretName,
Namespace: instance.Namespace,
Type: util.TemplateTypeScripts,
InstanceType: instance.Kind,
AdditionalTemplate: commonScriptMap,
Labels: secretLabels,
},
// Secret
{
Name: secretName,
Expand Down
6 changes: 1 addition & 5 deletions controllers/heatapi_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,11 +590,7 @@ func (r *HeatAPIReconciler) reconcileNormal(ctx context.Context, instance *heatv
//
parentHeatName := heat.GetOwningHeatName(instance)

ctrlResult, err := r.getSecret(ctx, helper, instance, fmt.Sprintf("%s-scripts", parentHeatName), &secretVars)
if err != nil {
return ctrlResult, err
}
ctrlResult, err = r.getSecret(ctx, helper, instance, fmt.Sprintf("%s-config-data", parentHeatName), &secretVars)
ctrlResult, err := r.getSecret(ctx, helper, instance, fmt.Sprintf("%s-config-data", parentHeatName), &secretVars)
// note r.getSecret adds Conditions with condition.InputReadyWaitingMessage
// when secret is not found
if err != nil {
Expand Down
6 changes: 1 addition & 5 deletions controllers/heatcfnapi_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,11 +592,7 @@ func (r *HeatCfnAPIReconciler) reconcileNormal(ctx context.Context, instance *he
//
parentHeatName := heat.GetOwningHeatName(instance)

ctrlResult, err := r.getSecret(ctx, helper, instance, fmt.Sprintf("%s-scripts", parentHeatName), &secretVars)
if err != nil {
return ctrlResult, err
}
ctrlResult, err = r.getSecret(ctx, helper, instance, fmt.Sprintf("%s-config-data", parentHeatName), &secretVars)
ctrlResult, err := r.getSecret(ctx, helper, instance, fmt.Sprintf("%s-config-data", parentHeatName), &secretVars)
// note r.getSecret adds Conditions with condition.InputReadyWaitingMessage
// when secret is not found
if err != nil {
Expand Down
6 changes: 1 addition & 5 deletions controllers/heatengine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,7 @@ func (r *HeatEngineReconciler) reconcileNormal(
//
parentHeatName := heat.GetOwningHeatName(instance)

ctrlResult, err := r.getSecret(ctx, helper, instance, fmt.Sprintf("%s-scripts", parentHeatName), &secretVars)
if err != nil {
return ctrlResult, err
}
ctrlResult, err = r.getSecret(ctx, helper, instance, fmt.Sprintf("%s-config-data", parentHeatName), &secretVars)
ctrlResult, err := r.getSecret(ctx, helper, instance, fmt.Sprintf("%s-config-data", parentHeatName), &secretVars)
// note r.getSecret adds Conditions with condition.InputReadyWaitingMessage
// when secret is not found
if err != nil {
Expand Down
15 changes: 0 additions & 15 deletions pkg/heat/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,8 @@ import (

// GetVolumes ...
func GetVolumes(name string) []corev1.Volume {
var scriptsVolumeDefaultMode int32 = 0755

return []corev1.Volume{
{
Name: "scripts",
VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
DefaultMode: &scriptsVolumeDefaultMode,
SecretName: name + "-scripts",
},
},
},
{
Name: "config-data",
VolumeSource: corev1.VolumeSource{
Expand All @@ -55,11 +45,6 @@ func GetVolumes(name string) []corev1.Volume {
// GetVolumeMounts ...
func GetVolumeMounts() []corev1.VolumeMount {
return []corev1.VolumeMount{
{
Name: "scripts",
MountPath: "/usr/local/bin/container-scripts",
ReadOnly: true,
},
{
Name: "config-data",
MountPath: "/var/lib/config-data/default",
Expand Down
35 changes: 0 additions & 35 deletions templates/common/common.sh

This file was deleted.

21 changes: 0 additions & 21 deletions tests/kuttl/tests/heat_tls/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ spec:
- -c
- /usr/local/bin/kolla_httpd_setup && /usr/local/bin/kolla_start
volumeMounts:
- mountPath: /usr/local/bin/container-scripts
name: scripts
readOnly: true
- mountPath: /var/lib/config-data/default
name: config-data
- mountPath: /etc/my.cnf
Expand Down Expand Up @@ -124,10 +121,6 @@ spec:
readOnly: true
subPath: tls.key
volumes:
- name: scripts
secret:
defaultMode: 493
secretName: heat-scripts
- name: config-data
secret:
defaultMode: 420
Expand Down Expand Up @@ -164,9 +157,6 @@ spec:
- -c
- /usr/local/bin/kolla_httpd_setup && /usr/local/bin/kolla_start
volumeMounts:
- mountPath: /usr/local/bin/container-scripts
name: scripts
readOnly: true
- mountPath: /var/lib/config-data/default
name: config-data
- mountPath: /etc/my.cnf
Expand Down Expand Up @@ -198,10 +188,6 @@ spec:
readOnly: true
subPath: tls.key
volumes:
- name: scripts
secret:
defaultMode: 493
secretName: heat-scripts
- name: config-data
secret:
defaultMode: 420
Expand Down Expand Up @@ -238,9 +224,6 @@ spec:
- -c
- /usr/local/bin/kolla_start
volumeMounts:
- mountPath: /usr/local/bin/container-scripts
name: scripts
readOnly: true
- mountPath: /var/lib/config-data/default
name: config-data
- mountPath: /etc/my.cnf
Expand All @@ -256,10 +239,6 @@ spec:
readOnly: true
subPath: tls-ca-bundle.pem
volumes:
- name: scripts
secret:
defaultMode: 493
secretName: heat-scripts
- name: config-data
secret:
defaultMode: 420
Expand Down

0 comments on commit d5ee8a8

Please sign in to comment.