@@ -17,25 +17,26 @@ package olm
1717import (
1818 "fmt"
1919
20- "github.com/operator-framework/operator-sdk/internal/util/k8sutil"
21-
2220 appsv1 "k8s.io/api/apps/v1"
2321 corev1 "k8s.io/api/core/v1"
2422 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23+
24+ "github.com/operator-framework/operator-sdk/internal/util/k8sutil"
2525)
2626
2727const (
2828 // The image operator-registry's initializer and registry-server binaries
2929 // are run from.
3030 // QUESTION(estroz): version registry image?
31- registryBaseImage = "quay.io/openshift/origin- operator-registry:latest"
31+ registryBaseImage = "quay.io/operator-framework/upstream- registry-builder :latest"
3232 // The port registry-server will listen on within a container.
3333 registryGRPCPort = 50051
34- // Path of the bundle database generated by initializer.
35- regisryDBName = "bundle.db"
36- // Path of the log file generated by registry-server.
37- // TODO(estroz): have this log file in an obvious place, ex. /var/log.
38- registryLogFile = "termination.log"
34+ // Path of the bundle database generated by initializer. Use /tmp since it is
35+ // typically world-writable.
36+ registryDBName = "/tmp/bundle.db"
37+ // Path of the log file generated by registry-server. Use /tmp since it is
38+ // typically world-writable.
39+ registryLogFile = "/tmp/termination.log"
3940)
4041
4142func getRegistryServerName (pkgName string ) string {
@@ -99,13 +100,12 @@ func withContainerVolumeMounts(volName string, paths ...string) func(*appsv1.Dep
99100}
100101
101102// getDBContainerCmd returns a command string that, when run, does two things:
102- // 1. Runs a database initializer on the manifests in the current working
103+ // 1. Runs a database initializer on the manifests in the /registry
103104// directory.
104105// 2. Runs an operator-registry server serving the bundle database.
105- // The database must be in the current working directory.
106106func getDBContainerCmd (dbPath , logPath string ) string {
107- initCmd := fmt .Sprintf ("/usr/ bin/initializer -o %s" , dbPath )
108- srvCmd := fmt .Sprintf ("/usr/ bin/registry-server -d %s -t %s" , dbPath , logPath )
107+ initCmd := fmt .Sprintf ("/bin/initializer -o %s -m %s " , dbPath , containerManifestsDir )
108+ srvCmd := fmt .Sprintf ("/bin/registry-server -d %s -t %s" , dbPath , logPath )
109109 return fmt .Sprintf ("%s && %s" , initCmd , srvCmd )
110110}
111111
@@ -114,13 +114,14 @@ func getDBContainerCmd(dbPath, logPath string) string {
114114// pod template spec.
115115func withRegistryGRPCContainer (pkgName string ) func (* appsv1.Deployment ) {
116116 container := corev1.Container {
117- Name : getRegistryServerName (pkgName ),
118- Image : registryBaseImage ,
119- Command : []string {"/bin/bash" },
117+ Name : getRegistryServerName (pkgName ),
118+ Image : registryBaseImage ,
119+ WorkingDir : "/tmp" ,
120+ Command : []string {"/bin/sh" },
120121 Args : []string {
121122 "-c" ,
122123 // TODO(estroz): grab logs and print if error
123- getDBContainerCmd (regisryDBName , registryLogFile ),
124+ getDBContainerCmd (registryDBName , registryLogFile ),
124125 },
125126 Ports : []corev1.ContainerPort {
126127 {Name : "registry-grpc" , ContainerPort : registryGRPCPort },
0 commit comments