Skip to content

Conversation

@tonyo
Copy link
Collaborator

@tonyo tonyo commented Dec 28, 2025

Fixes #232 and another issue that didn't allow to create two config mounts with the same source config.

It should more closely mirror now the Compose behavior which also uses the full target path in the tar header and extracts it to the root:

@tonyo tonyo force-pushed the tonyo/fix-configs-nested-1 branch from 3d878ee to 486f80b Compare December 28, 2025 16:07
@tonyo tonyo marked this pull request as ready for review December 28, 2025 16:12
Copy link
Owner

@psviderski psviderski left a comment

Choose a reason for hiding this comment

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

Excellent! Just one note about the Equal implementation for the config mounts. We can do it in a separate PR. It's up to you to decide, just raising to not forget.

mount.Mode = &mode
}

configMounts = append(configMounts, mount)
Copy link
Owner

@psviderski psviderski Dec 29, 2025

Choose a reason for hiding this comment

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

Just found out that ContainerSpec.Equal depends on the order of config mounts. This is not a big deal as usually people update and deploy the same Compose file so the order of service.configs normally stays the same hence the spec comparison works as expected.

However, while we're on this, it would be good to make the comparison order agnostic, like with volume mounts to not trigger a spec change/redeployment if only the order is different:

uncloud/pkg/api/service.go

Lines 289 to 300 in 79dc05c

func (s *ContainerSpec) Equals(spec ContainerSpec) bool {
orig := s.SetDefaults()
spec = spec.SetDefaults()
slices.Sort(orig.Volumes)
slices.Sort(spec.Volumes)
sortVolumeMounts(orig.VolumeMounts)
sortVolumeMounts(spec.VolumeMounts)
return cmp.Equal(orig, spec, cmpopts.EquateEmpty())
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense, but will handle it in another PR

@tonyo tonyo merged commit 2c34ba7 into main Dec 29, 2025
4 checks passed
@tonyo tonyo deleted the tonyo/fix-configs-nested-1 branch December 29, 2025 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't mount Compose config at a path that doesn't exist in container

3 participants