Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
wip: remove bundle controller
Browse files Browse the repository at this point in the history
Signed-off-by: Varsha Prasad Narsing <[email protected]>
  • Loading branch information
varshaprasad96 committed Dec 18, 2023
1 parent b4e9976 commit b5b397b
Show file tree
Hide file tree
Showing 19 changed files with 905 additions and 629 deletions.
20 changes: 17 additions & 3 deletions api/v1alpha1/bundledeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,25 @@ type BundleDeploymentSpec struct {
//+kubebuilder:validation:Pattern:=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
// ProvisionerClassName sets the name of the provisioner that should reconcile this BundleDeployment.
ProvisionerClassName string `json:"provisionerClassName"`
// Template describes the generated Bundle that this deployment will manage.
Template BundleTemplate `json:"template"`
// Source defines the configuration for the underlying Bundle content.
Source BundleSource `json:"source"`
// Config is provisioner specific configurations
// +kubebuilder:pruning:PreserveUnknownFields
Config runtime.RawExtension `json:"config,omitempty"`
}

// For more details on how each format looks like,
// refer: https://github.com/operator-framework/rukpak/tree/main/docs/bundles.
const (
FormatPlain = "plain"
FormatRegistryV1 = "registry"
FormatHelm = "helm"
)

// FormatType refers to the allowed bundle formats that
// can be processed by rukpak.
type FormatType string

