Skip to content

Commit

Permalink
Merge pull request #1399 from sgratch/merge-main-to-2-7-branch
Browse files Browse the repository at this point in the history
Merge main to 2 7 branch
  • Loading branch information
sgratch authored Dec 3, 2024
2 parents 717892c + 3bcd75b commit 42414f8
Show file tree
Hide file tree
Showing 218 changed files with 14,805 additions and 33,221 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/on-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ jobs:
node-version: 20

- name: Install dependencies
run: npm install
run: yarn install

- name: Lint, eslint and stylelint
run: npm run lint
run: yarn lint

- name: Lint, test i18n files
run: npm run test:i18n
run: yarn test:i18n

- name: Test build
run: npm run build
run: yarn build

- name: Test
run: npm run test:coverage
run: yarn test:coverage

- name: Test coverage
uses: codecov/codecov-action@v4
Expand All @@ -55,7 +55,7 @@ jobs:
uses: actions/checkout@v4

- name: Run pre e2e test tasks
run: npm run e2e:pre-test
run: yarn e2e:pre-test

- name: Run cypress
uses: cypress-io/github-action@v6
Expand Down
5 changes: 5 additions & 0 deletions .tekton/forklift-console-plugin-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ spec:
- name: path-context
value: .
pipelineSpec:
description: |
This pipeline is ideal for building container images from a Containerfile while maintaining trust after pipeline customization.
_Uses `buildah` to create a container image leveraging [trusted artifacts](https://konflux-ci.dev/architecture/ADR/0036-trusted-artifacts.html). It also optionally creates a source image and runs some build-time tests. Information is shared between tasks using OCI artifacts instead of PVCs. EC will pass the [`trusted_task.trusted`](https://enterprisecontract.dev/docs/ec-policies/release_policy.html#trusted_task__trusted) policy as long as all data used to build the artifact is generated from trusted tasks.
This pipeline is pushed as a Tekton bundle to [quay.io](https://quay.io/repository/konflux-ci/tekton-catalog/pipeline-docker-build-oci-ta?tab=tags)_
finally:
- name: show-sbom
params:
Expand Down
5 changes: 5 additions & 0 deletions .tekton/forklift-console-plugin-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ spec:
- name: path-context
value: .
pipelineSpec:
description: |
This pipeline is ideal for building container images from a Containerfile while maintaining trust after pipeline customization.
_Uses `buildah` to create a container image leveraging [trusted artifacts](https://konflux-ci.dev/architecture/ADR/0036-trusted-artifacts.html). It also optionally creates a source image and runs some build-time tests. Information is shared between tasks using OCI artifacts instead of PVCs. EC will pass the [`trusted_task.trusted`](https://enterprisecontract.dev/docs/ec-policies/release_policy.html#trusted_task__trusted) policy as long as all data used to build the artifact is generated from trusted tasks.
This pipeline is pushed as a Tekton bundle to [quay.io](https://quay.io/repository/konflux-ci/tekton-catalog/pipeline-docker-build-oci-ta?tab=tags)_
finally:
- name: show-sbom
params:
Expand Down
45 changes: 29 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ Forklift console plugin is managed by Migration Toolkit for Virtualization opera

## Installation

To get started, clone the repo to your development workstation and install the required dependencies locally with NPM.
To get started, clone the repo to your development workstation and install the required dependencies locally with yarn.

``` bash
git clone https://github.com/kubev2v/forklift-console-plugin.git
cd forklift-console-plugin
npm install
yarn install
```

## Quick start
Expand All @@ -38,33 +38,46 @@ With a user logged in to existing Kubernetes or Openshift environment with Forkl
# for example:
# export INVENTORY_SERVER_HOST=https://virt-konveyor-forklift.apps.example.com
# - To close the console server run:
# npm run console:stop
# yarn console:stop

# Setting the console image and forklift setvice URLs as enviorment variables:
# Setting the console image and forklift service URLs as environment variables:
#
# Note: default values works with the local development cluster, you can create using the CI.
# set this variables if you use a different cluster.
export INVENTORY_SERVER_HOST=https://virt-konveyor-forklift.apps.<your caluster address>
export SERVICES_API_SERVER_HOST=https://virt-konveyor-forklift.apps.<your caluster address>
export CONSOLE_IMAGE=quay.io/openshift/origin-console:4.15
export INVENTORY_SERVER_HOST=https://virt-konveyor-forklift.apps.<your cluster address>
export SERVICES_API_SERVER_HOST=https://virt-konveyor-forklift.apps.<your cluster address>
export CONSOLE_IMAGE=quay.io/openshift/origin-console:4.18

# Run the web console locally (uses the enviorment variables we defined above)
npm run console
yarn console

# If this is the first time running, npm run build will build the required dependencies
npm run build
# If this is the first time running, yarn build will build the required dependencies
yarn build

# Start the plugin in development mode
npm run start
yarn start
```

#### How to find the cluster address

The cluster address will be the part of the address after the `apps.` or `api.` in the cluster services or API service address.

For example, if your cluter API address is `api.example.com:6443`, the cluster address will be `example.com`, and
the inventory service address will be:

``` bash
export INVENTORY_SERVER_HOST=https://virt-konveyor-forklift.apps.example.com
```

Note: use this method to find the inventory and services address when using an Openshift cluster, when using K8s use the inventory service address.

## Setup a local cluster for development

Forklift console plugin requires the user to be logged into an openshift or kubernetes cluster, if you do not have access to one, you can setup your own using [Openshift local]( https://developers.redhat.com/products/openshift-local/overview) or use the CI script to build a local [KinD](https://sigs.k8s.io/kind) cluster.

``` bash
# Setup a kind cluster with Forklift operator and an OKD web console
npm run cluster:up
yarn cluster:up

# Example: setup a local KinD cluster with ovirt mock provider
# [ options: --with-all-providers --with-ovirt-provider, --with-vmware-provider, --with-openstack-provider]
Expand All @@ -73,10 +86,10 @@ npm run cluster:up
# Note II: mock providers requires NFS server running, look at forkliftci documentation for more details.
# See: forkliftci/cluster/providers/utils/install_nfs.sh
git clone [email protected]:kubev2v/forkliftci.git ./ci/forkliftci
npm run cluster:up -- --with-ovirt-provider
yarn cluster:up -- --with-ovirt-provider

# run cleanup to stop and delete the cluster.
npm run cluster:delete
yarn cluster:delete
```

## Learn more
Expand All @@ -88,6 +101,6 @@ More documentation is available in the [docs](./docs) directory.
| [Forklift](https://github.com/kubev2v/forklift/) | Migration toolkit for virtualization |
| [Openshift web console](https://github.com/openshift/console) | Openshift web console is a web based user interface for Openshift. |
| [OpenShift Dynamic Plugin SDK](https://github.com/openshift/dynamic-plugin-sdk) | Dynamic plugin SDK for Openshift user interfaces. |
| [Forklift documentation](https://github.com/kubev2v/forklift-documentation) | Usage documentation for the migration toolkit for viertualization. |
| [Forklict CI](https://github.com/kubev2v/forkliftci) | Collection of scripts and tools used in forklict development. |
| [Forklift documentation](https://github.com/kubev2v/forklift-documentation) | Usage documentation for the migration toolkit for virtualization. |
| [Forklift CI](https://github.com/kubev2v/forkliftci) | Collection of scripts and tools used in forklift development. |
| [Patternfly](https://www.patternfly.org/) | Open source design system used for Openshift user interfaces development. |
3 changes: 2 additions & 1 deletion build/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ WORKDIR /opt/app-root/src/app

# Run install as supper tux
USER 0
RUN npm ci && npm run build
RUN command -v yarn || npm i -g yarn
RUN yarn install --frozen-lockfile --ignore-engines && yarn build

# Web server container
FROM registry.access.redhat.com/ubi9/nginx-122
Expand Down
2 changes: 1 addition & 1 deletion ci/create-forklift-user-account.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ echo export TOKEN_ADMIN=...
echo export BRIDGE_K8S_AUTH_BEARER_TOKEN=$\{TOKEN_ADMIN \| TOKEN_USER \| TOKEN_READER\}
echo
echo before starting the bridge
echo npm run console
echo yarn console
5 changes: 3 additions & 2 deletions ci/start-console.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ CONSOLE_PORT=${CONSOLE_PORT:-9000}
# Look for forklift routes
if oc_available_loggedin; then
routes=$(oc get routes -A -o template --template='{{range .items}}{{.spec.host}}{{"\n"}}{{end}}' 2>/dev/null || true)
INVENTORY_SERVER_HOST=${INVENTORY_SERVER_HOST:-$(echo "$routes" | grep forklift-inventory)}
SERVICES_API_SERVER_HOST=${SERVICES_API_SERVER_HOST:-$(echo "$routes" | grep forklift-services)}
INVENTORY_SERVER_HOST=${INVENTORY_SERVER_HOST:-$(echo "$routes" | grep forklift-inventory || true)}
SERVICES_API_SERVER_HOST=${SERVICES_API_SERVER_HOST:-$(echo "$routes" | grep forklift-services || true)}
fi

# Default to localhost if no route found
Expand Down Expand Up @@ -99,4 +99,5 @@ podman run \
--publish=${CONSOLE_PORT}:${CONSOLE_PORT} \
--name=${CONSOLE_CONTAINER_NAME} \
--env "BRIDGE_*" \
--arch=amd64 \
${CONSOLE_IMAGE}
2 changes: 1 addition & 1 deletion ci/test-i18n.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

npm run i18n
yarn i18n
GIT_STATUS="$(git status --short --untracked-files -- packages/forklift-console-plugin/locales)"
if [ -n "$GIT_STATUS" ]; then
echo "i18n files are not up to date. Commit them to fix."
Expand Down
18 changes: 18 additions & 0 deletions docs/cli-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,21 @@ sudo install crc-linux-2.10.1-amd64/crc /usr/local/bin/crc
crc setup
crc start
```

## How to increase the inotify.max_user_watches and inotify.max_user_instances sysctls

When running the forklift development on local workstation machine, you may hit inotify limits.

To edit the `inotify` limits edit the file `/etc/sysctl.conf` and add the limits you need, for example:

```
# Add this lines to /etc/sysctl.conf
fs.inotify.max_user_watches=524288
fs.inotify.max_user_instances=8192
```

And then restart the service:

```bash
sudo sysctl -p
```
16 changes: 16 additions & 0 deletions docs/setup-local-nfs-server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Local NFS server for forklift CI tasks

Some forklift CI tasks require an NFS server running on the localhost exporting the directory /home/nfsshare,
to set up this NFS server on fedora, see the bash example below:

``` bash
sudo dnf install nfs-utils -y

sudo mkdir -p /home/nfsshare
sudo chown -R nobody:nobody /home/nfsshare
sudo chmod 777 /home/nfsshare
sudo bash -c 'echo "/home/nfsshare *(insecure,rw,no_root_squash)" >>/etc/exports'
sudo exportfs -a

sudo systemctl restart nfs-server
```
Loading

0 comments on commit 42414f8

Please sign in to comment.