2424_KUEUE_NAMESPACE_NAME = 'kueue-system'
2525_CERT_WEBHOOK_DEPLOYMENT_NAME = 'cert-manager-webhook'
2626_CERT_WEBHOOK_NAMESPACE_NAME = 'cert-manager'
27+ _WEBHOOK_PACKAGE = 'mldiagnostics-injection-webhook'
28+ _WEBHOOK_VERSION = Version ('v0.5.0' )
29+ _WEBHOOK_FILENAME = f'{ _WEBHOOK_PACKAGE } -v{ _WEBHOOK_VERSION } .yaml'
30+ _OPERATOR_PACKAGE = 'mldiagnostics-connection-operator'
31+ _OPERATOR_VERSION = Version ('v0.5.0' )
32+ _OPERATOR_FILENAME = f'{ _OPERATOR_PACKAGE } -v{ _OPERATOR_VERSION } .yaml'
33+ _CERT_MANAGER_VERSION = Version ('v1.13.0' )
2734
2835
29- def _install_cert_manager (version : Version = Version ( 'v1.13.0' ) ) -> int :
36+ def _install_cert_manager (version : Version = _CERT_MANAGER_VERSION ) -> int :
3037 """
3138 Apply the cert-manager manifest.
3239
@@ -111,13 +118,11 @@ def _install_mldiagnostics_yaml(artifact_filename: str) -> int:
111118
112119 command = f'kubectl apply -f { full_artifact_path } -n gke-mldiagnostics'
113120
114- return_code = run_command_with_updates (
121+ return run_command_with_updates (
115122 command ,
116123 f'Install { full_artifact_path } ...' ,
117124 )
118125
119- return return_code
120-
121126
122127def _label_default_namespace_mldiagnostics () -> int :
123128 """
@@ -129,13 +134,11 @@ def _label_default_namespace_mldiagnostics() -> int:
129134
130135 command = 'kubectl label namespace default managed-mldiagnostics-gke=true'
131136
132- return_code = run_command_with_updates (
137+ return run_command_with_updates (
133138 command ,
134139 'Label default namespace with managed-mldiagnostics-gke=true' ,
135140 )
136141
137- return return_code
138-
139142
140143def install_mldiagnostics_prerequisites () -> int :
141144 """
@@ -166,12 +169,8 @@ def install_mldiagnostics_prerequisites() -> int:
166169 xpk_print ('The cert-manager-webhook installation failed.' )
167170 return 1
168171
169- webhook_package = 'mldiagnostics-injection-webhook'
170- webhook_version = Version ('v0.5.0' )
171- webhook_filename = f'{ webhook_package } -v{ webhook_version } .yaml'
172-
173172 return_code = _download_mldiagnostics_yaml (
174- package_name = webhook_package , version = webhook_version
173+ package_name = _WEBHOOK_PACKAGE , version = _WEBHOOK_VERSION
175174 )
176175 if return_code != 0 :
177176 return return_code
@@ -180,25 +179,23 @@ def install_mldiagnostics_prerequisites() -> int:
180179 if return_code != 0 :
181180 return return_code
182181
183- return_code = _install_mldiagnostics_yaml (artifact_filename = webhook_filename )
182+ return_code = _install_mldiagnostics_yaml (artifact_filename = _WEBHOOK_FILENAME )
184183 if return_code != 0 :
185184 return return_code
186185
187186 return_code = _label_default_namespace_mldiagnostics ()
188187 if return_code != 0 :
189188 return return_code
190189
191- operator_package = 'mldiagnostics-connection-operator'
192- operator_version = Version ('v0.5.0' )
193- operator_filename = f'{ operator_package } -v{ operator_version } .yaml'
194-
195190 return_code = _download_mldiagnostics_yaml (
196- package_name = operator_package , version = operator_version
191+ package_name = _OPERATOR_PACKAGE , version = _OPERATOR_VERSION
197192 )
198193 if return_code != 0 :
199194 return return_code
200195
201- return_code = _install_mldiagnostics_yaml (artifact_filename = operator_filename )
196+ return_code = _install_mldiagnostics_yaml (
197+ artifact_filename = _OPERATOR_FILENAME
198+ )
202199 if return_code != 0 :
203200 return return_code
204201
0 commit comments