Merge pull request #6 from arthurbarr/master
Update chart storage parameters for consistency with other IBM charts
This commit is contained in:
15
Makefile
15
Makefile
@@ -26,6 +26,9 @@ default: build-devserver test
|
|||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: build-devserver build-advancedserver
|
all: build-devserver build-advancedserver
|
||||||
|
|
||||||
|
.PHONY: devserver
|
||||||
|
devserver: build-devserver test-devserver
|
||||||
|
|
||||||
# Build incubating components
|
# Build incubating components
|
||||||
.PHONY: incubating
|
.PHONY: incubating
|
||||||
incubating: build-explorer
|
incubating: build-explorer
|
||||||
@@ -37,6 +40,7 @@ clean:
|
|||||||
rm -rf ./deps
|
rm -rf ./deps
|
||||||
|
|
||||||
downloads/mqadv_dev903_ubuntu_x86-64.tar.gz:
|
downloads/mqadv_dev903_ubuntu_x86-64.tar.gz:
|
||||||
|
$(info $(SPACER)$(shell printf $(TITLE)"Downloading IBM MQ Advanced for Developers"$(END)))
|
||||||
mkdir -p downloads
|
mkdir -p downloads
|
||||||
cd downloads; curl -LO https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/mqadv_dev903_ubuntu_x86-64.tar.gz
|
cd downloads; curl -LO https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/mqadv_dev903_ubuntu_x86-64.tar.gz
|
||||||
|
|
||||||
@@ -46,8 +50,8 @@ downloads: downloads/mqadv_dev903_ubuntu_x86-64.tar.gz
|
|||||||
.PHONY: deps
|
.PHONY: deps
|
||||||
deps:
|
deps:
|
||||||
glide install --strip-vendor
|
glide install --strip-vendor
|
||||||
cd test/docker && dep ensure
|
cd test/docker && dep ensure -vendor-only
|
||||||
cd test/kubernetes && dep ensure
|
cd test/kubernetes && dep ensure -vendor-only
|
||||||
|
|
||||||
build/runmqserver:
|
build/runmqserver:
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
@@ -76,6 +80,7 @@ test-advancedserver: build
|
|||||||
|
|
||||||
.PHONY: test-devserver
|
.PHONY: test-devserver
|
||||||
test-devserver: build
|
test-devserver: build
|
||||||
|
$(info $(SPACER)$(shell printf $(TITLE)"Test $(DOCKER_IMAGE_DEVSERVER)"$(END)))
|
||||||
cd pkg/name && go test
|
cd pkg/name && go test
|
||||||
cd test/docker && TEST_IMAGE=$(DOCKER_IMAGE_DEVSERVER) go test
|
cd test/docker && TEST_IMAGE=$(DOCKER_IMAGE_DEVSERVER) go test
|
||||||
|
|
||||||
@@ -109,11 +114,13 @@ endef
|
|||||||
|
|
||||||
.PHONY: build-advancedserver
|
.PHONY: build-advancedserver
|
||||||
build-advancedserver: build downloads/CNJR7ML.tar.gz
|
build-advancedserver: build downloads/CNJR7ML.tar.gz
|
||||||
|
$(info $(SPACER)$(shell printf $(TITLE)"Build $(DOCKER_IMAGE_ADVANCEDSERVER)"$(END)))
|
||||||
$(call docker-build-mq,$(DOCKER_IMAGE_ADVANCEDSERVER),Dockerfile-server,CNJR7ML.tar.gz,"4486e8c4cc9146fd9b3ce1f14a2dfc5b","IBM MQ Advanced","9.0.3")
|
$(call docker-build-mq,$(DOCKER_IMAGE_ADVANCEDSERVER),Dockerfile-server,CNJR7ML.tar.gz,"4486e8c4cc9146fd9b3ce1f14a2dfc5b","IBM MQ Advanced","9.0.3")
|
||||||
docker tag $(DOCKER_IMAGE_ADVANCEDSERVER) mq-advancedserver:9.0.3-$(DOCKER_TAG_ARCH)
|
docker tag $(DOCKER_IMAGE_ADVANCEDSERVER) mq-advancedserver:9.0.3-$(DOCKER_TAG_ARCH)
|
||||||
|
|
||||||
.PHONY: build-devserver
|
.PHONY: build-devserver
|
||||||
build-devserver: build downloads/mqadv_dev903_ubuntu_x86-64.tar.gz
|
build-devserver: build downloads/mqadv_dev903_ubuntu_x86-64.tar.gz
|
||||||
|
$(info $(shell printf $(TITLE)"Build $(DOCKER_IMAGE_DEVSERVER)"$(END)))
|
||||||
$(call docker-build-mq,$(DOCKER_IMAGE_DEVSERVER),Dockerfile-server,mqadv_dev903_ubuntu_x86-64.tar.gz,"98102d16795c4263ad9ca075190a2d4d","IBM MQ Advanced for Developers (Non-Warranted)","9.0.3")
|
$(call docker-build-mq,$(DOCKER_IMAGE_DEVSERVER),Dockerfile-server,mqadv_dev903_ubuntu_x86-64.tar.gz,"98102d16795c4263ad9ca075190a2d4d","IBM MQ Advanced for Developers (Non-Warranted)","9.0.3")
|
||||||
docker tag $(DOCKER_IMAGE_DEVSERVER) mq-devserver:9.0.3-$(DOCKER_TAG_ARCH)
|
docker tag $(DOCKER_IMAGE_DEVSERVER) mq-devserver:9.0.3-$(DOCKER_TAG_ARCH)
|
||||||
|
|
||||||
@@ -130,6 +137,8 @@ build-advancedserver-cover: build-advanced-server build-cov
|
|||||||
# build-web: build downloads/CNJR7ML.tar.gz
|
# build-web: build downloads/CNJR7ML.tar.gz
|
||||||
# $(call docker-build-mq,mq-web:latest-$(DOCKER_TAG_ARCH),Dockerfile-mq-web)
|
# $(call docker-build-mq,mq-web:latest-$(DOCKER_TAG_ARCH),Dockerfile-mq-web)
|
||||||
|
|
||||||
.PHONY: build-devserver
|
.PHONY: build-explorer
|
||||||
build-explorer: build downloads/mqadv_dev903_ubuntu_x86-64.tar.gz
|
build-explorer: build downloads/mqadv_dev903_ubuntu_x86-64.tar.gz
|
||||||
$(call docker-build-mq,mq-explorer:latest-$(DOCKER_TAG_ARCH),incubating/mq-explorer/Dockerfile-mq-explorer,mqadv_dev903_ubuntu_x86-64.tar.gz,"98102d16795c4263ad9ca075190a2d4d","IBM MQ Advanced for Developers (Non-Warranted)","9.0.3")
|
$(call docker-build-mq,mq-explorer:latest-$(DOCKER_TAG_ARCH),incubating/mq-explorer/Dockerfile-mq-explorer,mqadv_dev903_ubuntu_x86-64.tar.gz,"98102d16795c4263ad9ca075190a2d4d","IBM MQ Advanced for Developers (Non-Warranted)","9.0.3")
|
||||||
|
|
||||||
|
include formatting.mk
|
||||||
|
|||||||
@@ -15,5 +15,5 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
description: IBM MQ queue manager
|
description: IBM MQ queue manager
|
||||||
name: ibm-mqadvanced-server-dev
|
name: ibm-mqadvanced-server-dev
|
||||||
version: 0.1.0
|
version: 1.0.0-beta
|
||||||
icon: https://developer.ibm.com/messaging/wp-content/uploads/sites/18/2017/07/IBM-MQ-Square-200.png
|
icon: https://developer.ibm.com/messaging/wp-content/uploads/sites/18/2017/07/IBM-MQ-Square-200.png
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ spec:
|
|||||||
{{- if .Values.persistence.enabled }}
|
{{- if .Values.persistence.enabled }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: "/mnt/mqm"
|
- mountPath: "/mnt/mqm"
|
||||||
name: {{ template "fullname" . }}-{{ .Values.persistence.name }}
|
name: "{{ template "fullname" . }}-{{ .Values.dataPVC.name }}"
|
||||||
{{- end }}
|
{{- end }}
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
@@ -76,18 +76,25 @@ spec:
|
|||||||
volumeClaimTemplates:
|
volumeClaimTemplates:
|
||||||
{{- if .Values.persistence.enabled }}
|
{{- if .Values.persistence.enabled }}
|
||||||
- metadata:
|
- metadata:
|
||||||
name: {{ template "fullname" . }}-{{ .Values.persistence.name }}
|
name: "{{ template "fullname" . }}-{{ .Values.dataPVC.name }}"
|
||||||
labels:
|
labels:
|
||||||
app: {{ template "fullname" . }}
|
app: {{ template "fullname" . }}
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
release: "{{ .Release.Name }}"
|
release: "{{ .Release.Name }}"
|
||||||
heritage: "{{ .Release.Service }}"
|
heritage: "{{ .Release.Service }}"
|
||||||
spec:
|
spec:
|
||||||
{{- if .Values.persistence.storageClassName }}
|
{{- if .Values.persistence.useDynamicProvisioning }}
|
||||||
storageClassName: {{ .Values.persistence.storageClassName | quote }}
|
# If present, use the storageClassName from the values.yaml, else use the
|
||||||
|
# default storageClass setup by Kubernetes Administrator
|
||||||
|
#
|
||||||
|
# Setting storageClassName to nil means use the default storage class
|
||||||
|
storageClassName: {{ default nil .Values.dataPVC.storageClassName | quote }}
|
||||||
|
{{- else }}
|
||||||
|
# Disable dynamic provisioning
|
||||||
|
storageClassName: ""
|
||||||
{{- end }}
|
{{- end }}
|
||||||
accessModes: [ "ReadWriteOnce" ]
|
accessModes: [ "ReadWriteOnce" ]
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: {{ .Values.persistence.size | quote }}
|
storage: {{ .Values.dataPVC.size | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
@@ -14,8 +14,9 @@
|
|||||||
|
|
||||||
# license must be set to "accept" to accept the terms of the IBM license
|
# license must be set to "accept" to accept the terms of the IBM license
|
||||||
license: "not accepted"
|
license: "not accepted"
|
||||||
|
|
||||||
image:
|
image:
|
||||||
# repository is the container repository to use, which must contain IBM MQ Advanced
|
# repository is the container repository to use, which must contain IBM MQ Advanced for Developers
|
||||||
repository: ibmcom/mq
|
repository: ibmcom/mq
|
||||||
# tag is the tag to use for the container repository
|
# tag is the tag to use for the container repository
|
||||||
tag: 9
|
tag: 9
|
||||||
@@ -23,18 +24,27 @@ image:
|
|||||||
pullSecret:
|
pullSecret:
|
||||||
# pullPolicy is either IfNotPresent or Always (https://kubernetes.io/docs/concepts/containers/images/)
|
# pullPolicy is either IfNotPresent or Always (https://kubernetes.io/docs/concepts/containers/images/)
|
||||||
pullPolicy: IfNotPresent
|
pullPolicy: IfNotPresent
|
||||||
# data section specifies settings for the main persistent volume claim, which is used for data in /var/mqm
|
|
||||||
|
# persistence section specifies persistence settings which apply to the whole chart
|
||||||
persistence:
|
persistence:
|
||||||
|
# enabled is whether to use Persistent Volumes or not
|
||||||
enabled: true
|
enabled: true
|
||||||
# name sets part of the name for this persistent volume claim
|
# useDynamicProvisioning is whether or not to use Storage Classes to dynamically create Persistent Volumes
|
||||||
|
useDynamicProvisioning: true
|
||||||
|
|
||||||
|
# dataPVC section specifies settings for the main Persistent Volume Claim, which is used for data in /var/mqm
|
||||||
|
dataPVC:
|
||||||
|
# name sets part of the name for this Persistent Volume Claim
|
||||||
name: "data"
|
name: "data"
|
||||||
## storageClassName is the name of the storage class to use, or an empty string for no storage class
|
## storageClassName is the name of the Storage Class to use, or an empty string for no Storage Class
|
||||||
storageClassName: ""
|
storageClassName: ""
|
||||||
## size is the minimum size of the persistent volume
|
## size is the minimum size of the Persistent Volume
|
||||||
size: 2Gi
|
size: 2Gi
|
||||||
|
|
||||||
service:
|
service:
|
||||||
name: qmgr
|
name: qmgr
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpu: 500m
|
cpu: 500m
|
||||||
@@ -42,6 +52,7 @@ resources:
|
|||||||
requests:
|
requests:
|
||||||
cpu: 500m
|
cpu: 500m
|
||||||
memory: 512Mi
|
memory: 512Mi
|
||||||
|
|
||||||
# queueManager section specifies settings for the MQ Queue Manager
|
# queueManager section specifies settings for the MQ Queue Manager
|
||||||
queueManager:
|
queueManager:
|
||||||
# name allows you to specify the name to use for the queue manager. Defaults to the Helm release name.
|
# name allows you to specify the name to use for the queue manager. Defaults to the Helm release name.
|
||||||
@@ -52,5 +63,6 @@ queueManager:
|
|||||||
adminPassword:
|
adminPassword:
|
||||||
# appPassword sets the password of the app user
|
# appPassword sets the password of the app user
|
||||||
appPassword:
|
appPassword:
|
||||||
|
|
||||||
# nameOverride can be set to partially override the name of the resources created by this chart
|
# nameOverride can be set to partially override the name of the resources created by this chart
|
||||||
nameOverride:
|
nameOverride:
|
||||||
|
|||||||
@@ -15,5 +15,5 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
description: IBM MQ queue manager
|
description: IBM MQ queue manager
|
||||||
name: ibm-mqadvanced-server-prod
|
name: ibm-mqadvanced-server-prod
|
||||||
version: 0.1.0
|
version: 1.0.0-beta
|
||||||
icon: https://developer.ibm.com/messaging/wp-content/uploads/sites/18/2017/07/IBM-MQ-Square-200.png
|
icon: https://developer.ibm.com/messaging/wp-content/uploads/sites/18/2017/07/IBM-MQ-Square-200.png
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ spec:
|
|||||||
{{- if .Values.persistence.enabled }}
|
{{- if .Values.persistence.enabled }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: "/mnt/mqm"
|
- mountPath: "/mnt/mqm"
|
||||||
name: {{ template "fullname" . }}-{{ .Values.persistence.name }}
|
name: "{{ template "fullname" . }}-{{ .Values.dataPVC.name }}"
|
||||||
{{- end }}
|
{{- end }}
|
||||||
# Set liveness probe to determine if the queue manager is running
|
# Set liveness probe to determine if the queue manager is running
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
@@ -67,7 +67,7 @@ spec:
|
|||||||
exec:
|
exec:
|
||||||
command:
|
command:
|
||||||
- chkmqready
|
- chkmqready
|
||||||
initialDelaySeconds: 5
|
initialDelaySeconds: 10
|
||||||
periodSeconds: 5
|
periodSeconds: 5
|
||||||
timeoutSeconds: 3
|
timeoutSeconds: 3
|
||||||
failureThreshold: 1
|
failureThreshold: 1
|
||||||
@@ -79,18 +79,25 @@ spec:
|
|||||||
volumeClaimTemplates:
|
volumeClaimTemplates:
|
||||||
{{- if .Values.persistence.enabled }}
|
{{- if .Values.persistence.enabled }}
|
||||||
- metadata:
|
- metadata:
|
||||||
name: {{ template "fullname" . }}-{{ .Values.persistence.name }}
|
name: "{{ template "fullname" . }}-{{ .Values.dataPVC.name }}"
|
||||||
labels:
|
labels:
|
||||||
app: {{ template "fullname" . }}
|
app: {{ template "fullname" . }}
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
release: "{{ .Release.Name }}"
|
release: "{{ .Release.Name }}"
|
||||||
heritage: "{{ .Release.Service }}"
|
heritage: "{{ .Release.Service }}"
|
||||||
spec:
|
spec:
|
||||||
{{- if .Values.persistence.storageClassName }}
|
{{- if .Values.persistence.useDynamicProvisioning }}
|
||||||
storageClassName: {{ .Values.persistence.storageClassName | quote }}
|
## If present, use the storageClassName from the values.yaml, else use the
|
||||||
|
## default storageClass setup by Kubernetes Administrator
|
||||||
|
##
|
||||||
|
## Setting storageClassName to nil means use the default storage class
|
||||||
|
storageClassName: {{ default nil .Values.dataPVC.storageClassName | quote }}
|
||||||
|
{{- else }}
|
||||||
|
## Disable dynamic provisioning
|
||||||
|
storageClassName: ""
|
||||||
{{- end }}
|
{{- end }}
|
||||||
accessModes: [ "ReadWriteOnce" ]
|
accessModes: [ "ReadWriteOnce" ]
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: {{ .Values.persistence.size | quote }}
|
storage: {{ .Values.dataPVC.size | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
# license must be set to "accept" to accept the terms of the IBM license
|
# license must be set to "accept" to accept the terms of the IBM license
|
||||||
license: "not accepted"
|
license: "not accepted"
|
||||||
|
|
||||||
image:
|
image:
|
||||||
# repository is the container repository to use, which must contain IBM MQ Advanced
|
# repository is the container repository to use, which must contain IBM MQ Advanced
|
||||||
repository:
|
repository:
|
||||||
@@ -23,18 +24,27 @@ image:
|
|||||||
pullSecret:
|
pullSecret:
|
||||||
# pullPolicy is either IfNotPresent or Always (https://kubernetes.io/docs/concepts/containers/images/)
|
# pullPolicy is either IfNotPresent or Always (https://kubernetes.io/docs/concepts/containers/images/)
|
||||||
pullPolicy: IfNotPresent
|
pullPolicy: IfNotPresent
|
||||||
# persistence section specifies settings for the main persistent volume claim, which is used for data in /var/mqm
|
|
||||||
|
# persistence section specifies persistence settings which apply to the whole chart
|
||||||
persistence:
|
persistence:
|
||||||
|
# enabled is whether to use Persistent Volumes or not
|
||||||
enabled: true
|
enabled: true
|
||||||
# name sets part of the name for this persistent volume claim
|
# useDynamicProvisioning is whether or not to use Storage Classes to dynamically create Persistent Volumes
|
||||||
|
useDynamicProvisioning: true
|
||||||
|
|
||||||
|
# dataPVC section specifies settings for the main Persistent Volume Claim, which is used for data in /var/mqm
|
||||||
|
dataPVC:
|
||||||
|
# name sets part of the name for this Persistent Volume Claim
|
||||||
name: "data"
|
name: "data"
|
||||||
## storageClassName is the name of the storage class to use, or an empty string for no storage class
|
# storageClassName is the name of the Storage Class to use, or an empty string for no Storage Class
|
||||||
storageClassName: ""
|
storageClassName: ""
|
||||||
## size is the minimum size of the persistent volume
|
# size is the minimum size of the Persistent Volume
|
||||||
size: 2Gi
|
size: 2Gi
|
||||||
|
|
||||||
service:
|
service:
|
||||||
name: qmgr
|
name: qmgr
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpu: 1
|
cpu: 1
|
||||||
@@ -42,11 +52,14 @@ resources:
|
|||||||
requests:
|
requests:
|
||||||
cpu: 1
|
cpu: 1
|
||||||
memory: 1Gi
|
memory: 1Gi
|
||||||
|
|
||||||
# queueManager section specifies settings for the MQ Queue Manager
|
# queueManager section specifies settings for the MQ Queue Manager
|
||||||
queueManager:
|
queueManager:
|
||||||
# name allows you to specify the name to use for the queue manager. Defaults to the Helm release name.
|
# name allows you to specify the name to use for the queue manager. Defaults to the Helm release name.
|
||||||
name:
|
name:
|
||||||
|
|
||||||
# nameOverride can be set to partially override the name of the resources created by this chart
|
# nameOverride can be set to partially override the name of the resources created by this chart
|
||||||
nameOverride:
|
nameOverride:
|
||||||
|
|
||||||
# livenessDelay should be raised if your system cannot start the Queue Manager in 60 seconds
|
# livenessDelay should be raised if your system cannot start the Queue Manager in 60 seconds
|
||||||
livenessDelay: 60
|
livenessDelay: 60
|
||||||
|
|||||||
17
formatting.mk
Normal file
17
formatting.mk
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
GREEN="\033[32m"
|
||||||
|
RED="\033[31m"
|
||||||
|
BLUE="\033[34m"
|
||||||
|
PURPLE="\033[35m"
|
||||||
|
AQUA="\033[36m"
|
||||||
|
|
||||||
|
END="\033[0m"
|
||||||
|
|
||||||
|
UNDERLINE="\033[4m"
|
||||||
|
BOLD="\033[1m"
|
||||||
|
|
||||||
|
TITLE=$(BLUE)$(BOLD)$(UNDERLINE)
|
||||||
|
|
||||||
|
define SPACER
|
||||||
|
|
||||||
|
|
||||||
|
endef
|
||||||
14
test/kubernetes/Gopkg.lock
generated
14
test/kubernetes/Gopkg.lock
generated
@@ -200,10 +200,10 @@
|
|||||||
revision = "eb3733d160e74a9c7e442f435eb3bea458e1d19f"
|
revision = "eb3733d160e74a9c7e442f435eb3bea458e1d19f"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "release-1.7"
|
||||||
name = "k8s.io/apimachinery"
|
name = "k8s.io/apimachinery"
|
||||||
packages = ["pkg/api/equality","pkg/api/errors","pkg/api/meta","pkg/api/resource","pkg/apimachinery","pkg/apimachinery/announced","pkg/apimachinery/registered","pkg/apis/meta/v1","pkg/apis/meta/v1/unstructured","pkg/apis/meta/v1alpha1","pkg/conversion","pkg/conversion/queryparams","pkg/conversion/unstructured","pkg/fields","pkg/labels","pkg/runtime","pkg/runtime/schema","pkg/runtime/serializer","pkg/runtime/serializer/json","pkg/runtime/serializer/protobuf","pkg/runtime/serializer/recognizer","pkg/runtime/serializer/streaming","pkg/runtime/serializer/versioning","pkg/selection","pkg/types","pkg/util/clock","pkg/util/diff","pkg/util/errors","pkg/util/framer","pkg/util/intstr","pkg/util/json","pkg/util/net","pkg/util/rand","pkg/util/runtime","pkg/util/sets","pkg/util/validation","pkg/util/validation/field","pkg/util/wait","pkg/util/yaml","pkg/version","pkg/watch","third_party/forked/golang/reflect"]
|
packages = ["pkg/api/equality","pkg/api/errors","pkg/api/meta","pkg/api/resource","pkg/apimachinery","pkg/apimachinery/announced","pkg/apimachinery/registered","pkg/apis/meta/v1","pkg/apis/meta/v1/unstructured","pkg/apis/meta/v1alpha1","pkg/conversion","pkg/conversion/queryparams","pkg/conversion/unstructured","pkg/fields","pkg/labels","pkg/openapi","pkg/runtime","pkg/runtime/schema","pkg/runtime/serializer","pkg/runtime/serializer/json","pkg/runtime/serializer/protobuf","pkg/runtime/serializer/recognizer","pkg/runtime/serializer/streaming","pkg/runtime/serializer/versioning","pkg/selection","pkg/types","pkg/util/clock","pkg/util/diff","pkg/util/errors","pkg/util/framer","pkg/util/intstr","pkg/util/json","pkg/util/net","pkg/util/rand","pkg/util/runtime","pkg/util/sets","pkg/util/validation","pkg/util/validation/field","pkg/util/wait","pkg/util/yaml","pkg/version","pkg/watch","third_party/forked/golang/reflect"]
|
||||||
revision = "b166f81f5c4c88402ae23a0d0944c6ad08bffd3b"
|
revision = "8ab5f3d8a330c2e9baaf84e39042db8d49034ae2"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "k8s.io/client-go"
|
name = "k8s.io/client-go"
|
||||||
@@ -211,15 +211,9 @@
|
|||||||
revision = "d92e8497f71b7b4e0494e5bd204b48d34bd6f254"
|
revision = "d92e8497f71b7b4e0494e5bd204b48d34bd6f254"
|
||||||
version = "v4.0.0"
|
version = "v4.0.0"
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
name = "k8s.io/kube-openapi"
|
|
||||||
packages = ["pkg/common"]
|
|
||||||
revision = "abfc5fbe1cf87ee697db107fdfd24c32fe4397a8"
|
|
||||||
|
|
||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
analyzer-version = 1
|
analyzer-version = 1
|
||||||
inputs-digest = "05d4500518bb3fde554ca53f3d165ed3a20dec25bd4a24c6e59ee50dbea491b9"
|
inputs-digest = "caae962961e20347a5f6f9001a55d7baa94307f6bf6aecc001165a28a51e3919"
|
||||||
solver-name = "gps-cdcl"
|
solver-name = "gps-cdcl"
|
||||||
solver-version = 1
|
solver-version = 1
|
||||||
|
|||||||
@@ -16,10 +16,14 @@
|
|||||||
branch = "master"
|
branch = "master"
|
||||||
name = "golang.org/x/sys"
|
name = "golang.org/x/sys"
|
||||||
|
|
||||||
[[constraint]]
|
# The version of client-go corresponds to a specific Kubernetes version
|
||||||
branch = "master"
|
# (e.g. client-go 4.0.0 is for kubernetes 1.7)
|
||||||
name = "k8s.io/apimachinery"
|
# If you change this version, you also need to update the corresponding
|
||||||
|
# branch for k8s.io/apimachinery (below)
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "k8s.io/client-go"
|
name = "k8s.io/client-go"
|
||||||
version = "4.0.0"
|
version = "4.0.0"
|
||||||
|
|
||||||
|
[[constraint]]
|
||||||
|
name = "k8s.io/apimachinery"
|
||||||
|
branch = "release-1.7"
|
||||||
|
|||||||
@@ -16,131 +16,38 @@ limitations under the License.
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
"runtime"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/client-go/kubernetes"
|
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var namespace string = "default"
|
var namespace = "default"
|
||||||
|
|
||||||
// runCommand runs an OS command. On Linux it waits for the command to
|
|
||||||
// complete and returns the exit status (return code).
|
|
||||||
// TODO: duplicated from cmd/runmqserver/main.go
|
|
||||||
func runCommand(t *testing.T, name string, arg ...string) (string, int, error) {
|
|
||||||
t.Logf("Running command %v %v", name, arg)
|
|
||||||
cmd := exec.Command(name, arg...)
|
|
||||||
// Run the command and wait for completion
|
|
||||||
out, err := cmd.CombinedOutput()
|
|
||||||
if err != nil {
|
|
||||||
var rc int
|
|
||||||
// Only works on Linux
|
|
||||||
if runtime.GOOS == "linux" {
|
|
||||||
// func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error)
|
|
||||||
var ws unix.WaitStatus
|
|
||||||
//var rusage syscall.Rusage
|
|
||||||
unix.Wait4(cmd.Process.Pid, &ws, 0, nil)
|
|
||||||
//ee := err.(*os.SyscallError)
|
|
||||||
//ws := ee.Sys().(syscall.WaitStatus)
|
|
||||||
rc = ws.ExitStatus()
|
|
||||||
} else {
|
|
||||||
rc = -1
|
|
||||||
}
|
|
||||||
if rc == 0 {
|
|
||||||
return string(out), rc, nil
|
|
||||||
}
|
|
||||||
return string(out), rc, err
|
|
||||||
}
|
|
||||||
return string(out), 0, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func helmDelete(t *testing.T, release string) {
|
|
||||||
out, _, err := runCommand(t, "helm", "delete", "--purge", release)
|
|
||||||
if err != nil {
|
|
||||||
t.Error(out)
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func helmDeleteWithPVC(t *testing.T, cs *kubernetes.Clientset, release string) {
|
|
||||||
helmDelete(t, release)
|
|
||||||
pvcs, err := cs.CoreV1().PersistentVolumeClaims(namespace).List(metav1.ListOptions{
|
|
||||||
LabelSelector: "app=" + release + "-mq",
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
for _, pvc := range pvcs.Items {
|
|
||||||
t.Logf("Deleting persistent volume claim: %v", pvc.Name)
|
|
||||||
err := cs.CoreV1().PersistentVolumeClaims(namespace).Delete(pvc.Name, &metav1.DeleteOptions{})
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func kubeLogin(t *testing.T) *kubernetes.Clientset {
|
|
||||||
kc := os.Getenv("HOME") + "/.kube/config"
|
|
||||||
c, err := clientcmd.BuildConfigFromFlags("", kc)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
cs, err := kubernetes.NewForConfig(c)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
return cs
|
|
||||||
}
|
|
||||||
|
|
||||||
func waitForTerminated(pods types.PodInterface, name string) (v1.PodPhase, error) {
|
|
||||||
status := v1.PodUnknown
|
|
||||||
var pod *v1.Pod
|
|
||||||
var err error
|
|
||||||
for status != v1.PodSucceeded && status != v1.PodFailed {
|
|
||||||
pod, err = pods.Get(name, metav1.GetOptions{})
|
|
||||||
if err != nil {
|
|
||||||
return status, err
|
|
||||||
}
|
|
||||||
status = pod.Status.Phase
|
|
||||||
time.Sleep(1 * time.Second)
|
|
||||||
}
|
|
||||||
// The LastTerminationState doesn't seem to include an exit code
|
|
||||||
//t := pod.Status.ContainerStatuses[0].LastTerminationState
|
|
||||||
return status, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestHelmGoldenPath(t *testing.T) {
|
func TestHelmGoldenPath(t *testing.T) {
|
||||||
cs := kubeLogin(t)
|
cs := kubeLogin(t)
|
||||||
chart := "../charts/mqadvanced-dev"
|
|
||||||
image := "master.cfc:8500/default/mqadvanced"
|
|
||||||
tag := "latest"
|
|
||||||
release := strings.ToLower(t.Name())
|
release := strings.ToLower(t.Name())
|
||||||
out, _, err := runCommand(t, "helm", "install", chart, "--name", release, "--set", "license=accept", "--set", "image.repository="+image, "--set", "image.tag="+tag)
|
helmInstall(t, cs, release, "license=accept", "persistence.useDynamicProvisioning=false")
|
||||||
if err != nil {
|
defer helmDelete(t, release)
|
||||||
t.Error(out)
|
defer helmDeletePVC(t, cs, release)
|
||||||
t.Fatal(err)
|
waitForReady(t, cs, release)
|
||||||
}
|
}
|
||||||
defer helmDeleteWithPVC(t, cs, release)
|
|
||||||
|
|
||||||
nodes, err := cs.CoreV1().Nodes().List(metav1.ListOptions{})
|
func TestPersistenceDisabled(t *testing.T) {
|
||||||
if err != nil {
|
cs := kubeLogin(t)
|
||||||
t.Fatal(err)
|
release := strings.ToLower(t.Name())
|
||||||
}
|
helmInstall(t, cs, release, "license=accept", "persistence.enabled=false")
|
||||||
t.Logf("There are %d nodes in the cluster\n", len(nodes.Items))
|
defer helmDelete(t, release)
|
||||||
|
waitForReady(t, cs, release)
|
||||||
|
|
||||||
pods, err := cs.CoreV1().Pods("").List(metav1.ListOptions{
|
// Check that no PVCs were created
|
||||||
LabelSelector: "app=" + release + "-mq",
|
pvcs, err := cs.CoreV1().PersistentVolumeClaims(namespace).List(metav1.ListOptions{
|
||||||
|
LabelSelector: "release=" + release,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
t.Logf("There are %d pods with the right label in the cluster\n", len(pods.Items))
|
if len(pvcs.Items) > 0 {
|
||||||
|
t.Errorf("Expected no PVC, found %v (%+v)", len(pvcs.Items), pvcs.Items)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
186
test/kubernetes/helm_test_util.go
Normal file
186
test/kubernetes/helm_test_util.go
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
/*
|
||||||
|
© Copyright IBM Corporation 2017
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/client-go/kubernetes"
|
||||||
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
|
)
|
||||||
|
|
||||||
|
// runCommand runs an OS command. On Linux it waits for the command to
|
||||||
|
// complete and returns the exit status (return code).
|
||||||
|
// TODO: duplicated from cmd/runmqserver/main.go
|
||||||
|
func runCommand(t *testing.T, name string, arg ...string) (string, int, error) {
|
||||||
|
t.Logf("Running command: %v %v", name, strings.Trim(fmt.Sprintf("%v", arg), "[]"))
|
||||||
|
cmd := exec.Command(name, arg...)
|
||||||
|
// Run the command and wait for completion
|
||||||
|
out, err := cmd.CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
var rc int
|
||||||
|
// Only works on Linux
|
||||||
|
if runtime.GOOS == "linux" {
|
||||||
|
var ws unix.WaitStatus
|
||||||
|
unix.Wait4(cmd.Process.Pid, &ws, 0, nil)
|
||||||
|
rc = ws.ExitStatus()
|
||||||
|
} else {
|
||||||
|
rc = -1
|
||||||
|
}
|
||||||
|
if rc == 0 {
|
||||||
|
return string(out), rc, nil
|
||||||
|
}
|
||||||
|
return string(out), rc, err
|
||||||
|
}
|
||||||
|
return string(out), 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func helmInstall(t *testing.T, cs *kubernetes.Clientset, release string, values ...string) {
|
||||||
|
chart := "../../charts/ibm-mqadvanced-server-prod"
|
||||||
|
image := "mycluster.icp:8500/default/mq-devserver"
|
||||||
|
tag := "latest"
|
||||||
|
arg := []string{
|
||||||
|
"install",
|
||||||
|
"--debug",
|
||||||
|
chart,
|
||||||
|
"--name",
|
||||||
|
release,
|
||||||
|
"--set",
|
||||||
|
"image.repository=" + image,
|
||||||
|
"--set",
|
||||||
|
"image.tag=" + tag,
|
||||||
|
"--set",
|
||||||
|
"image.pullSecret=admin.registrykey",
|
||||||
|
}
|
||||||
|
for _, value := range values {
|
||||||
|
arg = append(arg, "--set", value)
|
||||||
|
}
|
||||||
|
out, _, err := runCommand(t, "helm", arg...)
|
||||||
|
t.Log(out)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(out)
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func helmDelete(t *testing.T, release string) {
|
||||||
|
out, _, err := runCommand(t, "helm", "delete", "--purge", release)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(out)
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func helmDeletePVC(t *testing.T, cs *kubernetes.Clientset, release string) {
|
||||||
|
pvcs, err := cs.CoreV1().PersistentVolumeClaims(namespace).List(metav1.ListOptions{
|
||||||
|
LabelSelector: "release=" + release,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
for _, pvc := range pvcs.Items {
|
||||||
|
t.Logf("Deleting persistent volume claim: %v", pvc.Name)
|
||||||
|
err := cs.CoreV1().PersistentVolumeClaims(namespace).Delete(pvc.Name, &metav1.DeleteOptions{})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func kubeLogin(t *testing.T) *kubernetes.Clientset {
|
||||||
|
kc := os.Getenv("HOME") + "/.kube/config"
|
||||||
|
c, err := clientcmd.BuildConfigFromFlags("", kc)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
cs, err := kubernetes.NewForConfig(c)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
return cs
|
||||||
|
}
|
||||||
|
|
||||||
|
func kubeExec(t *testing.T, podName string, name string, arg ...string) (string, int, error) {
|
||||||
|
// Current version of Kubernetes Go client doesn't support "exec", so run this via the command line
|
||||||
|
param := []string{"exec", podName, "--", name}
|
||||||
|
param = append(param, arg...)
|
||||||
|
return runCommand(t, "kubectl", param...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func waitForReady(t *testing.T, cs *kubernetes.Clientset, release string) {
|
||||||
|
pods := getPodsForHelmRelease(t, cs, release)
|
||||||
|
if len(pods.Items) != 1 {
|
||||||
|
t.Fatalf("Expected 1 pod, found %v", len(pods.Items))
|
||||||
|
}
|
||||||
|
pod := pods.Items[0]
|
||||||
|
podName := pod.Name
|
||||||
|
// Wait for the queue manager container to be started...
|
||||||
|
for {
|
||||||
|
pod, err := cs.CoreV1().Pods(namespace).Get(podName, metav1.GetOptions{})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if len(pod.Status.ContainerStatuses) > 0 {
|
||||||
|
// Got a container now, but it could still be in state "ContainerCreating"
|
||||||
|
// TODO: Check the status here properly
|
||||||
|
time.Sleep(3 * time.Second)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Exec into the container to check if it's ready
|
||||||
|
for {
|
||||||
|
// Current version of Kubernetes Go client doesn't support "exec", so run this via the command line
|
||||||
|
// TODO: If we run "chkmqready" here, it doesn't seem to work
|
||||||
|
//out, _, err := runCommand(t, "kubectl", "exec", podName, "--", "dspmq")
|
||||||
|
out, _, err := kubeExec(t, podName, "dspmq")
|
||||||
|
//out, rc, err := runCommand(t, "kubectl", "exec", podName, "--", "chkmqready")
|
||||||
|
if err != nil {
|
||||||
|
t.Error(out)
|
||||||
|
out2, _, err2 := runCommand(t, "kubectl", "describe", "pod", podName)
|
||||||
|
if err2 == nil {
|
||||||
|
t.Log(out2)
|
||||||
|
}
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if strings.Contains(out, "Running") {
|
||||||
|
t.Log("MQ is ready")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// if rc == 0 {
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
time.Sleep(1 * time.Second)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func getPodsForHelmRelease(t *testing.T, cs *kubernetes.Clientset, release string) *v1.PodList {
|
||||||
|
pods, err := cs.CoreV1().Pods(namespace).List(metav1.ListOptions{
|
||||||
|
LabelSelector: "release=" + release,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
return pods
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user