Skip to content

Conversation

@abhinavdahiya
Copy link
Contributor

@abhinavdahiya abhinavdahiya commented Mar 22, 2019

It builds an image containing binaries like jq, terraform, awscli, oc, etc. to allow bringing up UPI infrastructure.
It also contains the upi directory that contains various terraform and cloud formation templates that are used to create infrastructure resources.

$ docker run --user 0 -ti --entrypoint /bin/bash abhinavdahiya/upi-installer:latest
bash-4.2# oc
OpenShift Client

This client helps you develop, build, deploy, and run your applications on any OpenShift or Kubernetes compatible
platform. It also includes the administrative commands for managing a cluster under the 'adm' subcommand.

To create a new application, login to your server and then run new-app:

  oc login https://mycluster.mycompany.com
  oc new-app centos/ruby-25-centos7~https://github.com/sclorg/ruby-ex.git
  oc logs -f bc/ruby-ex

This will create an application based on the Docker image 'centos/ruby-25-centos7' that builds the source code from
GitHub. A build will start automatically, push the resulting image to the registry, and a deployment will roll that
change out in your project.

Once your application is deployed, use the status, describe, and get commands to see more about the created components:

  oc status
  oc describe deploymentconfig ruby-ex
  oc get pods

To make this application visible outside of the cluster, use the expose command on the service we just created to create
a 'route' (which will connect your application over the HTTP port to a public domain name).

  oc expose svc/ruby-ex
  oc status

You should now see the URL the application can be reached at.

To see the full list of commands supported, run 'oc --help'.
bash-4.2# terraform
Usage: terraform [-version] [-help] <command> [args]

The available commands for execution are listed below.
The most common, useful commands are shown first, followed by
less common or more advanced commands. If you're just getting
started with Terraform, stick with the common commands. For the
other commands, please read the help and docs before usage.

Common commands:
    apply              Builds or changes infrastructure
    console            Interactive console for Terraform interpolations
    destroy            Destroy Terraform-managed infrastructure
    env                Workspace management
    fmt                Rewrites config files to canonical format
    get                Download and install modules for the configuration
    graph              Create a visual graph of Terraform resources
    import             Import existing infrastructure into Terraform
    init               Initialize a Terraform working directory
    output             Read an output from a state file
    plan               Generate and show an execution plan
    providers          Prints a tree of the providers used in the configuration
    push               Upload this Terraform module to Atlas to run
    refresh            Update local state file against real resources
    show               Inspect Terraform state or plan
    taint              Manually mark a resource for recreation
    untaint            Manually unmark a resource as tainted
    validate           Validates the Terraform files
    version            Prints the Terraform version
    workspace          Workspace management

All other commands:
    debug              Debug output management (experimental)
    force-unlock       Manually unlock the terraform state
    state              Advanced state management
bash-4.2# opens
openshift-install  openssl
bash-4.2# opens
openshift-install  openssl
bash-4.2# opens
openshift-install  openssl
bash-4.2# opens
openshift-install  openssl
bash-4.2# openshift-install
Creates OpenShift clusters

Usage:
  openshift-install [command]

Available Commands:
  completion                   Outputs shell completions for the openshift-install command
  create                       Create part of an OpenShift cluster
  destroy                      Destroy part of an OpenShift cluster
  graph                        Outputs the internal dependency graph for installer
  help                         Help about any command
  user-provided-infrastructure Entry-points for user-provided infrastructure
  version                      Print version information

Flags:
      --dir string         assets directory (default ".")
  -h, --help               help for openshift-install
      --log-level string   log level (e.g. "debug | info | warn | error") (default "info")

