Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1a27741
Metrics Docs Maintenance (#2024)
dtfranz Jun 12, 2025
b004bc2
Add manifests directory (#2025)
tmshort Jun 12, 2025
3441d90
Add catalogd to code coverage (#2026)
tmshort Jun 12, 2025
efc6657
:sparkles: Support serviceaccount pull secrets (#2005)
tmshort Jun 12, 2025
cf656c6
Merge branch 'main' into synchronize
Jun 13, 2025
0847a2b
UPSTREAM: <carry>: Add OpenShift specific files
dtfranz Oct 26, 2023
1a48335
UPSTREAM: <carry>: Fix catalogd.Dockerfile to use new paths
tmshort Feb 26, 2025
b8d32d4
UPSTREAM: <carry>: Update DOWNSTREAM_OWNERS_ALIASES
tmshort Mar 6, 2025
a431178
UPSTREAM: <carry>: Add openshift node selector annotation
oceanc80 Mar 26, 2025
28e905a
UPSTREAM: <carry>: Add caalogd-cas-dir option to op-con
tmshort Apr 15, 2025
f892b8f
UPSTREAM: <carry>: set the SElinux type
jianzhangbjz Apr 27, 2025
6a04c2b
UPSTREAM: <carry>: Add initial stack to run tests to validate the cat…
camilamacedo86 Apr 17, 2025
148253c
UPSTREAM: <carry>: Add vendor files for the catalog-sync tests
camilamacedo86 Apr 17, 2025
a727794
UPSTREAM: <carry>: Bump catalog versions to 4.19
tmshort Apr 24, 2025
efcc585
UPSTREAM: <carry>: revert "Bump catalog versions to 4.19"
tmshort May 15, 2025
e5c3081
UPSTREAM: <carry>: Update HOWTO-origin-tests
tmshort May 14, 2025
838103f
UPSTREAM: <carry>: [DefaultCatalogTests]: Allow to pass auth path for…
camilamacedo86 May 16, 2025
19bc4d1
UPSTREAM: <carry>: fix: set NoLchown=true to allow image unpack on OCPci
camilamacedo86 May 19, 2025
30e35d8
UPSTREAM: <carry>: [DefaultCatalogTests]: Moving parse of ENVVAR to t…
camilamacedo86 May 17, 2025
abaa01b
UPSTREAM: <carry>: [Default Catalog]: Create tmp dir to extract layer…
camilamacedo86 May 20, 2025
b12b7f7
UPSTREAM: <carry>: [Default Catalog](cleanp) Remove hack directory wh…
camilamacedo86 May 19, 2025
597a2c0
UPSTREAM: <carry>: Change code implementation to extract layers in OC…
camilamacedo86 May 21, 2025
5848487
UPSTREAM: <carry>: Add vendor files for change in the extract code im…
camilamacedo86 May 21, 2025
dea5c1d
UPSTREAM: <carry>: [Default Catalog Tests]: Final cleanups and enhanc…
camilamacedo86 May 22, 2025
c210b13
UPSTREAM: <carry>: SELinux type for operator-controller
jianzhangbjz May 22, 2025
3158fc7
UPSTREAM: <carry>: Bump catalog versions to 4.19
tmshort Apr 24, 2025
c67947e
UPSTREAM: <carry>: [Default Catalog Consistency Test] (feat) add chec…
camilamacedo86 May 28, 2025
94a7f68
UPSTREAM: <carry>: [Default Catalog Consistency Test]: fix junit outp…
camilamacedo86 Jun 2, 2025
14db614
UPSTREAM: <carry>: [Default Catalog Consistency Test] (feat) add chec…
camilamacedo86 May 29, 2025
4094c4f
UPSTREAM: <carry>: [Default Catalog Consistency Test]: Enable Catalog…
camilamacedo86 Jun 4, 2025
0eca244
UPSTREAM: <carry>: [Default Catalog Consistency Test]: Rename Tests s…
camilamacedo86 Jun 4, 2025
e44192f
UPSTREAM: <drop>: go mod vendor
Jun 13, 2025
8d964e9
UPSTREAM: <drop>: remove upstream GitHub configuration
Jun 13, 2025
6715324
UPSTREAM: <drop>: configure the commit-checker
Jun 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ export RELEASE_MANIFEST := operator-controller.yaml
export RELEASE_INSTALL := install.sh
export RELEASE_CATALOGS := default-catalogs.yaml

CATALOGS_MANIFEST := ./config/catalogs/clustercatalogs/default-catalogs.yaml
# List of manifests that are checked in
MANIFEST_HOME := ./manifests
STANDARD_MANIFEST := ./manifests/standard.yaml
CATALOGS_MANIFEST := ./manifests/default-catalogs.yaml

# Disable -j flag for make
.NOTPARALLEL:
Expand Down Expand Up @@ -143,7 +146,7 @@ KUSTOMIZE_OPCON_RBAC_DIR := config/base/operator-controller/rbac
CRD_WORKING_DIR := crd_work_dir
# Due to https://github.com/kubernetes-sigs/controller-tools/issues/837 we can't specify individual files
# So we have to generate them together and then move them into place
manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
manifests: $(CONTROLLER_GEN) $(KUSTOMIZE) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
mkdir $(CRD_WORKING_DIR)
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) crd paths="./api/v1/..." output:crd:artifacts:config=$(CRD_WORKING_DIR)
mv $(CRD_WORKING_DIR)/olm.operatorframework.io_clusterextensions.yaml $(KUSTOMIZE_OPCON_CRDS_DIR)
Expand All @@ -154,6 +157,9 @@ manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole,
# Generate the remaining catalogd manifests
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) rbac:roleName=manager-role paths="./internal/catalogd/..." output:rbac:artifacts:config=$(KUSTOMIZE_CATD_RBAC_DIR)
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) webhook paths="./internal/catalogd/..." output:webhook:artifacts:config=$(KUSTOMIZE_CATD_WEBHOOKS_DIR)
# Generate manifests stored in source-control
mkdir -p $(MANIFEST_HOME)
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) > $(STANDARD_MANIFEST)

