diff --git a/src/tasks/cluster_api_setup.cr b/src/tasks/cluster_api_setup.cr index d2d8e50c1..ca4ca9b7b 100644 --- a/src/tasks/cluster_api_setup.cr +++ b/src/tasks/cluster_api_setup.cr @@ -35,6 +35,16 @@ task "cluster_api_setup" do |_, args| File.write("#{clusterctl}/clusterctl.yaml", "CLUSTER_TOPOLOGY: \"true\"") + begin + KubectlClient::Create.namespace("cert-manager") + cmd = "kubectl label namespace cert-manager pod-security.kubernetes.io/enforce=privileged" + ShellCmd.run(cmd, "Label.namespace") + rescue e : KubectlClient::Create::AlreadyExistsError + Log.for("ensure_namespace_exists").info { "Kubernetes namespace cert-manager already exists for the CNF install" } + cmd = "kubectl label --overwrite namespace cert-manager pod-security.kubernetes.io/enforce=privileged" + ShellCmd.run(cmd, "Label.namespace") + end + cluster_init_cmd = "clusterctl init --infrastructure docker" stdout = IO::Memory.new Process.run(cluster_init_cmd, shell: true, output: stdout, error: stdout)