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

Extend wait_for with optional condition blocks #157

Merged
merged 1 commit into from
Aug 24, 2024

Conversation

jkabonickAtOlo
Copy link
Contributor

Addresses #155.

  • Extends wait_for to also support waiting for status.Conditions with a condition block.
  • Two acceptance tests to cover the addition

Can be used as below, with or without the existing field block.

resource "kubectl_manifest" "test" {
	wait_for {
		condition {
			type = "ContainersReady"
			status = "True"
		}
		condition {
			type = "Ready"
			status = "True"
		}
		field {
			key = "status.containerStatuses.[0].ready"
			value = "true"
		}
		field {
			key = "status.phase"
			value = "Running"
		}
		field {
			key = "status.podIP"
			value = "^(\\d+(\\.|$)){4}"
			value_type = "regex"
		}
	}
	yaml_body = <<YAML
apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx:1.14.2
    readinessProbe:
      httpGet:
        path: "/"
        port: 80			
      initialDelaySeconds: 10
YAML
}

@alekc
Copy link
Owner

alekc commented Aug 14, 2024

Thanks for your contribution. I will review it as soon as possible 👍

@alekc
Copy link
Owner

alekc commented Aug 23, 2024

@jkabonickAtOlo sorry it took so long. I have just one minor remark, and then it should be good to go.

type WaitForStatusCondition struct {
Type string
Status string
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@jkabonickAtOlo you might want to fix this before it gets merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stevehipwell I might be missing something, what is the problem with the struct?

Copy link
Contributor

Choose a reason for hiding this comment

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

Missing/removed EOF (shows up online but I'm not sure about mobile).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will take care of that. Thank you for pointing it out.

@jkabonickAtOlo jkabonickAtOlo force-pushed the add_wait_for_condition_support branch from b8a3674 to bd2961d Compare August 23, 2024 13:50
@alekc alekc merged commit 3203edc into alekc:master Aug 24, 2024
37 checks passed
@stevehipwell
Copy link
Contributor

@jkabonickAtOlo I think you're missing the README updates for this new functionality?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants