-
Notifications
You must be signed in to change notification settings - Fork 64
🌱 Refactor rukpack package for configurable registry+v1 rendering behavior #1968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ import ( | |
|
||
ocv1 "github.com/operator-framework/operator-controller/api/v1" | ||
"github.com/operator-framework/operator-controller/internal/operator-controller/authorization" | ||
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/bundle/source" | ||
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/preflights/crdupgradesafety" | ||
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util" | ||
) | ||
|
@@ -53,13 +54,15 @@ type Preflight interface { | |
Upgrade(context.Context, *release.Release) error | ||
} | ||
|
||
type BundleToHelmChartFn func(rv1 fs.FS, installNamespace string, watchNamespace string) (*chart.Chart, error) | ||
type BundleToHelmChartConverter interface { | ||
ToHelmChart(bundle source.BundleSource, installNamespace string, watchNamespace string) (*chart.Chart, error) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, so we are moving away to have a function to define a contract/interface to convert any BundleSource to a HelmChart. For HelmChart, we’d skip the convert call anyway, right? |
||
} | ||
|
||
type Helm struct { | ||
ActionClientGetter helmclient.ActionClientGetter | ||
Preflights []Preflight | ||
PreAuthorizer authorization.PreAuthorizer | ||
BundleToHelmChartFn BundleToHelmChartFn | ||
ActionClientGetter helmclient.ActionClientGetter | ||
Preflights []Preflight | ||
PreAuthorizer authorization.PreAuthorizer | ||
BundleToHelmChartConverter BundleToHelmChartConverter | ||
} | ||
|
||
// shouldSkipPreflight is a helper to determine if the preflight check is CRDUpgradeSafety AND | ||
|
@@ -199,14 +202,14 @@ func (h *Helm) Apply(ctx context.Context, contentFS fs.FS, ext *ocv1.ClusterExte | |
} | ||
|
||
func (h *Helm) buildHelmChart(bundleFS fs.FS, ext *ocv1.ClusterExtension) (*chart.Chart, error) { | ||
if h.BundleToHelmChartFn == nil { | ||
return nil, errors.New("BundleToHelmChartFn is nil") | ||
if h.BundleToHelmChartConverter == nil { | ||
return nil, errors.New("BundleToHelmChartConverter is nil") | ||
} | ||
watchNamespace, err := GetWatchNamespace(ext) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return h.BundleToHelmChartFn(bundleFS, ext.Spec.Namespace, watchNamespace) | ||
return h.BundleToHelmChartConverter.ToHelmChart(source.FromFS(bundleFS), ext.Spec.Namespace, watchNamespace) | ||
} | ||
|
||
func (h *Helm) renderClientOnlyRelease(ctx context.Context, ext *ocv1.ClusterExtension, chrt *chart.Chart, values chartutil.Values, post postrender.PostRenderer) (*release.Release, error) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package bundle | ||
|
||
import ( | ||
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" | ||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||
|
||
"github.com/operator-framework/api/pkg/operators/v1alpha1" | ||
) | ||
|
||
type RegistryV1 struct { | ||
PackageName string | ||
CSV v1alpha1.ClusterServiceVersion | ||
CRDs []apiextensionsv1.CustomResourceDefinition | ||
Others []unstructured.Unstructured | ||
} |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I see you are trying to allow more options without bringing the complexity
If we enable the Webhook then automatically we either enable WebhookProviderCertManager