Skip to content

Commit

Permalink
Use my.cnf from config-data instead of subpath mount
Browse files Browse the repository at this point in the history
Fixed a potential race condition in the octavia amphora controllers,
config-data is only mounted in the init container and my.cnf is mounted
as a subpath of the config-data mount in the "main" container. It may
trigger some errors because the config-data is unmounted when kubernetes
tries to mount the subpath.
Copy my.cnf from the config-data-merged mount, using the json config
file.

JIRA: OSPRH-9128
  • Loading branch information
gthiemonge committed Aug 1, 2024
1 parent 7d05f09 commit be5fe24
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 10 deletions.
6 changes: 0 additions & 6 deletions pkg/octavia/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,5 @@ func GetVolumeMounts(serviceName string) []corev1.VolumeMount {
SubPath: serviceName + "-config.json",
ReadOnly: true,
},
{
Name: "config-data",
MountPath: "/etc/my.cnf",
SubPath: "my.cnf",
ReadOnly: true,
},
}
}
6 changes: 6 additions & 0 deletions templates/octavia/config/db-sync-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
"dest": "/etc/octavia/octavia.conf",
"owner": "octavia",
"perm": "0600"
},
{
"source": "/var/lib/config-data/merged/my.cnf",
"dest": "/etc/my.cnf",
"owner": "octavia",
"perm": "0644"
}
],
"permissions": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"dest": "/etc/octavia/octavia.conf.d/custom.conf",
"owner": "octavia",
"perm": "0600"
},
{
"source": "/var/lib/config-data/merged/my.cnf",
"dest": "/etc/my.cnf",
"owner": "octavia",
"perm": "0644"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"dest": "/etc/octavia/octavia.conf.d/custom.conf",
"owner": "octavia",
"perm": "0600"
},
{
"source": "/var/lib/config-data/merged/my.cnf",
"dest": "/etc/my.cnf",
"owner": "octavia",
"perm": "0644"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"dest": "/etc/octavia/octavia.conf.d/custom.conf",
"owner": "octavia",
"perm": "0600"
},
{
"source": "/var/lib/config-data/merged/my.cnf",
"dest": "/etc/my.cnf",
"owner": "octavia",
"perm": "0644"
}
]
}
6 changes: 6 additions & 0 deletions templates/octaviaapi/config/octavia-api-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
"owner": "octavia",
"perm": "0600",
"optional": true
},
{
"source": "/var/lib/config-data/merged/my.cnf",
"dest": "/etc/my.cnf",
"owner": "octavia",
"perm": "0644"
}
],
"permissions": [
Expand Down
6 changes: 6 additions & 0 deletions templates/octaviaapi/config/octavia-driver-agent-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
"perm": "0400",
"optional": true,
"merge": true
},
{
"source": "/var/lib/config-data/merged/my.cnf",
"dest": "/etc/my.cnf",
"owner": "octavia",
"perm": "0644"
}
],
"permissions": [
Expand Down
4 changes: 0 additions & 4 deletions tests/kuttl/tests/octavia_tls/02-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ spec:
name: config-data-merged
readOnly: true
subPath: octavia-api-config.json
- mountPath: /etc/my.cnf
name: config-data
- mountPath: /run/octavia
name: octavia-run
- mountPath: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
Expand Down Expand Up @@ -194,8 +192,6 @@ spec:
name: config-data-merged
readOnly: true
subPath: octavia-driver-agent-config.json
- mountPath: /etc/my.cnf
name: config-data
- mountPath: /run/octavia
name: octavia-run
- mountPath: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
Expand Down

0 comments on commit be5fe24

Please sign in to comment.