.PHONY: generate
generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
Expand Down Expand Up @@ -296,8 +302,8 @@ kind-load: $(KIND) #EXHELP Loads the currently constructed images into the KIND
.PHONY: kind-deploy
kind-deploy: export MANIFEST := $(RELEASE_MANIFEST)
kind-deploy: export DEFAULT_CATALOG := $(RELEASE_CATALOGS)
kind-deploy: manifests $(KUSTOMIZE)
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | sed "s/cert-git-version/cert-$(VERSION)/g" > $(MANIFEST)
kind-deploy: manifests
sed "s/cert-git-version/cert-$(VERSION)/g" $(STANDARD_MANIFEST) > $(MANIFEST)
cp $(CATALOGS_MANIFEST) $(DEFAULT_CATALOG)
envsubst '$$DEFAULT_CATALOG,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s

Expand Down Expand Up @@ -390,8 +396,9 @@ release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By d
.PHONY: quickstart
quickstart: export MANIFEST := "https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/$(notdir $(RELEASE_MANIFEST))"
quickstart: export DEFAULT_CATALOG := "https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/$(notdir $(RELEASE_CATALOGS))"
quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the unified installation release manifests and scripts.
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | sed "s/cert-git-version/cert-$(VERSION)/g" | sed "s/:devel/:$(VERSION)/g" > $(RELEASE_MANIFEST)
quickstart: manifests #EXHELP Generate the unified installation release manifests and scripts.
# Update the stored standard manifests for distribution
sed "s/:devel/:$(VERSION)/g" $(STANDARD_MANIFEST) | sed "s/cert-git-version/cert-$(VERSION)/g" > $(RELEASE_MANIFEST)
cp $(CATALOGS_MANIFEST) $(RELEASE_CATALOGS)
envsubst '$$DEFAULT_CATALOG,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > $(RELEASE_INSTALL)

