Skip to content

Commit 275b248

Browse files
committed
Add OM apply-configuration command stub
Generated with Claude Code
1 parent 5cb80d2 commit 275b248

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

cmd/cluster-kube-controller-manager-operator/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func NewSSCSCommand(ctx context.Context) *cobra.Command {
4848
cmd.AddCommand(recoverycontroller.NewCertRecoveryControllerCommand(ctx))
4949
cmd.AddCommand(mom.NewInputResourcesCommand(ioStreams))
5050
cmd.AddCommand(mom.NewOutputResourcesCommand(ioStreams))
51+
cmd.AddCommand(mom.NewApplyConfigurationCommand(ioStreams))
5152

5253
return cmd
5354
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package mom
2+
3+
import (
4+
"context"
5+
"fmt"
6+
7+
"github.com/openshift/multi-operator-manager/pkg/library/libraryapplyconfiguration"
8+
"github.com/spf13/cobra"
9+
"k8s.io/cli-runtime/pkg/genericiooptions"
10+
)
11+
12+
func NewApplyConfigurationCommand(streams genericiooptions.IOStreams) *cobra.Command {
13+
return libraryapplyconfiguration.NewApplyConfigurationCommand(RunApplyConfiguration, runOutputResources, streams)
14+
}
15+
16+
func RunApplyConfiguration(ctx context.Context, input libraryapplyconfiguration.ApplyConfigurationInput) (*libraryapplyconfiguration.ApplyConfigurationRunResult, libraryapplyconfiguration.AllDesiredMutationsGetter, error) {
17+
// TODO: Implement operator reconciliation logic
18+
//
19+
// The manifestclient (input.ManagementClient) is a drop-in replacement for standard k8s clients.
20+
// Pass it to your operator and run sync logic ONCE (not in a loop).
21+
//
22+
// Implementation steps:
23+
// 1. Create operator client using input.ManagementClient (manifestclient)
24+
// 2. Create informers from the manifestclient
25+
// 3. Initialize the operator with these clients
26+
// 4. Run sync logic ONCE (not in a control loop)
27+
// 5. Return the result
28+
//
29+
// Example pattern:
30+
// operatorClient, dynamicInformers, err := genericoperatorclient.NewStaticPodOperatorClient(...)
31+
// if err != nil { return nil, nil, err }
32+
//
33+
// // Create controllers with manifestclient-based informers
34+
// // Run sync once (not Start())
35+
// // Return result
36+
//
37+
// Reference implementation:
38+
// github.com/openshift/cluster-authentication-operator/pkg/cmd/mom/apply_configuration_command.go
39+
//
40+
// Key considerations:
41+
// - Use input.ManagementClient instead of real k8s client
42+
// - Use input.ManagementEventRecorder for events
43+
// - Run sync ONCE, not in a loop
44+
// - The manifestclient reads from input directory and writes to output directory
45+
46+
return nil, nil, fmt.Errorf("apply-configuration not yet implemented - see TODO comments above for implementation guidance")
47+
}

0 commit comments

Comments
 (0)