59 lines
1.7 KiB
Ruby
59 lines
1.7 KiB
Ruby
class Kustomize < Formula
|
|
desc "Template-free customization of Kubernetes YAML manifests"
|
|
homepage "https://github.com/kubernetes-sigs/kustomize"
|
|
url "https://github.com/kubernetes-sigs/kustomize.git",
|
|
:tag => "kustomize/v3.5.4",
|
|
:revision => "3af514fa9f85430f0c1557c4a0291e62112ab026"
|
|
head "https://github.com/kubernetes-sigs/kustomize.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "dd6c861f6693aa282a011f8ca83564317bb8c6b391387de30d1f409fe0079b09" => :mojave
|
|
sha256 "de22d3a03a654f6e240173519113565140a3f2ed135abcf6e01bb4bea4e905d9" => :high_sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
revision = Utils.popen_read("git", "rev-parse", "HEAD").strip
|
|
|
|
cd "kustomize" do
|
|
ldflags = %W[
|
|
-s -X sigs.k8s.io/kustomize/api/provenance.version=#{version}
|
|
-X sigs.k8s.io/kustomize/api/provenance.gitCommit=#{revision}
|
|
-X sigs.k8s.io/kustomize/api/provenance.buildDate=#{Time.now.iso8601}
|
|
]
|
|
system "go", "build", "-ldflags", ldflags.join(" "), "-o", bin/"kustomize"
|
|
end
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{bin}/kustomize version")
|
|
|
|
(testpath/"kustomization.yaml").write <<~EOS
|
|
resources:
|
|
- service.yaml
|
|
patchesStrategicMerge:
|
|
- patch.yaml
|
|
EOS
|
|
(testpath/"patch.yaml").write <<~EOS
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: brew-test
|
|
spec:
|
|
selector:
|
|
app: foo
|
|
EOS
|
|
(testpath/"service.yaml").write <<~EOS
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: brew-test
|
|
spec:
|
|
type: LoadBalancer
|
|
EOS
|
|
output = shell_output("#{bin}/kustomize build #{testpath}")
|
|
assert_match /type:\s+"?LoadBalancer"?/, output
|
|
end
|
|
end
|