Expand Down
53 changes: 27 additions & 26 deletions cmd/catalogd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ import (

"github.com/containers/image/v5/types"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/fields"
k8slabels "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
k8stypes "k8s.io/apimachinery/pkg/types"
apimachineryrand "k8s.io/apimachinery/pkg/util/rand"
Expand Down Expand Up @@ -61,8 +58,11 @@ import (
"github.com/operator-framework/operator-controller/internal/catalogd/serverutil"
"github.com/operator-framework/operator-controller/internal/catalogd/storage"
"github.com/operator-framework/operator-controller/internal/catalogd/webhook"
sharedcontrollers "github.com/operator-framework/operator-controller/internal/shared/controllers"
fsutil "github.com/operator-framework/operator-controller/internal/shared/util/fs"
imageutil "github.com/operator-framework/operator-controller/internal/shared/util/image"
"github.com/operator-framework/operator-controller/internal/shared/util/pullsecretcache"
sautil "github.com/operator-framework/operator-controller/internal/shared/util/sa"
"github.com/operator-framework/operator-controller/internal/shared/version"
)

Expand Down Expand Up @@ -246,17 +246,19 @@ func run(ctx context.Context) error {
cacheOptions := crcache.Options{
ByObject: map[client.Object]crcache.ByObject{},
}
if cfg.globalPullSecretKey != nil {
cacheOptions.ByObject[&corev1.Secret{}] = crcache.ByObject{
Namespaces: map[string]crcache.Config{
cfg.globalPullSecretKey.Namespace: {
LabelSelector: k8slabels.Everything(),
FieldSelector: fields.SelectorFromSet(map[string]string{
"metadata.name": cfg.globalPullSecretKey.Name,
}),
},
},
}

saKey, err := sautil.GetServiceAccount()
if err != nil {
setupLog.Error(err, "Failed to extract serviceaccount from JWT")
return err
}
setupLog.Info("Successfully extracted serviceaccount from JWT", "serviceaccount",
fmt.Sprintf("%s/%s", saKey.Namespace, saKey.Name))

err = pullsecretcache.SetupPullSecretCache(&cacheOptions, cfg.globalPullSecretKey, saKey)
if err != nil {
setupLog.Error(err, "Unable to setup pull-secret cache")
return err
}

// Create manager
Expand Down Expand Up @@ -312,7 +314,7 @@ func run(ctx context.Context) error {
DockerCertPath: cfg.pullCasDir,
OCICertPath: cfg.pullCasDir,
}
if _, err := os.Stat(authFilePath); err == nil && cfg.globalPullSecretKey != nil {
if _, err := os.Stat(authFilePath); err == nil {
logger.Info("using available authentication information for pulling image")
srcContext.AuthFilePath = authFilePath
} else if os.IsNotExist(err) {
Expand Down Expand Up @@ -370,17 +372,16 @@ func run(ctx context.Context) error {
return err
}

if cfg.globalPullSecretKey != nil {
setupLog.Info("creating SecretSyncer controller for watching secret", "Secret", cfg.globalPullSecret)
err := (&corecontrollers.PullSecretReconciler{
Client: mgr.GetClient(),
AuthFilePath: authFilePath,
SecretKey: *cfg.globalPullSecretKey,
}).SetupWithManager(mgr)
if err != nil {
setupLog.Error(err, "unable to create controller", "controller", "SecretSyncer")
return err
}
setupLog.Info("creating SecretSyncer controller for watching secret", "Secret", cfg.globalPullSecret)
err = (&sharedcontrollers.PullSecretReconciler{
Client: mgr.GetClient(),
AuthFilePath: authFilePath,
SecretKey: cfg.globalPullSecretKey,
ServiceAccountKey: saKey,
}).SetupWithManager(mgr)
if err != nil {
setupLog.Error(err, "unable to create controller", "controller", "SecretSyncer")
return err
}
//+kubebuilder:scaffold:builder

Expand Down
52 changes: 27 additions & 25 deletions cmd/operator-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ import (

"github.com/containers/image/v5/types"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
apiextensionsv1client "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1"
"k8s.io/apimachinery/pkg/fields"
k8slabels "k8s.io/apimachinery/pkg/labels"
k8stypes "k8s.io/apimachinery/pkg/types"
apimachineryrand "k8s.io/apimachinery/pkg/util/rand"
Expand Down Expand Up @@ -71,9 +69,12 @@ import (
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render/certproviders"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render/registryv1"
"github.com/operator-framework/operator-controller/internal/operator-controller/scheme"
sharedcontrollers "github.com/operator-framework/operator-controller/internal/shared/controllers"
fsutil "github.com/operator-framework/operator-controller/internal/shared/util/fs"
httputil "github.com/operator-framework/operator-controller/internal/shared/util/http"
imageutil "github.com/operator-framework/operator-controller/internal/shared/util/image"
"github.com/operator-framework/operator-controller/internal/shared/util/pullsecretcache"
sautil "github.com/operator-framework/operator-controller/internal/shared/util/sa"
"github.com/operator-framework/operator-controller/internal/shared/version"
)

Expand Down Expand Up @@ -217,17 +218,19 @@ func run() error {
},
DefaultLabelSelector: k8slabels.Nothing(),
}
if globalPullSecretKey != nil {
cacheOptions.ByObject[&corev1.Secret{}] = crcache.ByObject{
Namespaces: map[string]crcache.Config{
globalPullSecretKey.Namespace: {
LabelSelector: k8slabels.Everything(),
FieldSelector: fields.SelectorFromSet(map[string]string{
"metadata.name": globalPullSecretKey.Name,
}),
},
},
}

saKey, err := sautil.GetServiceAccount()
if err != nil {
setupLog.Error(err, "Failed to extract serviceaccount from JWT")
return err
}
setupLog.Info("Successfully extracted serviceaccount from JWT", "serviceaccount",
fmt.Sprintf("%s/%s", saKey.Namespace, saKey.Name))

err = pullsecretcache.SetupPullSecretCache(&cacheOptions, globalPullSecretKey, saKey)
if err != nil {
setupLog.Error(err, "Unable to setup pull-secret cache")
return err
}

metricsServerOptions := server.Options{}
Expand Down Expand Up @@ -360,7 +363,7 @@ func run() error {
OCICertPath: cfg.pullCasDir,
}
logger := log.FromContext(ctx)
if _, err := os.Stat(authFilePath); err == nil && globalPullSecretKey != nil {
if _, err := os.Stat(authFilePath); err == nil {
logger.Info("using available authentication information for pulling image")
srcContext.AuthFilePath = authFilePath
} else if os.IsNotExist(err) {
Expand Down Expand Up @@ -482,17 +485,16 @@ func run() error {
return err
}

if globalPullSecretKey != nil {
setupLog.Info("creating SecretSyncer controller for watching secret", "Secret", cfg.globalPullSecret)
err := (&controllers.PullSecretReconciler{
Client: mgr.GetClient(),
AuthFilePath: authFilePath,
SecretKey: *globalPullSecretKey,
}).SetupWithManager(mgr)
if err != nil {
setupLog.Error(err, "unable to create controller", "controller", "SecretSyncer")
return err
}
setupLog.Info("creating SecretSyncer controller for watching secret", "Secret", cfg.globalPullSecret)
err = (&sharedcontrollers.PullSecretReconciler{
Client: mgr.GetClient(),
AuthFilePath: authFilePath,
SecretKey: globalPullSecretKey,
ServiceAccountKey: saKey,
}).SetupWithManager(mgr)
if err != nil {
setupLog.Error(err, "unable to create controller", "controller", "SecretSyncer")
return err
}

//+kubebuilder:scaffold:builder
Expand Down
2 changes: 1 addition & 1 deletion commitchecker.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
expectedMergeBase: 0c9f0b529d50666f0bd28cb6e34fecf090076235
expectedMergeBase: efc6657e23a9f03ed370e73562c89b72d13ec605
upstreamBranch: main
upstreamOrg: operator-framework
upstreamRepo: operator-controller
16 changes: 16 additions & 0 deletions config/base/catalogd/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,19 @@ rules:
- get
- patch
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: manager-role
namespace: system
rules:
- apiGroups:
- ""
resources:
- secrets
- serviceaccounts
verbs:
- get
- list
- watch
17 changes: 17 additions & 0 deletions config/base/catalogd/rbac/role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,20 @@ subjects:
- kind: ServiceAccount
name: controller-manager
namespace: system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/part-of: olm
app.kubernetes.io/name: catalogd
name: manager-rolebinding
namespace: system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: manager-role
subjects:
- kind: ServiceAccount
name: controller-manager
namespace: system
8 changes: 8 additions & 0 deletions config/base/operator-controller/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,11 @@ rules:
- patch
- update
- watch
- apiGroups:
- ""
resources:
- serviceaccounts
verbs:
- get
- list
- watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: catalogd-controller-manager
namespace: olmv1-system
spec:
template:
spec:
containers:
- name: manager
env:
- name: GOCOVERDIR
value: /e2e-coverage
volumeMounts:
- name: e2e-coverage-volume
mountPath: /e2e-coverage
volumes:
- name: e2e-coverage-volume
persistentVolumeClaim:
claimName: e2e-coverage
3 changes: 2 additions & 1 deletion config/components/coverage/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ resources:
- manager_e2e_coverage_pvc.yaml
- manager_e2e_coverage_copy_pod.yaml
patches:
- path: manager_e2e_coverage_patch.yaml
- path: operator_controller_manager_e2e_coverage_patch.yaml
- path: catalogd_manager_e2e_coverage_patch.yaml
Loading