@@ -21,6 +21,7 @@ settings = {
2121 "preload_images_for_kind" : True ,
2222 "kind_cluster_name" : "capz" ,
2323 "capi_version" : "v1.7.1" ,
24+ "caaph_version" : "v0.2.1" ,
2425 "cert_manager_version" : "v1.14.4" ,
2526 "kubernetes_version" : "v1.28.3" ,
2627 "aks_kubernetes_version" : "v1.28.3" ,
@@ -61,13 +62,25 @@ def deploy_capi():
6162 extra_args = settings .get ("extra_args" )
6263 if extra_args .get ("core" ):
6364 core_extra_args = extra_args .get ("core" )
64- if core_extra_args :
65- for namespace in ["capi-system" , "capi-webhook-system" ]:
66- patch_args_with_extra_args (namespace , "capi-controller-manager" , core_extra_args )
65+ for namespace in ["capi-system" , "capi-webhook-system" ]:
66+ patch_args_with_extra_args (namespace , "capi-controller-manager" , core_extra_args )
6767 if extra_args .get ("kubeadm-bootstrap" ):
6868 kb_extra_args = extra_args .get ("kubeadm-bootstrap" )
69- if kb_extra_args :
70- patch_args_with_extra_args ("capi-kubeadm-bootstrap-system" , "capi-kubeadm-bootstrap-controller-manager" , kb_extra_args )
69+ patch_args_with_extra_args ("capi-kubeadm-bootstrap-system" , "capi-kubeadm-bootstrap-controller-manager" , kb_extra_args )
70+
71+ # deploy CAAPH
72+ def deploy_caaph ():
73+ version = settings .get ("caaph_version" )
74+
75+ caaph_uri = "https://github.com/kubernetes-sigs/cluster-api-addon-provider-helm/releases/download/{}/addon-components.yaml" .format (version )
76+ cmd = "curl --retry 3 -sSL {} | {} | {} apply -f -" .format (caaph_uri , envsubst_cmd , kubectl_cmd )
77+ local (cmd , quiet = True )
78+ if settings .get ("extra_args" ):
79+ extra_args = settings .get ("extra_args" )
80+ if extra_args .get ("helm" ):
81+ core_extra_args = extra_args .get ("helm" )
82+ for namespace in ["caaph-system" , "caaph-webhook-system" ]:
83+ patch_args_with_extra_args (namespace , "caaph-controller-manager" , core_extra_args )
7184
7285def patch_args_with_extra_args (namespace , name , extra_args ):
7386 args_str = str (local ("{} get deployments {} -n {} -o jsonpath={{.spec.template.spec.containers[1].args}}" .format (kubectl_cmd , name , namespace )))
@@ -198,11 +211,10 @@ def capz():
198211 # add extra_args if they are defined
199212 if settings .get ("extra_args" ):
200213 azure_extra_args = settings .get ("extra_args" ).get ("azure" )
201- if azure_extra_args :
202- yaml_dict = decode_yaml_stream (yaml )
203- append_arg_for_container_in_deployment (yaml_dict , "capz-controller-manager" , "capz-system" , "cluster-api-azure-controller" , azure_extra_args )
204- yaml = str (encode_yaml_stream (yaml_dict ))
205- yaml = fixup_yaml_empty_arrays (yaml )
214+ yaml_dict = decode_yaml_stream (yaml )
215+ append_arg_for_container_in_deployment (yaml_dict , "capz-controller-manager" , "capz-system" , "cluster-api-azure-controller" , azure_extra_args )
216+ yaml = str (encode_yaml_stream (yaml_dict ))
217+ yaml = fixup_yaml_empty_arrays (yaml )
206218
207219 # Forge the build command
208220 ldflags = "-extldflags \" -static\" " + str (local ("hack/version.sh" )).rstrip ("\n " )
@@ -449,6 +461,8 @@ if settings.get("deploy_cert_manager"):
449461
450462deploy_capi ()
451463
464+ deploy_caaph ()
465+
452466create_identity_secret ()
453467
454468capz ()
0 commit comments