Use "openshift-install [command] --help" for more information about a command.
bash-4.2# jq
jq - commandline JSON processor [version 1.5]
Usage: jq [options] <jq filter> [file...]

        jq is a tool for processing JSON inputs, applying the
        given filter to its JSON text inputs and producing the
        filter's results as JSON on standard output.
        The simplest filter is ., which is the identity filter,
        copying jq's input to its output unmodified (except for
        formatting).
        For more advanced filters see the jq(1) manpage ("man jq")
        and/or https://stedolan.github.io/jq

        Some of the options include:
         -c             compact instead of pretty-printed output;
         -n             use `null` as the single input value;
         -e             set the exit status code based on the output;
         -s             read (slurp) all inputs into an array; apply filter to it;
         -r             output raw strings, not JSON texts;
         -R             read raw strings, not JSON texts;
         -C             colorize JSON;
         -M             monochrome (don't colorize JSON);
         -S             sort keys of objects on output;
         --tab  use tabs for indentation;
         --arg a v      set variable $a to value <v>;
         --argjson a v  set variable $a to JSON value <v>;
         --slurpfile a f        set variable $a to an array of JSON texts read from <f>;
        See the manpage for more options.
bash-4.2# aws
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help
aws: error: too few arguments
bash-4.2# ls /var/lib/openshift-install/upi/
aws  metal  vsphere

/cc @wking

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 22, 2019
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be registry.svc.ci.openshift.org/openshift/origin-v4.0:base to match images/installer/Dockerfile.ci? Or, if that is missing important packages, can you say what they are in the commit message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

testing locally using registry.svc.ci.openshift.org/openshift/origin-v4.0:base fails

Step 9/16 : RUN yum install --setopt=tsflags=nodocs -y     epel-release     gettext     openssh-clients &&     yum update -y &&     yum install --setopt=tsflags=nodocs -y     unzip gzip jq awscli util-linux &&     yum clean all && rm -rf /var/cache/yum/*
 ---> Running in ad5c4106cc0b
Loaded plugins: ovl, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
http://base-4-0.ocp.svc/rhel-fast-datapath/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: base-4-0.ocp.svc; Unknown error"
Trying other mirror.


 One of the configured repositories failed (rhel-fast-datapath),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=rhel-fast-datapath ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable rhel-fast-datapath
        or
            subscription-manager repos --disable=rhel-fast-datapath

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=rhel-fast-datapath.skip_if_unavailable=true

failure: repodata/repomd.xml from rhel-fast-datapath: [Errno 256] No more mirrors to try.
http://base-4-0.ocp.svc/rhel-fast-datapath/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: base-4-0.ocp.svc; Unknown error"
The command '/bin/sh -c yum install --setopt=tsflags=nodocs -y     epel-release     gettext     openssh-clients &&     yum update -y &&     yum install --setopt=tsflags=nodocs -y     unzip gzip jq awscli util-linux &&     yum clean all && rm -rf /var/cache/yum/*' returned a non-zero code: 1

"Could not resolve host: base-4-0.ocp.svc error makes me believe if the Dockerfile can only be built in CI cluster.

🤞 we'll know when we merge and try to use openshift/release#3206

Copy link
Contributor Author

@abhinavdahiya abhinavdahiya Mar 22, 2019

Choose a reason for hiding this comment

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

done 91cd579 to 512f93d

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, would be nice if we could use the version baked into the installer somehow, although I don't know quite how that would work. This is fine until we get some ideas ;).

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 wouldn't bother. these are not shipped to customers. and docs where I use already points to download the latest. 3836fcb#diff-19bea2d1d6a72e1cf01e6747fa6f66b1R273

It builds an image containing binaries like jq, terraform, awscli, oc, etc. to allow bringing up UPI infrastructure.
It also contains the `upi` directory that contains various terraform and cloud formation templates that are used to create infrastructure resources.
@wking
Copy link
Member

wking commented Mar 24, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 24, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinavdahiya, wking

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [abhinavdahiya,wking]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 1c1b2bb into openshift:master Mar 24, 2019
wking added a commit to wking/openshift-release that referenced this pull request Jun 19, 2020
We need both 'oc' and 'aws' for this script.  The upi-installer image
has a complicated history with the 'aws' command:

* openshift/installer@512f93dd30 (images/installer: add image that can
  be used to instal UPI platforms, 2019-03-22, master and release-4.0,
  openshift/installer#1456) added the epel-release and awscli RPMs.

* openshift/installer@c7b7863b42 (image: remove unneeded packages,
  2019-08-13, master and release-4.2, openshift/installer#2206)
  removed the epel-release and awscli RPMs, which were no longer
  avialable.

* openshift/installer@665ba44f45 (Add AWS CLI to UPI image,
  2020-03-13, master and release-4.5, openshift/installer#3292)
  installed 'aws' via curl.

But that means that today the bundled upi-installer has no 'aws' for
4.4 and earlier, leading to errors like [1]:

  Gathering console logs for i-04151362d551668fe
  /bin/bash: line 39: aws: command not found
  error: failed to execute wrapped command: exit status 1
  2020/06/18 23:52:50 Container test in pod e2e-aws-gather-aws-console failed, exit code 1, reason Error

on 4.2.  With this commit I reference the 4.5 image [2,3], because
that has the commands I need, and we don't need anything that's
particularly senstive to the command versions.

[1]: https://deck-ci.apps.ci.l2s4.p1.openshiftapps.com/view/gcs/origin-ci-test/pr-logs/pull/openshift_cluster-version-operator/382/pull-ci-openshift-cluster-version-operator-release-4.2-e2e-aws/1273733457419177984
[2]: https://github.com/openshift/ci-tools/blob/97d72735a969f11b210806970d523f1b63297905/pkg/webreg/webreg.go#L933-L946
[3]: https://github.com/openshift/ci-tools/blob/97d72735a969f11b210806970d523f1b63297905/pkg/webreg/webreg.go#L1267-L1279
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants