@@ -132,7 +132,7 @@ func NewOptions() *Options {
132132 }
133133}
134134
135- func (o * Options ) Run ( ctx context. Context ) error {
135+ func (o * Options ) ValidateAndComplete ( ) error {
136136 if o .NodeName == "" {
137137 return fmt .Errorf ("node-name is required" )
138138 }
@@ -152,6 +152,20 @@ func (o *Options) Run(ctx context.Context) error {
152152 (o .PromQLTarget .KubeSvc .Namespace == "" || o .PromQLTarget .KubeSvc .Name == "" ) {
153153 return fmt .Errorf ("--use-dns-for-services is disabled, so --metrics-service and --metrics-namespace must be set" )
154154 }
155+
156+ if parsed , err := url .Parse (o .PrometheusURLString ); err != nil {
157+ return fmt .Errorf ("error parsing promql url: %v" , err )
158+ } else {
159+ o .PromQLTarget .URL = parsed
160+ }
161+
162+ // Inject the cluster ID into PromQL queries in HyperShift
163+ o .InjectClusterIdIntoPromQL = o .HyperShift
164+
165+ return nil
166+ }
167+
168+ func (o * Options ) Run (ctx context.Context ) error {
155169 if len (o .PayloadOverride ) > 0 {
156170 klog .Warningf ("Using an override payload directory for testing only: %s" , o .PayloadOverride )
157171 }
@@ -163,16 +177,6 @@ func (o *Options) Run(ctx context.Context) error {
163177 return fmt .Errorf ("--always-enable-capabilities was set with unknown capabilities: %v" , unknownCaps )
164178 }
165179
166- // Inject the cluster ID into PromQL queries in HyperShift
167- o .InjectClusterIdIntoPromQL = o .HyperShift
168-
169- // parse the prometheus url
170- var err error
171- o .PromQLTarget .URL , err = url .Parse (o .PrometheusURLString )
172- if err != nil {
173- return fmt .Errorf ("error parsing promql url: %v" , err )
174- }
175-
176180 // initialize the core objects
177181 cb , err := newClientBuilder (o .Kubeconfig )
178182 if err != nil {
0 commit comments