Skip to content

Commit

Permalink
Merge pull request #710 from deads2k/apply-05-MOM-prototype
Browse files Browse the repository at this point in the history
API-1835: demonstration mutation recording client
  • Loading branch information
openshift-merge-bot[bot] authored Oct 17, 2024
2 parents 76fe855 + c92e9e2 commit a44a55d
Show file tree
Hide file tree
Showing 42 changed files with 4,055 additions and 451 deletions.
9 changes: 9 additions & 0 deletions cmd/authentication-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import (

"github.com/spf13/cobra"

"k8s.io/cli-runtime/pkg/genericiooptions"
"k8s.io/component-base/cli"

"github.com/openshift/cluster-authentication-operator/pkg/cmd/mom"
"github.com/openshift/cluster-authentication-operator/pkg/cmd/operator"
)

Expand All @@ -24,7 +26,14 @@ func NewAuthenticationOperatorCommand() *cobra.Command {
},
}

ioStreams := genericiooptions.IOStreams{
In: os.Stdin,
Out: os.Stdout,
ErrOut: os.Stderr,
}

cmd.AddCommand(operator.NewOperator())
cmd.AddCommand(mom.NewApplyConfigurationCommand(ioStreams))

return cmd
}
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ require (
github.com/openshift/api v0.0.0-20241001152557-e415140e5d5f
github.com/openshift/build-machinery-go v0.0.0-20240613134303-8359781da660
github.com/openshift/client-go v0.0.0-20241001162912-da6d55e4611f
github.com/openshift/library-go v0.0.0-20241001171606-756adf2188fc
github.com/openshift/library-go v0.0.0-20241016205830-b3a7a46e7136
github.com/openshift/multi-operator-manager v0.0.0-20241017140751-8b22f6c45da3
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.9.0
go.etcd.io/etcd/client/v3 v3.5.14
Expand All @@ -18,6 +19,7 @@ require (
k8s.io/api v0.31.1
k8s.io/apimachinery v0.31.1
k8s.io/apiserver v0.31.1
k8s.io/cli-runtime v0.31.1
k8s.io/client-go v0.31.1
k8s.io/component-base v0.31.1
k8s.io/klog/v2 v2.130.1
Expand Down
8 changes: 6 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ github.com/openshift/build-machinery-go v0.0.0-20240613134303-8359781da660 h1:F0
github.com/openshift/build-machinery-go v0.0.0-20240613134303-8359781da660/go.mod h1:8jcm8UPtg2mCAsxfqKil1xrmRMI3a+XU2TZ9fF8A7TE=
github.com/openshift/client-go v0.0.0-20241001162912-da6d55e4611f h1:FRc0bVNWprihWS0GqQWzb3dY4dkCwpOP3mDw5NwSoR4=
github.com/openshift/client-go v0.0.0-20241001162912-da6d55e4611f/go.mod h1:KiZi2mJRH1TOJ3FtBDYS6YvUL30s/iIXaGSUrSa36mo=
github.com/openshift/library-go v0.0.0-20241001171606-756adf2188fc h1:QXYkFJn7wLTHAI56l+9DJnLrNynGtXjyOZLgiIglTnE=
github.com/openshift/library-go v0.0.0-20241001171606-756adf2188fc/go.mod h1:9B1MYPoLtP9tqjWxcbUNVpwxy68zOH/3EIP6c31dAM0=
github.com/openshift/library-go v0.0.0-20241016205830-b3a7a46e7136 h1:DzmXoRRel2FiuAHFlA2TG/52OIMQ8oid6GwFhy9pcAo=
github.com/openshift/library-go v0.0.0-20241016205830-b3a7a46e7136/go.mod h1:9B1MYPoLtP9tqjWxcbUNVpwxy68zOH/3EIP6c31dAM0=
github.com/openshift/multi-operator-manager v0.0.0-20241017140751-8b22f6c45da3 h1:/rOm5CjL8W8sSeSzf/bg8wySP98+juT2SbVhBhmROLo=
github.com/openshift/multi-operator-manager v0.0.0-20241017140751-8b22f6c45da3/go.mod h1:7u7Wj5yctFzwixEJdrnpZCCNuJwdwls3SwqHoxRlN7E=
github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down Expand Up @@ -325,6 +327,8 @@ k8s.io/apimachinery v0.31.1 h1:mhcUBbj7KUjaVhyXILglcVjuS4nYXiwC+KKFBgIVy7U=
k8s.io/apimachinery v0.31.1/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo=
k8s.io/apiserver v0.31.1 h1:Sars5ejQDCRBY5f7R3QFHdqN3s61nhkpaX8/k1iEw1c=
k8s.io/apiserver v0.31.1/go.mod h1:lzDhpeToamVZJmmFlaLwdYZwd7zB+WYRYIboqA1kGxM=
k8s.io/cli-runtime v0.31.1 h1:/ZmKhmZ6hNqDM+yf9s3Y4KEYakNXUn5sod2LWGGwCuk=
k8s.io/cli-runtime v0.31.1/go.mod h1:pKv1cDIaq7ehWGuXQ+A//1OIF+7DI+xudXtExMCbe9U=
k8s.io/client-go v0.31.1 h1:f0ugtWSbWpxHR7sjVpQwuvw9a3ZKLXX0u0itkFXufb0=
k8s.io/client-go v0.31.1/go.mod h1:sKI8871MJN2OyeqRlmA4W4KM9KBdBUpDLu/43eGemCg=
k8s.io/component-base v0.31.1 h1:UpOepcrX3rQ3ab5NB6g5iP0tvsgJWzxTyAo20sgYSy8=
Expand Down
35 changes: 35 additions & 0 deletions pkg/cmd/mom/apply_configuration_command.go
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
}
Loading

0 comments on commit a44a55d

Please sign in to comment.