Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for kubernetes_replication_controller #9

Merged
merged 1 commit into from
Jun 22, 2017

Conversation

radeksimko
Copy link
Member

Test results

make testacc TESTARGS='-run=TestAccKubernetesReplicationController_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccKubernetesReplicationController_ -timeout 120m
?   	github.com/terraform-providers/terraform-provider-kubernetes	[no test files]
=== RUN   TestAccKubernetesReplicationController_basic
--- PASS: TestAccKubernetesReplicationController_basic (123.60s)
=== RUN   TestAccKubernetesReplicationController_importBasic
--- PASS: TestAccKubernetesReplicationController_importBasic (120.65s)
=== RUN   TestAccKubernetesReplicationController_generatedName
--- PASS: TestAccKubernetesReplicationController_generatedName (4.89s)
=== RUN   TestAccKubernetesReplicationController_importGeneratedName
--- PASS: TestAccKubernetesReplicationController_importGeneratedName (5.14s)
=== RUN   TestAccKubernetesReplicationController_with_security_context
--- PASS: TestAccKubernetesReplicationController_with_security_context (4.71s)
=== RUN   TestAccKubernetesReplicationController_with_container_liveness_probe_using_exec
--- PASS: TestAccKubernetesReplicationController_with_container_liveness_probe_using_exec (6.14s)
=== RUN   TestAccKubernetesReplicationController_with_container_liveness_probe_using_http_get
--- PASS: TestAccKubernetesReplicationController_with_container_liveness_probe_using_http_get (4.51s)
=== RUN   TestAccKubernetesReplicationController_with_container_liveness_probe_using_tcp
--- PASS: TestAccKubernetesReplicationController_with_container_liveness_probe_using_tcp (5.54s)
=== RUN   TestAccKubernetesReplicationController_with_container_lifecycle
--- PASS: TestAccKubernetesReplicationController_with_container_lifecycle (5.47s)
=== RUN   TestAccKubernetesReplicationController_with_container_security_context
--- PASS: TestAccKubernetesReplicationController_with_container_security_context (5.38s)
=== RUN   TestAccKubernetesReplicationController_with_volume_mount
--- PASS: TestAccKubernetesReplicationController_with_volume_mount (6.78s)
=== RUN   TestAccKubernetesReplicationController_with_resource_requirements
--- PASS: TestAccKubernetesReplicationController_with_resource_requirements (3.23s)
=== RUN   TestAccKubernetesReplicationController_with_empty_dir_volume
--- PASS: TestAccKubernetesReplicationController_with_empty_dir_volume (3.51s)
PASS
ok  	github.com/terraform-providers/terraform-provider-kubernetes/kubernetes	299.632s

Copy link
Contributor

@apparentlymart apparentlymart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel qualified to review this in detail due to my limited knowledge of Kubernetes, but the implementation looks plausible and I just had some minor feedback on the docs and naming.

}
requests{
cpu = "250m"
memory = "50Mi"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should align these by equals to match what hclfmt would do.

selector {
Test = "MyExampleApp"
}
template {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation seems wrong here

* `env` - (Optional) List of environment variables to set in the container. Cannot be updated.
* `image` - (Optional) Docker image name. More info: http://kubernetes.io/docs/user-guide/images
* `image_pull_policy` - (Optional) Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/images#updating-images
* `lifecycle` - (Optional) Actions that the management system should take in response to container lifecycle events
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course at this nested level lifecycle isn't special but since we have a special meaning of it at the resource level, should we try to pick a non-conflicting name here in case we want to mimic this same nested structure as a top-level resource later?

Probably not a big deal unless we can already imagine a situation where a container structure like this would be a top-level resource. So feel free to ignore if you disagree. 😀

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah 🤔 I see what do you mean, but I'd rather keep it as is. Vast majority of the code + docs was generated based on K8S API structs and I think it's good that we stick to their naming conventions where possible.

I know it may cause troubles if we ever get to implement the nested resources - as 1st level meta-params might suddenly become valid in nested structures, but I'd prefer to deal with it when it becomes a real problem.

@radeksimko radeksimko force-pushed the f-replication-controller branch from 371d81d to 895062e Compare June 21, 2017 10:09
Copy link

@catsby catsby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2(?) questions but non-blockers I think 👍

The following arguments are supported:

* `metadata` - (Required) Standard replication controller's metadata. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
* `spec` - (Required) Spec defines the specification of the desired behavior of the replication controller. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, this is kind of a side effect of K8S having these outdated links in swagger/API specs from which I've generated the schema and then these docs. 😢

I'll fix it here manually and then sed the existing docs too in a separate PR.

return fmt.Errorf("Failed to update replication controller: %s", err)
}
log.Printf("[INFO] Submitted updated replication controller: %#v", out)
d.SetId(buildId(out.ObjectMeta))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it normal for the ID of the resource to change here? Does the old ID still work? Is it possible for the Patch operation above (~line 170) to encounter an error but still actually change the id, in which case something is lost?

If this kind of id updating is normal then ignore me. I've seen other resources re-set the ID in UPDATE methods when it wasn't necessary (or recommended)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you're absolutely right, thanks for pointing it out. Neither name or namespace (from which we build the ID) are updatable, so the ID would never change. Fixed.

@radeksimko radeksimko force-pushed the f-replication-controller branch from 895062e to e86504a Compare June 22, 2017 06:48
@radeksimko
Copy link
Member Author

Both fixed. Thanks for the review.

@radeksimko radeksimko merged commit 59fc241 into master Jun 22, 2017
@radeksimko radeksimko deleted the f-replication-controller branch June 22, 2017 06:52
@ghost ghost locked and limited conversation to collaborators Apr 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants