()
| 62 | } |
| 63 | |
| 64 | func NewOptions() (*Options, error) { |
| 65 | var ( |
| 66 | leaderElection componentbaseconfigv1alpha1.LeaderElectionConfiguration |
| 67 | clientConnection componentbaseconfigv1alpha1.ClientConnectionConfiguration |
| 68 | ) |
| 69 | componentbaseconfigv1alpha1.RecommendedDefaultLeaderElectionConfiguration(&leaderElection) |
| 70 | componentbaseconfigv1alpha1.RecommendedDefaultClientConnectionConfiguration(&clientConnection) |
| 71 | |
| 72 | leaderElection.ResourceName = "cloudshell-controller-manager" |
| 73 | leaderElection.ResourceNamespace = NamespaceCloudttySystem |
| 74 | leaderElection.ResourceLock = resourcelock.LeasesResourceLock |
| 75 | |
| 76 | clientConnection.ContentType = runtime.ContentTypeJSON |
| 77 | |
| 78 | var options Options |
| 79 | |
| 80 | // not need scheme.Convert |
| 81 | if err := componentbaseconfigv1alpha1.Convert_v1alpha1_LeaderElectionConfiguration_To_config_LeaderElectionConfiguration(&leaderElection, &options.LeaderElection, nil); err != nil { |
| 82 | return nil, err |
| 83 | } |
| 84 | if err := componentbaseconfigv1alpha1.Convert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration(&clientConnection, &options.ClientConnection, nil); err != nil { |
| 85 | return nil, err |
| 86 | } |
| 87 | |
| 88 | options.Logs = logs.NewOptions() |
| 89 | return &options, nil |
| 90 | } |
| 91 | |
| 92 | // initFlags initializes flags by section name. |
| 93 | func (o *Options) Flags() cliflag.NamedFlagSets { |
no outgoing calls
no test coverage detected