Skip to content

Commit f4d9445

Browse files
committed
Separate CA configuration for pulls vs catalogd services
Rename the flags that provide CAs to image pulling to indicate the use. Keep the old flag around (for backward compatibility), but prefer the new flag(s). Signed-off-by: Todd Short <tshort@redhat.com>
1 parent 10e2754 commit f4d9445

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

catalogd/cmd/catalogd/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func main() {
9797
certFile string
9898
keyFile string
9999
webhookPort int
100-
caCertDir string
100+
pullCertDir string
101101
globalPullSecret string
102102
)
103103
flag.StringVar(&metricsAddr, "metrics-bind-address", "", "The address for the metrics endpoint. Requires tls-cert and tls-key. (Default: ':7443')")
@@ -115,7 +115,7 @@ func main() {
115115
flag.StringVar(&certFile, "tls-cert", "", "The certificate file used for serving catalog and metrics. Required to enable the metrics server. Requires tls-key.")
116116
flag.StringVar(&keyFile, "tls-key", "", "The key file used for serving catalog contents and metrics. Required to enable the metrics server. Requires tls-cert.")
117117
flag.IntVar(&webhookPort, "webhook-server-port", 9443, "The port that the mutating webhook server serves at.")
118-
flag.StringVar(&caCertDir, "ca-certs-dir", "", "The directory of CA certificate to use for verifying HTTPS connections to image registries.")
118+
flag.StringVar(&pullCertDir, "pull-cas-dir", "", "The directory of TLS certificate authoritiess to use for verifying HTTPS connections to image registries.")
119119
flag.StringVar(&globalPullSecret, "global-pull-secret", "", "The <namespace>/<name> of the global pull secret that is going to be used to pull bundle images.")
120120

121121
klog.InitFlags(flag.CommandLine)
@@ -271,8 +271,8 @@ func main() {
271271
BaseCachePath: unpackCacheBasePath,
272272
SourceContextFunc: func(logger logr.Logger) (*types.SystemContext, error) {
273273
srcContext := &types.SystemContext{
274-
DockerCertPath: caCertDir,
275-
OCICertPath: caCertDir,
274+
DockerCertPath: pullCertDir,
275+
OCICertPath: pullCertDir,
276276
}
277277
if _, err := os.Stat(authFilePath); err == nil && globalPullSecretKey != nil {
278278
logger.Info("using available authentication information for pulling image")

catalogd/config/components/ca/patches/manager_deployment_cacerts.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
value: {"name":"olmv1-certificate", "readOnly": true, "mountPath":"/var/ca-certs/"}
77
- op: add
88
path: /spec/template/spec/containers/0/args/-
9-
value: "--ca-certs-dir=/var/ca-certs"
9+
value: "--pull-certs-dir=/var/ca-certs"

cmd/operator-controller/main.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,14 @@ func main() {
101101
cachePath string
102102
operatorControllerVersion bool
103103
systemNamespace string
104-
caCertDir string
104+
catalogdCertDir string
105+
pullCertDir string
105106
globalPullSecret string
106107
)
107108
flag.StringVar(&metricsAddr, "metrics-bind-address", "", "The address for the metrics endpoint. Requires tls-cert and tls-key. (Default: ':8443')")
108109
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
109-
flag.StringVar(&caCertDir, "ca-certs-dir", "", "The directory of TLS certificate to use for verifying HTTPS connections to the Catalogd and docker-registry web servers.")
110+
flag.StringVar(&catalogdCertDir, "catalogd-cas-dir", "", "The directory of TLS certificate authorities to use for verifying HTTPS connections to the Catalogd web service.")
111+
flag.StringVar(&pullCertDir, "pull-cas-dir", "", "The directory of TLS certificate authorities to use for verifying HTTPS connections to image registries.")
110112
flag.StringVar(&certFile, "tls-cert", "", "The certificate file used for the metrics server. Required to enable the metrics server. Requires tls-key.")
111113
flag.StringVar(&keyFile, "tls-key", "", "The key file used for the metrics server. Required to enable the metrics server. Requires tls-cert")
112114
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
@@ -283,7 +285,7 @@ func main() {
283285
os.Exit(1)
284286
}
285287

286-
certPoolWatcher, err := httputil.NewCertPoolWatcher(caCertDir, ctrl.Log.WithName("cert-pool"))
288+
certPoolWatcher, err := httputil.NewCertPoolWatcher(catalogdCertDir, ctrl.Log.WithName("cert-pool"))
287289
if err != nil {
288290
setupLog.Error(err, "unable to create CA certificate pool")
289291
os.Exit(1)
@@ -301,8 +303,8 @@ func main() {
301303
BaseCachePath: filepath.Join(cachePath, "unpack"),
302304
SourceContextFunc: func(logger logr.Logger) (*types.SystemContext, error) {
303305
srcContext := &types.SystemContext{
304-
DockerCertPath: caCertDir,
305-
OCICertPath: caCertDir,
306+
DockerCertPath: pullCertDir,
307+
OCICertPath: pullCertDir,
306308
}
307309
if _, err := os.Stat(authFilePath); err == nil && globalPullSecretKey != nil {
308310
logger.Info("using available authentication information for pulling image")

config/components/tls/patches/manager_deployment_cert.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
value: {"name":"olmv1-certificate", "readOnly": true, "mountPath":"/var/certs/"}
77
- op: add
88
path: /spec/template/spec/containers/0/args/-
9-
value: "--ca-certs-dir=/var/certs"
9+
value: "--catalogd-certs-dir=/var/certs"
10+
- op: add
11+
path: /spec/template/spec/containers/0/args/-
12+
value: "--pull-certs-dir=/var/certs"
1013
- op: add
1114
path: /spec/template/spec/containers/0/args/-
1215
value: "--tls-cert=/var/certs/tls.cert"

0 commit comments

Comments
 (0)