diff --git a/Dockerfile.dapper b/Dockerfile.dapper index 4ffab1a..cdfdc9e 100644 --- a/Dockerfile.dapper +++ b/Dockerfile.dapper @@ -1,10 +1,16 @@ FROM quay.io/submariner/shipyard-dapper-base:devel ARG DAPPER_HOST_ARCH +ARG UPX_LEVEL=-5 ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH} \ DAPPER_ENV="REPO TAG QUAY_USERNAME QUAY_PASSWORD GITHUB_SHA MAKEFLAGS CLUSTERS_ARGS DEPLOY_ARGS E2E_ARGS RELEASE_ARGS" \ DAPPER_SOURCE=/go/src/github.com/submariner-io/submariner-charts DAPPER_DOCKER_SOCKET=true ENV DAPPER_OUTPUT=${DAPPER_SOURCE}/output PATH=${DAPPER_SOURCE}/bin/:${PATH} +ENV HELM_VERSION=v3.4.1 + +RUN curl "https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz" | tar -xzf - && \ + mv linux-${ARCH}/helm /go/bin/ && chmod a+x /go/bin/helm && rm -rf linux-${ARCH} && \ + find /go/bin -type f -executable -newercc /proc | xargs -r upx ${UPX_LEVEL} WORKDIR ${DAPPER_SOURCE} diff --git a/deploy_helm b/deploy_helm index d1f45fd..207c9c3 100644 --- a/deploy_helm +++ b/deploy_helm @@ -9,22 +9,8 @@ readonly SUBMARINER_PSK=$(LC_CTYPE=C tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w ### Functions ### -function install_helm() { - if kubectl -n kube-system rollout status deploy/tiller-deploy --timeout=3s > /dev/null 2>&1; then - echo "Helm already installed, skipping helm installation..." - return - fi - - echo "Installing helm..." - kubectl -n kube-system create serviceaccount tiller - kubectl create clusterrolebinding tiller --clusterrole=cluster-admin --serviceaccount=kube-system:tiller - helm --kube-context "${cluster}" init --service-account tiller - kubectl -n kube-system rollout status deploy/tiller-deploy --timeout=30s -} - function deploytool_prereqs() { - helm init --client-only - run_all_clusters install_helm + helm version } function setup_broker() { @@ -33,9 +19,9 @@ function setup_broker() { else echo "Installing submariner broker..." # shellcheck disable=SC2086 # Split on purpose - helm install ./submariner-k8s-broker \ + helm install "${SUBMARINER_BROKER_NS}" ./submariner-k8s-broker \ + --create-namespace \ --kube-context "${cluster}" \ - --name "${SUBMARINER_BROKER_NS}" \ --namespace "${SUBMARINER_BROKER_NS}" \ ${deploytool_broker_args} fi @@ -56,8 +42,9 @@ function helm_install_subm() { echo "Installing Submariner..." # shellcheck disable=SC2086 # Split on purpose - helm --kube-context "${cluster}" install ./submariner-operator \ - --name submariner-operator \ + helm --kube-context "${cluster}" install submariner-operator \ + ./submariner-operator \ + --create-namespace \ --namespace "${SUBM_NS}" \ --set ipsec.psk="${SUBMARINER_PSK}" \ --set broker.server="${submariner_broker_url}" \ diff --git a/submariner-k8s-broker/templates/crd.yaml b/submariner-k8s-broker/crds/crd.yaml similarity index 96% rename from submariner-k8s-broker/templates/crd.yaml rename to submariner-k8s-broker/crds/crd.yaml index 60b3f6f..6578b34 100644 --- a/submariner-k8s-broker/templates/crd.yaml +++ b/submariner-k8s-broker/crds/crd.yaml @@ -1,10 +1,7 @@ -{{- if .Values.crd.create -}} apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: clusters.submariner.io - annotations: - "helm.sh/hook": crd-install spec: group: submariner.io version: v1 @@ -17,8 +14,6 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: endpoints.submariner.io - annotations: - "helm.sh/hook": crd-install spec: group: submariner.io version: v1 @@ -31,8 +26,6 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: gateways.submariner.io - annotations: - "helm.sh/hook": crd-install spec: group: submariner.io version: v1 @@ -46,13 +39,10 @@ spec: description: High Availability Status of the Gateway JSONPath: .status.haStatus --- -{{- if .Values.submariner.serviceDiscovery }} apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: multiclusterservices.lighthouse.submariner.io - annotations: - "helm.sh/hook": crd-install spec: group: lighthouse.submariner.io version: v1 @@ -81,8 +71,6 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: serviceexports.lighthouse.submariner.io - annotations: - "helm.sh/hook": crd-install spec: group: lighthouse.submariner.io version: v2alpha1 @@ -96,8 +84,6 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: serviceimports.lighthouse.submariner.io - annotations: - "helm.sh/hook": crd-install spec: group: lighthouse.submariner.io version: v2alpha1 @@ -111,8 +97,6 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: serviceexports.multicluster.x-k8s.io - annotations: - "helm.sh/hook": crd-install spec: group: multicluster.x-k8s.io scope: Namespaced @@ -194,8 +178,6 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: serviceimports.multicluster.x-k8s.io - annotations: - "helm.sh/hook": crd-install spec: group: multicluster.x-k8s.io scope: Namespaced @@ -340,5 +322,3 @@ spec: x-kubernetes-list-map-keys: - cluster x-kubernetes-list-type: map -{{- end -}} -{{- end -}} \ No newline at end of file diff --git a/submariner-operator/templates/crd.yaml b/submariner-operator/crds/crd.yaml similarity index 99% rename from submariner-operator/templates/crd.yaml rename to submariner-operator/crds/crd.yaml index 457a96f..73b7ff8 100644 --- a/submariner-operator/templates/crd.yaml +++ b/submariner-operator/crds/crd.yaml @@ -4,7 +4,6 @@ kind: CustomResourceDefinition metadata: name: submariners.submariner.io annotations: - "helm.sh/hook": crd-install controller-gen.kubebuilder.io/version: v0.3.0 spec: group: submariner.io diff --git a/submariner/templates/crd.yaml b/submariner/crds/crd.yaml similarity index 96% rename from submariner/templates/crd.yaml rename to submariner/crds/crd.yaml index c7e9fa1..c9ba4cf 100644 --- a/submariner/templates/crd.yaml +++ b/submariner/crds/crd.yaml @@ -1,10 +1,7 @@ -{{- if .Values.crd.create -}} apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: clusters.submariner.io - annotations: - "helm.sh/hook": crd-install spec: group: submariner.io version: v1 @@ -17,8 +14,6 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: endpoints.submariner.io - annotations: - "helm.sh/hook": crd-install spec: group: submariner.io version: v1 @@ -31,8 +26,6 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: gateways.submariner.io - annotations: - "helm.sh/hook": crd-install spec: group: submariner.io version: v1 @@ -46,13 +39,10 @@ spec: description: High Availability Status of the Gateway JSONPath: .status.haStatus --- -{{- if .Values.submariner.serviceDiscovery }} apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: multiclusterservices.lighthouse.submariner.io - annotations: - "helm.sh/hook": crd-install spec: group: lighthouse.submariner.io version: v1 @@ -81,8 +71,6 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: serviceexports.lighthouse.submariner.io - annotations: - "helm.sh/hook": crd-install spec: group: lighthouse.submariner.io version: v2alpha1 @@ -96,8 +84,6 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: serviceimports.lighthouse.submariner.io - annotations: - "helm.sh/hook": crd-install spec: group: lighthouse.submariner.io version: v2alpha1 @@ -111,8 +97,6 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: serviceexports.multicluster.x-k8s.io - annotations: - "helm.sh/hook": crd-install spec: group: multicluster.x-k8s.io scope: Namespaced @@ -194,8 +178,6 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: serviceimports.multicluster.x-k8s.io - annotations: - "helm.sh/hook": crd-install spec: group: multicluster.x-k8s.io scope: Namespaced @@ -340,5 +322,3 @@ spec: x-kubernetes-list-map-keys: - cluster x-kubernetes-list-type: map -{{- end }} -{{- end -}}