-
Notifications
You must be signed in to change notification settings - Fork 216
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
Initial version of OCI registry as storage #2375
Open
0xavi0
wants to merge
2
commits into
rancher:main
Choose a base branch
from
0xavi0:2114-oci-registry-initial
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
0xavi0
force-pushed
the
2114-oci-registry-initial
branch
5 times, most recently
from
April 30, 2024 07:25
ae8f452
to
fdc4b3c
Compare
weyfonk
reviewed
May 6, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this effort, leaving a few comments :)
0xavi0
force-pushed
the
2114-oci-registry-initial
branch
from
May 8, 2024 14:21
fdc4b3c
to
87e640f
Compare
weyfonk
reviewed
May 17, 2024
0xavi0
force-pushed
the
2114-oci-registry-initial
branch
from
May 17, 2024 14:31
87e640f
to
883e55b
Compare
0xavi0
force-pushed
the
2114-oci-registry-initial
branch
3 times, most recently
from
May 24, 2024 14:02
949df75
to
6ed631f
Compare
4 tasks
|
0xavi0
force-pushed
the
2114-oci-registry-initial
branch
2 times, most recently
from
June 7, 2024 08:05
b2f720f
to
0e701d0
Compare
Implements an initial proposal to use OCI registries as storage. Adds the following new options to the `gitrepo` yaml: ```yaml // when ociRegistry is defined fleet will use oci registry as storage ociRegistry: // url is the OCI registry url. url: "docker.io/your-user-here" // secret name where the credentials for the OCI registry are. // expects a generic secret with username and password keys set. authSecretName: oci-secret // basicHTTP allows fleet to uses basic http connections to communicate // with the registry (defaults to false) basicHTTP: false // insecureSkipTLS allows connections to the OCI registry // without certs (defaults to false) insecureSkipTLS: false ``` New parameters are passed to `fleet apply` to propagate the values above. If at least the `url` value is set, `fleet apply` will do the following: * Creates a manifest from the resources found in the `bundle` * Creates and push an OCI manifest * Clears the `bundle`'s resource list (contents are in the OCI registry) * Adds the `contentID` value (this is a new value) in the `bundle`s spec * Creates a secret to pass the OCI registry values to the `fleet` controller and `agents`. This secret contains all the values so the controller and agents are able to reach the OCI registry. The upstream `fleet` controller then reconciles the just created `bundle` (remember, with no resources and the content's id set). When targetting, it also clones the secret containing all the OCI values, just changing the namespace to match the `bundledeployment`'s namespace. (This way the agents will be able to obtain the OCI values) It will also flag the `bundledeployment` to state that the content is stored in the OCI registry instead to a `content` resource. When deploying, the agents will check if the `bundledeployment` is flagged to has its contents in an OCI registry. If so, it gathers the OCI values it needs to access the registry from the `bundledeployment` secret and pulls the OCI manifest which is converted back into a `fleet` manifest. The agent deploys the manifest just like a regular manifest that was stored as a `contents` resource. All secrets created have the owner set to the `bundle` or `bundledeployment` so they are properly garbage collected when their owners are deleted. This to be defined / todo: * OCI registry garbage collection? (do we need this?) * Sign the OCI manifest when pushing the OCI manifest and check for the signature when pulling and before deploying to avoid back doors. At the moment the code checks that the `id` annotation is found in the OCI manifest and that it matches the expected content id. We could, maybe, use annotations to add a signature field. This has been tested with: * `zot` with basic HTTP * `zot` with HTTPS connections and insecure (self signed certs) * `zot` with secure HTTPS (through ngrok) * `dockerhub` (secure HTTPS) Refers to: rancher#2114 Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
0xavi0
force-pushed
the
2114-oci-registry-initial
branch
from
June 7, 2024 08:55
0e701d0
to
f6211bb
Compare
In order to use the feature the `EXPERIMENTAL_OCI_STORAGE` environment variable should be `true`. Adds tests for testing without the experimental flag. Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
0xavi0
force-pushed
the
2114-oci-registry-initial
branch
from
June 7, 2024 13:37
6d98159
to
a7d8d1d
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements an initial proposal to use OCI registries as storage.
NOTE: The feature is only available when the environment variable
EXPERIMENTAL_OCI_STORAGE
is set totrue
.Adds the following new options to the
gitrepo
yaml:New parameters are passed to
fleet apply
to propagate the values above.If at least the
url
value is set,fleet apply
will do the following:bundle
bundle
's resource list (contents are in the OCI registry)contentID
value (this is a new value) in thebundle
s specfleet
controller andagents
. This secret contains all the values so the controller and agents are able to reach the OCI registry.The upstream
fleet
controller then reconciles the just createdbundle
(remember, with no resources and the content's id set).When targeting, it also clones the secret containing all the OCI values, just changing the namespace to match the
bundledeployment
's namespace. (This way the agents will be able to obtain the OCI values) It will also flag thebundledeployment
to state that the content is stored in the OCI registry instead to acontent
resource.When deploying, the agents will check if the
bundledeployment
is flagged to has its contents in an OCI registry. If so, it gathers the OCI values it needs to access the registry from thebundledeployment
secret and pulls the OCI manifest which is converted back into afleet
manifest.The agent deploys the manifest just like a regular manifest that was stored as a
contents
resource.All secrets created have the owner set to the
bundle
orbundledeployment
so they are properly garbage collected when their owners are deleted.To be defined / todo / other considerations:
id
annotation is found in the OCI manifest and that it matches the expected content id. We could, maybe, use annotations to add a signature field.bundle
+ resource list +content
resource if there is any issue connecting to the OCI registry. That's something we could do asbundle
keeps the info to know if it is stored in a remote OCI registry or not.This has been tested with:
zot
with basic HTTPzot
with HTTPS connections and insecure (self signed certs)zot
with secure HTTPS (through ngrok)dockerhub
(secure HTTPS)Refers to: #2114