@@ -65,7 +65,7 @@ func getRunCloudMapCommand(operatorOpts *Options) *cobra.Command {
6565	// ----------------------------- 
6666
6767	cmd  :=  & cobra.Command {
68- 		Use :     "cloudmap [COMMAND] [ OPTIONS]" ,
68+ 		Use :     "cloudmap [OPTIONS]" ,
6969		Aliases : []string {"cm" , "aws-cloud-map" , "with-cloud-map" },
7070		Short :   "Run the program with AWS Cloud Map" ,
7171		PreRunE : func (cmd  * cobra.Command , args  []string ) error  {
@@ -204,9 +204,9 @@ func getRunCloudMapCommand(operatorOpts *Options) *cobra.Command {
204204		return  "" 
205205	}(),
206206		"name of the Kubernetes config map containing settings." )
207- 	cmd .Flags ().StringVar (& credentialsPath , "credentials-path" , "" ,
207+ 	cmd .Flags ().StringVar (& credentialsPath , "cloud-map. credentials-path" , "" ,
208208		"path to the credentials file." )
209- 	cmd .Flags ().StringVar (& credentialsSecret , "credentials-secret" , func () string  {
209+ 	cmd .Flags ().StringVar (& credentialsSecret , "cloud-map. credentials-secret" , func () string  {
210210		if  operatorOpts .RunningInK8s  {
211211			return  defaultCloudMapCredentialsSecretName 
212212		}
@@ -219,6 +219,12 @@ func getRunCloudMapCommand(operatorOpts *Options) *cobra.Command {
219219}
220220
221221func  runWithCloudMap (operatorOpts  * Options , cmOpts  * CloudMapOptions ) error  {
222+ 	// TODO: when #81 is solved an merged this will be replaced 
223+ 	// with zerolog 
224+ 	l  :=  ctrl .Log .WithName ("CloudMap" )
225+ 	ctrl .SetLogger (zap .New (zap .UseDevMode (true )))
226+ 	l .Info ("starting..." )
227+ 
222228	ctx , canc  :=  context .WithTimeout (context .Background (), 15 * time .Second )
223229	defer  canc ()
224230	const  tempPath  =  "/tmp/cnwan-operator-aws-credentials" 
@@ -236,15 +242,8 @@ func runWithCloudMap(operatorOpts *Options, cmOpts *CloudMapOptions) error {
236242		return  fmt .Errorf ("error while trying to load AWS configuration: %w" , err )
237243	}
238244
239- 	// TODO: when #81 is solved an merged this will be replaced 
240- 	// with zerolog 
241- 	l  :=  ctrl .Log .WithName ("ServiceDirectory" )
242- 	ctrl .SetLogger (zap .New (zap .UseDevMode (true )))
243- 
244- 	servreg  :=  cloudmap .NewHandler (ctx , servicediscovery .NewFromConfig (cfg ), l )
245- 
246- 	// TODO: use the handler (in next commits) 
247- 	_  =  servreg 
248- 
249- 	return  nil 
245+ 	// TODO: the context should be given by the run function, or explicitly 
246+ 	// provide a context for each call. This will be fixed with the new API 
247+ 	servreg  :=  cloudmap .NewHandler (context .Background (), servicediscovery .NewFromConfig (cfg ), l )
248+ 	return  run (servreg , operatorOpts )
250249}
0 commit comments