Skip to content

Commit ef06f40

Browse files
✨ Bump rukpak to 0.17.0 (#583)
This commit makes the following changes: 1. Bump Rukpak to use version 0.17.0 2. Modify the BundleDeployment spec accordingly to not specify a bundle template. 3. Introduce `watchNamespaces` field in the spec that accepts a list of namespaces to watch. 4. Fix unit and e2e tests accordingly. Signed-off-by: Varsha Prasad Narsing <[email protected]>
1 parent 4055f53 commit ef06f40

20 files changed

+680
-524
lines changed

.golangci.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ linters-settings:
4141
alias: $1$2
4242
- pkg: sigs.k8s.io/controller-runtime
4343
alias: ctrl
44-
- pkg: github.com/operator-framework/rukpak/api/v1alpha1
45-
alias: rukpakv1alpha1
44+
- pkg: github.com/operator-framework/rukpak/api/v1alpha2
45+
alias: rukpakv1alpha2
4646
- pkg: github.com/blang/semver/v4
4747
alias: bsemver
4848
goimports:

api/v1alpha1/clusterextension_types.go

+6
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ type ClusterExtensionSpec struct {
6565
//
6666
// Defines the policy for how to handle upgrade constraints
6767
UpgradeConstraintPolicy UpgradeConstraintPolicy `json:"upgradeConstraintPolicy,omitempty"`
68+
69+
//+kubebuilder:Optional
70+
//
71+
// watchNamespaces indicates which namespaces the extension should watch.
72+
// This feature is currently supported only with RegistryV1 bundles.
73+
WatchNamespaces []string `json:"watchNamespaces,omitempty"`
6874
}
6975

7076
const (

api/v1alpha1/zz_generated.deepcopy.go

+6-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/manager/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1"
2626
"github.com/operator-framework/deppy/pkg/deppy/solver"
27-
rukpakv1alpha1 "github.com/operator-framework/rukpak/api/v1alpha1"
27+
rukpakv1alpha2 "github.com/operator-framework/rukpak/api/v1alpha2"
2828
"github.com/spf13/pflag"
2929
"go.uber.org/zap/zapcore"
3030
"k8s.io/apimachinery/pkg/runtime"
@@ -52,7 +52,7 @@ func init() {
5252
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
5353

5454
utilruntime.Must(ocv1alpha1.AddToScheme(scheme))
55-
utilruntime.Must(rukpakv1alpha1.AddToScheme(scheme))
55+
utilruntime.Must(rukpakv1alpha2.AddToScheme(scheme))
5656
utilruntime.Must(catalogd.AddToScheme(scheme))
5757

5858
//+kubebuilder:scaffold:scheme

cmd/resolutioncli/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1"
2626
"github.com/operator-framework/deppy/pkg/deppy"
2727
"github.com/operator-framework/deppy/pkg/deppy/solver"
28-
rukpakv1alpha1 "github.com/operator-framework/rukpak/api/v1alpha1"
28+
rukpakv1alpha2 "github.com/operator-framework/rukpak/api/v1alpha2"
2929
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3030
"k8s.io/apimachinery/pkg/runtime"
3131
"k8s.io/apimachinery/pkg/runtime/serializer"
@@ -61,7 +61,7 @@ var (
6161
func init() {
6262
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
6363
utilruntime.Must(ocv1alpha1.AddToScheme(scheme))
64-
utilruntime.Must(rukpakv1alpha1.AddToScheme(scheme))
64+
utilruntime.Must(rukpakv1alpha2.AddToScheme(scheme))
6565
utilruntime.Must(catalogd.AddToScheme(scheme))
6666
}
6767

@@ -158,7 +158,7 @@ func run(ctx context.Context, packageName, packageChannel, packageVersionRange,
158158
if err := cl.List(ctx, &clusterExtensionList); err != nil {
159159
return err
160160
}
161-
bundleDeploymentList := rukpakv1alpha1.BundleDeploymentList{}
161+
bundleDeploymentList := rukpakv1alpha2.BundleDeploymentList{}
162162
if err := cl.List(ctx, &bundleDeploymentList); err != nil {
163163
return err
164164
}

config/crd/bases/olm.operatorframework.io_clusterextensions.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ spec:
6060
maxLength: 64
6161
pattern: ^(\s*(=||!=|>|<|>=|=>|<=|=<|~|~>|\^)\s*(v?(0|[1-9]\d*|[x|X|\*])(\.(0|[1-9]\d*|x|X|\*]))?(\.(0|[1-9]\d*|x|X|\*))?(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?)\s*)((?:\s+|,\s*|\s*\|\|\s*)(=||!=|>|<|>=|=>|<=|=<|~|~>|\^)\s*(v?(0|[1-9]\d*|x|X|\*])(\.(0|[1-9]\d*|x|X|\*))?(\.(0|[1-9]\d*|x|X|\*]))?(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?)\s*)*$
6262
type: string
63+
watchNamespaces:
64+
description: watchNamespaces indicates which namespaces the extension
65+
should watch. This feature is currently supported only with RegistryV1
66+
bundles.
67+
items:
68+
type: string
69+
type: array
6370
required:
6471
- packageName
6572
type: object
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Install Modes and WatchNamespaces in OMLv1
2+
3+
Operator Lifecycle Manager (OLM) operates with cluster-admin privileges, enabling it to grant necessary permissions to the Extensions it deploys. For extensions packaged as [`RegistryV1`][registryv1] bundles, it's the responsibility of the authors to specify supported `InstallModes` in the ClusterServiceVersion ([CSV][csv]). InstallModes define the operational scope of the extension within the Kubernetes cluster, particularly in terms of namespace availability. The four recognized InstallModes are as follows:
4+
5+
1. OwnNamespace: This mode allows the extension to monitor and respond to events within its own deployment namespace.
6+
1. SingleNamespace: In this mode, the extension is set up to observe events in a single, specific namespace other than the one it is deployed in.
7+
1. MultiNamespace: This enables the extension to function across multiple specified namespaces.
8+
1. AllNamespaces: Under this mode, the extension is equipped to monitor events across all namespaces within the cluster.
9+
10+
When creating a cluster extension, users have the option to define a list of `watchNamespaces`. This list determines the specific namespaces within which they intend the operator to operate. The configuration of `watchNamespaces` must align with the InstallModes supported by the extension as specified by the bundle author. The supported configurations in the order of preference are as follows:
11+
12+
13+
| Length of `watchNamespaces` specified through ClusterExtension | Allowed values | Supported InstallMode in CSV | Description |
14+
|------------------------------|-------------------------------------------------------|----------------------|-----------------------------------------------------------------|
15+
| **0 (Empty/Unset)** | - | AllNamespaces | Extension monitors all namespaces. |
16+
| | - | OwnNamespace | Supported when `AllNamespaces` is false. Extension only active in its deployment namespace. |
17+
| **1 (Single Entry)** | `""` (Empty String) | AllNamespaces | Extension monitors all namespaces. |
18+
| | Entry equals Install Namespace | OwnNamespace | Extension watches only its install namespace. |
19+
| | Entry is a specific namespace (not the Install Namespace) | SingleNamespace | Extension monitors a single, specified namespace in the spec. |
20+
| **>1 (Multiple Entries)** | Entries are specific, multiple namespaces | MultiNamespace | Extension monitors each of the specified multiple namespaces in the spec.
21+
22+
23+
[registryv1]: https://olm.operatorframework.io/docs/tasks/creating-operator-manifests/#writing-your-operator-manifests
24+
[csv]: https://olm.operatorframework.io/docs/concepts/crds/clusterserviceversion/

go.mod

+19-19
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/operator-framework/catalogd v0.11.0
1111
github.com/operator-framework/deppy v0.3.0
1212
github.com/operator-framework/operator-registry v1.36.0
13-
github.com/operator-framework/rukpak v0.16.0
13+
github.com/operator-framework/rukpak v0.17.0
1414
github.com/spf13/pflag v1.0.5
1515
github.com/stretchr/testify v1.8.4
1616
go.uber.org/zap v1.26.0
@@ -56,7 +56,7 @@ require (
5656
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
5757
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
5858
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
59-
github.com/felixge/httpsnoop v1.0.3 // indirect
59+
github.com/felixge/httpsnoop v1.0.4 // indirect
6060
github.com/fsnotify/fsnotify v1.7.0 // indirect
6161
github.com/go-air/gini v1.0.4 // indirect
6262
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
@@ -75,13 +75,13 @@ require (
7575
github.com/google/gnostic-models v0.6.8 // indirect
7676
github.com/google/gofuzz v1.2.0 // indirect
7777
github.com/google/uuid v1.4.0 // indirect
78-
github.com/gorilla/mux v1.8.0 // indirect
79-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
78+
github.com/gorilla/mux v1.8.1 // indirect
79+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
8080
github.com/h2non/filetype v1.1.3 // indirect
8181
github.com/h2non/go-is-svg v0.0.0-20160927212452-35e8c4b0612c // indirect
8282
github.com/hashicorp/errwrap v1.1.0 // indirect
8383
github.com/hashicorp/go-multierror v1.1.1 // indirect
84-
github.com/imdario/mergo v0.3.13 // indirect
84+
github.com/imdario/mergo v0.3.16 // indirect
8585
github.com/inconshreveable/mousetrap v1.1.0 // indirect
8686
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
8787
github.com/joelanford/ignore v0.0.0-20210607151042-0d25dc18b62d // indirect
@@ -98,7 +98,7 @@ require (
9898
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
9999
github.com/modern-go/reflect2 v1.0.2 // indirect
100100
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
101-
github.com/onsi/gomega v1.30.0 // indirect
101+
github.com/onsi/gomega v1.31.0 // indirect
102102
github.com/opencontainers/go-digest v1.0.0 // indirect
103103
github.com/opencontainers/image-spec v1.1.0-rc5 // indirect
104104
github.com/opencontainers/runc v1.1.10 // indirect
@@ -119,31 +119,31 @@ require (
119119
github.com/vbatts/tar-split v0.11.5 // indirect
120120
go.etcd.io/bbolt v1.3.8 // indirect
121121
go.opencensus.io v0.24.0 // indirect
122-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 // indirect
123-
go.opentelemetry.io/otel v1.20.0 // indirect
124-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect
125-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect
126-
go.opentelemetry.io/otel/metric v1.20.0 // indirect
127-
go.opentelemetry.io/otel/sdk v1.20.0 // indirect
128-
go.opentelemetry.io/otel/trace v1.20.0 // indirect
122+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
123+
go.opentelemetry.io/otel v1.21.0 // indirect
124+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
125+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 // indirect
126+
go.opentelemetry.io/otel/metric v1.21.0 // indirect
127+
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
128+
go.opentelemetry.io/otel/trace v1.21.0 // indirect
129129
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
130130
go.uber.org/multierr v1.11.0 // indirect
131131
golang.org/x/mod v0.14.0 // indirect
132132
golang.org/x/net v0.20.0 // indirect
133-
golang.org/x/oauth2 v0.14.0 // indirect
134-
golang.org/x/sync v0.5.0 // indirect
133+
golang.org/x/oauth2 v0.15.0 // indirect
134+
golang.org/x/sync v0.6.0 // indirect
135135
golang.org/x/sys v0.16.0 // indirect
136136
golang.org/x/term v0.16.0 // indirect
137137
golang.org/x/text v0.14.0 // indirect
138138
golang.org/x/time v0.3.0 // indirect
139139
golang.org/x/tools v0.16.1 // indirect
140140
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
141141
google.golang.org/appengine v1.6.8 // indirect
142-
google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect
143-
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect
144-
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect
142+
google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect
143+
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect
144+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect
145145
google.golang.org/grpc v1.60.1 // indirect
146-
google.golang.org/protobuf v1.31.0 // indirect
146+
google.golang.org/protobuf v1.32.0 // indirect
147147
gopkg.in/inf.v0 v0.9.1 // indirect
148148
gopkg.in/warnings.v0 v0.1.2 // indirect
149149
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)