@@ -17,25 +17,26 @@ package olm
17
17
import (
18
18
"fmt"
19
19
20
- "github.com/operator-framework/operator-sdk/internal/util/k8sutil"
21
-
22
20
appsv1 "k8s.io/api/apps/v1"
23
21
corev1 "k8s.io/api/core/v1"
24
22
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23
+
24
+ "github.com/operator-framework/operator-sdk/internal/util/k8sutil"
25
25
)
26
26
27
27
const (
28
28
// The image operator-registry's initializer and registry-server binaries
29
29
// are run from.
30
30
// QUESTION(estroz): version registry image?
31
- registryBaseImage = "quay.io/openshift/origin- operator-registry:latest"
31
+ registryBaseImage = "quay.io/operator-framework/upstream- registry-builder :latest"
32
32
// The port registry-server will listen on within a container.
33
33
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"
39
40
)
40
41
41
42
func getRegistryServerName (pkgName string ) string {
@@ -99,13 +100,12 @@ func withContainerVolumeMounts(volName string, paths ...string) func(*appsv1.Dep
99
100
}
100
101
101
102
// 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
103
104
// directory.
104
105
// 2. Runs an operator-registry server serving the bundle database.
105
- // The database must be in the current working directory.
106
106
func 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 )
109
109
return fmt .Sprintf ("%s && %s" , initCmd , srvCmd )
110
110
}
111
111
@@ -114,13 +114,14 @@ func getDBContainerCmd(dbPath, logPath string) string {
114
114
// pod template spec.
115
115
func withRegistryGRPCContainer (pkgName string ) func (* appsv1.Deployment ) {
116
116
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" },
120
121
Args : []string {
121
122
"-c" ,
122
123
// TODO(estroz): grab logs and print if error
123
- getDBContainerCmd (regisryDBName , registryLogFile ),
124
+ getDBContainerCmd (registryDBName , registryLogFile ),
124
125
},
125
126
Ports : []corev1.ContainerPort {
126
127
{Name : "registry-grpc" , ContainerPort : registryGRPCPort },
0 commit comments