package kubespray

import (
	"fmt"
	"kube-forge/internal/config"
	"kube-forge/internal/secrets_storage"
)

func InstallCluster(tags string) {
	runPlaybook("kubespray/project/cluster.yml", tags)
	CopyK8SAdminConfig("k8s-admin.conf")
	config := config.GetConfig()
	if config.Modules.SecretsStorage.Enabled {
		fmt.Println("## Additional Vault Configuration")
		secrets_storage.InitVault()
		secrets_storage.UnsealVault()
		secrets_storage.AddKubernetesLocalIntegration()
	}
}

func UpgradeCluster(tags string) {
	runPlaybook("kubespray/project/upgrade_cluster.yml", tags)
	CopyK8SAdminConfig("k8s-admin.conf")
}

func ScaleCluster() {
	runPlaybook("kubespray/project/scale.yml", "")
	CopyK8SAdminConfig("k8s-admin.conf")
}
