diff --git a/Makefile b/Makefile index 1ac53d1f..e75c4bb7 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ IMAGE_TAG ?= latest HELM ?= helm LABEL ?= commit-id PYTHON = python3 -CHART = armada +CHARTS := $(patsubst charts/%/.,%,$(wildcard charts/*/.)) IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG} # VERSION INFO @@ -108,6 +108,9 @@ protoc: .PHONY: clean clean: rm -rf build + rm -f charts/*.tgz + rm -f charts/*/requirements.lock + rm -rf charts/*/charts # testing checks .PHONY: tests @@ -138,13 +141,41 @@ lint: test-pep8 helm_lint test-pep8: check-tox tox -e pep8 -.PHONY: helm-lint -helm_lint: - @tools/helm_tk.sh $(HELM) - $(HELM) dep up charts/$(CHART) - $(HELM) lint charts/$(CHART) +chartbanner: + @echo Building charts: $(CHARTS) .PHONY: charts -charts: clean - $(HELM) dep up charts/$(CHART) - $(HELM) package charts/$(CHART) +charts: $(CHARTS) + @echo Done building charts. + +.PHONY: helm-init +helm-init: $(addprefix helm-init-,$(CHARTS)) + +.PHONY: helm-init-% +helm-init-%: helm-serve + @echo Initializing chart $* + cd charts;if [ -s $*/requirements.yaml ]; then echo "Initializing $*";$(HELM) dep up $*; fi + +.PHONY: helm-serve +helm-serve: + ./tools/helm_tk.sh $(HELM) $(HELM_PIDFILE) + +.PHONY: helm-lint +helm-lint: $(addprefix helm-lint-,$(CHARTS)) + +.PHONY: helm-lint-% +helm-lint-%: helm-init-% + @echo Linting chart $* + cd charts;$(HELM) lint $* + +.PHONY: dry-run +dry-run: $(addprefix dry-run-,$(CHARTS)) + +.PHONY: dry-run-% +dry-run-%: helm-lint-% + echo Running Dry-Run on chart $* + cd charts;$(HELM) template --set pod.resources.enabled=true $* + +.PHONY: $(CHARTS) +$(CHARTS): $(addprefix dry-run-,$(CHARTS)) chartbanner + $(HELM) package -d charts charts/$@ diff --git a/charts/armada/templates/configmap-bin.yaml b/charts/armada/templates/configmap-bin.yaml index 7487b0d1..69fad3e3 100644 --- a/charts/armada/templates/configmap-bin.yaml +++ b/charts/armada/templates/configmap-bin.yaml @@ -14,12 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */}} +{{- if .Values.manifests.configmap_bin }} --- apiVersion: v1 kind: ConfigMap metadata: name: armada-bin data: + image-repo-sync.sh: | +{{- include "helm-toolkit.scripts.image_repo_sync" . | indent 4 }} ks-service.sh: | {{- include "helm-toolkit.scripts.keystone_service" . | indent 4 }} ks-endpoints.sh: | @@ -28,3 +31,4 @@ data: {{- include "helm-toolkit.scripts.keystone_user" . | indent 4 }} ks-domain-user.sh: | {{- include "helm-toolkit.scripts.keystone_domain_user" . | indent 4 }} +{{- end }} diff --git a/charts/armada/templates/deployment-api.yaml b/charts/armada/templates/deployment-api.yaml index 42367eb4..1fbbb32a 100644 --- a/charts/armada/templates/deployment-api.yaml +++ b/charts/armada/templates/deployment-api.yaml @@ -16,11 +16,10 @@ limitations under the License. {{- if .Values.manifests.deployment_api }} {{- $envAll := . }} -{{- $dependencies := .Values.dependencies.static.api }} {{- $mounts_armada_api := .Values.pod.mounts.armada_api.armada_api }} {{- $mounts_armada_api_init := .Values.pod.mounts.armada_api.init_container }} {{- $serviceAccountName := "armada-api" }} -{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} +{{ tuple $envAll "api" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRole @@ -88,11 +87,10 @@ spec: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.api.timeout | default "30" }} initContainers: -{{ tuple $envAll $dependencies $mounts_armada_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} +{{ tuple $envAll "api" $mounts_armada_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: - name: armada-api - image: {{ .Values.images.tags.api }} - imagePullPolicy: {{ .Values.images.pull_policy }} +{{ tuple $envAll "api" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{- if .Values.pod.env.armada_api }} env: diff --git a/charts/armada/templates/job-image-repo-sync.yaml b/charts/armada/templates/job-image-repo-sync.yaml new file mode 100644 index 00000000..a4248039 --- /dev/null +++ b/charts/armada/templates/job-image-repo-sync.yaml @@ -0,0 +1,4 @@ +{{- if and .Values.manifests.job_image_repo_sync .Values.images.local_registry.active }} +{{- $imageRepoSyncJob := dict "envAll" . "serviceName" "armada" -}} +{{ $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" }} +{{- end }} diff --git a/charts/armada/values.yaml b/charts/armada/values.yaml index 55fd2a62..5d01a6be 100644 --- a/charts/armada/values.yaml +++ b/charts/armada/values.yaml @@ -24,13 +24,19 @@ labels: node_selector_value: enabled images: - pull_policy: IfNotPresent tags: api: 'quay.io/attcomdev/armada:latest' - dep_check: 'quay.io/stackanetes/kubernetes-entrypoint:v0.3.0' + dep_check: 'quay.io/stackanetes/kubernetes-entrypoint:v0.3.1' ks_endpoints: 'docker.io/openstackhelm/heat:newton' ks_service: 'docker.io/openstackhelm/heat:newton' ks_user: 'docker.io/openstackhelm/heat:newton' + image_repo_sync: docker.io/docker:17.07.0 + pull_policy: "IfNotPresent" + local_registry: + active: false + exclude: + - dep_check + - image_repo_sync network: api: @@ -46,6 +52,14 @@ network: port: 31903 dependencies: + dynamic: + common: + local_image_registry: + jobs: + - armada-image-repo-sync + services: + - endpoint: node + service: local_image_registry static: api: jobs: @@ -68,6 +82,10 @@ dependencies: services: - endpoint: internal service: identity + image_repo_sync: + services: + - endpoint: internal + service: local_image_registry # typically overriden by environmental # values, but should include all endpoints @@ -120,6 +138,18 @@ endpoints: default: http host_fqdn_override: default: null + local_image_registry: + name: docker-registry + namespace: docker-registry + hosts: + default: localhost + internal: docker-registry + node: localhost + host_fqdn_override: + default: null + port: + registry: + node: 5000 secrets: identity: @@ -231,6 +261,13 @@ pod: requests: memory: "128Mi" cpu: "100m" + image_repo_sync: + requests: + memory: "128Mi" + cpu: "100m" + limits: + memory: "1024Mi" + cpu: "2000m" test: api: limits: @@ -245,6 +282,7 @@ manifests: configmap_etc: true deployment_api: true ingress_api: true + job_image_repo_sync: true job_ks_endpoints: true job_ks_service: true job_ks_user: true diff --git a/charts/tiller/templates/deployment-tiller.yaml b/charts/tiller/templates/deployment-tiller.yaml index bd1df809..c515e3eb 100644 --- a/charts/tiller/templates/deployment-tiller.yaml +++ b/charts/tiller/templates/deployment-tiller.yaml @@ -16,9 +16,8 @@ limitations under the License. {{- if .Values.manifests.deployment_tiller }} {{- $envAll := . }} -{{- $dependencies := .Values.dependencies.tiller_deploy }} {{- $serviceAccountName := "tiller-deploy" }} -{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} +{{ tuple $envAll "tiller_deploy" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding @@ -60,8 +59,7 @@ spec: serviceAccountName: {{ $serviceAccountName }} containers: - name: tiller - image: {{ .Values.images.tags.tiller }} - imagePullPolicy: {{ .Values.images.pull_policy }} +{{ tuple $envAll "tiller" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.tiller | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} env: - name: TILLER_NAMESPACE diff --git a/charts/tiller/values.yaml b/charts/tiller/values.yaml index 306b6070..1054c933 100644 --- a/charts/tiller/values.yaml +++ b/charts/tiller/values.yaml @@ -15,13 +15,18 @@ # namespace: "kube-system" dependencies: - tiller_deploy: + static: + tiller_deploy: images: tags: tiller: gcr.io/kubernetes-helm/tiller:v2.7.2 - pull_policy: "IfNotPresent" + local_registry: + # NOTE(portdirect): this tiller chart does not support image pulling + active: false + exclude: + - tiller deployment: # NOTE: Current replica is hard-coded to 1. This is a placeholder variable