mharding-hpe / uas-mgr

The User Access Service (UAS) manager manages configuration and lifecycle of User Access Instances (UAIs) which provide lightweight disposable login platforms for users of Shasta systems.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cray User Access Service

Overview

The Cray User Access Service framework was generated by the swagger-codegen project. By using the OpenAPI-Spec from a remote server, you can easily generate the server stub. This service is an example of building a swagger-enabled Flask server.

The Cray User Access Service uses the Connexion library on top of Flask.

Requirements

Python 3.5.2+

Obtaining the Source Files

The Cray User Access Service source code is located in the UAN/uan-mgr Git repository. If you have not previously cloned this repository to a local directory on your laptop/workstation, you may do so with the following commands. Substitute your user name for in the example below.

mkdir -p UAN
cd UAN
git clone https://<username>@stash.us.cray.com/scm/uan/uan-mgr.git
cd uan-mgr

Local Usage

To run the service locally, please execute the following from the uan-mgr directory:

pip3 install -r requirements.txt
python3 -m swagger_server

and open your browser to here:

http://localhost:8080/v1/mgr-info

Building a Development Image and Running Unit tests

The unit tests, lint, and coverage can be checked at the shell in your development repository directory by running:

./dev_deploy.sh

This will also build you a new image that you can push to whatever container registry you want for use. By default, this builds a container image tagged as cray/cray-uas-mgr:latest. You can change the tag to whatever you want using the -t <tag> option to the command.

Running the Integration Tests

To launch the integration tests, use tox:

sudo pip install tox
tox

Running with Docker

To run the service on a Docker container, please execute the following from the uan-mgr directory:

# building the image
docker build -t cray-user-access-service .

# starting up a container
docker run -p 8080:8080 cray-user-access-service

Optional
Tag and push the the cray-user-access-service image to a Docker image registry ('uan-ci.us.cray.com:5000' is used in this example for the registry and 'my_version' is used as the version tag):

# Tag the image for pushing to the Docker registry
docker tag cray-user-access-service uan-ci:5000.us.cray.com/cray-user-access-service:my_version

# Push the image to the Docker registry
docker push uan-ci:5000.us.cray.com/cray-user-access-service:my_version

Deploying with Kubernetes

To deploy the service on a Kubernetes cluster, please execute the following instructions.

Important:
This document assumes the docker image that was built under the 'Running with Docker' section above, was pushed to the uan-ci.us.cray.com:5000 Docker image registry as described in the Optional portion of that section.

  1. Copy the cray-uas-deployment.yaml file from the uan-mgr directory on your laptop/workstation to the Kubernetes master node:
scp cray-uas-deployment.yaml root@<your_kubernetes_master>:
  1. Log into your Kubernetes master node as root.

  2. Create a Kubernetes configmap of the /etc/kubernetes/admin.conf file. This is needed so the cray-user-access-service can use the Kubernetes API.

kubectl create configmap --from-file=/etc/kubernetes/admin.conf kube-cfg
  1. Edit the image: line in the cray-uas-deployment.yaml file to use the image you just created.
# Change from this:
image: uan-ci.us.cray.com:5000/cray-user-access-service:latest

# To this:
image: uan-ci.us.cray.com:5000/cray-user-access-service:my_version
  1. Pull the cray-user-access-service image from the local docker registry to all kubernetes masters. (uan-ci.us.cray.com:5000/cray-user-access-service:my_version):
    Note: This download (pull) must be performed on all nodes in the Kubernetes cluster.
docker pull uan-ci.us.cray.com:5000/cray-user-access-service:my_version
  1. Execute the following command on the Kubernetes master to deploy and start the Cray User Access Service:
kubctl create -f cray-uas-deployment.yaml
  1. In a browser window, enter the following URL. You should see the Cray User Access Service screen.
http://<ip_of_your_kubernetes_master>:8063/v1/uas_access

Note: The IP address of your Kubernetes master can be found by running the following command on the Kubernetes master node:

kubectl cluster-info

Stopping the Cray User Access Service

To stop the Cray User Access Service, please execute the following instructions.

  1. Log into the Kubernetes master node as root.

  2. Run the following commands:

kubectl delete deployment cray-user-access-service
kubectl delete service cray-user-access-service

About

The User Access Service (UAS) manager manages configuration and lifecycle of User Access Instances (UAIs) which provide lightweight disposable login platforms for users of Shasta systems.

License:MIT License


Languages

Language:Python 95.0%Language:Shell 2.5%Language:Makefile 1.3%Language:Dockerfile 1.3%Language:Smarty 0.0%