-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef4ab4c
commit 888fa91
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
class Vcluster < Formula | ||
desc "Creates fully functional virtual k8s cluster inside host k8s cluster's namespace" | ||
homepage "https://www.vcluster.com" | ||
url "https://github.com/loft-sh/vcluster.git", | ||
tag: "v0.12.3", | ||
revision: "397d9942f6f05ba7ca1dc9d507f26c8e33cd36b4" | ||
license "Apache-2.0" | ||
|
||
depends_on "go" => :build | ||
depends_on "helm" | ||
depends_on "kubernetes-cli" | ||
|
||
conflicts_with "homebrew/core/vcluster" | ||
|
||
def install | ||
ldflags = %W[ | ||
-s -w | ||
-X main.commitHash=#{Utils.git_head} | ||
-X main.buildDate=#{time.iso8601} | ||
-X main.version=#{version} | ||
] | ||
system "go", "build", "-mod", "vendor", *std_go_args(ldflags: ldflags), "./cmd/vclusterctl/main.go" | ||
end | ||
|
||
test do | ||
help_output = "vcluster root command" | ||
assert_match help_output, shell_output("#{bin}/vcluster --help") | ||
|
||
create_output = "there is an error loading your current kube config " \ | ||
"(invalid configuration: no configuration has been provided, " \ | ||
"try setting KUBERNETES_MASTER environment variable), " \ | ||
"please make sure you have access to a kubernetes cluster and the command " \ | ||
"`kubectl get namespaces` is working" | ||
assert_match create_output, shell_output("#{bin}/vcluster create vcluster -n vcluster --create-namespace", 1) | ||
end | ||
end |