Skip to content

Commit 724f053

Browse files
committed
(entitySource) Use catalogd provided content for sourcing entities
This PR replaces OLM v0 catalog operator with https://github.com/operator-framework/catalogd as the source of entities for deppy. Addresses #161 Signed-off-by: Anik <[email protected]>
1 parent 29a5cc9 commit 724f053

15 files changed

+301
-130
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
vendor
12

23
# Binaries for programs and plugins
34
*.exe

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export IMAGE_REPO ?= quay.io/operator-framework/operator-controller
66
export IMAGE_TAG ?= devel
77
export GO_BUILD_TAGS ?= upstream
88
export CERT_MGR_VERSION ?= v1.9.0
9+
export CATALOGD_VERSION ?= v0.1.3
910
export GORELEASER_VERSION ?= v1.16.2
10-
export OLM_V0_VERSION ?= v0.24.0
1111
export RUKPAK_VERSION=$(shell go list -mod=mod -m -f "{{.Version}}" github.com/operator-framework/rukpak)
1212
export WAIT_TIMEOUT ?= 60s
1313
IMG?=$(IMAGE_REPO):$(IMAGE_TAG)
@@ -147,7 +147,7 @@ release: goreleaser ## Runs goreleaser for the operator-controller. By default,
147147
quickstart: export MANIFEST="https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml"
148148
quickstart: kustomize generate ## Generate the installation release manifests and scripts
149149
kubectl kustomize config/default | sed "s/:devel/:$(VERSION)/g" > operator-controller.yaml
150-
envsubst '$$OLM_V0_VERSION,$$CERT_MGR_VERSION,$$RUKPAK_VERSION,$$MANIFEST' < scripts/install.tpl.sh > install.sh
150+
envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$RUKPAK_VERSION,$$MANIFEST' < scripts/install.tpl.sh > install.sh
151151

152152
##@ Deployment
153153

@@ -159,7 +159,7 @@ endif
159159
install: export MANIFEST="./operator-controller.yaml"
160160
install: manifests kustomize generate ## Install CRDs into the K8s cluster specified in ~/.kube/config.
161161
kubectl kustomize config/default > operator-controller.yaml
162-
envsubst '$$OLM_V0_VERSION,$$CERT_MGR_VERSION,$$RUKPAK_VERSION,$$MANIFEST' < scripts/install.tpl.sh | bash -s
162+
envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$RUKPAK_VERSION,$$MANIFEST' < scripts/install.tpl.sh | bash -s
163163

164164
.PHONY: uninstall
165165
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.

config/rbac/role.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ metadata:
55
creationTimestamp: null
66
name: manager-role
77
rules:
8+
- apiGroups:
9+
- catalogd.operatorframework.io
10+
resources:
11+
- bundlemetadata
12+
verbs:
13+
- list
14+
- watch
15+
- apiGroups:
16+
- catalogd.operatorframework.io
17+
resources:
18+
- packages
19+
verbs:
20+
- list
21+
- watch
822
- apiGroups:
923
- core.rukpak.io
1024
resources:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: catalogd.operatorframework.io/v1beta1
2+
kind: CatalogSource
3+
metadata:
4+
name: operatorhubio
5+
spec:
6+
image: quay.io/operatorhubio/catalog:latest

config/samples/operators_v1alpha1_operator.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ metadata:
99
app.kubernetes.io/created-by: operator-controller
1010
name: operator-sample
1111
spec:
12-
# TODO(user): Add fields here
13-
packageName: prometheus
12+
packageName: argocd-operator

controllers/operator_controller.go

