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_service_account #17

Merged
merged 1 commit into from
Jul 5, 2017
Merged

Conversation

radeksimko
Copy link
Member

Test results

make testacc TEST=./kubernetes TESTARGS='-run=TestAccKubernetesServiceAccount_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./kubernetes -v -run=TestAccKubernetesServiceAccount_ -timeout 120m
=== RUN   TestAccKubernetesServiceAccount_basic
--- PASS: TestAccKubernetesServiceAccount_basic (6.25s)
=== RUN   TestAccKubernetesServiceAccount_update
--- PASS: TestAccKubernetesServiceAccount_update (9.81s)
=== RUN   TestAccKubernetesServiceAccount_generatedName
--- PASS: TestAccKubernetesServiceAccount_generatedName (2.62s)
PASS
ok  	github.com/terraform-providers/terraform-provider-kubernetes/kubernetes	18.760s

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

otherwise LGTM :)

AutomountServiceAccountToken: ptrToBool(false),
ObjectMeta: metadata,
ImagePullSecrets: expandLocalObjectReferenceArray(d.Get("image_pull_secret").(*schema.Set).List()),
Secrets: expandServiceAccountSecrets(d.Get("secret").(*schema.Set).List(), ""),
Copy link
Contributor

Choose a reason for hiding this comment

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

should this not be passing in default_secret_name?

Copy link
Member Author

Choose a reason for hiding this comment

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

We have no default name at this point yet (during initial creation), so there's nothing to add.

},
"default_secret_name": {
Type: schema.TypeString,
Computed: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

given this is being used in the Read method, should this also be optional?

Copy link
Member Author

Choose a reason for hiding this comment

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

It cannot and should not be specified by the user, so no. It's a computed-only field.
You can call d.Set on a computed field at any time in the CRUD, the only difference is that user cannot specify it in the tf/HCL config.

log.Printf("[INFO] Checking service account %s", name)
_, err := conn.CoreV1().ServiceAccounts(namespace).Get(name, metav1.GetOptions{})
if err != nil {
if statusErr, ok := err.(*errors.StatusError); ok && statusErr.ErrStatus.Code == 404 {
Copy link
Contributor

Choose a reason for hiding this comment

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

we could use http.StatusNotFound here

Copy link
Member Author

Choose a reason for hiding this comment

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

Aye, we could do and under many circumstances I would, I just feel that for common codes like 200 and 404 it's just not worth it as three digits are shorter and nearly everyone knows what these mean.

@radeksimko radeksimko merged commit c0343f8 into master Jul 5, 2017
@radeksimko radeksimko deleted the f-service-account branch July 5, 2017 08:28
ddub pushed a commit to ddub/terraform-provider-kubernetes that referenced this pull request Jun 21, 2018
Add instruction on terraform init
@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.

2 participants