-
Notifications
You must be signed in to change notification settings - Fork 533
Enhancements/oc/mirroring-manifests: Propose a new enhancement #238
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,208 @@ | ||
| --- | ||
| title: mirroring-manifsts | ||
| authors: | ||
| - "@wking" | ||
| - "@jottofar" | ||
| reviewers: | ||
| - "@jottofar" | ||
| - "@LalatenduMohanty" | ||
| - "@smarterclayton" | ||
| - "@deads2k" | ||
| approvers: | ||
| - "@LalatenduMohanty" | ||
| - "@smarterclayton" | ||
| - "@deads2k" | ||
| creation-date: 2020-01-24 | ||
| last-updated: 2020-03-11 | ||
| status: provisional|implementable | ||
| --- | ||
|
|
||
| # Mirroring Manifests | ||
|
|
||
| ## Release Signoff Checklist | ||
|
|
||
| - [x] Enhancement is `implementable` | ||
| - [x] Design details are appropriately documented from clear requirements | ||
| - [ ] Test plan is defined | ||
| - [ ] Graduation criteria for dev preview, tech preview, GA | ||
| - [ ] User-facing documentation is created in [openshift-docs](https://github.com/openshift/openshift-docs/) | ||
|
|
||
| ## Summary | ||
|
|
||
| For disconnected clusters, `oc adm release mirror ...` already helps users copy the release image and its dependencies into their local mirror. As of 4.2 and 4.3, the following command: | ||
|
|
||
| ```console | ||
| $ oc adm release mirror \ | ||
| --from=quay.io/openshift-release-dev/ocp-release:4.3.0-x86_64 \ | ||
| --to=registry.example.com/your/repository \ | ||
| --to-release-image=registry.example.com/your/repository:your-tag \ | ||
| ``` | ||
|
|
||
| will mirror the 4.3.0 release image and other images referenced by the release image into the mirror repository at registry.example.com. | ||
|
|
||
| This enhancment extends that command to also handle manifests, information that cannot be represented by container images, by either pushing them to disk or by applying them to a connected cluster. | ||
| The manifest application would begin after the image mirror had completed. For example, `oc` might produce ConfigMap manifests containing the release image signature which the cluster-version operator could use to [verify the mirrored release][cvo-config-map-signatures]. | ||
|
|
||
| ## Motivation | ||
|
|
||
| There is a lot of information in the wider internet that may be useful for restricted-network clusters. | ||
| Some of that information can be represented by container images, such as the release image and the operator and other images referenced by the release image. | ||
| Some of that information cannot be represented by container images, including container signatures. | ||
| By extending `oc`'s release-mirror support to create and apply Kubernetes manifests, we provide a channel that can be used to gather arbitrary information in one place that the user can audit, transport into their restricted network, and apply to their local cluster. | ||
| As the need for additional information arises, additional manifests may be created, possibly using new [custom resources][custom-resources] known to the local cluster, without users needing to adjust their mirroring workflows. | ||
|
|
||
| ### Goals | ||
|
|
||
| Users should be able to run a single `oc adm release mirror ...` command to gather all the external information needed to deploy that release inside their cluster, which may have restricted network access. | ||
|
|
||
| ### Non-Goals | ||
|
|
||
| This proposal does not specify the types of manifests that are created. | ||
| Users who intend to audit the gathered manifests should extract the gathered types from the manifests themselves. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agree |
||
|
|
||
| ## Proposal | ||
|
|
||
| ### Pushing manifests to disk for later application | ||
|
|
||
| As of 4.3, the following command: | ||
|
|
||
| ```console | ||
| $ oc adm release mirror --to-dir=mirror quay.io/openshift-release-dev/ocp-release:4.3.0-x86_64 | ||
| ... | ||
| Success | ||
| Update image: openshift/release:4.3.0 | ||
|
|
||
| To upload local images to a registry, run: | ||
|
|
||
| oc image mirror --from-dir=mirror file://openshift/release:4.3.0* REGISTRY/REPOSITORY | ||
| ``` | ||
|
|
||
| creates an output filesystem like: | ||
|
|
||
| ```console | ||
| $ tree mirror | ||
| mirror | ||
| └── v2 | ||
| └── openshift | ||
| └── release | ||
| ├── blobs | ||
| │ ├── sha256:005337dc1f6870934cf5efaf443786149e6a71041a91566ce1e16e78bce511a9 | ||
| ... | ||
| │ └── sha256:ffc132fefac522ec38b1b22ecd67a5173565efb3e8929e47ef7e0b4ee7920adf | ||
| └── manifests | ||
| ├── 4.3.0 -> mirror/v2/openshift/release/manifests/sha256:3a516480dfd68e0f87f702b4d7bdd6f6a0acfdac5cd2e9767b838ceede34d70d | ||
| ... | ||
| ├── 4.3.0-thanos -> mirror/v2/openshift/release/manifests/sha256:42ab3f59d3e769e88af89c30304b9cc77a76b66960747e2e1a6f8db097420858 | ||
| ├── sha256:00ec58112784d340179e045bc70399ac1bd509ae43c4411e934ced23d016b2a1 | ||
| ... | ||
| └── sha256:ffa87c992c5a2c51290e6d67cb609f29893dd147c31cff639ff6785ae7a1cfe2 | ||
|
|
||
| 5 directories, 514 files | ||
| ``` | ||
|
|
||
| This filesystem can then be applied to the local registry with the given `oc image mirror` command. | ||
|
|
||
| With this enhancement, the output format would gain an additional directory `manifests` under the base directory, a sibling to the current `v2`, containing manifest files that can be applied to the local cluster with: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is little confusing as we already mentioning the manifest files in the command output before saying that this enhancement will introduce that or I misunderstood
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We haven't yet mentioned manifest files in this section "Proposal-Pushing manifests to disk for later server application". The section starts out showing what the current 'oc adm release mirror' "push to disk" functionality is and what the resulting directory structure would look like. Then goes on to explain that the enhancement adds an additional "manifests" directory which will contain the newly outputted manifests. Does that make it clear?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, thanks
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We already have the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We haven't yet mentioned manifest files in this section "Proposal-Pushing manifests to disk for later server application". The section starts out showing what the current 'oc adm release mirror' "push to disk" functionality is and what the resulting directory structure would look like. Then goes on to explain that the enhancement adds an additional "manifests" directory which will contain the newly outputted manifests. Does that make it clear?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This brings up another related point. This enhancement is written to describe a general purpose manifest mirroring function which is fine. However our first implementation of this is to handle image signatures which requires specific logic, e.g. searching for specific strings to locate the signature information. Even if we do create a general purpose directory to contain general manifests the signature ConfigMap files intended for image verification should should be saved somewhere separate so they can be easily located as such.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The opacity of
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not an issue as user needs to explicitly give a path to store the signature manifests.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Why? They can apply with
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wking Right, that's why I said my initial concern is an non issue. |
||
|
|
||
| ```console | ||
| $ oc apply -Rf mirror/manifests | ||
| ``` | ||
|
|
||
| The `manifests` directory may or may not contain additional subdirectories, so the recursive `-R` should be given for future-proofing. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why can not make recursive behavior as the default. Less CLI flags = improved user experience.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Adjusting |
||
|
|
||
| Users may also want to push container images directly to a mirror repository (as in the example command in [the *Summary*](#summary) while still pushing manifests to disk (because there is not yet a cluster into which those manifests can be pushed). | ||
| While you could address this use-case with the command above followed by an immediate `oc image mirror ...`, it is more convenient to have `oc adm release mirror ...` push to the registry directly. | ||
| Because setting `--to-dir` adjusts the image source, this enhancement extends the command with a new `--manifests-to-dir` that can be used to set a manifest output directory without setting a container image output directory. | ||
| When `--manifests-to-dir` is set, it takes precedence. | ||
| When `--manifests-to-dir` is unset but `--to-dir` is set, the manifest directory is `${TO_DIR}/manifests`, as described above. | ||
|
|
||
| ### Applying manifests directly to the target cluster | ||
|
|
||
| This enhancement adds a new `--apply-manifests` option that when specified will apply manifests directly to the connected cluster rather than outputting them to disk. | ||
| When the `--apply-manifests` option is specified a user can also optionally specify `--overwrite` which would cause the apply to behave as the `oc apply --overwrite` does currently. | ||
| If the manifest exists on the cluster it will be updated. | ||
| If the manifest exists on the cluster and `--overwrite` is not specified a warning will be displayed that the manifest could not be created. | ||
| If `oc` encountered an error applying a manifest, it could optionally attempt to apply additional manifests or simply exit non-zero immediately. | ||
|
|
||
| ### User Stories | ||
|
|
||
| #### Release-signature ConfigMaps | ||
|
|
||
| Currently a cluster upgrade can be accomplished on a cluster that does not have an active connection to the internet. | ||
| However manual steps are required to create a ConfigMap containing the signature data required for update image verification. | ||
| This enhancement will automatically create the ConfigMap from the image manifest files. | ||
|
|
||
| #### In-cluster Cincinnati | ||
|
|
||
| Clusters running within a disconnected network will run Cincinnati on premise to provide an upgrade experience much more like that found on a cluster running within a connected network. | ||
| The `oc adm release mirror ...` command is expected to be used to ease the installation of an on premise Cincinnati by mirroring the Cincinnati images. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean Cincinnati images or the secondary metadata from cincinnati-graph-data repository?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Both. In my revived #188, I've made this "mirroring the Cincinnati images and manifests" to make that clearer. |
||
| With this enhancement any required Cincinnati manifests will also be mirrored. | ||
|
|
||
| #### Mirroring to a central registry in a fully air gapped environment | ||
|
|
||
| A fully air gapped environment is one in which your cluster nodes cannot access the internet. | ||
| For this reason you must mirror the images and manifests to a filesystem disconnected from that environment and then bring that host or removable media across that gap. | ||
| Our documnetation refers to this as disconnected mirroring. | ||
| It may also be the case that there are multiple clusters within the air gapped network. | ||
| In such a case it makes sense to configure a central registry in the air gapped environment from which every cluster can pull upgrade imagery. | ||
| Assuming the aforementioned use case and the use of removable media that will be sneakernetted across the gap, the steps for mirroring are: | ||
|
|
||
| 1. Connect the removable media to a system connected to the internet. | ||
| 2. Mirror the images and manifests to a directory on the removable media: | ||
| ```console | ||
| $ oc adm release mirror --to-dir=<removable-media-path>/mirror quay.io/openshift-release-dev/ocp-release:4.3.0-x86_64 | ||
| ``` | ||
| 3. The enhanced `oc adm release mirror ...` command will output the path, similar to the example below, to a configmap created containing the image signature. | ||
| ```console | ||
| Configmap <removable-media-path>/mirror/manifests/signature-sha256-81154f5c03294534e1eaf0319bef7a601134f891689ccede5d705ef659aa8c92 created | ||
| ``` | ||
| 4. Run any required checks/scrubs on the removable media. | ||
| 5. Connect the removable media to a host within the air gapped environment that has access to both the central registry and to any cluster requiring upgrade. | ||
| 6. Upload the mirrored images to the central registry: | ||
| ```console | ||
| $ oc image mirror --from-dir=<removable-media-path>/mirror file://openshift/release:4.3.0* REGISTRY/REPOSITORY | ||
| ``` | ||
| 7. Use oc to login to a given cluster to be upgraded. | ||
| 8. Apply the the mirrored configmap, noted above, to the connected cluster for use by CVO for upgrade image verification: | ||
| ```console | ||
| $ oc apply -Rf <removable-media-path>/mirror/manifests | ||
| ``` | ||
| 9. Perform the upgrade: | ||
| ```console | ||
| $ oc adm upgrade --to-image REGISTRY/REPOSITORY/release@sha256:81154f5c03294534e1eaf0319bef7a601134f891689ccede5d705ef659aa8c92 | ||
| ``` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The above workflow looks good to me, but @smarterclayton would be the right person to take final view.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /assign @smarterclayton
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You'll need Also, I'd have expected |
||
|
|
||
| ### Risks and Mitigations | ||
|
|
||
| One risk considered is that a user familiar with the current behavior of the `oc adm release mirror ...` command may inadvertently apply manifests to their cluster. | ||
| This has been addressed by requiring the explicit `--apply-manifests` argument to apply manifests to a cluster. | ||
|
|
||
| ## Design Details | ||
|
|
||
| ### Test Plan | ||
|
|
||
| The current e2e test, that makes sure the command always exits successfully and that certain apsects of the content are always present, will be modified to validate the new functionality as well. | ||
|
|
||
| ### Graduation Criteria | ||
|
|
||
| ### Upgrade / Downgrade Strategy | ||
|
|
||
| The image is included in the payload, but has no content running in a cluster to upgrade. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think for |
||
|
|
||
| ### Version Skew Strategy | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This section should maybe grow some text about what to do if vA
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1, We need to address With respect to future version where we have a new manifest , we need to update oc command to check if the manifest is present and error out accordingly. That's why the structure of manifest directory is important as it should have room for future enhancements. |
||
|
|
||
| The proposal for [applying manifests directly to the target cluster](#applying-manifests-directly-to-the-target-cluster) adds a new dependency on the cluster to which `oc` connects for Kubernetes activity. | ||
| The explicit `--apply-manifests` argument requires users who have been using the previous `oc adm release mirror` implementation (which did not push manifests) to explicitly opt in to the new functionality, so there is no chance that they accidentally push manifests into the wrong cluster. | ||
|
|
||
| ## Implementation History | ||
|
|
||
| See https://github.com/openshift/oc/pull/343 | ||
|
|
||
| ## Drawbacks | ||
|
|
||
| ## Alternatives | ||
|
|
||
| ## Infrastructure Needed [optional] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we aren't going to request any infrastructure, we should probably drop this header as well. The only thing I can think of requesting would be long-lived VPCs if we wanted to add tests using that approach to blackholing CI-registry access. |
||
|
|
||
| [cvo-config-map-signatures]: https://github.com/openshift/cluster-version-operator/pull/279 | ||
| [custom-resources]: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/ | ||
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.
Why are we promoting this up out of the Proposal section into the Summary? It seems like an implementation detail that we don't need for the high-level summary.
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.
It helps explain the current impl and then I refer to the Summary in section "Pushing manifests to disk for later application" as part of explaining an ehancement need there
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.
But why do we need to show an example
occommand to explain the current implementation, especially just for this single images-to-disk case?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.
I do not see any harm showing the current implementation. At least it helps in better review of this PR.
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.
I'm not saying "don't show the current implementation", I'm saying "this is not summary-level information, this is proposal-level background".