diff --git a/GNUmakefile b/GNUmakefile index 79eac35c89..f290f71ef2 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -47,8 +47,8 @@ test-compile: targets: $(TARGETS) $(TARGETS): - GOOS=$@ GOARCH=amd64 go build -o "dist/$@/terraform-provider-tfstate_${TRAVIS_TAG}_x4" - zip -j dist/terraform-provider-tfstate_${TRAVIS_TAG}_$@_amd64.zip dist/$@/terraform-provider-tfstate_${TRAVIS_TAG}_x4 + GOOS=$@ GOARCH=amd64 go build -o "dist/$@/terraform-provider-kubernetes_${TRAVIS_TAG}_x4" + zip -j dist/terraform-provider-kubernetes_${TRAVIS_TAG}_$@_amd64.zip dist/$@/terraform-provider-kubernetes_${TRAVIS_TAG}_x4 .PHONY: build test testacc vet fmt fmtcheck errcheck vendor-status test-compile targets $(TARGETS) diff --git a/kubernetes/resource_kubernetes_deployment.go b/kubernetes/resource_kubernetes_deployment.go index bb05bf16d8..b5df36beac 100755 --- a/kubernetes/resource_kubernetes_deployment.go +++ b/kubernetes/resource_kubernetes_deployment.go @@ -73,6 +73,12 @@ func resourceKubernetesDeployment() *schema.Resource { Optional: true, Default: 1, }, + "revision_history_limit": { + Type: schema.TypeInt, + Description: "The number of old ReplicaSets to retain to allow rollback. Defaults to 10.", + Optional: true, + Default: 10, + }, "selector": { Type: schema.TypeMap, Description: "A label query over pods that should match the Replicas count. If Selector is empty, it is defaulted to the labels present on the Pod template. Label keys and values that must match in order to be controlled by this deployment, if empty defaulted to labels on Pod template. More info: http://kubernetes.io/docs/user-guide/labels#label-selectors", diff --git a/kubernetes/resource_kubernetes_deployment_test.go b/kubernetes/resource_kubernetes_deployment_test.go index a0482eb2dd..c82f549529 100644 --- a/kubernetes/resource_kubernetes_deployment_test.go +++ b/kubernetes/resource_kubernetes_deployment_test.go @@ -89,6 +89,7 @@ func TestAccKubernetesDeployment_basic(t *testing.T) { resource.TestCheckResourceAttr("kubernetes_deployment.test", "spec.0.template.0.spec.0.container.0.name", "tf-acc-test"), resource.TestCheckResourceAttr("kubernetes_deployment.test", "spec.0.paused", "true"), resource.TestCheckResourceAttr("kubernetes_deployment.test", "spec.0.progress_deadline_seconds", "30"), + resource.TestCheckResourceAttr("kubernetes_deployment.test", "spec.0.revision_history_limit", "4"), ), }, { @@ -364,7 +365,8 @@ resource "kubernetes_deployment" "test" { } spec { paused = true - progress_deadline_seconds = "30" + progress_deadline_seconds = 30 + revision_history_limit = 4 selector { TestLabelOne = "one" TestLabelTwo = "two" diff --git a/kubernetes/structures_deployment.go b/kubernetes/structures_deployment.go index 77eef71134..de889e89fa 100755 --- a/kubernetes/structures_deployment.go +++ b/kubernetes/structures_deployment.go @@ -17,12 +17,22 @@ func flattenDeploymentSpec(in v1beta1.DeploymentSpec, d *schema.ResourceData) ([ att["paused"] = in.Paused if in.ProgressDeadlineSeconds != nil { att["progress_deadline_seconds"] = int(*in.ProgressDeadlineSeconds) + } else { + // nil pointer means the this is set to the default value (600) + att["progress_deadline_seconds"] = 600 } if in.Replicas != nil { att["replicas"] = *in.Replicas } + if in.RevisionHistoryLimit != nil { + att["revision_history_limit"] = *in.RevisionHistoryLimit + } else { + // nil pointer means the this is set to the default value (10) + att["revision_history_limit"] = 10 + } + att["selector"] = in.Selector.MatchLabels att["strategy"] = flattenDeploymentStrategy(in.Strategy) diff --git a/scripts/runtests_mk.sh b/scripts/runtests_mk.sh new file mode 100755 index 0000000000..92839fbc12 --- /dev/null +++ b/scripts/runtests_mk.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +export TF_ACC=1 +export KUBE_CTX=minikube +export KUBE_CTX_CLUSTER=minikube +export KUBE_CTX_AUTH_INFO=minikube + +/usr/local/bin/go test -v -parallel 1 -timeout 3600s github.com/sl1pm4t/terraform-provider-kubernetes/kubernetes -run "^TestAccKubernetes.*"