-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch represents an implementation of the proposal [1] and aligns the glance-operator with the work already done in Cinder and the other storage operators. There are a few relevant changes in the bootstrap process of Glance, in particular: - It stops using an init container to generate the snippet files that configure each glanceAPI service. The logic that was previously implemented in the Init Container has been moved to the Controllers, where config files are generated and stored in k8s Secrets. Init Containers are fully removed from the bootstrap process; - It uses Kolla to copy the generated content to the target directory /etc/glance/glance.conf.d, which is used by each API service to run; - The relevant content, including scripts, previously stored in a ConfigMap, are now stored in a corresponding k8s Secret, which is mounted to the GlanceAPI deployment Pods (hence no additional calls to GetVolume/GetVolumeMounts are required); - A total of 4 config snippet files are generated: - 00-config.conf contains global settings that are common to every GlanceAPI Pod, including ones that are derived from deployment secrets (e.g. database password, etc.) - 01-config.conf contains the global customServiceConfig settings that apply to every GlanceAPI service. - 02-config.conf contains the customServiceConfig settings that are specific to each service. - 03-config.conf contains secrets specified by each service's customServiceConfigSecrets. - glance-image-import.conf has been removed, and the default config has been added to 00-config.conf, which is the common file generated by the umbrella Glance controller; - logging.conf has been removed as it's no longer required in the switch to a side container approach for logging purposes; - functional tests are aligned to the use of k8s Secrets instead of the old pattern based on ConfigMaps; - kuttl tests are updated and the 'initContainer' has been removed. - dbsync now mounts only the required files (a minimal 00-config.conf) and a db-sync-config.json containing the command run through kolla. [1] openstack-k8s-operators/dev-docs#31 Signed-off-by: Francesco Pantano <[email protected]>
- Loading branch information
Showing
19 changed files
with
278 additions
and
599 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
Copyright 2022. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package controllers | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"github.com/openstack-k8s-operators/lib-common/modules/common/env" | ||
"github.com/openstack-k8s-operators/lib-common/modules/common/helper" | ||
"github.com/openstack-k8s-operators/lib-common/modules/common/secret" | ||
"github.com/openstack-k8s-operators/lib-common/modules/common/util" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
func GenerateConfigsGeneric( | ||
ctx context.Context, h *helper.Helper, | ||
instance client.Object, | ||
envVars *map[string]env.Setter, | ||
templateParameters map[string]interface{}, | ||
customData map[string]string, | ||
cmLabels map[string]string, | ||
scripts bool, | ||
) error { | ||
|
||
cms := []util.Template{ | ||
// Templates where the GlanceAPI config is stored | ||
{ | ||
Name: fmt.Sprintf("%s-config-data", instance.GetName()), | ||
Namespace: instance.GetNamespace(), | ||
Type: util.TemplateTypeConfig, | ||
InstanceType: instance.GetObjectKind().GroupVersionKind().Kind, | ||
ConfigOptions: templateParameters, | ||
CustomData: customData, | ||
Labels: cmLabels, | ||
}, | ||
} | ||
if scripts { | ||
cms = append(cms, util.Template{ | ||
Name: fmt.Sprintf("%s-scripts", instance.GetName()), | ||
Namespace: instance.GetNamespace(), | ||
Type: util.TemplateTypeScripts, | ||
InstanceType: instance.GetObjectKind().GroupVersionKind().Kind, | ||
Labels: cmLabels, | ||
}) | ||
} | ||
return secret.EnsureSecrets(ctx, h, instance, cms, envVars) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.