-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #710 from deads2k/apply-05-MOM-prototype
API-1835: demonstration mutation recording client
- Loading branch information
Showing
42 changed files
with
4,055 additions
and
451 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package mom | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/openshift/cluster-authentication-operator/pkg/operator" | ||
|
||
"github.com/openshift/multi-operator-manager/pkg/library/libraryapplyconfiguration" | ||
"github.com/spf13/cobra" | ||
"k8s.io/cli-runtime/pkg/genericiooptions" | ||
) | ||
|
||
func NewApplyConfigurationCommand(streams genericiooptions.IOStreams) *cobra.Command { | ||
return libraryapplyconfiguration.NewApplyConfigurationCommand(RunApplyConfiguration, streams) | ||
} | ||
|
||
func RunApplyConfiguration(ctx context.Context, input libraryapplyconfiguration.ApplyConfigurationInput) (libraryapplyconfiguration.AllDesiredMutationsGetter, error) { | ||
// TODO initialize dynamic clients, informers, operator clients, and kubeclients from the input to demonstrate. | ||
|
||
authenticationOperatorInput, err := operator.CreateOperatorInputFromMOM(ctx, input) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to configure operator input: %w", err) | ||
} | ||
operatorStarter, err := operator.CreateOperatorStarter(ctx, authenticationOperatorInput) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to configure operators: %w", err) | ||
} | ||
var operatorRunError error | ||
if err := operatorStarter.RunOnce(ctx); err != nil { | ||
operatorRunError = fmt.Errorf("unable to run operators: %w", err) | ||
} | ||
|
||
return libraryapplyconfiguration.NewApplyConfigurationFromClient(input.MutationTrackingClient.GetMutations()), operatorRunError | ||
} |
Oops, something went wrong.