Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions changelog/fragments/fix-run-packagemanifests-e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
entries:
- description:
Fixed a bug with `run packagemanifests` that caused the underlying
registry pod to fail to start. Changed the registry pod image from
`quay.io/openshift/origin-operator-registry:latest` to
`quay.io/operator-framework/upstream-registry-builder:latest`

# kind is one of:
# - addition
# - change
# - deprecation
# - removal
# - bugfix
kind: bugfix

# Is this a breaking change?
breaking: false
4 changes: 2 additions & 2 deletions hack/tests/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ popd
# Install OLM on the cluster if not installed.
olm_latest_exists=0
if ! operator-sdk olm status > /dev/null 2>&1; then
operator-sdk olm install
operator-sdk olm install --version=0.15.1
olm_latest_exists=1
fi

Expand All @@ -58,5 +58,5 @@ header_text "Integration tests succeeded"

# Uninstall OLM if it was installed for test purposes.
if eval "(( $olm_latest_exists ))"; then
operator-sdk olm uninstall
operator-sdk olm uninstall --version=0.15.1
fi
10 changes: 9 additions & 1 deletion internal/olm/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,15 @@ func (c Client) DoCSVWait(ctx context.Context, key types.NamespacedName) error {
curPhase = newPhase
log.Printf(" Found ClusterServiceVersion %q phase: %s", key, curPhase)
}
return curPhase == olmapiv1alpha1.CSVPhaseSucceeded, nil

switch curPhase {
case olmapiv1alpha1.CSVPhaseFailed:
return false, fmt.Errorf("csv failed: reason: %q, message: %q", csv.Status.Reason, csv.Status.Message)
case olmapiv1alpha1.CSVPhaseSucceeded:
return true, nil
default:
return false, nil
}
}

return wait.PollImmediateUntil(time.Second, csvPhaseSucceeded, ctx.Done())
Expand Down
19 changes: 10 additions & 9 deletions internal/olm/operator/registry/configmap/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ package configmap
import (
"fmt"

"github.com/operator-framework/operator-sdk/internal/util/k8sutil"

appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/operator-framework/operator-sdk/internal/util/k8sutil"
)

