forked from rancher/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add extension image load dialog (rancher#9010)
Update dialog with repo creation - update docs Add uninstall for custom images Add extension images list view Add image load dialog and uninstall within extension image view Update publish and bundle scripts for image load - move image page to tab Add extension container build workflow file to pkg creator Move plugin server template into extension build scripts Fix publish script for multiple asset packages Move ImageList view to separate page - add crd metadata for custom images Update docs - fix references to images with catalog Fix wording, cache state badge, masthead breadcrumb, when deleteing resources check for namespaces Update docs - fix delete repo resource - default cache state Trim image whitespace - populate extensionUrl Add experimental badge
- Loading branch information
1 parent
e6f0fa5
commit d94e78c
Showing
34 changed files
with
1,909 additions
and
306 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
120 changes: 120 additions & 0 deletions
120
docusaurus/docs/extensions/advanced/air-gapped-environments.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# Air-gapped Environments | ||
|
||
In order to load an extension within an air-gapped instance of Rancher, you will need to import an Extension Catalog Image to provide the extension assets, which are then served within the "Available" tab of the Extensions page and can be installed as normal. | ||
|
||
The Extension Catalog Image (ECI) contains the assets of each extension which give the [ui-plugin-operator](https://github.com/rancher/ui-plugin-operator) the necessary files to load an extension into the Rancher Dashboard. | ||
|
||
We have implemented an action within the Extensions page to take care of the heavy lifting for you by creating the necessary resources. | ||
|
||
> Note: The ECI is comprised of a hardened [SLE BCI](https://registry.suse.com/bci/bci-base-15sp4/index.html) image with an [NGINX](https://nginx.org/en/) service which supplies the minified extension files. | ||
## Prerequisites | ||
|
||
Loading an extension into an air-gapped envrionment requires a few prerequisites, namely: | ||
|
||
- The Extension needs to be bundled into the ECI | ||
- A registry to house the ECI | ||
- Access to this registry within the air-gapped Cluster | ||
|
||
> Note: Any Secrets that are required to authenticate with the registry ***MUST*** be created in the `cattle-ui-plugin-system` namespace. | ||
## Building the Extension Catalog Image | ||
|
||
Currently there are two options available for building your extension into an ECI. You can use the predefined Github Workflow, if you plan on housing the extension within a Github repository, or you can manually build and publish your extension to a specified registry. | ||
|
||
In either case, the ECI will need to be published to a registry that is accessible from the air-gapped cluster. | ||
|
||
### Github Workflow | ||
|
||
If using the provided Github workflow with your extension, the extension will be built and published for each package version to the [Github Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry) (`ghcr`). | ||
|
||
> Note: The extension image that is built will contain Helm charts for each subsequent package (i.e. `./pkg/<EXTENSION_NAME>`). In order to release a new version of a package, the root extension will need to be published with an updated tag within `./package.json`. | ||
Once the extension has been published you will then be able to pull, tag, and push the ECI into your desired registry. | ||
|
||
From a machine that has access to both the desired registry and `ghcr.io`, pull the image: | ||
|
||
```sh | ||
docker pull ghcr.io/<ORGANIZATION>/ui-extension-<REPO>:<TAG> | ||
``` | ||
|
||
Then re-tag and push the image to your registry: | ||
|
||
```sh | ||
docker tag ghcr.io/<ORGANIZATION>/ui-extension-<REPO>:<TAG> <MY_REGISTRY>/<ORGANIZATION>/ui-extension-<REPO>:TAG | ||
docker push <MY_REGISTRY>/<ORGANIZATION>/ui-extension-<REPO>:TAG | ||
``` | ||
|
||
Proceed to the [Importing the Extension Catalog Image](#importing-the-catalog-image) step. | ||
|
||
### Manual Build | ||
|
||
The ECI can also be built manually using the `yarn publish-pkgs -c` command. | ||
|
||
___Building Prerequisites___ | ||
|
||
This method requires a few tools to be installed: | ||
|
||
- [make](https://www.gnu.org/software/make/) | ||
- [docker](https://docs.docker.com/get-docker/) | ||
- [go](https://go.dev/dl/) | ||
- [nodejs](https://nodejs.org/en/download) ( >= `12.0.0` < `17.0.0` ) | ||
- [yarn](https://yarnpkg.com/getting-started/install) | ||
- [jq](https://stedolan.github.io/jq/) | ||
- [yq](https://github.com/mikefarah/yq/#install) ( >= `4.0.0` ) | ||
- [helm](https://helm.sh/docs/intro/install/) ( >= `3.0.0` ) | ||
|
||
___Running the Build Manually___ | ||
|
||
To build, simply run the following: | ||
|
||
```sh | ||
yarn publish-pkgs -cp -r <REGISTRY> -o <ORGANIZATION> | ||
``` | ||
|
||
- `-c` - Specifies the script to build the extension as a container image | ||
- `-p` - To push the built image | ||
- `-r` - Specifies the Container Registry | ||
- `-o` - Specifies the Organization name for the image (defaults to 'rancher') | ||
|
||
___Additional Script Usage___ | ||
```sh | ||
Usage: yarn publish-pkgs [<options>] [plugins] | ||
options: | ||
-p Push container images on build | ||
-f Force building the chart even if it already exists | ||
-r <name> Specify destination container registry for built images | ||
-o <name> Specify destination container registry organization for built images | ||
-i <prefix> Specify prefix for the built container image (default: 'ui-extension-') | ||
-c Build as a container image rather than publishing to Github | ||
-s <repo> Specify destination GitHub repository (org/name) - defaults to the git origin (implies -g) | ||
-b <branch> Specify destination GitHub branch (implies -g) | ||
``` | ||
## Importing the Extension Catalog Image | ||
Importing the ECI is fairly straightforward, you will need the Catalog Image Reference from your registry and any secrets necessary to authenticate with the registry. | ||
> Note: Any Secrets that are required to authenticate with the registry ***MUST*** be created in the `cattle-ui-plugin-system` namespace. | ||
Within the Extensions page, select "Manage Extension Catalog" from the action menu in the top right. From here you will be able to see any Extension Catalog Images loaded previously along with their state, name, image used for the deployment, and cache state (used by the `ui-plugin-operator`). | ||
To import an ECI, click on the "Import Extension Catalog" button: | ||
 | ||
Fill out the form within the modal with your Catalog Reference Image URI (for example: `<MY_REGISTRY>/<ORGANIZATION>/ui-extension-<REPO>:TAG`) and any secrets necessary to pull the image. | ||
> Note: If the registry is not supplied within the URI, it will default to `hub.docker.io`. | ||
> Note: If the version of the image is omitted, this will default to `latest`. | ||
 | ||
The resources mentioned [above](#air-gapped-environments) will be created. You can navigate back to the main Extensions page by selecting breadcrumb link for "Extension" button from the header title in the top left of the screen. | ||
 | ||
Within the "Available", tab the newly imported extensions are now available to be installed normally. | ||
 |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<script> | ||
import { BadgeState } from '@components/BadgeState'; | ||
import { stateDisplay } from '@shell/plugins/dashboard-store/resource-class'; | ||
export default { | ||
props: { | ||
value: { | ||
type: String, | ||
default: '' | ||
} | ||
}, | ||
components: { BadgeState }, | ||
data() { | ||
const STATES = { | ||
cached: { | ||
color: 'info', icon: 'dot-open', label: 'Cached', compoundIcon: 'checkmark' | ||
}, | ||
pending: { | ||
color: 'warning', icon: 'tag', label: 'In Progress', compoundIcon: 'info' | ||
}, | ||
disabled: { | ||
color: 'error', icon: 'dot-half', label: 'Cache Disabled', compoundIcon: 'info' | ||
}, | ||
}; | ||
return { | ||
STATES, | ||
stateDisplay: '', | ||
stateBackground: '' | ||
}; | ||
}, | ||
watch: { | ||
value: { | ||
handler() { | ||
const out = this.value || 'pending'; | ||
const color = this.colorForState(out); | ||
this.stateDisplay = stateDisplay(out); | ||
this.stateBackground = color.replace('text-', 'bg-'); | ||
}, | ||
immediate: true | ||
} | ||
}, | ||
methods: { | ||
colorForState(state) { | ||
const key = (state).toLowerCase(); | ||
let color; | ||
if ( this.STATES[key] && this.STATES[key].color ) { | ||
color = this.STATES[key].color; | ||
} | ||
if ( !color ) { | ||
color = 'info'; | ||
} | ||
return `text-${ color }`; | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<BadgeState | ||
:color="stateBackground" | ||
:label="stateDisplay" | ||
/> | ||
</div> | ||
</template> |
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
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
Oops, something went wrong.