// BundleTemplate defines the desired state of a Bundle resource
type BundleTemplate struct {
// Standard object's metadata.
Expand All @@ -73,7 +85,9 @@ type BundleTemplate struct {
// BundleDeploymentStatus defines the observed state of BundleDeployment
type BundleDeploymentStatus struct {
Conditions []metav1.Condition `json:"conditions,omitempty"`
ActiveBundle string `json:"activeBundle,omitempty"`
Phase string `json:"phase,omitempty"`
ResolvedSource *BundleSource `json:"resolvedSource,omitempty"`
ContentURL string `json:"contentURL,omitempty"`
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

Expand Down
7 changes: 6 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 27 additions & 21 deletions cmd/core/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"

rukpakv1alpha1 "github.com/operator-framework/rukpak/api/v1alpha1"
"github.com/operator-framework/rukpak/internal/controllers/bundle"
"github.com/operator-framework/rukpak/internal/controllers/bundledeployment"
"github.com/operator-framework/rukpak/internal/finalizer"
"github.com/operator-framework/rukpak/internal/provisioner/plain"
Expand Down Expand Up @@ -231,12 +230,6 @@ func main() {
os.Exit(1)
}

commonBundleProvisionerOptions := []bundle.Option{
bundle.WithUnpacker(unpacker),
bundle.WithFinalizers(bundleFinalizers),
bundle.WithStorage(bundleStorage),
}

cfgGetter := helmclient.NewActionConfigGetter(mgr.GetConfig(), mgr.GetRESTMapper(), mgr.GetLogger())
acg := helmclient.NewActionClientGetter(cfgGetter)
commonBDProvisionerOptions := []bundledeployment.Option{
Expand All @@ -245,27 +238,40 @@ func main() {
bundledeployment.WithStorage(bundleStorage),
}

if err := bundle.SetupWithManager(mgr, systemNsCluster.GetCache(), systemNamespace, append(
commonBundleProvisionerOptions,
bundle.WithProvisionerID(plain.ProvisionerID),
bundle.WithHandler(bundle.HandlerFunc(plain.HandleBundle)),
)...); err != nil {
setupLog.Error(err, "unable to create controller", "controller", rukpakv1alpha1.BundleKind, "provisionerID", plain.ProvisionerID)
os.Exit(1)
}
// if err := bundle.SetupWithManager(mgr, systemNsCluster.GetCache(), systemNamespace, append(
// commonBundleProvisionerOptions,
// bundle.WithProvisionerID(plain.ProvisionerID),
// bundle.WithHandler(bundle.HandlerFunc(plain.HandleBundle)),
// )...); err != nil {
// setupLog.Error(err, "unable to create controller", "controller", rukpakv1alpha1.BundleKind, "provisionerID", plain.ProvisionerID)
// os.Exit(1)
// }

// if err := bundle.SetupWithManager(mgr, systemNsCluster.GetCache(), systemNamespace, append(
// commonBundleProvisionerOptions,
// bundle.WithProvisionerID(registry.ProvisionerID),
// bundle.WithHandler(bundle.HandlerFunc(registry.HandleBundle)),
// )...); err != nil {
// setupLog.Error(err, "unable to create controller", "controller", rukpakv1alpha1.BundleKind, "provisionerID", registry.ProvisionerID)
// os.Exit(1)
// }

if err := bundle.SetupWithManager(mgr, systemNsCluster.GetCache(), systemNamespace, append(
commonBundleProvisionerOptions,
bundle.WithProvisionerID(registry.ProvisionerID),
bundle.WithHandler(bundle.HandlerFunc(registry.HandleBundle)),
if err := bundledeployment.SetupWithManager(mgr, append(
commonBDProvisionerOptions,
bundledeployment.WithUnpacker(unpacker),
bundledeployment.WithProvisionerID(plain.ProvisionerID),
bundledeployment.WithBundleDeplymentProcessor(bundledeployment.BundleDeploymentProcessorFunc(plain.ProcessBundleDeployment)),
bundledeployment.WithHandler(bundledeployment.HandlerFunc(plain.HandleBundleDeployment)),
)...); err != nil {
setupLog.Error(err, "unable to create controller", "controller", rukpakv1alpha1.BundleKind, "provisionerID", registry.ProvisionerID)
setupLog.Error(err, "unable to create controller", "controller", rukpakv1alpha1.BundleDeploymentKind, "provisionerID", plain.ProvisionerID)
os.Exit(1)
}

if err := bundledeployment.SetupWithManager(mgr, append(
commonBDProvisionerOptions,
bundledeployment.WithProvisionerID(plain.ProvisionerID),
bundledeployment.WithUnpacker(unpacker),
bundledeployment.WithProvisionerID(registry.ProvisionerID),
bundledeployment.WithBundleDeplymentProcessor(bundledeployment.BundleDeploymentProcessorFunc(registry.ProcessBundleDeployment)),
bundledeployment.WithHandler(bundledeployment.HandlerFunc(plain.HandleBundleDeployment)),
)...); err != nil {
setupLog.Error(err, "unable to create controller", "controller", rukpakv1alpha1.BundleDeploymentKind, "provisionerID", plain.ProvisionerID)
Expand Down
20 changes: 4 additions & 16 deletions cmd/helm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"

rukpakv1alpha1 "github.com/operator-framework/rukpak/api/v1alpha1"
"github.com/operator-framework/rukpak/internal/controllers/bundle"
"github.com/operator-framework/rukpak/internal/controllers/bundledeployment"
"github.com/operator-framework/rukpak/internal/finalizer"
"github.com/operator-framework/rukpak/internal/provisioner/helm"
Expand Down Expand Up @@ -205,12 +204,6 @@ func main() {
os.Exit(1)
}

commonBundleProvisionerOptions := []bundle.Option{
bundle.WithUnpacker(unpacker),
bundle.WithFinalizers(bundleFinalizers),
bundle.WithStorage(bundleStorage),
}

cfgGetter := helmclient.NewActionConfigGetter(mgr.GetConfig(), mgr.GetRESTMapper(), mgr.GetLogger())
acg := helmclient.NewActionClientGetter(cfgGetter)
commonBDProvisionerOptions := []bundledeployment.Option{
Expand All @@ -219,18 +212,13 @@ func main() {
bundledeployment.WithStorage(bundleStorage),
}

if err := bundle.SetupWithManager(mgr, systemNsCluster.GetCache(), systemNamespace, append(
commonBundleProvisionerOptions,
bundle.WithProvisionerID(helm.ProvisionerID),
bundle.WithHandler(bundle.HandlerFunc(helm.HandleBundle)),
)...); err != nil {
setupLog.Error(err, "unable to create controller", "controller", rukpakv1alpha1.BundleKind, "provisionerID", helm.ProvisionerID)
os.Exit(1)
}

if err := bundledeployment.SetupWithManager(mgr, append(
commonBDProvisionerOptions,
bundledeployment.WithProvisionerID(helm.ProvisionerID),
bundledeployment.WithFinalizers(bundleFinalizers),
bundledeployment.WithUnpacker(unpacker),
bundledeployment.WithStorage(bundleStorage),
bundledeployment.WithBundleDeplymentProcessor(bundledeployment.BundleDeploymentProcessorFunc(helm.ProcessBundleDeployment)),
bundledeployment.WithHandler(bundledeployment.HandlerFunc(helm.HandleBundleDeployment)),
)...); err != nil {
setupLog.Error(err, "unable to create controller", "controller", rukpakv1alpha1.BundleDeploymentKind, "provisionerID", helm.ProvisionerID)
Expand Down
Loading

0 comments on commit b5b397b

Please sign in to comment.