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

[2/3] Add Inline Solution for ConfigMaps #593

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

linki
Copy link
Member

@linki linki commented Feb 22, 2024

This is a solution for Inline ConfigMaps. It follows the design of other inline resources such as HPAs. It could be used as a blueprint for inline PCS as well.

Please also see the previous and follow up PRs that are based on this one:

Let's also do this:

@linki linki force-pushed the configmap-and-secret-refs branch 4 times, most recently from 16324de to f4ab763 Compare February 27, 2024 11:18
controller/stack_resources.go Outdated Show resolved Hide resolved
@linki linki force-pushed the configmap-inline-another-try branch from c463eef to 4371dc9 Compare February 27, 2024 11:40
Base automatically changed from configmap-and-secret-refs to master February 27, 2024 17:24
@linki linki changed the base branch from master to test-refactoring February 29, 2024 15:32
@linki linki force-pushed the configmap-inline-another-try branch 2 times, most recently from 9c57062 to f732160 Compare February 29, 2024 15:40
Base automatically changed from test-refactoring to master February 29, 2024 16:31
@linki linki force-pushed the configmap-inline-another-try branch from f732160 to bb4468a Compare March 7, 2024 13:15
@linki linki changed the base branch from master to configuration-resources-tests March 7, 2024 13:15
@linki linki force-pushed the configmap-inline-another-try branch from bb4468a to ee45eb2 Compare March 7, 2024 13:31
@linki linki changed the title Inline Solution for ConfigMaps [2/3] Add Inline Solution for ConfigMaps Mar 7, 2024
Base automatically changed from configuration-resources-tests to master March 7, 2024 14:55
@linki linki force-pushed the configmap-inline-another-try branch from ee45eb2 to d24e5a4 Compare March 7, 2024 15:00

base := &v1.ConfigMap{
ObjectMeta: metaObj,
Data: configResource.ConfigMap.Data,
Copy link
Member Author

@linki linki Mar 7, 2024

Choose a reason for hiding this comment

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

I think for the (original) reference approach, we could just do a

client.CoreV1().ConfigMaps(metaObj.Namespace).Get(ctx, configResource.GetName(), metav1.GetOptions{})

to fetch the reference ConfigMap's data and other fields. We'd need to pass-in the Kubernetes client for that but everything else would stay the same.

Still leaves the race condition problem...

// ConfigMap removed
if desiredConfigMap == nil {
if existingConfigMap != nil {
err := c.client.CoreV1().ConfigMaps(existingConfigMap.Namespace).Delete(ctx, existingConfigMap.Name, metav1.DeleteOptions{})
Copy link
Member Author

Choose a reason for hiding this comment

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

This doesn't handle the case where a ConfigMap with the same name already exists in the cluster but isn't defined in the StackSet definition as a configurationResource. In that case the resource would be deleted. I think the same would happen for HPAs, Ingress, RouteGroups etc. but maybe we want to do an owner check similar to how we already do it for reference ConfigMaps (where we don't touch the resource if it's not owned by us).

@linki linki force-pushed the configmap-inline-another-try branch from d24e5a4 to df18af0 Compare March 19, 2024 11:02
@linki linki changed the title [2/3] Add Inline Solution for ConfigMaps [2b/3] Add Inline Solution for ConfigMaps Mar 19, 2024
@linki linki changed the title [2b/3] Add Inline Solution for ConfigMaps [2/3] Add Inline Solution for ConfigMaps Mar 19, 2024
@linki linki force-pushed the configmap-inline-another-try branch from df18af0 to b6abb34 Compare March 19, 2024 13:50
@linki linki changed the base branch from master to e2e-sample-for-reference March 19, 2024 13:52
Base automatically changed from e2e-sample-for-reference to master March 19, 2024 14:50
@linki linki force-pushed the configmap-inline-another-try branch from b6abb34 to 19a2f7a Compare March 19, 2024 14:53
@linki linki force-pushed the configmap-inline-another-try branch 2 times, most recently from 433bc16 to ef7d88d Compare April 18, 2024 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant