diff --git a/.github/workflows/build-consumerui.yaml b/.github/workflows/build-consumerui.yaml new file mode 100644 index 00000000..6bcc8a26 --- /dev/null +++ b/.github/workflows/build-consumerui.yaml @@ -0,0 +1,51 @@ +name: Build consumerui + +on: + push: + branches: + - "master" + release: + types: [published, edited] + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Login to Container Registry + uses: docker/login-action@v2 + if: github.event_name != 'pull_request' + with: + registry: ${{ secrets.REGISTRY }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + - + name: Set Version + run: echo "VERSION=$(tail -1 consumerui/versions.txt)" >> $GITHUB_ENV + - + name: Docker metadata + id: consumerui_meta + uses: docker/metadata-action@v4 + with: + images: ${{ secrets.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/consumerui + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=raw,value=${{env.VERSION}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }} + + - + name: Build and push consumerui + uses: docker/build-push-action@v4 + with: + context: ./consumerui + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.consumerui_meta.outputs.tags }} diff --git a/.github/workflows/build-deploy.yaml b/.github/workflows/build-deploy.yaml new file mode 100644 index 00000000..fac68cab --- /dev/null +++ b/.github/workflows/build-deploy.yaml @@ -0,0 +1,91 @@ +name: Build deploy utils + +on: + push: + branches: + - "master" + release: + types: [published, edited] + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Login to Container Registry + uses: docker/login-action@v2 + with: + registry: ${{ secrets.REGISTRY }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + - + name: Set Version + run: echo "VERSION=$(tail -1 deploy/versions.txt)" >> $GITHUB_ENV + + - + name: Docker webhook metadata + id: webhook_tls_getter + uses: docker/metadata-action@v4 + with: + images: ${{ secrets.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/webhook-tls-getter + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=raw,value=${{env.VERSION}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }} + - + name: Build and push webhook-tls-getter + uses: docker/build-push-action@v4 + with: + context: ./deploy + file: ./deploy/Dockerfile + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.webhook_tls_getter.outputs.tags }} + + - + name: Docker delete-kubeplus-resources metadata + id: delete_kubeplus_resources + uses: docker/metadata-action@v4 + with: + images: ${{ secrets.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/delete-kubeplus-resources + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=raw,value=${{env.VERSION}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }} + + - + name: Build and push delete-kubeplus-resources + uses: docker/build-push-action@v4 + with: + context: ./deploy + file: ./deploy/Dockerfile.cleanup + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.delete_kubeplus_resources.outputs.tags }} + + - + name: Docker kubeconfiggenerator metadata + id: kubeconfiggenerator + uses: docker/metadata-action@v4 + with: + images: ${{ secrets.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/kubeconfiggenerator + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=raw,value=${{env.VERSION}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }} + + - + name: Build and push kubeconfiggenerator + uses: docker/build-push-action@v4 + with: + context: ./deploy + file: ./deploy/Dockerfile.kubeconfiggenerator + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.kubeconfiggenerator.outputs.tags }} diff --git a/.github/workflows/build-mutating-webhook.yaml b/.github/workflows/build-mutating-webhook.yaml new file mode 100644 index 00000000..9e8f2949 --- /dev/null +++ b/.github/workflows/build-mutating-webhook.yaml @@ -0,0 +1,51 @@ +name: Build mutating-webhook + +on: + push: + branches: + - "master" + release: + types: [published, edited] + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Login to Container Registry + uses: docker/login-action@v2 + with: + registry: ${{ secrets.REGISTRY }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + - + name: Set Version + run: echo "VERSION=$(tail -1 mutating-webhook/versions.txt)" >> $GITHUB_ENV + - + name: Docker webhook metadata + id: pac_mutating_admission_webhook + uses: docker/metadata-action@v4 + with: + images: ${{ secrets.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/pac-mutating-admission-webhook + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=raw,value=${{env.VERSION}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }} + + - + name: Build and push mutating-webhook + uses: docker/build-push-action@v4 + with: + context: . + file: mutating-webhook/Dockerfile + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.pac_mutating_admission_webhook.outputs.tags }} diff --git a/.github/workflows/build-platform-helmer.yaml b/.github/workflows/build-platform-helmer.yaml new file mode 100644 index 00000000..c0db89bd --- /dev/null +++ b/.github/workflows/build-platform-helmer.yaml @@ -0,0 +1,52 @@ +name: Build helmer + +on: + push: + branches: + - "master" + release: + types: [published, edited] + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Login to Container Registry + uses: docker/login-action@v2 + with: + registry: ${{ secrets.REGISTRY }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + - + name: Set Helmer Version + run: echo "HELMER_VERSION=$(tail -1 platform-operator/helm-pod/versions.txt)" >> $GITHUB_ENV + + - + name: Docker helm-pod metadata + id: helm_pod + uses: docker/metadata-action@v4 + with: + images: ${{ secrets.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/helm-pod + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=raw,value=${{env.HELMER_VERSION}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }} + + - + name: Build and push helm pod + uses: docker/build-push-action@v4 + with: + context: . + file: platform-operator/helm-pod/Dockerfile + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.helm_pod.outputs.tags }} diff --git a/.github/workflows/build-platform-operator.yaml b/.github/workflows/build-platform-operator.yaml new file mode 100644 index 00000000..c387d069 --- /dev/null +++ b/.github/workflows/build-platform-operator.yaml @@ -0,0 +1,52 @@ +name: Build platform-operator + +on: + push: + branches: + - "master" + release: + types: [published, edited] + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Login to Container Registry + uses: docker/login-action@v2 + with: + registry: ${{ secrets.REGISTRY }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - + name: Set platform-operator Version + run: echo "OPERATOR_VERSION=$(tail -1 platform-operator/versions.txt)" >> $GITHUB_ENV + - + name: Docker platform-operator metadata + id: platform_operator + uses: docker/metadata-action@v4 + with: + images: ${{ secrets.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/platform-operator + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=raw,value=${{env.OPERATOR_VERSION}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }} + + - + name: Build and push platform-operator + uses: docker/build-push-action@v4 + with: + context: ./platform-operator + file: platform-operator/artifacts/deployment/Dockerfile + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.platform_operator.outputs.tags }} diff --git a/consumerui/Dockerfile b/consumerui/Dockerfile index 4deba2c8..4e1ee94a 100644 --- a/consumerui/Dockerfile +++ b/consumerui/Dockerfile @@ -2,9 +2,10 @@ FROM ubuntu:20.04 RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata && apt-get install -y python3-pip python-setuptools curl wget tar sudo apt-transport-https ca-certificates socat python-yaml vim graphviz -RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl - -RUN cp /usr/bin/python3.8 /usr/bin/python +RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \ +curl -LO https://dl.k8s.io/release/v1.26.0/bin/linux/${arch}/kubectl && \ +install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \ +cp /usr/bin/python3.8 /usr/bin/python RUN wget https://github.com/cloud-ark/kubeplus/raw/master/kubeplus-kubectl-plugins.tar.gz && gunzip kubeplus-kubectl-plugins.tar.gz && tar -xvf kubeplus-kubectl-plugins.tar && cp -r /plugins/* bin/ diff --git a/consumerui/build-artifact.sh b/consumerui/build-artifact.sh index 507fd71c..fe156e1a 100755 --- a/consumerui/build-artifact.sh +++ b/consumerui/build-artifact.sh @@ -13,7 +13,7 @@ fi if [ "$artifacttype" = "versioned" ]; then version=`tail -1 versions.txt` echo "Building version $version" - docker build --no-cache -t gcr.io/cloudark-kubeplus/consumerui:$version . + docker build --no-cache -t gcr.io/cloudark-kubeplus/consumerui:$version . docker push gcr.io/cloudark-kubeplus/consumerui:$version fi diff --git a/deploy/Dockerfile b/deploy/Dockerfile index e849b574..d920fc14 100644 --- a/deploy/Dockerfile +++ b/deploy/Dockerfile @@ -1,10 +1,7 @@ FROM ubuntu:20.04 -USER root -RUN apt-get update && apt-get upgrade && apt-get install -y curl openssl jq python3 python3-pip && pip3 install pyyaml +RUN apt-get update && apt-get install -y openssl curl jq python3 python3-pip && pip3 install pyyaml ADD webhook-create-self-signed-ca-cert.sh / -RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -RUN install -o root -g root -m 0755 kubectl bin/kubectl -RUN cp bin/kubectl /root/kubectl +RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && cd /root/ && curl -LO "https://dl.k8s.io/release/v1.26.0/bin/linux/${arch}/kubectl" COPY kubeplus-non-pod-resources.yaml /root/. COPY mutatingwebhook.yaml /root/. #COPY webhook-patch-ca-bundle-new.sh /root/. diff --git a/deploy/Dockerfile.cleanup b/deploy/Dockerfile.cleanup index 926844f8..fc6a4a76 100644 --- a/deploy/Dockerfile.cleanup +++ b/deploy/Dockerfile.cleanup @@ -1,11 +1,7 @@ FROM ubuntu:20.04 USER root ADD delete-kubeplus-components.sh /root/. -#COPY kubectl /root/ -RUN apt-get update && apt-get install -y curl openssl jq python3 python3-pip && pip3 install pyyaml -#RUN cp /root/kubectl bin/. && -RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -RUN install -o root -g root -m 0755 kubectl bin/kubectl -RUN cp bin/kubectl /root/kubectl -RUN chmod +x /root/kubectl && chmod +x bin/kubectl +RUN apt-get update && apt-get install -y openssl curl jq python3 python3-pip && pip3 install pyyaml +RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && cd /root/ && curl -LO "https://dl.k8s.io/release/v1.26.0/bin/linux/${arch}/kubectl" +RUN cp /root/kubectl bin/. && chmod +x /root/kubectl && chmod +x bin/kubectl ENTRYPOINT ["/root/delete-kubeplus-components.sh"] diff --git a/deploy/Dockerfile.kubeconfiggenerator b/deploy/Dockerfile.kubeconfiggenerator index 5f521217..8bd33e6a 100644 --- a/deploy/Dockerfile.kubeconfiggenerator +++ b/deploy/Dockerfile.kubeconfiggenerator @@ -1,24 +1,13 @@ FROM ubuntu:20.04 -USER root -RUN apt-get update && apt-get upgrade && apt-get install -y curl openssl jq python3 python3-pip wget ca-certificates && pip3 install pyyaml -#COPY kubectl /root/ +RUN apt-get update && apt-get install -y curl wget openssl jq python3 python3-pip && pip3 install pyyaml Flask +RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \ + wget "https://get.helm.sh/helm-v3.11.1-linux-${arch}.tar.gz" && \ + tar xvf "helm-v3.11.1-linux-${arch}.tar.gz" && \ + mv "linux-${arch}/helm" /root/ && rm "helm-v3.11.1-linux-${arch}.tar.gz" && \ + rm -rf "linux-${arch}"/ +RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && cd /root/ && curl -LO "https://dl.k8s.io/release/v1.26.0/bin/linux/${arch}/kubectl" COPY kubeconfiggenerator.py /root/. -COPY kubeconfiggenerator.sh /root/. -ADD requirements.txt /root/requirements.txt -RUN cd /root; pip3 install -r requirements.txt -#RUN cp /root/kubectl bin/. && chmod +x /root/kubectl && chmod +x bin/kubectl && -RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -RUN install -o root -g root -m 0755 kubectl bin/kubectl -RUN cp bin/kubectl /root/kubectl -RUN chmod +x /root/kubectl && chmod +x bin/kubectl -RUN chmod +x /root/kubeconfiggenerator.sh -RUN wget https://get.helm.sh/helm-v3.12.1-linux-amd64.tar.gz \ - && gunzip helm-v3.12.1-linux-amd64.tar.gz \ - && tar -xvf helm-v3.12.1-linux-amd64.tar \ - && mv linux-amd64/helm bin/. - - -#ENTRYPOINT ["/root/kubeconfiggenerator.sh"] +RUN cp /root/kubectl bin/. && chmod +x /root/kubectl && chmod +x bin/kubectl && cp /root/helm bin/. && chmod +x /root/helm && chmod +x bin/helm EXPOSE 5005 CMD ["python3", "/root/kubeconfiggenerator.py"] diff --git a/deploy/build-artifact-clean.sh b/deploy/build-artifact-clean.sh index 1bb85e12..6b59278c 100755 --- a/deploy/build-artifact-clean.sh +++ b/deploy/build-artifact-clean.sh @@ -7,13 +7,13 @@ fi artifacttype=$1 if [ "$artifacttype" = "latest" ]; then - docker build -t gcr.io/cloudark-kubeplus/delete-kubeplus-resources:latest -f Dockerfile.cleanup . + docker build -t gcr.io/cloudark-kubeplus/delete-kubeplus-resources:latest -f ./Dockerfile.cleanup . fi if [ "$artifacttype" = "versioned" ]; then version=`tail -1 versions.txt` echo "Building version $version" - docker build -t gcr.io/cloudark-kubeplus/delete-kubeplus-resources:$version -f Dockerfile.cleanup . + docker build -t gcr.io/cloudark-kubeplus/delete-kubeplus-resources:$version -f ./Dockerfile.cleanup . docker push gcr.io/cloudark-kubeplus/delete-kubeplus-resources:$version fi diff --git a/deploy/build-artifact-kubeconfiggenerator.sh b/deploy/build-artifact-kubeconfiggenerator.sh index 8e3b6454..78a21c9a 100755 --- a/deploy/build-artifact-kubeconfiggenerator.sh +++ b/deploy/build-artifact-kubeconfiggenerator.sh @@ -7,13 +7,13 @@ fi artifacttype=$1 if [ "$artifacttype" = "latest" ]; then - docker build -f Dockerfile.kubeconfiggenerator -t gcr.io/cloudark-kubeplus/kubeconfiggenerator:latest . + docker build -f ./Dockerfile.kubeconfiggenerator -t gcr.io/cloudark-kubeplus/kubeconfiggenerator:latest . fi if [ "$artifacttype" = "versioned" ]; then version=`tail -1 versions.txt` echo "Building version $version" - docker build -f Dockerfile.kubeconfiggenerator -t gcr.io/cloudark-kubeplus/kubeconfiggenerator:$version . + docker build -f ./Dockerfile.kubeconfiggenerator -t gcr.io/cloudark-kubeplus/kubeconfiggenerator:$version . docker push gcr.io/cloudark-kubeplus/kubeconfiggenerator:$version fi diff --git a/deploy/build-artifact.sh b/deploy/build-artifact.sh index 19cd5fa0..d16326e7 100755 --- a/deploy/build-artifact.sh +++ b/deploy/build-artifact.sh @@ -7,13 +7,13 @@ fi artifacttype=$1 if [ "$artifacttype" = "latest" ]; then - docker build -t gcr.io/cloudark-kubeplus/webhook-tls-getter:latest . + docker build -t gcr.io/cloudark-kubeplus/webhook-tls-getter:latest -f ./Dockerfile . fi if [ "$artifacttype" = "versioned" ]; then version=`tail -1 versions.txt` echo "Building version $version" - docker build -t gcr.io/cloudark-kubeplus/webhook-tls-getter:$version . + docker build -t gcr.io/cloudark-kubeplus/webhook-tls-getter:$version -f ./Dockerfile . docker push gcr.io/cloudark-kubeplus/webhook-tls-getter:$version fi diff --git a/deploy/kubeplus-chart/templates/_helpers.tpl b/deploy/kubeplus-chart/templates/_helpers.tpl new file mode 100644 index 00000000..b20ce9a1 --- /dev/null +++ b/deploy/kubeplus-chart/templates/_helpers.tpl @@ -0,0 +1,49 @@ +{{- define "webhooktlsGetterImage" -}} +{{- $registryName := .Values.webhooktlsGetter.image.registry -}} +{{- $imageName := .Values.webhooktlsGetter.image.repository -}} +{{- $tag := .Values.webhooktlsGetter.image.tag -}} +{{- printf "%s/%s:%s" $registryName $imageName $tag -}} +{{- end -}} + +{{- define "kubeconfiggeneratorImage" -}} +{{- $registryName := .Values.kubeconfiggenerator.image.registry -}} +{{- $imageName := .Values.kubeconfiggenerator.image.repository -}} +{{- $tag := .Values.kubeconfiggenerator.image.tag -}} +{{- printf "%s/%s:%s" $registryName $imageName $tag -}} +{{- end -}} + +{{- define "mutatingAdmissionWebhookImage" -}} +{{- $registryName := .Values.mutatingAdmissionWebhook.image.registry -}} +{{- $imageName := .Values.mutatingAdmissionWebhook.image.repository -}} +{{- $tag := .Values.mutatingAdmissionWebhook.image.tag -}} +{{- printf "%s/%s:%s" $registryName $imageName $tag -}} +{{- end -}} + +{{- define "platformOperatorImage" -}} +{{- $registryName := .Values.platformOperator.image.registry -}} +{{- $imageName := .Values.platformOperator.image.repository -}} +{{- $tag := .Values.platformOperator.image.tag -}} +{{- printf "%s/%s:%s" $registryName $imageName $tag -}} +{{- end -}} + + +{{- define "consumeruiImage" -}} +{{- $registryName := .Values.consumerui.image.registry -}} +{{- $imageName := .Values.consumerui.image.repository -}} +{{- $tag := .Values.consumerui.image.tag -}} +{{- printf "%s/%s:%s" $registryName $imageName $tag -}} +{{- end -}} + +{{- define "helmerImage" -}} +{{- $registryName := .Values.helmer.image.registry -}} +{{- $imageName := .Values.helmer.image.repository -}} +{{- $tag := .Values.helmer.image.tag -}} +{{- printf "%s/%s:%s" $registryName $imageName $tag -}} +{{- end -}} + +{{- define "cleanupKubeplusComponentsImage" -}} +{{- $registryName := .Values.cleanupKubeplusComponents.image.registry -}} +{{- $imageName := .Values.cleanupKubeplusComponents.image.repository -}} +{{- $tag := .Values.cleanupKubeplusComponents.image.tag -}} +{{- printf "%s/%s:%s" $registryName $imageName $tag -}} +{{- end -}} diff --git a/deploy/kubeplus-chart/templates/kubeplus-components-6.yaml b/deploy/kubeplus-chart/templates/kubeplus-components-6.yaml index f5537963..faa5f0dc 100644 --- a/deploy/kubeplus-chart/templates/kubeplus-components-6.yaml +++ b/deploy/kubeplus-chart/templates/kubeplus-components-6.yaml @@ -302,8 +302,8 @@ spec: initContainers: #containers: - name: webhook-cert-setup - image: {{ .Values.WEBHOOK_INIT_CONTAINER }} #gcr.io/cloudark-kubeplus/webhook-tls-getter:3.0.26 - imagePullPolicy: IfNotPresent + image: {{ template "webhooktlsGetterImage" . }} + imagePullPolicy: {{ .Values.webhooktlsGetter.image.pullPolicy | quote }} env: - name: KUBEPLUS_NAMESPACE valueFrom: @@ -319,11 +319,8 @@ spec: - "webhook-tls-certificates" containers: - name: kubeconfiggenerator - image: {{ .Values.CRD_REGISTRATION_HELPER }} #gcr.io/cloudark-kubeplus/kubeconfiggenerator:3.0.27 - imagePullPolicy: IfNotPresent - resources: - requests: - ephemeral-storage: "70Mi" + image: {{ template "kubeconfiggeneratorImage" . }} + imagePullPolicy: {{ .Values.kubeconfiggenerator.image.pullPolicy | quote }} env: - name: KUBEPLUS_NAMESPACE valueFrom: @@ -337,11 +334,8 @@ spec: - name: shared-data mountPath: /crdinstances - name: crd-hook - image: {{ .Values.MUTATING_WEBHOOK }} #gcr.io/cloudark-kubeplus/pac-mutating-admission-webhook:3.0.14 - imagePullPolicy: IfNotPresent - resources: - requests: - ephemeral-storage: "10Mi" + image: {{ template "mutatingAdmissionWebhookImage" . }} + imagePullPolicy: {{ .Values.mutatingAdmissionWebhook.image.pullPolicy | quote }} env: - name: CHECK_KYVERNO_POLICIES value: "{{ .Values.CHECK_KYVERNO_POLICIES }}" @@ -358,25 +352,16 @@ spec: - name: shared-data mountPath: /crdinstances - name: platform-operator - image: {{ .Values.PLATFORM_OPERATOR }} #gcr.io/cloudark-kubeplus/platform-operator:3.0.6 - imagePullPolicy: IfNotPresent - resources: - requests: - ephemeral-storage: "5Mi" + image: {{ template "platformOperatorImage" . }} + imagePullPolicy: {{ .Values.platformOperator.image.pullPolicy | quote }} command: [ "/platform-operator"] - name: consumerui - image: {{ .Values.CONSUMERUI }} #gcr.io/cloudark-kubeplus/consumerui:0.0.6 - imagePullPolicy: IfNotPresent - resources: - requests: - ephemeral-storage: "10Mi" + image: {{ template "consumeruiImage" . }} + imagePullPolicy: {{ .Values.consumerui.image.pullPolicy | quote }} command: [ "python3", "/root/consumerui.py"] - name: helmer - image: {{ .Values.HELMER }} #gcr.io/cloudark-kubeplus/helm-pod:3.0.17 - imagePullPolicy: IfNotPresent - resources: - requests: - ephemeral-storage: "10Mi" + image: {{ template "helmerImage" . }} + imagePullPolicy: {{ .Values.helmer.image.pullPolicy | quote }} command: ["/root/helm-pod"] volumeMounts: - mountPath: /chart @@ -420,9 +405,8 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - image: {{ .Values.RESOURCE_CLEANER }} #gcr.io/cloudark-kubeplus/delete-kubeplus-resources:3.0.12 - imagePullPolicy: IfNotPresent + image: {{ template "cleanupKubeplusComponentsImage" . }} + imagePullPolicy: {{ .Values.cleanupKubeplusComponents.image.pullPolicy | quote }} command: ["./root/delete-kubeplus-components.sh"] args: - "$(KUBEPLUS_NAMESPACE)" - diff --git a/deploy/kubeplus-chart/values.yaml b/deploy/kubeplus-chart/values.yaml index 66f8acb4..03c0c17a 100644 --- a/deploy/kubeplus-chart/values.yaml +++ b/deploy/kubeplus-chart/values.yaml @@ -1,4 +1,47 @@ CHECK_KYVERNO_POLICIES: NO +webhooktlsGetter: + image: + registry: gcr.io + repository: cloudark-kubeplus/webhook-tls-getter + tag: 3.0.13 + pullPolicy: IfNotPresent +kubeconfiggenerator: + image: + registry: gcr.io + repository: cloudark-kubeplus/kubeconfiggenerator + tag: 3.0.16 + pullPolicy: IfNotPresent +mutatingAdmissionWebhook: + image: + registry: gcr.io + repository: cloudark-kubeplus/pac-mutating-admission-webhook + tag: 3.0.8 + pullPolicy: IfNotPresent +platformOperator: + image: + registry: gcr.io + repository: cloudark-kubeplus/platform-operator + tag: 3.0.3 + pullPolicy: IfNotPresent +consumerui: + image: + registry: gcr.io + repository: cloudark-kubeplus/consumerui + tag: 0.0.6 + pullPolicy: IfNotPresent +helmer: + image: + registry: gcr.io + repository: cloudark-kubeplus/helm-pod + tag: 3.0.10 + pullPolicy: IfNotPresent + +cleanupKubeplusComponents: + image: + registry: gcr.io + repository: cloudark-kubeplus/delete-kubeplus-resources + tag: 3.0.12 + pullPolicy: IfNotPresent # Containers WEBHOOK_INIT_CONTAINER: gcr.io/cloudark-kubeplus/webhook-tls-getter:3.0.28 diff --git a/deploy/values.yaml b/deploy/values.yaml new file mode 100644 index 00000000..3baac8e5 --- /dev/null +++ b/deploy/values.yaml @@ -0,0 +1,44 @@ +CHECK_KYVERNO_POLICIES: NO +webhooktlsGetter: + image: + registry: gcr.io + repository: cloudark-kubeplus/webhook-tls-getter + tag: latest + pullPolicy: Never +kubeconfiggenerator: + image: + registry: gcr.io + repository: cloudark-kubeplus/kubeconfiggenerator + tag: latest + pullPolicy: Never +mutatingAdmissionWebhook: + image: + registry: gcr.io + repository: cloudark-kubeplus/pac-mutating-admission-webhook + tag: latest + pullPolicy: Never +platformOperator: + image: + registry: gcr.io + repository: cloudark-kubeplus/platform-operator + tag: latest + pullPolicy: Never +consumerui: + image: + registry: gcr.io + repository: cloudark-kubeplus/consumerui + tag: latest + pullPolicy: Never +helmer: + image: + registry: gcr.io + repository: cloudark-kubeplus/helm-pod + tag: latest + pullPolicy: Never + +cleanupKubeplusComponents: + image: + registry: gcr.io + repository: cloudark-kubeplus/delete-kubeplus-resources + tag: latest + pullPolicy: Never diff --git a/mutating-webhook/Dockerfile b/mutating-webhook/Dockerfile index cd6ed355..49281283 100644 --- a/mutating-webhook/Dockerfile +++ b/mutating-webhook/Dockerfile @@ -1,5 +1,11 @@ #FROM alpine:latest +FROM golang:1.20.1-bullseye as builder +RUN mkdir /build +ADD ./ /build/ +WORKDIR /build/mutating-webhook +RUN GO111MODULE=on; CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o crd-hook + FROM ubuntu:20.04 -ADD crd-hook /crd-hook +COPY --from=builder /build/mutating-webhook/crd-hook crd-hook ENTRYPOINT ["./crd-hook"] diff --git a/mutating-webhook/build-artifact.sh b/mutating-webhook/build-artifact.sh index ace31878..46f344be 100755 --- a/mutating-webhook/build-artifact.sh +++ b/mutating-webhook/build-artifact.sh @@ -3,21 +3,21 @@ if (( $# < 1 )); then echo "./build-artifact.sh " fi - +cd ../ artifacttype=$1 if [ "$artifacttype" = "latest" ]; then - export GO111MODULE=on; CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o crd-hook - docker build --no-cache -t gcr.io/cloudark-kubeplus/pac-mutating-admission-webhook:latest . + # export GO111MODULE=on; CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o crd-hook + docker build --no-cache -t gcr.io/cloudark-kubeplus/pac-mutating-admission-webhook:latest -f ./mutating-webhook/Dockerfile . fi if [ "$artifacttype" = "versioned" ]; then version=`tail -1 versions.txt` echo "Building version $version" - export GO111MODULE=on; CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o crd-hook + # export GO111MODULE=on; CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o crd-hook #docker build --no-cache -t lmecld/pac-mutating-admission-webhook:$version . #docker push lmecld/pac-mutating-admission-webhook:$version - docker build -t gcr.io/cloudark-kubeplus/pac-mutating-admission-webhook:$version . + docker build -t gcr.io/cloudark-kubeplus/pac-mutating-admission-webhook:$version -f ./mutating-webhook/Dockerfile . docker push gcr.io/cloudark-kubeplus/pac-mutating-admission-webhook:$version fi diff --git a/platform-operator/artifacts/deployment/Dockerfile b/platform-operator/artifacts/deployment/Dockerfile index 9644b1b5..4112c470 100644 --- a/platform-operator/artifacts/deployment/Dockerfile +++ b/platform-operator/artifacts/deployment/Dockerfile @@ -1,3 +1,9 @@ +FROM golang:1.20.1-bullseye as builder +RUN mkdir /build +ADD ./ /build/ +WORKDIR /build/ +RUN export GOOS=linux; go build . + FROM fedora -ADD platform-operator / +COPY --from=builder /build/platform-operator / ENTRYPOINT ["/platform-operator"] diff --git a/platform-operator/build-artifact.sh b/platform-operator/build-artifact.sh index 09138839..a8300387 100755 --- a/platform-operator/build-artifact.sh +++ b/platform-operator/build-artifact.sh @@ -6,21 +6,23 @@ fi artifacttype=$1 +# cd ../ + if [ "$artifacttype" = "latest" ]; then - CGO_ENABLED=0 export GOOS=linux; go build . - #export GOOS=linux; go build . - cp platform-operator ./artifacts/deployment/platform-operator - docker build -t gcr.io/cloudark-kubeplus/platform-operator:latest ./artifacts/deployment + #export GO111MODULE=off; export GOOS=linux; go build . + # export GOOS=linux; go build . + #cp platform-operator ./artifacts/deployment/platform-operator + docker build -t gcr.io/cloudark-kubeplus/platform-operator:latest -f ./artifacts/deployment/Dockerfile . fi if [ "$artifacttype" = "versioned" ]; then version=`tail -1 versions.txt` echo "Building version $version" - CGO_ENABLED=0 export GOOS=linux; go build . - #export GOOS=linux; go build . - cp platform-operator ./artifacts/deployment/platform-operator + #export GO111MODULE=off; export GOOS=linux; go build . + # export GOOS=linux; go build . + #cp platform-operator ./artifacts/deployment/platform-operator #echo "PROJECT_ID $PROJECT_ID" - docker build -t gcr.io/cloudark-kubeplus/platform-operator:$version ./artifacts/deployment + docker build -t gcr.io/cloudark-kubeplus/platform-operator:$version -f ./artifacts/deployment/Dockerfile . #docker build -t lmecld/platform-operator:$version ./artifacts/deployment #docker push lmecld/platform-operator:$version docker push gcr.io/cloudark-kubeplus/platform-operator:$version diff --git a/platform-operator/helm-pod/Dockerfile b/platform-operator/helm-pod/Dockerfile index 26664e6a..673c25f3 100644 --- a/platform-operator/helm-pod/Dockerfile +++ b/platform-operator/helm-pod/Dockerfile @@ -1,18 +1,20 @@ -FROM ubuntu:20.04 -USER root -#COPY kubectl /root/ -COPY helm-pod /root/ -RUN apt-get update && apt-get install wget curl vim python -y && mkdir /.helm && mkdir -p /.helm/repository && mkdir /.helm/repository/cache && mkdir -p /.helm/cache/archive && mkdir -p /.helm/cache/plugins && wget https://github.com/cloud-ark/kubeplus/raw/master/kubeplus-kubectl-plugins.tar.gz && gunzip kubeplus-kubectl-plugins.tar.gz && tar -xvf kubeplus-kubectl-plugins.tar && cp -r /plugins/* bin/ -RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -RUN install -o root -g root -m 0755 kubectl bin/kubectl -RUN cp bin/kubectl /root/kubectl -#RUN cp /root/kubectl bin/. && -RUN chmod +x /root/kubectl && chmod +x /bin/kubectl -RUN wget https://get.helm.sh/helm-v3.12.1-linux-amd64.tar.gz \ - && gunzip helm-v3.12.1-linux-amd64.tar.gz \ - && tar -xvf helm-v3.12.1-linux-amd64.tar \ - && mv linux-amd64/helm bin/. +#FROM alpine:latest +FROM golang:1.20.1-bullseye as builder +RUN mkdir /build +ADD ./ /build/ +WORKDIR /build/platform-operator/helm-pod +RUN export GO111MODULE=on; export GOOS=linux; go mod vendor; go build . -#COPY repositories.yaml /.helm/repository/ -#COPY cloudark-helm-charts-index.yaml /.helm/repository/cache/ +FROM ubuntu:20.04 +COPY --from=builder /build/platform-operator/helm-pod/helm-pod /root/ +RUN apt-get update && apt-get install wget curl vim python -y +RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \ + wget "https://get.helm.sh/helm-v3.11.1-linux-${arch}.tar.gz" && \ + tar xvf "helm-v3.11.1-linux-${arch}.tar.gz" && \ + mv "linux-${arch}/helm" /root/ && rm "helm-v3.11.1-linux-${arch}.tar.gz" && \ + rm -rf "linux-${arch}"/ +RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && cd /root/ && curl -LO "https://dl.k8s.io/release/v1.26.0/bin/linux/${arch}/kubectl" +RUN apt-get update && apt-get install wget curl vim python -y && mkdir /.helm && mkdir -p /.helm/repository && mkdir /.helm/repository/cache && mkdir -p /.helm/cache/archive && mkdir -p /.helm/cache/plugins && chmod +x /root/helm && chmod +x /root/kubectl && wget https://github.com/cloud-ark/kubeplus/raw/master/kubeplus-kubectl-plugins.tar.gz && gunzip kubeplus-kubectl-plugins.tar.gz && tar -xvf kubeplus-kubectl-plugins.tar && cp -r /plugins/* bin/ && cp /root/helm bin/. && cp /root/kubectl bin/. +COPY platform-operator/helm-pod/repositories.yaml /.helm/repository/ +COPY platform-operator/helm-pod/cloudark-helm-charts-index.yaml /.helm/repository/cache/ ENTRYPOINT ["/root/helm-pod"] diff --git a/platform-operator/helm-pod/Dockerfile.waiter b/platform-operator/helm-pod/Dockerfile.waiter index 9a4b759a..e028c148 100644 --- a/platform-operator/helm-pod/Dockerfile.waiter +++ b/platform-operator/helm-pod/Dockerfile.waiter @@ -1,5 +1,5 @@ FROM ubuntu:20.04 -COPY kubectl /root/ +RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && cd /root/ && curl -LO "https://dl.k8s.io/release/v1.26.0/bin/linux/${arch}/kubectl" COPY waiter.sh /root/ RUN chmod +x /root/kubectl && chmod +x /root/waiter.sh ENTRYPOINT ["/root/waiter.sh"] diff --git a/platform-operator/helm-pod/build-artifact.sh b/platform-operator/helm-pod/build-artifact.sh index 04c96dd3..3af083e5 100755 --- a/platform-operator/helm-pod/build-artifact.sh +++ b/platform-operator/helm-pod/build-artifact.sh @@ -5,17 +5,18 @@ if (( $# < 1 )); then fi artifacttype=$1 +cd ../../ if [ "$artifacttype" = "latest" ]; then - export GO111MODULE=on; CGO_ENABLED=0 export GOOS=linux; go build . - docker build --no-cache -t gcr.io/cloudark-kubeplus/helm-pod:latest . + # export GO111MODULE=on; export GOOS=linux; go build . + docker build --no-cache -t gcr.io/cloudark-kubeplus/helm-pod:latest -f ./platform-operator/helm-pod/Dockerfile . fi if [ "$artifacttype" = "versioned" ]; then version=`tail -1 versions.txt` echo "Building version $version" - export GO111MODULE=on; CGO_ENABLED=0 export GOOS=linux; go build . - docker build -t gcr.io/cloudark-kubeplus/helm-pod:$version . + # export GO111MODULE=on; export GOOS=linux; go build . + docker build -t gcr.io/cloudark-kubeplus/helm-pod:$version ./platform-operator/helm-pod/Dockerfile . docker push gcr.io/cloudark-kubeplus/helm-pod:$version fi