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

chore: split config.Registries into the separate resource. #9780

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DmitriyMV
Copy link
Member

Required for #9614

Closes #9766

@DmitriyMV DmitriyMV changed the title chore: split config.Registry into the separate resource. chore: split config.Registries into the separate resource. Nov 21, 2024
Copy link
Member

@dsseng dsseng left a comment

Choose a reason for hiding this comment

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

Maybe this could also remove those config definitions from the old place as well?

Copy link
Member

@smira smira left a comment

Choose a reason for hiding this comment

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

the image/resolver (via PullImage) hasn't been updated

@DmitriyMV
Copy link
Member Author

@smira I think all paths leading to image package are updated now.

// This is a hack, but I (Dmitry) don't have enough patience to figure out why we don't support complex maps
return "resource/definitions/cri/registry.proto", "talos.resource.definitions.cri.RegistryMirrorConfig"
case typeData{"github.com/siderolabs/talos/pkg/machinery/resources/cri", "RegistryConfig"}:
// This is a hack, but I (Dmitry) don't have enough patience to figure out why we don't support complex maps
Copy link
Member

Choose a reason for hiding this comment

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

the author gave up 😛

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah...

)

// RegistriesSpecType is type of RegistriesSpec resource.
const RegistriesSpecType = resource.Type("Registries.net.talos.dev")
Copy link
Member

Choose a reason for hiding this comment

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

if we call it registries, we should name the constant RegistriesType, and cascading down.

I would probably name it RegistriesConfig though

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

const RegistriesID resource.ID = "registries"

// RegistriesSpec resource holds info about container registries.
type RegistriesSpec = typed.Resource[RegistriesSpecSpec, RegistriesSpecExtension]
Copy link
Member

Choose a reason for hiding this comment

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

add it to the cri_test.go in this folder to catch some issues quickly

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup!

@@ -1506,13 +1507,19 @@ func Upgrade(_ runtime.Sequence, data any) (runtime.TaskExecutionFunc, string) {

logger.Printf("performing upgrade via %q", in.GetImage())

rgs, err := safe.ReaderGetByID[*crires.RegistriesSpec](ctx, r.State().V1Alpha2().Resources(), crires.RegistriesID)
Copy link
Member

Choose a reason for hiding this comment

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

this certainly has a race condition (not here, but more on the install sequence)

a proper way would be to block for the config to be available

Suggested change
rgs, err := safe.ReaderGetByID[*crires.RegistriesSpec](ctx, r.State().V1Alpha2().Resources(), crires.RegistriesID)
rgs, err := safe.StateWaitFor[*crires.RegistriesSpec](ctx, r.State().V1Alpha2().Resources(), crires.RegistriesID, state.WithEventTypes(state.Created, state.Updated))

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@DmitriyMV
Copy link
Member Author

Integration provision passes, so upgrades work. I'll remove the label to speed-up process.

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.

image cache: split out config.Registries to a resource and re-wire the controllers
4 participants