Skip to content

Commit

Permalink
Updated the README
Browse files Browse the repository at this point in the history
Signed-off-by: jubittajohn <jujohn@redhat.com>
  • Loading branch information
jubittajohn committed Aug 9, 2023
1 parent 44f8130 commit 6785df4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 27 deletions.
38 changes: 18 additions & 20 deletions test/operator-framework-e2e/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Cross-component E2E for operator framework

This is a cross-component demo with all OLM v1 repositories. The ginkgo test does the following:
- Automates the creation of `plain+v0` bundles and FBCs for a set of bundle manifest directories.
- Uses operator-sdk and kustomize to build `plain+v0` bundles and create catalogs to include the bundles.
- Installs, upgrades and deletes a `plain+v0` operator.
- Uses operator-sdk to build `registry+v1` bundles and create catalogs to include the bundles.
- Installs, upgrades and deletes a `registry+v1` operator.

The steps in the ginkgo test can be summarized as follows:

1. start with an empty directory
2. call operator-sdk to initialize and generate an operator
3. generate a bundle directory
Expand All @@ -27,10 +29,9 @@ This is a cross-component demo with all OLM v1 repositories. The ginkgo test doe

- Building operator-controller, deploying it into the cluster and rest of the configuration is done in the `MakeFile` of this repo under the target `operator-developer-e2e`. This includes:

- Setting up a kind cluster.
- Setting up a kind cluster named `operator-controller-op-dev-e2e`.
- Installing the operator controller onto the cluster.
- Downloading the opm tool.
- Installing the operator-sdk.
- Setting up `opm`, `operator-sdk` and `kustomize` using bingo.
- Setting up a local registry server for building and loading images.

- The following structs defined are required as input for both plain+v0 and registry+v1 bundles:
Expand All @@ -47,11 +48,11 @@ This is a cross-component demo with all OLM v1 repositories. The ginkgo test doe
imageRef string
}
```
- `baseFolderPath` - Base path of the folder for the specific bundle type input data.
- `baseFolderPath` - Base/root path of the folder for the specific bundle type input data.[path to plain-v0 or registry-v1 bundles testdata]
- `bundles` - Stores the data relevant to different versions of the bundle.
- `bInputDir` - The input directory containing the specific version of the bundle data.
- `bundleVersion` - The specific version of the bundle data.
- `imageRef` - This is formed. Stores the bundle image reference which will be of the format `localhost:5000/<operator_name>-bundle:v.<bundleVersion>`
- `imageRef` - This is formed. Stores the bundle image reference which will be of the format `localhost:5001/<operator_name>-bundle:v.<bundleVersion>`
- For getting catalog related inputs:
```
type CatalogDInfo struct {
Expand All @@ -63,11 +64,11 @@ This is a cross-component demo with all OLM v1 repositories. The ginkgo test doe
fbcFileName string
}
```
- `baseFolderPath` - Base path of the folder for the catalogs.
- `baseFolderPath` - Base/root path of the folder for the catalogs.
- `operatorName` - Name of the operator to be installed from the bundles.
- `desiredChannelName` - Desired channel name for the operator.
- `catalogDir` - This is formed. The directory to store the FBC. The formed value will be of the format: `<operator-name>-catalog`
- `imageRef` - This is formed. Stores the FBC image reference which will be of the format: `localhost:5000/<username>/<catalogDir>:test`
- `imageRef` - This is formed. Stores the FBC image reference which will be of the format: `localhost:5001/<username>/<catalogDir>:test`
- `fbcFileName` - Name of the FBC file. This is hard-coded as `catalog.yaml`.
- For getting information related to the install/upgrade action for operators:
```
Expand All @@ -80,20 +81,17 @@ This is a cross-component demo with all OLM v1 repositories. The ginkgo test doe
- `upgradeVersion` - Version of the operator to be upgraded on the cluster.

### Plain bundles
- Plain bundle manifests are taken as input.

- The plain bundle manifest directory taken as input should follow the below directory structure:
- The plain+v0 bundles are formed using `operator-sdk` and `kustomize`.
- The below input is used to form the bundle using operator-sdk.
```
bundles/
└── plain-v0/
├── plain.v<version>/
│ ├── manifests
│ └── Dockerfile
└── plain.v<version>/
├── manifests
└── Dockerfile
type SdkProjectInfo struct {
projectName string
domainName string
group string
version string
kind string
}
```
- The bundles should be present in the testdata folder.

- After the bundle image is created and loaded, the FBC is formed by a custom routine by using the operatorName, desiredChannelName, bundle imageRefs and bundleVersions.

Expand Down
4 changes: 2 additions & 2 deletions test/operator-framework-e2e/operator_framework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ var _ = BeforeSuite(func() {

})

var _ = Describe("Operator Framework E2E for plain bundles", func() {
var _ = Describe("Operator Framework E2E for plain+v0 bundles", func() {
var (
sdkInfo *SdkProjectInfo
bundleInfo *BundleInfo
Expand Down Expand Up @@ -399,7 +399,7 @@ func sdkInitialize(sdkInfo *SdkProjectInfo) error {
return nil
}

// Creates new API and controller
// Creates new API and controller for the given project with the name sdkInfo.projectName
func sdkNewAPIAndController(sdkInfo *SdkProjectInfo) error {
operatorSdkProjectAbsPath, _ := filepath.Abs(sdkInfo.projectName)
operatorSdkProjectPath := "OPERATOR_SDK_PROJECT_PATH=" + operatorSdkProjectAbsPath
Expand Down
12 changes: 8 additions & 4 deletions test/operator-framework-e2e/read_manifests.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package operatore2e

import (
"bytes"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -45,11 +46,14 @@ func collectKubernetesObjects(bundlePath, packageName, version string) ([]runtim
}

decoder := codecs.UniversalDecoder(scheme.PrioritizedVersionsAllGroups()...)
object, _, err := decoder.Decode(fileContent, nil, nil)
if err != nil {
return fmt.Errorf("failed to decode file %s: %w", filePath, err)
yamlObjects := bytes.Split(fileContent, []byte("\n---\n"))
for _, yamlObject := range yamlObjects {
object, _, err := decoder.Decode(yamlObject, nil, nil)
if err != nil {
return fmt.Errorf("failed to decode file %s: %w", filePath, err)
}
objects = append(objects, object)
}
objects = append(objects, object)
return nil
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ data:
user-interface.properties: |
color.good=purple
color.bad=yellow
allow.textmode=true
allow.textmode=true

0 comments on commit 6785df4

Please sign in to comment.