+4-11
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,11 @@ type OperatorReconciler struct {
5555

5656
//+kubebuilder:rbac:groups=core.rukpak.io,resources=bundledeployments,verbs=get;list;watch;create;update;patch
5757

58-
// Reconcile is part of the main kubernetes reconciliation loop which aims to
59-
// move the current state of the cluster closer to the desired state.
60-
// TODO(user): Modify the Reconcile function to compare the state specified by
61-
// the Operator object against the actual cluster state, and then
62-
// perform operations to make the cluster state reflect the state specified by
63-
// the user.
64-
//
65-
// For more details, check Reconcile and its Result here:
66-
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile
58+
//+kubebuilder:rbac:groups=catalogd.operatorframework.io,resources=bundlemetadata,verbs=list;watch
59+
//+kubebuilder:rbac:groups=catalogd.operatorframework.io,resources=packages,verbs=list;watch
60+
6761
func (r *OperatorReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
68-
l := log.FromContext(ctx).WithName("reconcile")
62+
l := log.FromContext(ctx).WithName("operator-controller")
6963
l.V(1).Info("starting")
7064
defer l.V(1).Info("ending")
7165

@@ -121,7 +115,6 @@ func (r *OperatorReconciler) reconcile(ctx context.Context, op *operatorsv1alpha
121115
})
122116
return ctrl.Result{}, nil
123117
}
124-
125118
// run resolution
126119
solution, err := r.Resolver.Resolve(ctx)
127120
if err != nil {

controllers/operator_controller_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
operatorutil "github.com/operator-framework/operator-controller/internal/util"
2525
)
2626

27-
var _ = Describe("Reconcile Test", func() {
27+
var _ = Describe("Operator Controller Test", func() {
2828
var (
2929
ctx context.Context
3030
reconciler *controllers.OperatorReconciler

go.mod

+8-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ require (
66
github.com/blang/semver/v4 v4.0.0
77
github.com/onsi/ginkgo/v2 v2.8.3
88
github.com/onsi/gomega v1.27.1
9+
github.com/operator-framework/catalogd v0.1.3
910
github.com/operator-framework/deppy v0.0.0-20230125110717-dc02e928470f
10-
github.com/operator-framework/operator-registry v1.26.2
11+
github.com/operator-framework/operator-registry v1.26.3
1112
github.com/operator-framework/rukpak v0.12.0
1213
go.uber.org/zap v1.24.0
1314
k8s.io/apimachinery v0.26.1
@@ -38,7 +39,7 @@ require (
3839
github.com/google/go-cmp v0.5.9 // indirect
3940
github.com/google/gofuzz v1.2.0 // indirect
4041
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
41-
github.com/google/uuid v1.2.0 // indirect
42+
github.com/google/uuid v1.3.0 // indirect
4243
github.com/imdario/mergo v0.3.13 // indirect
4344
github.com/josharian/intern v1.0.0 // indirect
4445
github.com/json-iterator/go v1.1.12 // indirect
@@ -47,16 +48,18 @@ require (
4748
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
4849
github.com/modern-go/reflect2 v1.0.2 // indirect
4950
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
51+
github.com/operator-framework/api v0.17.3 // indirect
5052
github.com/pkg/errors v0.9.1 // indirect
5153
github.com/prometheus/client_golang v1.14.0 // indirect
5254
github.com/prometheus/client_model v0.3.0 // indirect
5355
github.com/prometheus/common v0.37.0 // indirect
5456
github.com/prometheus/procfs v0.8.0 // indirect
57+
github.com/sirupsen/logrus v1.9.0 // indirect
5558
github.com/spf13/pflag v1.0.5 // indirect
5659
go.uber.org/atomic v1.7.0 // indirect
5760
go.uber.org/multierr v1.6.0 // indirect
5861
golang.org/x/net v0.7.0 // indirect
59-
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
62+
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
6063
golang.org/x/sys v0.5.0 // indirect
6164
golang.org/x/term v0.5.0 // indirect
6265
golang.org/x/text v0.7.0 // indirect
@@ -70,9 +73,11 @@ require (
7073
gopkg.in/yaml.v3 v3.0.1 // indirect
7174
k8s.io/api v0.26.1 // indirect
7275
k8s.io/apiextensions-apiserver v0.26.1 // indirect
76+
k8s.io/apiserver v0.26.1 // indirect
7377
k8s.io/component-base v0.26.1 // indirect
7478
k8s.io/klog/v2 v2.80.1 // indirect
7579
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
80+
sigs.k8s.io/apiserver-runtime v1.1.2-0.20221226021050-33c901856927 // indirect
7681
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
7782
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
7883
sigs.k8s.io/yaml v1.3.0 // indirect

0 commit comments

Comments
 (0)