Merge "Update Ranger Dockerfile and Makefile"
This commit is contained in:
commit
2d086fb546
39
Makefile
39
Makefile
@ -13,20 +13,27 @@
|
||||
# limitations under the License.
|
||||
|
||||
DOCKER_REGISTRY ?= quay.io
|
||||
IMAGE_NAME ?= ranger
|
||||
IMAGE_NAME := ranger rangercli
|
||||
IMAGE_PREFIX ?= attcomdev
|
||||
IMAGE_TAG ?= ocata
|
||||
HELM ?= helm
|
||||
LABEL ?= commit-id
|
||||
PROXY ?= http://proxy.foo.com:8000
|
||||
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
||||
USE_PROXY ?= false
|
||||
USE_PROXY ?= true
|
||||
|
||||
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
|
||||
IMAGE_DIR:=images/$(IMAGE_NAME)
|
||||
|
||||
# Build ranger Docker image for this project
|
||||
.PHONY: images
|
||||
images: build_$(IMAGE_NAME)
|
||||
#Build all images in the list
|
||||
images: $(IMAGE_NAME)
|
||||
#sudo make images will build and run ranger and rangercli
|
||||
$(IMAGE_NAME):
|
||||
@echo
|
||||
@echo "===== Processing [$@] image ====="
|
||||
@make build_$@ IMAGE=${DOCKER_REGISTRY}/${IMAGE_PREFIX}/$@:${IMAGE_TAG} IMAGE_DIR=images/$@ IMAGE_NAME=$@
|
||||
|
||||
# Create tgz of the chart
|
||||
.PHONY: charts
|
||||
@ -44,11 +51,11 @@ dry-run: clean
|
||||
tools/helm_tk.sh $(HELM)
|
||||
|
||||
# Make targets intended for use by the primary targets above.
|
||||
.PHONY: build_$(IMAGE_NAME)
|
||||
build_$(IMAGE_NAME):
|
||||
.PHONY: build_ranger
|
||||
build_ranger:
|
||||
|
||||
ifeq ($(USE_PROXY), true)
|
||||
docker build --network host -t $(IMAGE) --label $(LABEL) -f Dockerfile \
|
||||
docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile \
|
||||
--build-arg http_proxy=$(PROXY) \
|
||||
--build-arg https_proxy=$(PROXY) \
|
||||
--build-arg HTTP_PROXY=$(PROXY) \
|
||||
@ -56,9 +63,25 @@ ifeq ($(USE_PROXY), true)
|
||||
--build-arg no_proxy=$(NO_PROXY) \
|
||||
--build-arg NO_PROXY=$(NO_PROXY) .
|
||||
else
|
||||
docker build --network host -t $(IMAGE) --label $(LABEL) -f Dockerfile .
|
||||
docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile .
|
||||
endif
|
||||
|
||||
.PHONY: build_rangercli
|
||||
build_rangercli:
|
||||
|
||||
ifeq ($(USE_PROXY), true)
|
||||
docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile \
|
||||
--build-arg http_proxy=$(PROXY) \
|
||||
--build-arg https_proxy=$(PROXY) \
|
||||
--build-arg HTTP_PROXY=$(PROXY) \
|
||||
--build-arg HTTPS_PROXY=$(PROXY) \
|
||||
--build-arg no_proxy=$(NO_PROXY) \
|
||||
--build-arg NO_PROXY=$(NO_PROXY) .
|
||||
else
|
||||
docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile .
|
||||
endif
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf build
|
||||
@ -66,7 +89,7 @@ clean:
|
||||
|
||||
.PHONY: pep8
|
||||
pep8:
|
||||
tox -e pep8
|
||||
cd ../../; tox -e pep8
|
||||
|
||||
.PHONY: helm_lint
|
||||
helm_lint: clean
|
||||
|
@ -1,50 +0,0 @@
|
||||
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
DOCKER_REGISTRY ?= quay.io
|
||||
IMAGE_NAME ?= ranger-client
|
||||
IMAGE_PREFIX ?= attcomdev
|
||||
IMAGE_TAG ?= ocata
|
||||
LABEL ?= commit-id
|
||||
PROXY ?= http://proxy.foo.com:8000
|
||||
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
||||
USE_PROXY ?= false
|
||||
|
||||
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
|
||||
|
||||
# Build ranger Docker image for this project
|
||||
.PHONY: images
|
||||
images: build_$(IMAGE_NAME)
|
||||
|
||||
|
||||
|
||||
# Make targets intended for use by the primary targets above.
|
||||
.PHONY: build_$(IMAGE_NAME)
|
||||
build_$(IMAGE_NAME):
|
||||
|
||||
ifeq ($(USE_PROXY), true)
|
||||
docker build --network host -t $(IMAGE) --label $(LABEL) -f Dockerfile \
|
||||
--build-arg http_proxy=$(PROXY) \
|
||||
--build-arg https_proxy=$(PROXY) \
|
||||
--build-arg HTTP_PROXY=$(PROXY) \
|
||||
--build-arg HTTPS_PROXY=$(PROXY) \
|
||||
--build-arg no_proxy=$(NO_PROXY) \
|
||||
--build-arg NO_PROXY=$(NO_PROXY) .
|
||||
else
|
||||
docker build --network host -t $(IMAGE) --label $(LABEL) -f Dockerfile .
|
||||
endif
|
||||
|
||||
.PHONY: pep8
|
||||
pep8:
|
||||
tox -e pep8
|
@ -32,6 +32,8 @@ python-dev \
|
||||
python-dateutil \
|
||||
ca-certificates \
|
||||
openstack-pkg-tools \
|
||||
vim \
|
||||
curl \
|
||||
gcc \
|
||||
g++ \
|
||||
libffi-dev \
|
73
tools/rangercli.sh
Executable file
73
tools/rangercli.sh
Executable file
@ -0,0 +1,73 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -e
|
||||
|
||||
# rangercli require /${HOME}/openrc environment file that contains all the
|
||||
# required env variables to run the ranger CLI commands.
|
||||
envfile="${HOME}/openrc"
|
||||
|
||||
if [ ! -f $envfile ]
|
||||
then
|
||||
echo "Environment file $envfile not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# source the environment file if exists
|
||||
. ${HOME}/openrc
|
||||
|
||||
# User can run the script as they would execute the ranger CLI.
|
||||
# For instance, to run the './orm cms create_customer' command, user can execute
|
||||
# the following command after setting up the required environment variables:
|
||||
#
|
||||
# $ ./rangercli.sh ./orm cms create_customer /target/cms/create_basic_cms.json
|
||||
#
|
||||
|
||||
# NOTE: If user is executing the script from outside the cluster, e.g. from
|
||||
# a remote jump server, then he/she will need to ensure that the DNS server
|
||||
# is able to resolve the FQDN of the Ranger and Keystone public URL (both
|
||||
# will be pointing to the IP of the Ingress Controller). If the DNS resolution
|
||||
# is not available, the user will need to ensure that the /etc/hosts file is
|
||||
# properly updated before running the script.
|
||||
|
||||
### Additional variables required to run ranger cli commands:
|
||||
# RANGERCLI_HOSTPATH: we'll always use '/target' as defined below
|
||||
RANGERCLI_HOSTPATH=${RANGERCLI_HOSTPATH:-"/target"}
|
||||
# RANGERCLI_JSONPATH = provide full path of your ranger CLI JSON files
|
||||
RANGERCLI_JSONPATH=${RANGERCLI_JSONPATH}
|
||||
# RANGERCLI_IMAGE = provide rangercli docker image name to use
|
||||
RANGERCLI_IMAGE=${RANGERCLI_IMAGE}
|
||||
|
||||
# Define Base Docker Command
|
||||
base_docker_command=$(cat << EndOfCommand
|
||||
sudo docker run -t --rm --net=host
|
||||
-e http_proxy=${HTTP_PROXY}
|
||||
-e https_proxy=${HTTPS_PROXY}
|
||||
-e no_proxy=${NO_PROXY:-127.0.0.1,localhost,.svc.cluster.local}
|
||||
-e RANGER_USERNAME=${RANGER_USERNAME:-ranger-admin}
|
||||
-e RANGER_TENANT_NAME=${RANGER_TENANT_NAME:-service}
|
||||
-e RANGER_PASSWORD=${RANGER_PASSWORD:-xxxxxxxx}
|
||||
-e RANGER_AUTH_REGION=${RANGER_AUTH_REGION}
|
||||
-e RANGER_CMS_BASE_URL=${RANGER_CMS_BASE_URL}
|
||||
-e RANGER_FMS_BASE_URL=${RANGER_FMS_BASE_URL}
|
||||
-e RANGER_IMS_BASE_URL=${RANGER_IMS_BASE_URL}
|
||||
-e RANGER_RMS_BASE_URL=${RANGER_RMS_BASE_URL}
|
||||
-e verify=False
|
||||
-it
|
||||
EndOfCommand
|
||||
)
|
||||
|
||||
# Execute Ranger CLI
|
||||
${base_docker_command} -v "${RANGERCLI_JSONPATH}":"${RANGERCLI_HOSTPATH}" "${RANGERCLI_IMAGE}" $@
|
Loading…
x
Reference in New Issue
Block a user