Skip to content

Commit

Permalink
[CatalogSource] Set Global Catalog NS with EnvVar
Browse files Browse the repository at this point in the history
This commit introduces a change that makes it possible to configure the
Global Catalog Namespace by adding the CATALOG_NAMESPACE environment
variable to the catalog-operator deployment.
  • Loading branch information
awgreene committed Aug 29, 2019
1 parent 2959328 commit c0b2c3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Documentation/install/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ To configure a release of OLM for installation in a cluster:

The above steps are automated for official releases with `make ver=0.3.0 release`, which will output new versions of manifests in `deploy/tectonic-alm-operator/manifests/$(ver)`.

## Overriding the Global Catalog Namespace

It is possible to override the Global Catalog Namespace by setting the `GLOBAL_CATALOG_NAMESPACE` environment variable in the catalog operator deployment.

## Subscribe to a Package and Channel

Cloud Services can be installed from the catalog by subscribing to a channel in the corresponding package.
Expand Down
7 changes: 7 additions & 0 deletions cmd/catalog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
)

const (
catalogNamespaceEnvVarName = "GLOBAL_CATALOG_NAMESPACE"
defaultWakeupInterval = 15 * time.Minute
defaultCatalogNamespace = "openshift-operator-lifecycle-manager"
defaultConfigMapServerImage = "quay.io/operatorframework/configmap-operator-registry:latest"
Expand Down Expand Up @@ -103,6 +104,12 @@ func main() {
}
logger.Infof("log level %s", logger.Level)

// If the catalogNamespaceEnvVarName environment variable is set, then update the value of catalogNamespace.
if catalogNamespaceEnvVarValue := os.Getenv(catalogNamespaceEnvVarName); catalogNamespaceEnvVarValue != "" {
logger.Infof("%s environment variable is set. Updating Global Catalog Namespace to %s", catalogNamespaceEnvVarName, catalogNamespaceEnvVarValue)
*catalogNamespace = catalogNamespaceEnvVarValue
}

var useTLS bool
if *tlsCertPath != "" && *tlsKeyPath == "" || *tlsCertPath == "" && *tlsKeyPath != "" {
logger.Warn("both --tls-key and --tls-crt must be provided for TLS to be enabled, falling back to non-https")
Expand Down

0 comments on commit c0b2c3c

Please sign in to comment.