Kubernetes deployment artifacts for Canonical's MaaS.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. # Copyright 2017 AT&T Intellectual Property. All other rights reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. DOCKER_REGISTRY ?= quay.io
  15. REGION_SUFFIX ?= maas-region
  16. IMG_COMMON_DIR ?= images
  17. REGION_IMG_DIR ?= images/maas-region-controller
  18. RACK_SUFFIX ?= maas-rack
  19. RACK_IMG_DIR ?= images/maas-rack-controller
  20. CACHE_SUFFIX ?= maas-cache
  21. CACHE_IMG_DIR ?= images/sstream-cache
  22. IMAGE_PREFIX ?= airshipit
  23. IMAGE_TAG ?= untagged
  24. PROXY ?= http://proxy.foo.com:8000
  25. NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
  26. USE_PROXY ?= false
  27. PUSH_IMAGE ?= false
  28. # use this variable for image labels added in internal build process
  29. LABEL ?= org.airshipit.build=community
  30. COMMIT ?= $(shell git rev-parse HEAD)
  31. IMAGE_NAME := maas-rack-controller maas-region-controller sstream-cache
  32. BUILD_DIR := $(shell mktemp -d)
  33. HELM := $(BUILD_DIR)/helm
  34. SSTREAM_IMAGE := "https://images.maas.io/ephemeral-v3/daily/"
  35. UBUNTU_BASE_IMAGE ?= ubuntu:16.04
  36. .PHONY: images
  37. #Build all images in the list
  38. images: $(IMAGE_NAME)
  39. $(IMAGE_NAME):
  40. @echo
  41. @echo "===== Processing [$@] image ====="
  42. @make build IMAGE=${DOCKER_REGISTRY}/${IMAGE_PREFIX}/$@:${IMAGE_TAG} IMAGE_DIR=images/$@
  43. # Create tgz of the chart
  44. .PHONY: charts
  45. charts: helm_lint
  46. $(HELM) package build/charts/maas
  47. # Perform Linting
  48. .PHONY: lint
  49. lint: helm_lint
  50. # Dry run templating of chart
  51. .PHONY: dry-run
  52. dry-run: helm_lint
  53. tools/helm_tk.sh $(HELM)
  54. $(HELM) template build/charts/maas
  55. # Make targets intended for use by the primary targets above.
  56. # Install helm binary
  57. .PHONY: helm-install
  58. helm-install:
  59. tools/helm_install.sh $(HELM)
  60. .PHONY: build
  61. build:
  62. ifeq ($(USE_PROXY), true)
  63. docker build -t $(IMAGE) --label $(LABEL) --network=host \
  64. --label "org.opencontainers.image.revision=$(COMMIT)" \
  65. --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
  66. --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
  67. -f $(IMAGE_DIR)/Dockerfile \
  68. --build-arg FROM=$(UBUNTU_BASE_IMAGE) \
  69. --build-arg http_proxy=$(PROXY) \
  70. --build-arg https_proxy=$(PROXY) \
  71. --build-arg HTTP_PROXY=$(PROXY) \
  72. --build-arg HTTPS_PROXY=$(PROXY) \
  73. --build-arg no_proxy=$(NO_PROXY) \
  74. --build-arg NO_PROXY=$(NO_PROXY) \
  75. --build-arg SSTREAM_IMAGE=$(SSTREAM_IMAGE) \
  76. $(IMAGE_DIR)
  77. else
  78. docker build -t $(IMAGE) --label $(LABEL) --network=host \
  79. --label "org.opencontainers.image.revision=$(COMMIT)" \
  80. --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
  81. --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
  82. -f $(IMAGE_DIR)/Dockerfile \
  83. --build-arg FROM=$(UBUNTU_BASE_IMAGE) \
  84. --build-arg SSTREAM_IMAGE=$(SSTREAM_IMAGE) \
  85. $(IMAGE_DIR)
  86. endif
  87. ifeq ($(PUSH_IMAGE), true)
  88. docker push $(IMAGE)
  89. endif
  90. .PHONY: clean
  91. clean:
  92. rm -rf build
  93. .PHONY: helm_lint
  94. helm_lint: clean helm-install
  95. tools/helm_tk.sh $(HELM)
  96. mkdir -p build/charts/maas
  97. cp -R charts/maas build/charts/
  98. $(HELM) dep up build/charts/maas
  99. $(HELM) lint build/charts/maas