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

ODS in a Box with Vagrant #936

Open
felipecruz91 opened this issue Jan 5, 2021 · 9 comments
Open

ODS in a Box with Vagrant #936

felipecruz91 opened this issue Jan 5, 2021 · 9 comments
Assignees
Labels
question Further information is requested

Comments

@felipecruz91
Copy link
Contributor

felipecruz91 commented Jan 5, 2021

The concept of ODS in a box it's a really great idea and I am learning more about it in my spare time. I am interested in creating a cloud-agnostic VM image (not coupled to AWS for instance) that can run on my laptop (not in the cloud) using Vagrant with VirtualBox.

I've forked ods-core (master branch) into my personal account and extended ODS in a box with the following files:

When I run packer build -on-error=ask ./ods-devenv/packer/CentOS2ODSBoxVagrant.json, Vagrant spins up a new VM in VirtualBox using the Centos 7 Base image and it proceeds to install the Atlassian stack, OpenShift, etc (using the boostrap.sh script). However, it fails when it tries to build the nexus image:

Screenshots

nexus-build-error

nexus-build-events

Affected version (please complete the following information):

  • OpenShift: 3.11
  • OpenDevStack (master branch)

Additional context
From the error message, I understand that the user does not have the RBAC permissions needed to list the secrets under the ods namespace.

==> vagrant: Warning: Group 'system:authenticated' not found
    vagrant: role "view" added: "system:authenticated"
==> vagrant: + oc adm policy add-cluster-role-to-group system:image-puller system:authenticated -n ods
==> vagrant: Warning: Group 'system:authenticated' not found
    vagrant: cluster role "system:image-puller" added: "system:authenticated"
==> vagrant: + oc adm policy add-cluster-role-to-user self-provisioner system:serviceaccount:ods:jenkins
==> vagrant: Warning: ServiceAccount 'jenkins' not found
    vagrant: cluster role "self-provisioner" added: "system:serviceaccount:ods:jenkins"
@felipecruz91 felipecruz91 added the question Further information is requested label Jan 5, 2021
@felipecruz91 felipecruz91 changed the title ODS in a Box ODS in a Box with Vagrant Jan 5, 2021
@felipecruz91
Copy link
Contributor Author

After this failure, I have triggered the nexus build with oc start-build nexus -n ods and now it has completed successfully. I guess it is a timing issue where the secrets are not created by the time the build starts.

Perhaps it would be interesting to wait for all the resources to be created in OpenShift before starting the setup_nexus function.

@clemensutschig
Copy link
Member

clemensutschig commented Jan 5, 2021 via email

@clemensutschig
Copy link
Member

clemensutschig commented Jan 5, 2021 via email

@felipecruz91
Copy link
Contributor Author

felipecruz91 commented Jan 5, 2021

@clemensutschig It seems to be a timing issue, yes.

In this second run, it has progressed a lot and has started testing the ODS installation but it seems that the Prov App is not running:

    vagrant: === RUN   TestVerifyOdsProjectProvisionThruProvisionApi
    vagrant:     provision-api_test.go:40: Failed to delete project: Execution of `provisioning-app-api.sh` for 'DELETE/ODSVERIFY' failed:
    vagrant:         StdOut: No config file found, assuming defaults, current dir: /home/openshift/opendevstack/ods-core/tests/smoketest
    vagrant:
    vagrant:         Started provision project/component script with command (DELETE)!
    vagrant:
    vagrant:         ... encoding basic auth credentials in base64 format
    vagrant:
    vagrant:         ... sending request to 'https://prov-app-ods.ocp.odsbox.lan' (output will be saved in file './response.txt' and headers in file './headers.txt')


(omitted logs)


    vagrant:         < HTTP/1.0 503 Service Unavailable
    vagrant:         < Pragma: no-cache
    vagrant:         < Cache-Control: private, max-age=0, no-cache, no-store
    vagrant:         < Connection: close
    vagrant:         < Content-Type: text/html
    vagrant:         <
    vagrant:         { [data not shown]
    vagrant: 100  3265    0  3265    0     0   7805      0 --:--:-- --:--:-- --:--:--  7811
    vagrant:         * Closing connection 0
    vagrant:         Error from server (NotFound): namespaces "ODSVERIFY" not found
    vagrant:
    vagrant:         Err: exit status 1
    vagrant: --- FAIL: TestVerifyOdsProjectProvisionThruProvisionApi (2.52s)

After some investigation, it seems that the DeploymentConfig resource of the Prov App is not created by Tailor (only ImageStream and BuildConfig resources are).

function setup_provisioning_app() {
    echo "Setting up provisioning app"
    echo "make apply-provisioning-app-build:"
    pushd ods-provisioning-app/ocp-config

    tailor apply --namespace ${NAMESPACE} is,bc --non-interactive --verbose
    popd

    echo "make start-provisioning-app-build:"
    ocp-scripts/start-and-follow-build.sh --namespace ${NAMESPACE} --build-config ods-provisioning-app --verbose 
    ################ ^^^^^^^^ exits here after waiting for the build status to be complete  ################

 ################
  The lines below never get executed which means that the DeploymentConfig of the Prov App does not get created.
#################

    echo "make apply-provisioning-app-deploy:"
    pushd ods-provisioning-app/ocp-config
    tailor apply --namespace ${NAMESPACE} --exclude is,bc --non-interactive --verbose
    # roll back change to suppress confluence adapter
    git reset --hard
    popd
}

@michaelsauter
Copy link
Member

@felipecruz91 Could be a resource issue ... https://gist.github.com/felipecruz91/1c124fe2fb24ec3ab341dc93b8256751#file-ods-box-vagrant-logs-txt-L126-L148 shows that the build is pending and never progresses ...

@felipecruz91
Copy link
Contributor Author

felipecruz91 commented Jan 5, 2021

@michaelsauter Yes, the lack of resources makes the build take longer than expected 😅 but it ends up completing successfully after ~ 5 min. The problem is that the script bails out before the build completes and therefore the rest of resources such as the DeploymentConfig are not applied (just right after make apply-provisioning-app-deploy)

@clemensutschig
Copy link
Member

clemensutschig commented Jan 5, 2021 via email

@felipecruz91
Copy link
Contributor Author

Increasing the timeout solves this particular issue. As a suggestion for the future, it would be nice to monitor the build status and make the script wait until the build has successfully completed (instead of waiting a fixed time and hope the build will complete within the timeout period).

@clemensutschig
Copy link
Member

clemensutschig commented Jan 7, 2021 via email

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

No branches or pull requests

4 participants