Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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: 12 additions & 7 deletions cmd/package-server-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ func run(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
customSchemas, err := cmd.Flags().GetString("custom-schemas")
if err != nil {
return err
}

ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
setupLog := ctrl.Log.WithName("setup")
Expand Down Expand Up @@ -166,13 +170,14 @@ func run(cmd *cobra.Command, args []string) error {
}

if err := (&controllers.PackageServerCSVReconciler{
Name: name,
Namespace: namespace,
Image: os.Getenv("PACKAGESERVER_IMAGE"),
Interval: interval,
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName(name),
Scheme: mgr.GetScheme(),
Name: name,
Namespace: namespace,
Image: os.Getenv("PACKAGESERVER_IMAGE"),
Interval: interval,
CustomSchemas: customSchemas,
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName(name),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", name)
return err
Expand Down
1 change: 1 addition & 0 deletions cmd/package-server-manager/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func newStartCmd() *cobra.Command {
cmd.Flags().String("tls-cert", "", "path to use for certificate key (requires tls-key)")
cmd.Flags().String("tls-key", "", "path to use for private key (requires tls-cert)")
cmd.Flags().String("client-ca", "", "path to watch for client ca bundle")
cmd.Flags().String("custom-schemas", "", "comma-separated list of custom FBC schemas to fetch from catalog sources (e.g., io.openshift.operators.lifecycles.v1alpha1)")

return cmd
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ require (
google.golang.org/genproto v0.0.0-20260203192932-546029d2fa20 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 // indirect
google.golang.org/grpc v1.81.0 // indirect
google.golang.org/grpc v1.81.1 // indirect
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -830,8 +830,8 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.81.0 h1:W3G9N3KQf3BU+YuCtGKJk0CmxQNbAISICD/9AORxLIw=
google.golang.org/grpc v1.81.0/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I=
google.golang.org/grpc v1.81.1 h1:VnnIIZ88UzOOKLukQi+ImGz8O1Wdp8nAGGnvOfEIWQQ=
google.golang.org/grpc v1.81.1/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2 h1:rgSNvqscFZ1JgV/4wH5GOsZFSFkR2Eua9As3KIr2LlM=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2/go.mod h1:iMEtFwDlAhjDU9L5mY6U1XLwlIId/G3h+QcBHDIvrJ8=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ spec:
- /etc/tls/private/tls.key
- --client-ca
- /etc/tls/private/tls.crt
- --custom-schemas
- io.openshift.operators.lifecycles.v1alpha1
image: quay.io/operator-framework/olm@sha256:de396b540b82219812061d0d753440d5655250c621c753ed1dc67d6154741607
imagePullPolicy: IfNotPresent
env:
Expand Down
2 changes: 2 additions & 0 deletions manifests/0000_50_olm_06-psm-operator.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ spec:
- /etc/tls/private/tls.key
- --client-ca
- /etc/tls/private/tls.crt
- --custom-schemas
- io.openshift.operators.lifecycles.v1alpha1
image: quay.io/operator-framework/olm@sha256:de396b540b82219812061d0d753440d5655250c621c753ed1dc67d6154741607
imagePullPolicy: IfNotPresent
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ spec:
- /etc/tls/private/tls.key
- --client-ca
- /etc/tls/private/tls.crt
- --custom-schemas
- io.openshift.operators.lifecycles.v1alpha1
image: quay.io/operator-framework/olm@sha256:de396b540b82219812061d0d753440d5655250c621c753ed1dc67d6154741607
imagePullPolicy: IfNotPresent
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ spec:
- /etc/tls/private/tls.key
- --client-ca
- /etc/tls/private/tls.crt
- --custom-schemas
- io.openshift.operators.lifecycles.v1alpha1
image: quay.io/operator-framework/olm@sha256:de396b540b82219812061d0d753440d5655250c621c753ed1dc67d6154741607
imagePullPolicy: IfNotPresent
env:
Expand Down
5 changes: 4 additions & 1 deletion pkg/package-server-manager/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,15 @@ func getTopologyModeFromInfra(infra *configv1.Infrastructure) bool {
// resource matches that of the codified defaults and high availability configurations, where
// codified defaults are defined by the csv returned by the manifests.NewPackageServerCSV
// function.
func ensureCSV(log logr.Logger, image string, interval string, csv *olmv1alpha1.ClusterServiceVersion, highlyAvailableMode bool) (bool, error) {
func ensureCSV(log logr.Logger, image string, interval string, customSchemas string, csv *olmv1alpha1.ClusterServiceVersion, highlyAvailableMode bool) (bool, error) {

flags := []string{}
if interval != "" {
flags = append(flags, "--interval", interval)
}
if customSchemas != "" {
flags = append(flags, "--custom-schemas", customSchemas)
}
expectedCSV, err := manifests.NewPackageServerCSV(
manifests.WithName(csv.Name),
manifests.WithNamespace(csv.Namespace),
Expand Down
18 changes: 11 additions & 7 deletions pkg/package-server-manager/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ type PackageServerCSVReconciler struct {
Scheme *runtime.Scheme
Lock sync.Mutex

Name string
Namespace string
Image string
Interval string
Name string
Namespace string
Image string
Interval string
CustomSchemas string
}

// Reconcile is part of the main kubernetes reconciliation loop which is responsible
Expand Down Expand Up @@ -84,6 +85,9 @@ func (r *PackageServerCSVReconciler) Reconcile(ctx context.Context, req ctrl.Req
if r.Interval != "" {
flags = append(flags, "--interval", r.Interval)
}
if r.CustomSchemas != "" {
flags = append(flags, "--custom-schemas", r.CustomSchemas)
}

required, err := manifests.NewPackageServerCSV(
manifests.WithName(r.Name),
Expand All @@ -96,7 +100,7 @@ func (r *PackageServerCSVReconciler) Reconcile(ctx context.Context, req ctrl.Req
return ctrl.Result{}, err
}
res, err := controllerutil.CreateOrUpdate(ctx, r.Client, required, func() error {
return reconcileCSV(r.Log, r.Image, r.Interval, required, highAvailabilityMode)
return reconcileCSV(r.Log, r.Image, r.Interval, r.CustomSchemas, required, highAvailabilityMode)
})

log.Info("reconciliation result", "res", res)
Expand All @@ -123,12 +127,12 @@ func ensureRBAC(client client.Client, ctx context.Context, namespace string, log
return nil
}

func reconcileCSV(log logr.Logger, image string, interval string, csv *olmv1alpha1.ClusterServiceVersion, highAvailabilityMode bool) error {
func reconcileCSV(log logr.Logger, image string, interval string, customSchemas string, csv *olmv1alpha1.ClusterServiceVersion, highAvailabilityMode bool) error {
if csv.ObjectMeta.CreationTimestamp.IsZero() {
log.Info("attempting to create the packageserver csv")
}

modified, err := ensureCSV(log, image, interval, csv, highAvailabilityMode)
modified, err := ensureCSV(log, image, interval, customSchemas, csv, highAvailabilityMode)
if err != nil {
return fmt.Errorf("error ensuring CSV: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/package-server-manager/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func TestEnsureCSV(t *testing.T) {
tc := tc

t.Run(tc.name, func(t *testing.T) {
gotBool, gotErr := ensureCSV(logger, image, interval, tc.inputCSV, tc.highlyAvailable)
gotBool, gotErr := ensureCSV(logger, image, interval, "", tc.inputCSV, tc.highlyAvailable)
require.EqualValues(t, tc.want.expectedBool, gotBool)
require.EqualValues(t, tc.want.expectedErr, gotErr)
require.EqualValues(t, tc.inputCSV.Spec, tc.expectedCSV.Spec)
Expand Down
2 changes: 2 additions & 0 deletions scripts/generate_crds_manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ spec:
- /etc/tls/private/tls.key
- --client-ca
- /etc/tls/private/tls.crt
- --custom-schemas
- io.openshift.operators.lifecycles.v1alpha1
image: quay.io/operator-framework/olm@sha256:de396b540b82219812061d0d753440d5655250c621c753ed1dc67d6154741607
imagePullPolicy: IfNotPresent
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ spec:
- --interval
- {{ .Values.package.interval }}
{{- end }}
{{- if .Values.package.customSchemas }}
- --custom-schemas
- {{ .Values.package.customSchemas }}
{{- end }}
{{- if .Values.package.commandArgs }}
- {{ .Values.package.commandArgs }}
{{- end }}
Expand Down
14 changes: 12 additions & 2 deletions staging/operator-lifecycle-manager/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ require (
golang.org/x/net v0.54.0
golang.org/x/sync v0.20.0
golang.org/x/time v0.15.0
google.golang.org/grpc v1.81.0
google.golang.org/grpc v1.81.1
google.golang.org/protobuf v1.36.11
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.35.4
k8s.io/apiextensions-apiserver v0.35.4
Expand All @@ -62,6 +63,7 @@ require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Microsoft/hcsshim v0.13.0 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/akrylysov/pogreb v0.10.2 // indirect
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
Expand Down Expand Up @@ -91,6 +93,9 @@ require (
github.com/fatih/color v1.18.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.7.0 // indirect
github.com/go-git/go-git/v5 v5.16.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.22.4 // indirect
Expand Down Expand Up @@ -125,6 +130,8 @@ require (
github.com/h2non/go-is-svg v0.0.0-20160927212452-35e8c4b0612c // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/itchyny/timefmt-go v0.1.8 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/joelanford/ignore v0.1.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.18.4 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
Expand All @@ -146,6 +153,7 @@ require (
github.com/otiai10/mint v1.6.3 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/procfs v0.20.1 // indirect
github.com/tidwall/btree v1.8.1 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.etcd.io/bbolt v1.4.3 // indirect
go.etcd.io/etcd/api/v3 v3.6.7 // indirect
Expand Down Expand Up @@ -180,10 +188,10 @@ require (
google.golang.org/genproto v0.0.0-20260203192932-546029d2fa20 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b // indirect
k8s.io/kms v0.35.4 // indirect
Expand All @@ -195,3 +203,5 @@ require (
)

retract v3.11.0+incompatible // https://github.com/operator-framework/operator-lifecycle-manager/issues/2253

replace github.com/operator-framework/operator-registry => github.com/perdasilva/operator-registry v1.23.2-0.20260518074945-e87fce41ba01
8 changes: 4 additions & 4 deletions staging/operator-lifecycle-manager/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,12 @@ github.com/openshift/library-go v0.0.0-20260204111611-b7d4fa0e292a h1:YLnZtVfqGU
github.com/openshift/library-go v0.0.0-20260204111611-b7d4fa0e292a/go.mod h1:DCRz1EgdayEmr9b6KXKDL+DWBN0rGHu/VYADeHzPoOk=
github.com/operator-framework/api v0.42.0 h1:rkc5V3zW8RxZMjePAe12jdL7Co/hwsYo1pLnkkhuR7s=
github.com/operator-framework/api v0.42.0/go.mod h1:bMEj+wl/8tGqcGNtxt38cLUYagu9chNsbYzb/5HQaUQ=
github.com/operator-framework/operator-registry v1.68.0 h1:hsWR4o2a508xrc3DAalY4D/JGg7wnv6wjX+BTqXxSLI=
github.com/operator-framework/operator-registry v1.68.0/go.mod h1:QuIAkmWIo0Kc03iVjybiI148AEQhBPdnrnAzFcDDR3Q=
github.com/otiai10/copy v1.14.1 h1:5/7E6qsUMBaH5AnQ0sSLzzTg1oTECmcCmT6lvF45Na8=
github.com/otiai10/copy v1.14.1/go.mod h1:oQwrEDDOci3IM8dJF0d8+jnbfPDllW6vUjNc3DoZm9I=
github.com/otiai10/mint v1.6.3 h1:87qsV/aw1F5as1eH1zS/yqHY85ANKVMgkDrf9rcxbQs=
github.com/otiai10/mint v1.6.3/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM=
github.com/perdasilva/operator-registry v1.23.2-0.20260518074945-e87fce41ba01 h1:EMm2cns+s95PdlJD5ssNwzr6nhUk59/Cmio3DE9AgIk=
github.com/perdasilva/operator-registry v1.23.2-0.20260518074945-e87fce41ba01/go.mod h1:NtJvZw1fIJr6OonnFbwXbBDMCjoRuSMV3iqWeAriA6s=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down Expand Up @@ -607,8 +607,8 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.81.0 h1:W3G9N3KQf3BU+YuCtGKJk0CmxQNbAISICD/9AORxLIw=
google.golang.org/grpc v1.81.0/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I=
google.golang.org/grpc v1.81.1 h1:VnnIIZ88UzOOKLukQi+ImGz8O1Wdp8nAGGnvOfEIWQQ=
google.golang.org/grpc v1.81.1/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
Loading