const (
// The image operator-registry's initializer and registry-server binaries
// are run from.
// QUESTION(estroz): version registry image?
registryBaseImage = "quay.io/openshift/origin-operator-registry:latest"
registryBaseImage = "quay.io/operator-framework/upstream-registry-builder:latest"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw

 Waiting for Deployment \\\"default/e2e-fkkv-registry-server\\\" to rollout: 0 of 1 updated replicas are available\"\ntime=\"2020-09-04T15:34:20Z\" level=fatal msg=\"Failed to run packagemanifests: create catalog: error creating registry resources: error registering package: error waiting for Deployment \\\"default/e2e-fkkv-registry-server\\\" to roll out: timed out waiting for the condition\\n\"\n",

// The port registry-server will listen on within a container.
registryGRPCPort = 50051
// Path of the bundle database generated by initializer.
Expand Down Expand Up @@ -99,14 +99,15 @@ func withContainerVolumeMounts(volName string, paths ...string) func(*appsv1.Dep
}

// getDBContainerCmd returns a command string that, when run, does two things:
// 1. Runs a database initializer on the manifests in the current working
// 1. Runs a database initializer on the manifests in the /registry
// directory.
// 2. Runs an operator-registry server serving the bundle database.
// The database must be in the current working directory.
// The database must be in /registry directory.
func getDBContainerCmd(dbPath, logPath string) string {
initCmd := fmt.Sprintf("/usr/bin/initializer -o %s", dbPath)
srvCmd := fmt.Sprintf("/usr/bin/registry-server -d %s -t %s", dbPath, logPath)
return fmt.Sprintf("%s && %s", initCmd, srvCmd)
cdCmd := "cd /registry"
initCmd := fmt.Sprintf("/bin/initializer -o %s", dbPath)
srvCmd := fmt.Sprintf("/bin/registry-server -d %s -t %s", dbPath, logPath)
return fmt.Sprintf("%s && %s && %s", cdCmd, initCmd, srvCmd)
}

// withRegistryGRPCContainer returns a function that appends a container
Expand All @@ -116,7 +117,7 @@ func withRegistryGRPCContainer(pkgName string) func(*appsv1.Deployment) {
container := corev1.Container{
Name: getRegistryServerName(pkgName),
Image: registryBaseImage,
Command: []string{"/bin/bash"},
Command: []string{"/bin/sh"},
Args: []string{
"-c",
// TODO(estroz): grab logs and print if error
Expand Down
13 changes: 7 additions & 6 deletions test/e2e-ansible/e2e_ansible_olm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ import (
"encoding/json"
"fmt"
"os/exec"
"path"
"path/filepath"
"strings"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/operator-framework/api/pkg/apis/scorecard/v1alpha3"

testutils "github.com/operator-framework/operator-sdk/test/internal"
)

Expand Down Expand Up @@ -55,16 +54,18 @@ var _ = Describe("Integrating ansible Projects with OLM", func() {
By("building the operator bundle image")
// Use the existing image tag but with a "-bundle" suffix.
imageSplit := strings.SplitN(tc.ImageName, ":", 2)
bundleImage := path.Join("quay.io", imageSplit[0]+"-bundle")
bundleImage := imageSplit[0] + "-bundle"
if len(imageSplit) == 2 {
bundleImage += ":" + imageSplit[1]
}
err = tc.Make("bundle-build", "BUNDLE_IMG="+bundleImage)
Expect(err).NotTo(HaveOccurred())

By("loading the project image into Kind cluster")
err = tc.LoadImageToKindClusterWithName(bundleImage)
Expect(err).Should(Succeed())
if isRunningOnKind() {
By("loading the bundle image into Kind cluster")
err = tc.LoadImageToKindClusterWithName(bundleImage)
Expect(err).Should(Succeed())
}

By("adding the 'packagemanifests' rule to the Makefile")
err = tc.AddPackagemanifestsTarget()
Expand Down
11 changes: 6 additions & 5 deletions test/e2e-helm/e2e_helm_olm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"encoding/json"
"fmt"
"os/exec"
"path"
"path/filepath"
"strings"

Expand Down Expand Up @@ -55,16 +54,18 @@ var _ = Describe("Integrating Helm Projects with OLM", func() {
By("building the operator bundle image")
// Use the existing image tag but with a "-bundle" suffix.
imageSplit := strings.SplitN(tc.ImageName, ":", 2)
bundleImage := path.Join("quay.io", imageSplit[0]+"-bundle")
bundleImage := imageSplit[0] + "-bundle"
if len(imageSplit) == 2 {
bundleImage += ":" + imageSplit[1]
}
err = tc.Make("bundle-build", "BUNDLE_IMG="+bundleImage)
Expect(err).NotTo(HaveOccurred())

By("loading the project image into Kind cluster")
err = tc.LoadImageToKindClusterWithName(bundleImage)
Expect(err).Should(Succeed())
if isRunningOnKind() {
By("loading the bundle image into Kind cluster")
err = tc.LoadImageToKindClusterWithName(bundleImage)
Expect(err).Should(Succeed())
}

By("adding the 'packagemanifests' rule to the Makefile")
err = tc.AddPackagemanifestsTarget()
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ var _ = Describe("operator-sdk", func() {
By("building the operator bundle image")
// Use the existing image tag but with a "-bundle" suffix.
imageSplit := strings.SplitN(tc.ImageName, ":", 2)
bundleImage := path.Join("quay.io", imageSplit[0]+"-bundle")
bundleImage := imageSplit[0] + "-bundle"
if len(imageSplit) == 2 {
bundleImage += ":" + imageSplit[1]
}
Expand Down