Skip to content

Commit

Permalink
Initial draft of the IBM Cloud Charts Repository.
Browse files Browse the repository at this point in the history
- See README.md for more details on the content and purpose of this repo.

Contributors:
  - @kschloss
  - @mdelder
  • Loading branch information
Michael D. Elder committed Jun 23, 2017
1 parent 7e14dbc commit 51fe9c2
Show file tree
Hide file tree
Showing 31 changed files with 1,400 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repo/
26 changes: 26 additions & 0 deletions Configfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
###############################################################################
# Licensed Materials - Property of IBM.
# Copyright IBM Corporation 2017. All Rights Reserved.
# U.S. Government Users Restricted Rights - Use, duplication or disclosure
# restricted by GSA ADP Schedule Contract with IBM Corp.
#
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
GIT_REMOTE_URL = $(shell git config --get remote.origin.url)
GIT_TOKEN ?=
DOCKER_SERVER ?= registry.ng.bluemix.net
DOCKER_USERNAME ?= token
DOCKER_PASSWORD ?=
IMAGE_DESCRIPTION =
IMAGE_NAME = ibm-charts
IMAGE_REPO ?= registry.ng.bluemix.net/mdelder
RELEASE_TAG ?= latest

STABLE_BUILD_DIR = repo/stable
STABLE_REPO_URL ?= https://raw.githubusercontent.com/IBM/charts/$(STABLE_BUILD_DIR)/master/
STABLE_CHARTS := $(wildcard stable/*)

INCUBATING_BUILD_DIR = repo/incubating
INCUBATING_REPO_URL ?= https://raw.githubusercontent.com/IBM/charts/$(INCUBATING_BUILD_DIR)/master/
INCUBATING_CHARTS := $(wildcard incubating/*)
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
###############################################################################
# Licensed Materials - Property of IBM.
# Copyright IBM Corporation 2017. All Rights Reserved.
# U.S. Government Users Restricted Rights - Use, duplication or disclosure
# restricted by GSA ADP Schedule Contract with IBM Corp.
#
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
FROM nginx:1.13.1-alpine

ARG VCS_REF
ARG VCS_URL
ARG IMAGE_NAME
ARG IMAGE_DESCRIPTION

# http://label-schema.org/rc1/
LABEL org.label-schema.vendor="IBM" \
org.label-schema.name="$IMAGE_NAME" \
org.label-schema.description="$IMAGE_DESCRIPTION" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url=$VCS_URL \
org.label-schema.license="Licensed Materials - Property of IBM" \
org.label-schema.schema-version="1.0"

RUN mkdir -p /usr/share/nginx/html/stable && \
mkdir -p /usr/share/nginx/html/incubating

ADD repo/incubating /usr/share/nginx/html/incubating
ADD repo/stable /usr/share/nginx/html/stable
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

Unless otherwise noted for derived works (identified by the presence of an `ORIGIN` and/or a `LICENSE` file):

Licensed Materials - Property of IBM Copyright IBM Corporation 2017. All Rights Reserved.
U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP
Schedule Contract with IBM Corp.

Contributors:
IBM Corporation - initial API and implementation
51 changes: 51 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
###############################################################################
# Licensed Materials - Property of IBM.
# Copyright IBM Corporation 2017. All Rights Reserved.
# U.S. Government Users Restricted Rights - Use, duplication or disclosure
# restricted by GSA ADP Schedule Contract with IBM Corp.
#
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
include Configfile

.DEFAULT: charts-stable

$(STABLE_BUILD_DIR):
@mkdir -p $@

$(INCUBATING_BUILD_DIR):
@mkdir -p $@

.PHONY: charts charts-stable charts-incubating

# Default aliases: charts, repo

charts: charts-stable

repo: repo-stable

charts-stable: $(STABLE_CHARTS)
$(STABLE_CHARTS): $(STABLE_BUILD_DIR)
helm lint --strict $@
helm package $@ -d $(STABLE_BUILD_DIR)

charts-incubating: $(INCUBATING_CHARTS)
$(INCUBATING_CHARTS): $(INCUBATING_BUILD_DIR)
helm lint --strict $@
helm package $@ -d $(INCUBATING_BUILD_DIR)

.PHONY: repo repo-stable repo-incubating

repo-stable: $(STABLE_CHARTS)
helm repo index $(STABLE_BUILD_DIR) --url $(STABLE_REPO_URL)

repo-incubating: $(INCUBATING_CHARTS)
helm repo index $(INCUBATING_BUILD_DIR) --url $(INCUBATING_REPO_URL)

.PHONY: all
all: repo-stable repo-incubating $(STABLE_CHARTS) $(INCUBATING_CHARTS)

image:: repo-stable repo-incubating

include Makefile.docker
73 changes: 73 additions & 0 deletions Makefile.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
###############################################################################
# Licensed Materials - Property of IBM.
# Copyright IBM Corporation 2017. All Rights Reserved.
# U.S. Government Users Restricted Rights - Use, duplication or disclosure
# restricted by GSA ADP Schedule Contract with IBM Corp.
#
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
#
# WARNING: DO NOT MODIFY. Changes may be overwritten in future updates.
#
# The following build goals are designed to be generic for any docker image.
# This Makefile is designed to be included in other Makefiles.
# You must ensure that Make variables are defined for IMAGE_REPO, IMAGE_NAME,
# DOCKER_USERNAME and DOCKER_PASSWORD.
#
# If you are using a Bluemix image registry, you must use a token for DOCKER_PASSWORD
# created with the command `bx cr token-add --description "" --non-expiring --readwrite`
###############################################################################

.DEFAULT_GOAL=image

.PHONY: docker-login
docker-login:
ifndef $(and DOCKER_USERNAME, DOCKER_PASSWORD)
$(error DOCKER_USERNAME and DOCKER_PASSWORD must be defined, required for goal (docker-login))
endif
@docker login -u $(DOCKER_USERNAME) -p $(DOCKER_PASSWORD) $(DOCKER_SERVER)

.PHONY: app-version
app-version:
$(eval WORKING_CHANGES := $(shell git status --porcelain))
$(eval BUILD_DATE := $(shell date +%m/%d@%H:%M:%S))
$(eval GIT_COMMIT := $(shell git rev-parse --short HEAD))
$(eval VCS_REF := $(if $(WORKING_CHANGES),$(GIT_COMMIT)-$(BUILD_DATE),$(GIT_COMMIT)))
$(eval APP_VERSION ?= $(if $(shell cat VERSION 2> /dev/null),$(shell cat VERSION 2> /dev/null),0.0.1))
$(eval IMAGE_VERSION ?= $(APP_VERSION)-$(GIT_COMMIT))
@echo "App: $(IMAGE_NAME) $(IMAGE_VERSION)"

.PHONY: check-env
check-env:
ifndef IMAGE_REPO
$(error IMAGE_REPO is undefined)
endif
ifndef IMAGE_NAME
$(error IMAGE_NAME is undefined)
endif

.PHONY: image
image:: check-env app-version
docker build -t $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_VERSION) \
--build-arg "VCS_REF=$(VCS_REF)" \
--build-arg "VCS_URL=$(GIT_REMOTE_URL)" \
--build-arg "IMAGE_NAME=$(IMAGE_NAME)" \
--build-arg "IMAGE_DESCRIPTION=$(IMAGE_DESCRIPTION)" .

.PHONY: push
push: check-env image
docker push $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_VERSION)

.PHONY: release
release: check-env app-version
docker tag $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_VERSION) $(IMAGE_REPO)/$(IMAGE_NAME):$(RELEASE_TAG)
docker push $(IMAGE_REPO)/$(IMAGE_NAME):$(RELEASE_TAG)

.PHONY: show-labels
show-labels: app-version
@docker inspect $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_VERSION) --format='{{json .Config.Labels}}' | tr , '\n' | tr -d '{' | tr -d '}'

.PHONY: clean
clean::
@echo "Cleaning up generated files"
7 changes: 7 additions & 0 deletions ORIGIN
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
origins:
- path: stable/postgresql:
origin: https://github.com/kubernetes/charts/tree/master/stable/postgresql
license: https://github.com/kubernetes/charts/blob/master/LICENSE
- path: stable/rabbitmq:
origin: https://github.com/kubernetes/charts/tree/master/stable/rabbitmq
license: https://github.com/kubernetes/charts/blob/master/LICENSE
74 changes: 72 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,72 @@
# charts
Helm charts for services delivered through the Bluemix Private Cloud repository mechanism
# **IBM Cloud Charts** Helm Repository

## Overview

The `IBM/charts` repository provides [helm](https://github.com/kubernetes/helm) charts for IBM and Third Party middleware.

The repository is organized as follows:

- The `master` branch serves as a landing ground for new `helm` charts.
- The `stable` branch is pushed from a built version of the `helm` chart repository. The published chart repository can be consumed directly from GitHub.

## Development

## Configure the `kubernetes` command line interface for IBM® Cloud private®

To access the kubernetes `apiserver`, you will need an authorization token. In IBM® Cloud private®, authorization tokens can be requested via the REST API.

- KnowledgeCenter: [Accessing the APIs](https://www.ibm.com/support/knowledgecenter/SS8TQM_1.1.0/apis/access_api.html).

Once you have an authorization token, you can configure `kubectl`:

```shell
export MASTER_IP=10.x.x.x
export CLUSTER_NAME=cloud-private
export AUTH_TOKEN=$(curl -k -u admin:admin https://$MASTER_IP:8443/acs/api/v1/auth/token)

kubectl config set-cluster $CLUSTER_NAME --server=https://$MASTER_IP:8001 --insecure-skip-tls-verify=true
kubectl config set-context $CLUSTER_NAME --cluster=$CLUSTER_NAME
kubectl config set-credentials user --token=$AUTH_TOKEN
kubectl config set-context $CLUSTER_NAME --user=user --namespace=default
kubectl config use-context $CLUSTER_NAME
```

Then [configure your helm command line interface](https://github.com/kubernetes/helm) to work with `helm`.

## Building the Chart Repository and associated image

A `Makefile` is included which allows you to package charts, generate the chart repository index, and package the entire repo into a docker image.

### Build stable charts
```shell
make charts
```

### Build charts under incubation
```shell
make charts-incubating
```

### Build the stable repository
```shell
make repo
```

### Build the incubation repository
```shell
make repo-incubating
```

### Build docker image with the contents of the repository
```shell
make image release
```

### Run the chart repository server
```shell
docker run -d --rm -p 9081:80 registry.ng.bluemix.net/mdelder/ibm-charts
curl -vvL localhost:9081/stable/index.yaml
curl -vvL localhost:9081/incubating/index.yaml
```

_Copyright IBM Corporation 2017. All Rights Reserved._
17 changes: 17 additions & 0 deletions stable/postgresql/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: postgresql
version: 0.6.0
description: Object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance.
keywords:
- postgresql
- postgres
- database
- sql
home: https://www.postgresql.org/
icon: https://www.postgresql.org/media/img/about/press/elephant.png
sources:
- https://github.com/kubernetes/charts
- https://github.com/docker-library/postgres
maintainers:
- name: swordbeta
- name: databus23
engine: gotpl
Loading

0 comments on commit 51fe9c2

Please sign in to comment.