@@ -168,78 +168,6 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
168168		)
169169		_  =  cmd .RegisterFlagCompletionFunc (groupAddFlagName , completion .AutocompleteNone )
170170
171- 		healthCmdFlagName  :=  "health-cmd" 
172- 		createFlags .StringVar (
173- 			& cf .HealthCmd ,
174- 			healthCmdFlagName , "" ,
175- 			"set a healthcheck command for the container ('none' disables the existing healthcheck)" ,
176- 		)
177- 		_  =  cmd .RegisterFlagCompletionFunc (healthCmdFlagName , completion .AutocompleteNone )
178- 
179- 		healthIntervalFlagName  :=  "health-interval" 
180- 		createFlags .StringVar (
181- 			& cf .HealthInterval ,
182- 			healthIntervalFlagName , define .DefaultHealthCheckInterval ,
183- 			"set an interval for the healthcheck (a value of disable results in no automatic timer setup)" ,
184- 		)
185- 		_  =  cmd .RegisterFlagCompletionFunc (healthIntervalFlagName , completion .AutocompleteNone )
186- 
187- 		healthLogDestinationFlagName  :=  "health-log-destination" 
188- 		createFlags .StringVar (
189- 			& cf .HealthLogDestination ,
190- 			healthLogDestinationFlagName , define .DefaultHealthCheckLocalDestination ,
191- 			"set the destination of the HealthCheck log. Directory path, local or events_logger (local use container state file)" ,
192- 		)
193- 		_  =  cmd .RegisterFlagCompletionFunc (healthLogDestinationFlagName , completion .AutocompleteNone )
194- 
195- 		healthMaxLogCountFlagName  :=  "health-max-log-count" 
196- 		createFlags .UintVar (
197- 			& cf .HealthMaxLogCount ,
198- 			healthMaxLogCountFlagName , define .DefaultHealthMaxLogCount ,
199- 			"set maximum number of attempts in the HealthCheck log file. ('0' value means an infinite number of attempts in the log file)" ,
200- 		)
201- 		_  =  cmd .RegisterFlagCompletionFunc (healthMaxLogCountFlagName , completion .AutocompleteNone )
202- 
203- 		healthMaxLogSizeFlagName  :=  "health-max-log-size" 
204- 		createFlags .UintVar (
205- 			& cf .HealthMaxLogSize ,
206- 			healthMaxLogSizeFlagName , define .DefaultHealthMaxLogSize ,
207- 			"set maximum length in characters of stored HealthCheck log. ('0' value means an infinite log length)" ,
208- 		)
209- 		_  =  cmd .RegisterFlagCompletionFunc (healthMaxLogSizeFlagName , completion .AutocompleteNone )
210- 
211- 		healthRetriesFlagName  :=  "health-retries" 
212- 		createFlags .UintVar (
213- 			& cf .HealthRetries ,
214- 			healthRetriesFlagName , define .DefaultHealthCheckRetries ,
215- 			"the number of retries allowed before a healthcheck is considered to be unhealthy" ,
216- 		)
217- 		_  =  cmd .RegisterFlagCompletionFunc (healthRetriesFlagName , completion .AutocompleteNone )
218- 
219- 		healthStartPeriodFlagName  :=  "health-start-period" 
220- 		createFlags .StringVar (
221- 			& cf .HealthStartPeriod ,
222- 			healthStartPeriodFlagName , define .DefaultHealthCheckStartPeriod ,
223- 			"the initialization time needed for a container to bootstrap" ,
224- 		)
225- 		_  =  cmd .RegisterFlagCompletionFunc (healthStartPeriodFlagName , completion .AutocompleteNone )
226- 
227- 		healthTimeoutFlagName  :=  "health-timeout" 
228- 		createFlags .StringVar (
229- 			& cf .HealthTimeout ,
230- 			healthTimeoutFlagName , define .DefaultHealthCheckTimeout ,
231- 			"the maximum time allowed to complete the healthcheck before an interval is considered failed" ,
232- 		)
233- 		_  =  cmd .RegisterFlagCompletionFunc (healthTimeoutFlagName , completion .AutocompleteNone )
234- 
235- 		healthOnFailureFlagName  :=  "health-on-failure" 
236- 		createFlags .StringVar (
237- 			& cf .HealthOnFailure ,
238- 			healthOnFailureFlagName , "none" ,
239- 			"action to take once the container turns unhealthy" ,
240- 		)
241- 		_  =  cmd .RegisterFlagCompletionFunc (healthOnFailureFlagName , AutocompleteHealthOnFailure )
242- 
243171		createFlags .BoolVar (
244172			& cf .HTTPProxy ,
245173			"http-proxy" , podmanConfig .ContainersConfDefaultsRO .Containers .HTTPProxy ,
@@ -311,11 +239,6 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
311239		)
312240		_  =  cmd .RegisterFlagCompletionFunc (logOptFlagName , AutocompleteLogOpt )
313241
314- 		createFlags .BoolVar (
315- 			& cf .NoHealthCheck ,
316- 			"no-healthcheck" , false ,
317- 			"Disable healthchecks on container" ,
318- 		)
319242		createFlags .BoolVar (
320243			& cf .OOMKillDisable ,
321244			"oom-kill-disable" , false ,
@@ -452,46 +375,6 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
452375		)
453376		_  =  cmd .RegisterFlagCompletionFunc (secretFlagName , AutocompleteSecrets )
454377
455- 		startupHCCmdFlagName  :=  "health-startup-cmd" 
456- 		createFlags .StringVar (
457- 			& cf .StartupHCCmd ,
458- 			startupHCCmdFlagName , "" ,
459- 			"Set a startup healthcheck command for the container" ,
460- 		)
461- 		_  =  cmd .RegisterFlagCompletionFunc (startupHCCmdFlagName , completion .AutocompleteNone )
462- 
463- 		startupHCIntervalFlagName  :=  "health-startup-interval" 
464- 		createFlags .StringVar (
465- 			& cf .StartupHCInterval ,
466- 			startupHCIntervalFlagName , define .DefaultHealthCheckInterval ,
467- 			"Set an interval for the startup healthcheck" ,
468- 		)
469- 		_  =  cmd .RegisterFlagCompletionFunc (startupHCIntervalFlagName , completion .AutocompleteNone )
470- 
471- 		startupHCRetriesFlagName  :=  "health-startup-retries" 
472- 		createFlags .UintVar (
473- 			& cf .StartupHCRetries ,
474- 			startupHCRetriesFlagName , 0 ,
475- 			"Set the maximum number of retries before the startup healthcheck will restart the container" ,
476- 		)
477- 		_  =  cmd .RegisterFlagCompletionFunc (startupHCRetriesFlagName , completion .AutocompleteNone )
478- 
479- 		startupHCSuccessesFlagName  :=  "health-startup-success" 
480- 		createFlags .UintVar (
481- 			& cf .StartupHCSuccesses ,
482- 			startupHCSuccessesFlagName , 0 ,
483- 			"Set the number of consecutive successes before the startup healthcheck is marked as successful and the normal healthcheck begins (0 indicates any success will start the regular healthcheck)" ,
484- 		)
485- 		_  =  cmd .RegisterFlagCompletionFunc (startupHCSuccessesFlagName , completion .AutocompleteNone )
486- 
487- 		startupHCTimeoutFlagName  :=  "health-startup-timeout" 
488- 		createFlags .StringVar (
489- 			& cf .StartupHCTimeout ,
490- 			startupHCTimeoutFlagName , define .DefaultHealthCheckTimeout ,
491- 			"Set the maximum amount of time that the startup healthcheck may take before it is considered failed" ,
492- 		)
493- 		_  =  cmd .RegisterFlagCompletionFunc (startupHCTimeoutFlagName , completion .AutocompleteNone )
494- 
495378		stopSignalFlagName  :=  "stop-signal" 
496379		createFlags .StringVar (
497380			& cf .StopSignal ,
@@ -665,6 +548,141 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
665548			`If a container with the same name exists, replace it` ,
666549		)
667550	}
551+ 	if  mode  ==  entities .CreateMode  ||  mode  ==  entities .UpdateMode  {
552+ 		// TODO: Focus on disable 
553+ 		createFlags .BoolVar (
554+ 			& cf .NoHealthCheck ,
555+ 			"no-healthcheck" , false ,
556+ 			"Disable healthchecks on container" ,
557+ 		)
558+ 
559+ 		healthCmdFlagName  :=  "health-cmd" 
560+ 		createFlags .StringVar (
561+ 			& cf .HealthCmd ,
562+ 			healthCmdFlagName , "" ,
563+ 			"set a healthcheck command for the container ('none' disables the existing healthcheck)" ,
564+ 		)
565+ 		_  =  cmd .RegisterFlagCompletionFunc (healthCmdFlagName , completion .AutocompleteNone )
566+ 
567+ 		info  :=  "" 
568+ 		if  mode  ==  entities .UpdateMode  {
569+ 			info  =  "Changing this setting resets timer." 
570+ 		}
571+ 		healthIntervalFlagName  :=  "health-interval" 
572+ 		createFlags .StringVar (
573+ 			& cf .HealthInterval ,
574+ 			healthIntervalFlagName , define .DefaultHealthCheckInterval ,
575+ 			"set an interval for the healthcheck. (a value of disable results in no automatic timer setup) " + info ,
576+ 		)
577+ 		_  =  cmd .RegisterFlagCompletionFunc (healthIntervalFlagName , completion .AutocompleteNone )
578+ 
579+ 		warning  :=  "" 
580+ 		if  mode  ==  entities .UpdateMode  {
581+ 			warning  =  "Warning: Changing this setting may cause the loss of previous logs!" 
582+ 		}
583+ 		healthLogDestinationFlagName  :=  "health-log-destination" 
584+ 		createFlags .StringVar (
585+ 			& cf .HealthLogDestination ,
586+ 			healthLogDestinationFlagName , define .DefaultHealthCheckLocalDestination ,
587+ 			"set the destination of the HealthCheck log. Directory path, local or events_logger (local use container state file) " + warning ,
588+ 		)
589+ 		_  =  cmd .RegisterFlagCompletionFunc (healthLogDestinationFlagName , completion .AutocompleteNone )
590+ 
591+ 		healthMaxLogCountFlagName  :=  "health-max-log-count" 
592+ 		createFlags .UintVar (
593+ 			& cf .HealthMaxLogCount ,
594+ 			healthMaxLogCountFlagName , define .DefaultHealthMaxLogCount ,
595+ 			"set maximum number of attempts in the HealthCheck log file. ('0' value means an infinite number of attempts in the log file)" ,
596+ 		)
597+ 		_  =  cmd .RegisterFlagCompletionFunc (healthMaxLogCountFlagName , completion .AutocompleteNone )
598+ 
599+ 		healthMaxLogSizeFlagName  :=  "health-max-log-size" 
600+ 		createFlags .UintVar (
601+ 			& cf .HealthMaxLogSize ,
602+ 			healthMaxLogSizeFlagName , define .DefaultHealthMaxLogSize ,
603+ 			"set maximum length in characters of stored HealthCheck log. ('0' value means an infinite log length)" ,
604+ 		)
605+ 		_  =  cmd .RegisterFlagCompletionFunc (healthMaxLogSizeFlagName , completion .AutocompleteNone )
606+ 
607+ 		healthRetriesFlagName  :=  "health-retries" 
608+ 		createFlags .UintVar (
609+ 			& cf .HealthRetries ,
610+ 			healthRetriesFlagName , define .DefaultHealthCheckRetries ,
611+ 			"the number of retries allowed before a healthcheck is considered to be unhealthy" ,
612+ 		)
613+ 		_  =  cmd .RegisterFlagCompletionFunc (healthRetriesFlagName , completion .AutocompleteNone )
614+ 
615+ 		healthStartPeriodFlagName  :=  "health-start-period" 
616+ 		createFlags .StringVar (
617+ 			& cf .HealthStartPeriod ,
618+ 			healthStartPeriodFlagName , define .DefaultHealthCheckStartPeriod ,
619+ 			"the initialization time needed for a container to bootstrap" ,
620+ 		)
621+ 		_  =  cmd .RegisterFlagCompletionFunc (healthStartPeriodFlagName , completion .AutocompleteNone )
622+ 
623+ 		healthTimeoutFlagName  :=  "health-timeout" 
624+ 		createFlags .StringVar (
625+ 			& cf .HealthTimeout ,
626+ 			healthTimeoutFlagName , define .DefaultHealthCheckTimeout ,
627+ 			"the maximum time allowed to complete the healthcheck before an interval is considered failed" ,
628+ 		)
629+ 		_  =  cmd .RegisterFlagCompletionFunc (healthTimeoutFlagName , completion .AutocompleteNone )
630+ 
631+ 		healthOnFailureFlagName  :=  "health-on-failure" 
632+ 		createFlags .StringVar (
633+ 			& cf .HealthOnFailure ,
634+ 			healthOnFailureFlagName , "none" ,
635+ 			"action to take once the container turns unhealthy" ,
636+ 		)
637+ 		_  =  cmd .RegisterFlagCompletionFunc (healthOnFailureFlagName , AutocompleteHealthOnFailure )
638+ 
639+ 		// Startup HealthCheck 
640+ 
641+ 		startupHCCmdFlagName  :=  "health-startup-cmd" 
642+ 		createFlags .StringVar (
643+ 			& cf .StartupHCCmd ,
644+ 			startupHCCmdFlagName , "" ,
645+ 			"Set a startup healthcheck command for the container" ,
646+ 		)
647+ 		_  =  cmd .RegisterFlagCompletionFunc (startupHCCmdFlagName , completion .AutocompleteNone )
648+ 
649+ 		info  =  "" 
650+ 		if  mode  ==  entities .UpdateMode  {
651+ 			info  =  "Changing this setting resets the timer, depending on the state of the container." 
652+ 		}
653+ 		startupHCIntervalFlagName  :=  "health-startup-interval" 
654+ 		createFlags .StringVar (
655+ 			& cf .StartupHCInterval ,
656+ 			startupHCIntervalFlagName , define .DefaultHealthCheckInterval ,
657+ 			"Set an interval for the startup healthcheck. " + info ,
658+ 		)
659+ 		_  =  cmd .RegisterFlagCompletionFunc (startupHCIntervalFlagName , completion .AutocompleteNone )
660+ 
661+ 		startupHCRetriesFlagName  :=  "health-startup-retries" 
662+ 		createFlags .UintVar (
663+ 			& cf .StartupHCRetries ,
664+ 			startupHCRetriesFlagName , 0 ,
665+ 			"Set the maximum number of retries before the startup healthcheck will restart the container" ,
666+ 		)
667+ 		_  =  cmd .RegisterFlagCompletionFunc (startupHCRetriesFlagName , completion .AutocompleteNone )
668+ 
669+ 		startupHCSuccessesFlagName  :=  "health-startup-success" 
670+ 		createFlags .UintVar (
671+ 			& cf .StartupHCSuccesses ,
672+ 			startupHCSuccessesFlagName , 0 ,
673+ 			"Set the number of consecutive successes before the startup healthcheck is marked as successful and the normal healthcheck begins (0 indicates any success will start the regular healthcheck)" ,
674+ 		)
675+ 		_  =  cmd .RegisterFlagCompletionFunc (startupHCSuccessesFlagName , completion .AutocompleteNone )
676+ 
677+ 		startupHCTimeoutFlagName  :=  "health-startup-timeout" 
678+ 		createFlags .StringVar (
679+ 			& cf .StartupHCTimeout ,
680+ 			startupHCTimeoutFlagName , define .DefaultHealthCheckTimeout ,
681+ 			"Set the maximum amount of time that the startup healthcheck may take before it is considered failed" ,
682+ 		)
683+ 		_  =  cmd .RegisterFlagCompletionFunc (startupHCTimeoutFlagName , completion .AutocompleteNone )
684+ 	}
685+ 
668686	// Restart is allowed for created, updated, and infra ctr 
669687	if  mode  ==  entities .InfraMode  ||  mode  ==  entities .CreateMode  ||  mode  ==  entities .UpdateMode  {
670688		restartFlagName  :=  "restart" 
0 commit comments