diff options
author | Andrej Marolt | 2017-11-04 01:05:15 +0100 |
---|---|---|
committer | Andrej Marolt | 2017-11-04 01:07:20 +0100 |
commit | 3740acb81e3af4f6969385bf80bc851efc3bbd60 (patch) | |
tree | e4fe4fd37ad8df4899c090640906cd71123b89e4 | |
parent | 7f7fa2cf0d9ca687d1120cf62bc82844a21a6728 (diff) | |
download | aur-3740acb81e3af4f6969385bf80bc851efc3bbd60.tar.gz |
Upgrade due to upstream release. | Remove custom scripts.
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | 0.read.config.sh | 24 | ||||
-rwxr-xr-x | 1.install.cluster.sh | 63 | ||||
-rwxr-xr-x | 2.install.certificate.sh | 114 | ||||
-rwxr-xr-x | 3.start.cluster.sh | 23 | ||||
-rwxr-xr-x | 4.stop.cluster.sh | 13 | ||||
-rwxr-xr-x | 5.delete.cluster.sh | 101 | ||||
-rw-r--r-- | PKGBUILD | 2 | ||||
-rw-r--r-- | README.md | 44 |
9 files changed, 8 insertions, 378 deletions
@@ -1,7 +1,7 @@ pkgbase = openshift-origin-git pkgdesc = OpenShift Origin is a platform for developing, building, and deploying containerized applications. See https://docs.openshift.org/latest for more on running OpenShift Origin. pkgver = 1.0.0 - pkgrel = 10 + pkgrel = 11 url = https://github.com/openshift/origin install = install.sh arch = x86_64 diff --git a/0.read.config.sh b/0.read.config.sh deleted file mode 100644 index 85c73bb19dda..000000000000 --- a/0.read.config.sh +++ /dev/null @@ -1,24 +0,0 @@ -# Do not delete this file. -# It is used by many scripts to read configuration file. - -read_config() { - - if [ -e "${CONFIG_FILE}" ]; then - echo "Reading configuration file: ${CONFIG_FILE}" - source "${CONFIG_FILE}" - fi - - if [ -z "${ORIGIN_HOME}" ]; then - echo "Error parsing configuration file: ${CONFIG_FILE}" - echo "Sample configuration: - ORIGIN_HOME=/var/lib/origin - PUBLIC_HOSTNAME=$(hostname) - ROUTING_SUFFIX=apps.$(hostname) - ADMIN_USERNAME=$(whoami) - CERT_FILE=/path-to/$(hostname)/certificate - KEY_FILE=/path-to/$(hostname)/private-key - " - - exit 1 - fi -}
\ No newline at end of file diff --git a/1.install.cluster.sh b/1.install.cluster.sh deleted file mode 100755 index 2f983f279285..000000000000 --- a/1.install.cluster.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -CONFIG_FILE="$1" - - -# This script is used to create and start a new cluster as well as start an existing cluster. - -# Starts an OpenShift cluster using Docker containers, provisioning a registry, router, initial templates, and a default project. - -# Data and config is preserved between restarts with the --use-existing-config flag and --host-data-dir argument. - -# A public hostname is specified for the server with the --public-hostname argument. - -# A custom routing suffix is specified using the --routing-suffix argument. -# This is to allow dynamic host names to be created for routes. - -# This script also adds one user to cluster-admin role. - -# You can copy or edit config.sh configuration file. This way you can install more then one cluster. However, only one cluster can run at a time. - -# You can run 2.install.certificate.sh to install your server's certificate and private key into cluster. -# Then you will be able to access the web console at https://your-domain:8443/console . - - -_oc_cluster_up() { - - oc cluster up \ - --use-existing-config \ - --host-data-dir="${ORIGIN_HOME}/openshift.local.etcd" \ - --host-config-dir="${ORIGIN_HOME}/openshift.local.config" \ - --host-volumes-dir="${ORIGIN_HOME}/openshift.local.volumes" \ - --public-hostname="${PUBLIC_HOSTNAME}" \ - --routing-suffix="${ROUTING_SUFFIX}" \ - --version="${VERSION}" \ - --metrics -} - - -main() { - - if [ -z "${CONFIG_FILE}" ]; then - echo "You have to pass configuration file." - echo "Usage: install.cluster.sh <path-to-config-file>" - echo "Example: ./install.cluster.sh ./config.sh" - exit 1 - fi - - source "0.read.config.sh" - read_config - - _oc_cluster_up - - oc login -u system:admin - - echo "Adding user ${ADMIN_USERNAME} as cluster-admin." - oadm policy add-cluster-role-to-user cluster-admin "${ADMIN_USERNAME}" - echo "open https://${PUBLIC_HOSTNAME}:8443/console" - echo "User: ${ADMIN_USERNAME}" - echo "Password: ${ADMIN_USERNAME}" - -} - -main diff --git a/2.install.certificate.sh b/2.install.certificate.sh deleted file mode 100755 index 1f95495d9037..000000000000 --- a/2.install.certificate.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash - -CONFIG_FILE="$1" - - -# Install your server's certificate and private key into cluster. - -# You need to run this script as root or have sudo access without password. - -# Certificate and private key will be copied from existing location into cluster. -# master-config.yaml will be updated with information about the certificate. - -# You can specify the existing location of certificate and private key with CERT_FILE and KEY_FILE keys in config.sh . -# Or you will be asked to specify this info interactively by this script. - -_read_certificate_from_user() { - - DEFAULT_CERT_FILE="/etc/letsencrypt/live/${PUBLIC_HOSTNAME}/cert.pem" - DEFAULT_KEY_FILE="/etc/letsencrypt/live/${PUBLIC_HOSTNAME}/privkey.pem" - - echo "Enter path to certificate file i.e. ${DEFAULT_CERT_FILE}" - read -p "Certificate file : " CERT_FILE - - echo "Enter path to private key file i.e. ${DEFAULT_KEY_FILE}" - read -p "Private key file : " KEY_FILE - -} - -_write_config() { - - echo "Writing config to ${CONFIG_FILE}..." - echo "CERT_FILE=${CERT_FILE}" >> "${CONFIG_FILE}" - echo "KEY_FILE=${KEY_FILE}" >> "${CONFIG_FILE}" - -} - -installCertificate=true - -_validate_certificate() { - - validCert=false - validKey=false - - [ -e "${CERT_FILE}" ] && validCert=true - - [ -e "${KEY_FILE}" ] && validKey=true - - if [ $validCert = false ] - then - echo "Error: Missing certificate: ${CERT_FILE}" - installCertificate=false - fi - - if [ $validKey = false ] - then - echo "Error: Missing private key: ${KEY_FILE}" - installCertificate=false - fi - -} - -_install_certificate() { - - sudo cp "${CERT_FILE}" "${ORIGIN_HOME}/openshift.local.config/master/certFile.pem" - sudo cp "${KEY_FILE}" "${ORIGIN_HOME}/openshift.local.config/master/keyFile.pem" - - configFileMaster="${ORIGIN_HOME}/openshift.local.config/master/master-config.yaml" - - sudo cp "${configFileMaster}" "${configFileMaster}.original" - - search=' namedCertificates: null' - replace=" namedCertificates:| - certFile: certFile.pem| keyFile: keyFile.pem| names:| - \"DomainName\"" - - sudo sed -i "/^${search}/c =${replace}" "${configFileMaster}" - sudo sed -i "s/=//" "${configFileMaster}" - sudo sed -i "s/|/\n/g" "${configFileMaster}" - sudo sed -i "s/DomainName/${PUBLIC_HOSTNAME}/g" "${configFileMaster}" - -} - - -main() { - - if [ -z "${CONFIG_FILE}" ]; then - echo "You have to pass configuration file." - echo "Usage: install.certificate.sh <path-to-config-file>" - echo "Example: ./install.certificate.sh ./config.sh" - fi - - source "0.read.config.sh" - read_config - - if [ -z "${CERT_FILE}" ]; then - _read_certificate_from_user - fi - - _validate_certificate - - if [ "${installCertificate}" = true ] - then - echo "Installing certificate..." - _install_certificate - _write_config - echo "Certificate has been installed." - else - echo "ERROR: Certificate installation failed." - echo "Make sure to enter path to existing certificate and private key." - fi - - docker restart origin - -} - -main diff --git a/3.start.cluster.sh b/3.start.cluster.sh deleted file mode 100755 index 33f8607e982b..000000000000 --- a/3.start.cluster.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -CONFIG_FILE="$1" - - -# Start local Docker cluster - - -main() { - - if [ -z "${CONFIG_FILE}" ]; then - echo "You have to pass configuration file." - echo "Usage: 3.start.cluster.sh <path-to-config-file>" - echo "Example: ./3.start.cluster.sh ./config.sh" - exit 1 - fi - - # The same script can be used to install the cluster from scratch as well as start an existing cluster that has been stopped. - ./1.install.cluster.sh $CONFIG_FILE - -} - -main diff --git a/4.stop.cluster.sh b/4.stop.cluster.sh deleted file mode 100755 index 555ba47d17d3..000000000000 --- a/4.stop.cluster.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# Stop local Docker cluster - -# If this cluster had been started by 'oc cluster up', below command would destroy all traces of the cluster. -# This cluster has been started by '3.start.cluster.sh config.sh'. -# This method of starting a cluster preserves data among restarts. -# You will be able to restart it by '3.start.cluster.sh config.sh'. - -# This script does not need to be passed any configuration file. -# It stops the currently running cluster. - -oc cluster down diff --git a/5.delete.cluster.sh b/5.delete.cluster.sh deleted file mode 100755 index e6e2d1be5846..000000000000 --- a/5.delete.cluster.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash - -CONFIG_FILE="$1" - - -# This script destroys all traces of the cluster. -# The cluster is identified by the configuration file. -# You need to run this script as root - -# Script will: -# stop and delete docker containers that have openshift in their image name. -# This is okay, because all such containers belong to currently running cluster. -# If you have installed another cluster then all its containers have been deleted already. They will be recreated upon restart. -# delete docker images pushed into embedded docker registry. -# delete docker images that have openshift in their repository name. -# This is okay, because any docker images required by another cluster will be re-fetched from docker hub if needed. -# unmount any volumes that may have been mounted from within openshift.local.volumes, thus preventing the next step. -# delete the folder containing all configuration, persistent data and temporary volumes shared among the host and the cluster. - -_setup() { - oc login -u system:admin - oc project default - tempfile=$(mktemp) - oc status | grep svc/docker-registry > $tempfile - line=$(oc status | grep svc/docker-registry) - registryAddress=$(sed -e 's/svc\/docker-registry - //g' $tempfile) - echo $registryAddress - rm $tempfile -} - - -_stop_and_delete_containers() { - containerRows=$(docker ps -a --format "{{.ID}};{{.Image}}" | grep openshift) - mapfile -t containers <<< "$containerRows" - if [ -z "$containerRows" ]; then return; fi - for i in "${containers[@]}"; do - IFS=';' read -ra container <<< "$i" - docker stop "${container[0]}" - docker rm "${container[0]}" - echo Deleted container "${container[1]}" - done -} - -__delete_images() { - for i in "$@"; do - IFS=';' read -ra image <<< "$i" - docker rmi "${image[0]}" - echo "Deleted image ${image[1]}:${image[2]}" - done -} - -_delete_images() { - - imageRows=$(docker images --format "{{.ID}};{{.Repository}};{{.Tag}}" | grep $registryAddress) - __delete_images $imageRows - - imageRows=$(docker images --format "{{.ID}};{{.Repository}};{{.Tag}}" | grep openshift | grep $VERSION) - __delete_images $imageRows - -} - -_unmount_volumes() { - - umount ${ORIGIN_HOME}/openshift.local.volumes/pods/*/volumes/kubernetes.io~secret/*/ - -} - -main() { - - if [ -z "${CONFIG_FILE}" ]; then - echo "You have to pass configuration file." - echo "Usage: delete.cluster.sh <path-to-config-file>" - echo "Example: ./delete.cluster.sh ./config.sh" - fi - - if [ ! "$(whoami)" = "root" ]; then - echo "ERROR: You need to run this script as root." - exit 1 - fi - - source "0.read.config.sh" - read_config - - OLD_IFS=$IFS - - _setup - - _stop_and_delete_containers - - _delete_images - - _unmount_volumes - - echo "Removing ${ORIGIN_HOME}..." - rm -rf "${ORIGIN_HOME}" - - export IFS=$OLD_IFS - -} - -main @@ -1,7 +1,7 @@ # Maintainer: Andrej Marolt <andrej.marolt@gmail.com> pkgname=openshift-origin-git pkgver=1.0.0 -pkgrel=10 +pkgrel=11 pkgdesc="OpenShift Origin is a platform for developing, building, and deploying containerized applications. See https://docs.openshift.org/latest for more on running OpenShift Origin." arch=(x86_64) url="https://github.com/openshift/origin" diff --git a/README.md b/README.md index 1f595e013e95..6829fa7cf147 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ It downloads source code from official [OpenShift Origin](https://docs.openshift.org/latest) [GitHub repository](https://github.com/openshift/origin). -Install script compiles source code, installs two binaries (oc, openshift) and six symlinks (kubectl, kube-apiserver, kube-controller-manager, kubelet, kube-proxy, kube-scheduler, oadm) into /usr/bin/ . +Install script compiles source code, installs three binaries (oc, openshift, kubefed) and seven symlinks (kubectl, kube-apiserver, kube-controller-manager, kubelet, kube-proxy, kube-scheduler, +oadm) into /usr/bin/ . I will release this package upon each upstream release. You can reinstall this package at any time to build binaries based on the latest commit (yaourt --sync openshift-origin-git). @@ -29,45 +30,12 @@ install.sh - Package metadata. -#### Optional scripts +#### Optional script -These files are optional scripts. They let you run a cluster once you have installed the package. -You should probably copy them to your path (/usr/local/bin). +https://github.com/openshift-evangelists/oc-cluster-wrapper -- config.sh -- 0.read.config.sh -- 1.install.cluster.sh -- 2.install.certificate.sh -- 3.start.cluster.sh -- 4.stop.cluster.sh -- 5.delete.cluster.sh - -config.sh -- Sample configuration file. You can copy or edit it to your liking. -- All commands that require a configuration file (config.sh), can specify . instead. - -0.read.config.sh -- Shared dependency used by many scripts. - -1.install.cluster.sh -- Create and start a new cluster configured by configuration file. -- Usage: 1.install.cluster.sh config.sh - -2.install.certificate.sh -- Install your server's certificate and private key into cluster. -- Usage: 2.install.certificate.sh config.sh - -3.start.cluster.sh -- Start an existing cluster that has been stopped. -- Usage: 3.start.cluster.sh config.sh - -4.stop.cluster.sh -- Stop a running cluster. Docker containers will be destroyed, but they will be recreated upon restart. -- Usage: 4.stop.cluster.sh - -5.delete.cluster.sh -- Delete a cluster and all its data. -- Usage: 5.delete.cluster.sh config.sh +This wrapper script is optional. It makes it easier to run an Openshift cluster once you have installed the package. +You should probably install it to your path (/usr/local/bin). #### Dependencies |