Skip to content

Add openshift.io/deployer-pod.type label #8632

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

Conversation

legionus
Copy link
Contributor

@legionus legionus commented Apr 26, 2016

Fix #8498

@Kargakis please review

@legionus legionus force-pushed the provide-a-way-to-distinguish-hook-pods-from-other-deployer-pods branch from 65b01a6 to d5d4e01 Compare April 26, 2016 14:26
@legionus
Copy link
Contributor Author

[test]

@0xmichalis
Copy link
Contributor

Looks good for the description of the issue but I didn't realize at first we wanted to filter even between different types of hooks cc: @smarterclayton @ironcladlou

apiVersion: v1
kind: DeploymentConfig
metadata:
name: failing-dc-hooks
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename this to "complete-dc-hooks" since they do complete

@legionus
Copy link
Contributor Author

re[test]

@legionus legionus force-pushed the provide-a-way-to-distinguish-hook-pods-from-other-deployer-pods branch from d5d4e01 to e640a10 Compare April 26, 2016 15:42
@0xmichalis
Copy link
Contributor

LGTM

@0xmichalis 0xmichalis added the lgtm Indicates that a PR is ready to be merged. label Apr 26, 2016
@0xmichalis 0xmichalis self-assigned this Apr 26, 2016
@@ -184,6 +184,11 @@ os::cmd::expect_success_and_text "cat '${LOG_DIR}/kubectl-with-token.log'" 'Usin
os::cmd::expect_success_and_text "cat '${LOG_DIR}/kubectl-with-token.log'" 'kubectl-with-token'

echo "[INFO] Testing deployment logs and failing pre and mid hooks ..."
# test hook selectors
os::cmd::expect_success 'oc create -f test/fixtures/complete-dc-hooks.yaml'
wait_for_command 'oc get pods -l openshift.io/deployer-pod.type=hook-pre | grep -q Completed' $((60*TIME_SEC))
Copy link
Contributor

@stevekuznetsov stevekuznetsov Apr 26, 2016

Choose a reason for hiding this comment

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

These tests should be written as follows:

os::cmd::try_until_text 'oc get pods -l openshift.io/deployer-pod.type=hook-pre --jsonpath=<path to field>' 'completed'

This way we:

  1. are consistent in using os::cmd
  2. get jUnit integration
  3. don't depend on unstable oc get output and instead specifically probe with jsonpath

@legionus legionus force-pushed the provide-a-way-to-distinguish-hook-pods-from-other-deployer-pods branch 2 times, most recently from 1511d42 to 0d495bc Compare April 27, 2016 11:41
@legionus
Copy link
Contributor Author

@Kargakis @stevekuznetsov Fixed.

@@ -184,6 +184,11 @@ os::cmd::expect_success_and_text "cat '${LOG_DIR}/kubectl-with-token.log'" 'Usin
os::cmd::expect_success_and_text "cat '${LOG_DIR}/kubectl-with-token.log'" 'kubectl-with-token'

echo "[INFO] Testing deployment logs and failing pre and mid hooks ..."
# test hook selectors
os::cmd::expect_success "oc create -f ${OS_ROOT}/test/fixtures/complete-dc-hooks.yaml"
os::cmd::try_until_text 'oc get pods -l openshift.io/deployer-pod.type=hook-pre -o jsonpath={.items[*].status.phase}' 'Succeeded'
Copy link
Contributor

Choose a reason for hiding this comment

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

With .items[*].status.phase you will get a list of phases, and your assert is that at least one of these phases is Succeeded -- is that what we want? At least one pod has succeeded? Do we want to know that all of them have?

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 thought that the second argument is the whole output.
Should I use ^Succeeded$ or something for that ?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's given to grep so you would need line anchors if you wanted them. I believe the * notation will give you [Complete] if there's only one pod.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. I'll get a list of values in line. I want to be sure that I found only one pod. That's why I use ^Succeeded$.

@legionus legionus force-pushed the provide-a-way-to-distinguish-hook-pods-from-other-deployer-pods branch from 0d495bc to 1cd520a Compare April 27, 2016 13:52
@legionus
Copy link
Contributor Author

re[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 1cd520a

@@ -274,6 +275,7 @@ func TestHookExecutor_makeHookPod(t *testing.T) {
ObjectMeta: kapi.ObjectMeta{
Name: namer.GetPodName(deploymentName, "hook"),
Labels: map[string]string{
deployapi.DeploymentPodTypeLabel: "hook",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why these labels?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, I see. Nevermind

@0xmichalis
Copy link
Contributor

[merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 1cd520a

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/3350/)

@openshift-bot
Copy link
Contributor

openshift-bot commented Apr 27, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/3350/) (Image: devenv-rhel7_4053)

@openshift-bot openshift-bot merged commit 1d1ea5c into openshift:master Apr 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants