Skip to content

Commit a1cb8a6

Browse files
authored
⚠ add TLS overlay for Catalogd v0.13.0 web server TLS (#888)
* Update catalogd dep to v0.13.0 Fix references to Catalog and CatalogSpec * Implement TLS overlay for Catalogd TLS Signed-off-by: Tayler Geiger <[email protected]> * Reorganize TLS changes * Move e2e to its own overlay * Change default namespace to olmv1-system Use v0.14.0 of Catalogd which also uses olmv1-system namespace --------- Signed-off-by: Tayler Geiger <[email protected]>
1 parent 5798a4a commit a1cb8a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+134
-64
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ install.sh
3939
site
4040

4141
.tiltbuild/
42+
.vscode

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ else
5454
$(warning Could not find docker or podman in path! This may result in targets requiring a container runtime failing!)
5555
endif
5656

57-
KUSTOMIZE_BUILD_DIR := config/default
57+
KUSTOMIZE_BUILD_DIR := config/overlays/tls
5858

5959
# Disable -j flag for make
6060
.NOTPARALLEL:
@@ -95,7 +95,7 @@ tidy: #HELP Update dependencies.
9595

9696
.PHONY: manifests
9797
manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
98-
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
98+
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/base/crd/bases
9999

100100
.PHONY: generate
101101
generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -150,7 +150,7 @@ build-push-e2e-catalog: ## Build the testdata catalog used for e2e tests and pus
150150
# for example: ARTIFACT_PATH=/tmp/artifacts make test-e2e
151151
.PHONY: test-e2e
152152
test-e2e: KIND_CLUSTER_NAME := operator-controller-e2e
153-
test-e2e: KUSTOMIZE_BUILD_DIR := config/e2e
153+
test-e2e: KUSTOMIZE_BUILD_DIR := config/overlays/e2e
154154
test-e2e: GO_BUILD_FLAGS := -cover
155155
test-e2e: run image-registry build-push-e2e-catalog registry-load-bundles e2e e2e-coverage kind-clean #HELP Run e2e test suite on local kind cluster
156156

Tiltfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos = cfg.get('repos', ['operator-controller', 'catalogd'])
99

1010
repo = {
1111
'image': 'quay.io/operator-framework/operator-controller',
12-
'yaml': 'config/default',
12+
'yaml': 'config/overlays/tls',
1313
'binaries': {
1414
'manager': 'operator-controller-controller-manager',
1515
},

cmd/manager/main.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ import (
2020
"crypto/x509"
2121
"flag"
2222
"fmt"
23-
"net/http"
2423
"net/url"
2524
"os"
2625
"path/filepath"
27-
"time"
2826

2927
"github.com/spf13/pflag"
3028
"go.uber.org/zap/zapcore"
@@ -50,6 +48,7 @@ import (
5048
"github.com/operator-framework/operator-controller/internal/catalogmetadata/cache"
5149
catalogclient "github.com/operator-framework/operator-controller/internal/catalogmetadata/client"
5250
"github.com/operator-framework/operator-controller/internal/controllers"
51+
"github.com/operator-framework/operator-controller/internal/httputil"
5352
"github.com/operator-framework/operator-controller/internal/labels"
5453
"github.com/operator-framework/operator-controller/internal/version"
5554
"github.com/operator-framework/operator-controller/pkg/features"
@@ -58,7 +57,7 @@ import (
5857

5958
var (
6059
setupLog = ctrl.Log.WithName("setup")
61-
defaultSystemNamespace = "operator-controller-system"
60+
defaultSystemNamespace = "olmv1-system"
6261
)
6362

6463
// podNamespace checks whether the controller is running in a Pod vs.
@@ -82,9 +81,11 @@ func main() {
8281
operatorControllerVersion bool
8382
systemNamespace string
8483
provisionerStorageDirectory string
84+
caCert string
8585
)
8686
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
8787
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
88+
flag.StringVar(&caCert, "ca-cert", "", "The TLS certificate to use for verifying HTTPS connections to the Catalogd web server.")
8889
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
8990
"Enable leader election for controller manager. "+
9091
"Enabling this will ensure there is only one active controller manager.")
@@ -153,8 +154,13 @@ func main() {
153154
os.Exit(1)
154155
}
155156

157+
httpClient, err := httputil.BuildHTTPClient(caCert)
158+
if err != nil {
159+
setupLog.Error(err, "unable to create catalogd http client")
160+
}
161+
156162
cl := mgr.GetClient()
157-
catalogClient := catalogclient.New(cl, cache.NewFilesystemCache(cachePath, &http.Client{Timeout: 10 * time.Second}))
163+
catalogClient := catalogclient.New(cl, cache.NewFilesystemCache(cachePath, httpClient))
158164

159165
cfgGetter, err := helmclient.NewActionConfigGetter(mgr.GetConfig(), mgr.GetRESTMapper(), helmclient.StorageNamespaceMapper(func(o client.Object) (string, error) {
160166
return systemNamespace, nil
File renamed without changes.

config/default/kustomization.yaml renamed to config/base/kustomization.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Adds namespace to all resources.
2-
namespace: operator-controller-system
2+
namespace: olmv1-system
33

44
# Value of this field is prepended to the
55
# names of all resources, e.g. a deployment named
@@ -15,9 +15,9 @@ namePrefix: operator-controller-
1515
# someName: someValue
1616

1717
resources:
18-
- ../crd
19-
- ../rbac
20-
- ../manager
18+
- crd
19+
- rbac
20+
- manager
2121
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
2222
# crd/kustomization.yaml
2323
#- ../webhook

config/manager/manager.yaml renamed to config/base/manager/manager.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,4 @@ spec:
114114
- name: cache
115115
emptyDir: {}
116116
- name: bundle-cache
117-
emptyDir: {}
117+
emptyDir: {}

0 commit comments

Comments
 (0)