Skip to content

creating from template or console causes a build to occur......... a long time later #1738

Closed

Description

@thoraxe

I've noticed that a few releases back we started automatically starting to run builds, which is awesome.

But, within the last few drops, I've noticed that those builds will start....... eventually. It seems to take at least 60-90 seconds before the build starts. And there's no indication in the UI or CLI that a build is GOING to start. It just seems to happen, but later.

Which might result in someone starting a build accidentally and then OpenShift starting its own build.

Activity

  1. thoraxe commented on Apr 14, 2015

    @thoraxe
    ContributorAuthor

    I was watching logs but I don't think controller or image_change are telling me when the build starts:

    journalctl -u openshift-master -f | grep -E " controller.go:| image_change_controller.go:"
    

    I'm not sure what to grep for to see when the resources were defined (via adding from console) and when the build started.

    osc v0.4.3.2
    kubernetes v0.14.1-582-gb12d75d
    
  2. thoraxe commented on Apr 14, 2015

    @thoraxe
    ContributorAuthor

    creation of template:

    Apr 14 15:59:58 ose3-master.example.com openshift-master[5765]: I0414 15:59:58.769450    5765 reflector.go:221] Watch close - *api.Namespace total 1 items received
    

    start of build:

    Apr 14 16:01:18 ose3-master.example.com openshift-master[5765]: I0414 16:01:18.674162    5765 controller.go:42] Handling build sinatra-example-1
    Apr 14 16:01:18 ose3-master.example.com openshift-master[5765]: I0414 16:01:18.674317    5765 image_change_controller.go:39] Build image change controller detected imagerepo change openshift/ruby-20-centos7
    Apr 14 16:01:18 ose3-master.example.com openshift-master[5765]: I0414 16:01:18.674330    5765 image_change_controller.go:78] Running build for buildConfig ruby-sample-build in namespace wiring
    Apr 14 16:01:18 ose3-master.example.com openshift-master[5765]: I0414 16:01:18.753130    5765 generator.go:65] Generating build from config ruby-sample-build
    Apr 14 16:01:18 ose3-master.example.com openshift-master[5765]: I0414 16:01:18.809716    5765 replication_controller.go:251] periodic sync of docker-registry-1
    Apr 14 16:01:18 ose3-master.example.com openshift-master[5765]: I0414 16:01:18.809872    5765 replication_controller.go:251] periodic sync of router-1
    Apr 14 16:01:18 ose3-master.example.com openshift-master[5765]: I0414 16:01:18.809951    5765 replication_controller.go:251] periodic sync of sinatra-example-1
    Apr 14 16:01:18 ose3-master.example.com openshift-master[5765]: I0414 16:01:18.910135    5765 generator.go:114] Generating tagged build for config ruby-sample-build
    Apr 14 16:01:18 ose3-master.example.com openshift-master[5765]: I0414 16:01:18.910172    5765 generator.go:176] Found image change trigger with reference to repo ruby-20-centos7
    Apr 14 16:01:18 ose3-master.example.com openshift-master[5765]: I0414 16:01:18.957304    5765 generator.go:272] Found image stream wiring/ruby-20-centos7
    Apr 14 16:01:19 ose3-master.example.com openshift-master[5765]: I0414 16:01:19.050470    5765 controller.go:42] Handling build ruby-sample-build-1
    

    OK, that's less than 60 seconds, but even 20 seconds is still confusing to the user, I would think.

  3. gpei commented on Apr 16, 2015

    @gpei

    Hi, when I go through the "wiring" example in beta3 training doc, I found the build was not started automatically after run "osc create -f frontend-config.json". Couldn't get any build running even wait for several minutes.
    And after database pod created, coudn't connect to mysql. This should work well when testing with db-template.json in beta2.
    [alice@master beta3]$ osc get services | grep database | awk '{print $4}'
    172.30.17.32
    [root@node ~]# curl 172.30.17.32:5434
    curl: (56) Recv failure: Connection reset by peer

  4. smarterclayton commented on Apr 16, 2015

    @smarterclayton
    Contributor
  5. thoraxe commented on Apr 16, 2015

    @thoraxe
    ContributorAuthor

    @gpei your problems with mysql are because of #1740

    We have to fix the db template still. The current iteration of the db template has some old workarounds for selinux+docker 1.4

    See: #1740 (comment)

  6. bparees commented on Apr 16, 2015

    @bparees
    Contributor

    @smarterclayton my first guess would be that this relates to the import of the images not happening (or taking a long time), since that's what's really required to trigger a build here.

    @gpei and @thoraxe can you dump osc get imagestreams -o json for your namespace while you're waiting for the build to show up?

    also @thoraxe i have a request to @mnagy and @jhadvig to significantly enhance the log traceability of the build flow (when verbose logs are enabled) as part of some other work they are doing this sprint, so hopefully that will address your concern there.

  7. smarterclayton commented on Apr 16, 2015

    @smarterclayton
    Contributor

    Specifically look for the annotation about image import and the timestamp it provides there relative to the creation timestamp of the image stream.

    ----- Original Message -----

    @smarterclayton my first guess would be that this relates to the import of
    the images not happening (or taking a long time), since that's what's really
    required to trigger a build here.

    @gpei and @thoraxe can you dump osc get imagestreams -o json for your
    namespace while you're waiting for the build to show up?

    also @thoraxe i have a request to @mnagy and @jhadvig to significantly
    enhance the log traceability of the build flow (when verbose logs are
    enabled) as part of some other work they are doing this sprint, so hopefully
    that will address your concern there.


    Reply to this email directly or view it on GitHub:
    #1738 (comment)

  8. gpei commented on Apr 17, 2015

    @gpei

    @bparees Just like this.
    [alice@master beta3]$ osc get imagestreams -o json -n wiring
    {
    "kind": "List",
    "creationTimestamp": null,
    "resourceVersion": 36539,
    "apiVersion": "v1beta1",
    "items": [
    {
    "kind": "ImageStream",
    "apiVersion": "v1beta1",
    "metadata": {
    "name": "origin-ruby-sample",
    "namespace": "wiring",
    "selfLink": "/osapi/v1beta1/imageStreams/origin-ruby-sample?namespace=wiring",
    "uid": "115e476c-e4ab-11e4-b4f9-fa163e7a8db3",
    "resourceVersion": "36531",
    "creationTimestamp": "2015-04-17T02:40:10Z",
    "labels": {
    "template": "application-template-stibuild"
    }
    },
    "spec": {},
    "status": {
    "dockerImageRepository": "172.30.17.59:5000/wiring/origin-ruby-sample"
    }
    },
    {
    "kind": "ImageStream",
    "apiVersion": "v1beta1",
    "metadata": {
    "name": "ruby-20-centos7",
    "namespace": "wiring",
    "selfLink": "/osapi/v1beta1/imageStreams/ruby-20-centos7?namespace=wiring",
    "uid": "1160cb97-e4ab-11e4-b4f9-fa163e7a8db3",
    "resourceVersion": "36532",
    "creationTimestamp": "2015-04-17T02:40:11Z",
    "labels": {
    "template": "application-template-stibuild"
    }
    },
    "spec": {},
    "status": {
    "dockerImageRepository": "172.30.17.59:5000/wiring/ruby-20-centos7"
    }
    }
    ]
    }

  9. bparees commented on Apr 17, 2015

    @bparees
    Contributor

    your ruby-20-centos7 imagestream does not look right, it should be coming from dockerup and not your local registry. What does your ImageSTream look like in your template? It should be:

    {
    "apiVersion": "v1beta1",
    "kind": "ImageStream",
    "metadata": {
    "name": "ruby-20-centos7"
    },
    "spec": {
    "dockerImageRepository": "openshift/ruby-20-centos7"
    }
    },

  10. gpei commented on Apr 20, 2015

    @gpei
  11. bparees commented on Apr 20, 2015

    @bparees
    Contributor

    @gpei that seems like a problem with the template definition, since it's ImageRepository does not point to a registry, it's going to use the default registry. Not sure if that's the intent of the sample or not, @thoraxe ?

    if it is the intent, you won't get a build until you manually trigger one, or you push an image tagged as 172.30.17.59:5000/wiring/ruby-20-centos7

  12. thoraxe commented on Apr 21, 2015

    @thoraxe
    ContributorAuthor
    {
      "apiVersion": "v1beta1",
      "items": [
        {
          "apiVersion": "v1beta1",
          "containerPort": 8080,
          "id": "frontend",
          "kind": "Service",
          "port": 5432,
          "selector": {
            "name": "frontend"
          }
        },
        {
          "apiVersion": "v1beta1",
          "host": "wiring.cloudapps.example.com",
          "id": "sample-app-secure",
          "kind": "Route",
          "metadata": {
            "name": "route-edge"
          },
          "serviceName": "frontend"
        },
        {
          "apiVersion": "v1beta1",
          "kind": "ImageRepository",
          "metadata": {
            "name": "origin-ruby-sample"
          }
        },
        {
          "apiVersion": "v1beta1",
          "kind": "ImageRepository",
          "metadata": {
            "name": "ruby-20-centos7"
          }
        },
        {
          "apiVersion": "v1beta1",
          "kind": "BuildConfig",
          "labels": {
            "name": "ruby-sample-build"
          },
          "metadata": {
            "name": "ruby-sample-build"
          },
          "parameters": {
            "output": {
              "to": {
                "name": "origin-ruby-sample"
              }
            },
            "source": {
              "git": {
                "uri": "git://github.com/openshift/ruby-hello-world.git",
                "ref": "beta2"
              },
              "type": "Git"
            },
            "strategy": {
              "stiStrategy": {
                "image": "openshift/ruby-20-centos7"
              },
              "type": "STI"
            }
          },
          "triggers": [
            {
              "github": {
                "secret": "secret101"
              },
              "type": "github"
            },
            {
              "generic": {
                "secret": "secret101"
              },
              "type": "generic"
            },
            {
              "imageChange": {
                "from": {
                  "name": "ruby-20-centos7"
                },
                "image": "openshift/ruby-20-centos7",
                "tag": "latest"
              },
              "type": "imageChange"
            }
          ]
        },
        {
          "apiVersion": "v1beta1",
          "kind": "DeploymentConfig",
          "metadata": {
            "name": "frontend"
          },
          "template": {
            "controllerTemplate": {
              "podTemplate": {
                "desiredState": {
                  "manifest": {
                    "containers": [
                      {
                        "env": [
                          {
                            "name": "ADMIN_USERNAME",
                            "value": "${ADMIN_USERNAME}"
                          },
                          {
                            "name": "ADMIN_PASSWORD",
                            "value": "${ADMIN_PASSWORD}"
                          },
                          {
                            "name": "MYSQL_USER",
                            "value": "${MYSQL_USER}"
                          },
                          {
                            "name": "MYSQL_PASSWORD",
                            "value": "${MYSQL_PASSWORD}"
                          },
                          {
                            "name": "MYSQL_DATABASE",
                            "value": "${MYSQL_DATABASE}"
                          }
                        ],
                        "image": "origin-ruby-sample",
                        "name": "ruby-helloworld",
                        "ports": [
                          {
                            "containerPort": 8080
                          }
                        ]
                      }
                    ],
                    "version": "v1beta1"
                  }
                },
                "labels": {
                  "name": "frontend"
                }
              },
              "replicaSelector": {
                "name": "frontend"
              },
              "replicas": 1
            },
            "strategy": {
              "type": "Recreate"
            }
          },
          "triggers": [
            {
              "imageChangeParams": {
                "automatic": true,
                "containerNames": [
                  "ruby-helloworld"
                ],
                "from": {
                  "name": "origin-ruby-sample"
                },
                "tag": "latest"
              },
              "type": "ImageChange"
            }
          ]
        }
      ],
      "kind": "Template",
      "metadata": {
        "annotations": {
          "description": "This frontend template will be used to demonstrate parameters"
        },
        "name": "frontend-app-template"
      },
      "parameters": [
        {
          "description": "administrator username",
          "from": "admin[A-Z0-9]{3}",
          "generate": "expression",
          "name": "ADMIN_USERNAME"
        },
        {
          "description": "administrator password",
          "from": "[a-zA-Z0-9]{8}",
          "generate": "expression",
          "name": "ADMIN_PASSWORD"
        },
        {
          "description": "database password",
          "from": "[a-zA-Z0-9]{8}",
          "generate": "expression",
          "name": "MYSQL_PASSWORD"
        },
        {
          "description": "database name",
          "name": "MYSQL_DATABASE",
          "value": "example"
        },
        { "description": "database user",
          "name": "MYSQL_USER",
          "value": "example"
        }
      ],
      "labels": {
        "template": "application-template-stibuild"
      }
    }

    This is just the sample app template cut into two pieces. This is the frontend portion by itself.

    Processing and creating this does not seem to auto generate a build. I think it's because it uses ImageRepository and not ImageStream. Let me try re-cutting the existing sample app template and doing it again.

  13. ncdc commented on Apr 21, 2015

    @ncdc
    Contributor

    Triggers should work with both ImageRepository and ImageStream. If not, let me know.

  14. thoraxe commented on Apr 21, 2015

    @thoraxe
    ContributorAuthor

    With the above json based on IR and the old stuff, it doesn't trigger a build.

    Updating to the following JSON results in a build being triggered immediately

    {
      "apiVersion": "v1beta1",
      "items": [
        {
          "apiVersion": "v1beta1",
          "containerPort": 8080,
          "id": "frontend",
          "kind": "Service",
          "port": 5432,
          "selector": {
            "name": "frontend"
          }
        },
        {
          "apiVersion": "v1beta1",
          "host": "integrated.cloudapps.example.com",
          "id": "sample-app-secure",
          "kind": "Route",
          "metadata": {
            "name": "route-edge"
          },
          "serviceName": "frontend"
        },
        {
          "apiVersion": "v1beta1",
          "kind": "ImageStream",
          "metadata": {
            "name": "origin-ruby-sample"
          }
        },
        {
          "apiVersion": "v1beta1",
          "kind": "ImageStream",
          "metadata": {
            "name": "ruby-20-centos7"
          },
          "spec": {
            "dockerImageRepository": "openshift/ruby-20-centos7"
          }
        },
        {
          "apiVersion": "v1beta1",
          "kind": "BuildConfig",
          "metadata": {
            "name": "ruby-sample-build",
            "labels": {
              "name": "ruby-sample-build"
           }
          },
          "parameters": {
            "output": {
              "to": {
                "name": "origin-ruby-sample"
              }
            },
            "source": {
              "git": {
                "uri": "git://github.com/openshift/ruby-hello-world.git",
                "ref": "beta3"
              },
              "type": "Git"
            },
            "strategy": {
              "stiStrategy": {
                "image": "openshift/ruby-20-centos7"
              },
              "type": "STI"
            }
          },
          "triggers": [
            {
              "github": {
                "secret": "secret101"
              },
              "type": "github"
            },
            {
              "generic": {
                "secret": "secret101"
              },
              "type": "generic"
            },
            {
              "imageChange": {
                "from": {
                  "name": "ruby-20-centos7"
                },
                "image": "openshift/ruby-20-centos7",
                "tag": "latest"
              },
              "type": "imageChange"
            }
          ]
        },
        {
          "apiVersion": "v1beta1",
          "kind": "DeploymentConfig",
          "metadata": {
            "name": "frontend"
          },
          "template": {
            "controllerTemplate": {
              "podTemplate": {
                "desiredState": {
                  "manifest": {
                    "containers": [
                      {
                        "env": [
                          {
                            "name": "ADMIN_USERNAME",
                            "value": "${ADMIN_USERNAME}"
                          },
                          {
                            "name": "ADMIN_PASSWORD",
                            "value": "${ADMIN_PASSWORD}"
                          },
                          {
                            "name": "MYSQL_USER",
                            "value": "${MYSQL_USER}"
                          },
                          {
                            "name": "MYSQL_PASSWORD",
                            "value": "${MYSQL_PASSWORD}"
                          },
                          {
                            "name": "MYSQL_DATABASE",
                            "value": "${MYSQL_DATABASE}"
                          }
                        ],
                        "image": "origin-ruby-sample",
                        "name": "ruby-helloworld",
                        "ports": [
                          {
                            "containerPort": 8080
                          }
                        ]
                      }
                    ],
                    "version": "v1beta1"
                  }
                },
                "labels": {
                  "name": "frontend"
                }
              },
              "replicaSelector": {
                "name": "frontend"
              },
              "replicas": 1
            },
            "strategy": {
              "type": "Recreate",
              "recreateParams": {
                "pre": {
                  "failurePolicy": "Abort",
                  "execNewPod": {
                    "containerName": "ruby-helloworld",
                    "command": [
                      "/bin/true"
                    ],
                    "env": [
                      {
                        "name": "CUSTOM_VAR1",
                        "value": "custom_value1"
                      }
                    ]
                  }
                },
                "post": {
                  "failurePolicy": "Ignore",
                  "execNewPod": {
                    "containerName": "ruby-helloworld",
                    "command": [
                      "/bin/false"
                    ],
                    "env": [
                      {
                        "name": "CUSTOM_VAR2",
                        "value": "custom_value2"
                      }
                    ]
                  }
                }
              }
            }
          },
          "triggers": [
            {
              "imageChangeParams": {
                "automatic": true,
                "containerNames": [
                  "ruby-helloworld"
                ],
                "from": {
                  "name": "origin-ruby-sample"
                },
                "tag": "latest"
              },
              "type": "ImageChange"
            }
          ]
        }
      ],
      "kind": "Template",
      "metadata": {
        "annotations": {
          "description": "This is a hand-wiring example for an application"
        },
        "name": "wiring-frontend-example"
      },
      "parameters": [
        {
          "description": "administrator username",
          "from": "admin[A-Z0-9]{3}",
          "generate": "expression",
          "name": "ADMIN_USERNAME"
        },
        {
          "description": "administrator password",
          "from": "[a-zA-Z0-9]{8}",
          "generate": "expression",
          "name": "ADMIN_PASSWORD"
        },
        {
          "description": "database username",
          "from": "user[A-Z0-9]{3}",
          "generate": "expression",
          "name": "MYSQL_USER"
        },
        {
          "description": "database password",
          "from": "[a-zA-Z0-9]{8}",
          "generate": "expression",
          "name": "MYSQL_PASSWORD"
        },
        {
          "description": "database name",
          "name": "MYSQL_DATABASE",
          "value": "root"
        }
      ],
      "labels": {
        "template": "application-template-stibuild"
      }
    }
  15. ncdc commented on Apr 21, 2015

    @ncdc
    Contributor

    @thoraxe what's the difference between the old and new json?

  16. bparees commented on Apr 21, 2015

    @bparees
    Contributor

    imagestream vs imagerepository

  17. ncdc commented on Apr 21, 2015

    @ncdc
    Contributor

    I think the key difference is setting the dockerImageRepository for ruby-20-centos7. It didn't look like that was set in the old version.

  18. bparees commented on Apr 22, 2015

    @bparees
    Contributor

    I think @ncdc is right, when using ImageRepository it should look like:

    {
    "apiVersion": "v1beta1",
    "kind": "ImageRepository",
    "metadata": {
    "name": "ruby-20-centos7"
    },
    "tags": {
    "validtag": "buildsuccess"
    },
    "dockerImageRepository": "openshift/ruby-20-centos7"
    },

  19. thoraxe commented on Apr 27, 2015

    @thoraxe
    ContributorAuthor

    OK, this is related to IS vs IR so I will close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions