mirror of
https://github.com/czhu12/canine.git
synced 2026-04-27 23:22:49 -05:00
added telepresence to default stack
This commit is contained in:
@@ -10,6 +10,7 @@ class Clusters::Install
|
||||
Clusters::InstallNginxIngress,
|
||||
Clusters::InstallAcmeIssuer,
|
||||
Clusters::InstallMetricServer,
|
||||
Clusters::InstallTelepresence,
|
||||
)
|
||||
cluster.running! if result.success?
|
||||
cluster.failed! if result.failure?
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
class Clusters::InstallTelepresence
|
||||
extend LightService::Action
|
||||
expects :cluster
|
||||
|
||||
executed do |context|
|
||||
cluster = context.cluster
|
||||
runner = Cli::RunAndLog.new(cluster)
|
||||
kubectl = K8::Kubectl.new(cluster.kubeconfig, runner)
|
||||
cluster.info("Checking if Nginx ingress controller is already installed...", color: :yellow)
|
||||
|
||||
begin
|
||||
kubectl.("get deployment traffic-manager -n #{Clusters::Install::DEFAULT_NAMESPACE}")
|
||||
cluster.success("Telepresence already installed")
|
||||
rescue Cli::CommandFailedError => e
|
||||
cluster.info("Telepresence not detected, installing...", color: :yellow)
|
||||
command = "bash #{Rails.root.join("resources", "k8", "scripts", "install_telepresence.sh")}"
|
||||
kubectl.with_kube_config do |kubeconfig_file|
|
||||
begin
|
||||
runner.(command, envs: { "KUBECONFIG" => kubeconfig_file.path, "NAMESPACE" => Clusters::Install::DEFAULT_NAMESPACE })
|
||||
cluster.success("Telepresence installed successfully")
|
||||
rescue Cli::CommandFailedError => e
|
||||
cluster.failed!
|
||||
cluster.error("Telepresence failed to install")
|
||||
context.fail_and_return!("Script failed with exit code #{e.message}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1 @@
|
||||
telepresence helm install --namespace $NAMESPACE
|
||||
@@ -0,0 +1,13 @@
|
||||
# This needs to be on the canine server to work (assuming linux)
|
||||
|
||||
# Install kubectl
|
||||
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
||||
|
||||
# Install helm
|
||||
sudo curl -fsSLo get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
|
||||
sudo chmod a+x get_helm.sh
|
||||
sudo ./get_helm.sh
|
||||
|
||||
# Install telepresence
|
||||
sudo curl -fL https://app.getambassador.io/download/tel2oss/releases/download/v2.21.1/telepresence-linux-amd64 -o /usr/local/bin/telepresence
|
||||
sudo chmod a+x /usr/local/bin/telepresence
|
||||
Reference in New Issue
Block a user