diff --git a/.dockerignore b/.dockerignore index dc09107e82..904167a978 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,6 @@ web/node_modules web/src api -dev docs kustomize migrations diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index bb5134649d..248875383f 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -2108,7 +2108,7 @@ jobs: - name: run kots admin-console push-images run: | set +e - ./bin/kots admin-console push-images ./hack/tests/small.airgap ttl.sh/automated-${{ github.run_id }} + ./bin/kots admin-console push-images ./e2e/artifacts/small.airgap ttl.sh/automated-${{ github.run_id }} validate-kots-admin-console-generate-manifests: diff --git a/.github/workflows/metrics.yml b/.github/workflows/metrics.yml deleted file mode 100644 index 0d2507de5c..0000000000 --- a/.github/workflows/metrics.yml +++ /dev/null @@ -1,24 +0,0 @@ -on: - push: - branches: - - main - -name: Metrics - -env: - DOCKER_BUILDKIT: 1 - -jobs: - docker-image-size: - runs-on: ubuntu-latest - strategy: - matrix: - service: [[kots, deploy/okteto, .], [web, web, web], [kurl-proxy, kurl_proxy, kurl_proxy], [migrations, migrations, migrations]] - steps: - - uses: actions/checkout@v4 - - run: | - docker build -t ${{ matrix.service[0] }} -f ${{ matrix.service[1] }}/okteto.Dockerfile ${{ matrix.service[2] }}/ - curl -X POST "https://api.datadoghq.com/api/v1/series" \ - -H "Content-Type: text/json" \ - -H "DD-API-KEY: ${{secrets.DD_API_KEY}}" \ - -d '{"series":[{"metric":"build.size.docker","points":[['"$(date +%s)"','"$(docker inspect -f "{{.Size}}" ${{ matrix.service[0] }})"']],"tags":["service:${{ matrix.service[0] }}"]}]}' \ No newline at end of file diff --git a/.gitignore b/.gitignore index b765820f1e..8a208024b1 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,10 @@ packages/* # precommit .pre-commit-config.yaml + +# tmp files +*.tmp + +# dev cache +dev/.gocache +dev/.gomodcache diff --git a/Makefile b/Makefile index 19d8424d09..cfae760260 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,13 @@ include Makefile.build.mk -CURRENT_USER := $(if $(GITHUB_USER),$(GITHUB_USER),$(shell id -u -n)) +CURRENT_USER := $(shell id -u -n) MINIO_TAG ?= 0.20240909.165928-r0 RQLITE_TAG ?= 8.30.2-r0 DEX_TAG ?= 2.41.1-r0 LVP_TAG ?= v0.6.7 PACT_PUBLISH_CONTRACT ?= false -define sendMetrics -@if [ -z "${PROJECT_NAME}" ]; then \ - echo "PROJECT_NAME not defined"; \ - exit 1; \ -fi -@curl -X POST "https://api.datadoghq.com/api/v1/series" \ --H "Content-Type: text/json" \ --H "DD-API-KEY: ${DD_API_KEY}" \ --d "{\"series\": [{\"metric\": \"build.time\",\"points\": [[$$(date +%s), $$(expr $$(date +%s) - $$(cat start-time))]],\"tags\": [\"service:${PROJECT_NAME}\"]}]}" -endef - -.PHONY: capture-start-time -capture-start-time: - @echo $$(date +%s) > start-time - -.PHONY: report-metric -report-metric: - @$(if ${DD_API_KEY}, $(call sendMetrics)) - @rm start-time +OS ?= linux +ARCH ?= $(shell go env GOARCH) .PHONY: test test: @@ -48,6 +31,10 @@ pact-consumer: e2e: ${MAKE} -C e2e +.PHONY: cluster +cluster: + ./cluster.sh + .PHONY: integration-cli integration-cli: go build ${LDFLAGS} -o bin/kots-integration ./integration @@ -57,15 +44,21 @@ ci-test: go test $(TEST_BUILDFLAGS) ./pkg/... ./cmd/... ./integration/... -coverprofile cover.out .PHONY: kots -kots: PROJECT_NAME = kots -kots: capture-start-time kots-real report-metric - -.PHONY: kots-real -kots-real: +kots: mkdir -p web/dist touch web/dist/README.md go build ${LDFLAGS} -o bin/kots $(BUILDFLAGS) github.com/replicatedhq/kots/cmd/kots +.PHONY: build +build: + mkdir -p web/dist + touch web/dist/README.md + go build ${LDFLAGS} ${GCFLAGS} -v -o bin/kotsadm $(BUILDFLAGS) ./cmd/kotsadm + +.PHONY: run +run: + ./bin/kotsadm api + .PHONY: fmt fmt: go fmt ./pkg/... ./cmd/... @@ -86,35 +79,29 @@ mock: mockgen -source=pkg/handlers/interface.go -destination=pkg/handlers/mock/mock.go mockgen -source=pkg/operator/client/client_interface.go -destination=pkg/operator/client/mock/mock.go -.PHONY: build -build: PROJECT_NAME = kotsadm -build: capture-start-time build-real report-metric +.PHONY: dev +dev: + @dev/scripts/dev.sh -.PHONY: build-real -build-real: - mkdir -p web/dist - touch web/dist/README.md - go build ${LDFLAGS} ${GCFLAGS} -v -o bin/kotsadm $(BUILDFLAGS) ./cmd/kotsadm +.PHONY: %-up +%-up: + @dev/scripts/up.sh $* -.PHONY: tidy -tidy: - go mod tidy +.PHONY: %-down +%-down: + @dev/scripts/down.sh $* -.PHONY: run -run: - ./bin/kotsadm api +.PHONY: %-up-ec +%-up-ec: + @dev/scripts/up-ec.sh $* -.PHONY: okteto-dev -okteto-dev: - ## We download all go modules, instead of putting them in the container. This will - ## use the PVC that everyone has, and will build a cache. - ## - ## We also run `make build` here because the initial compilation is slow and - ## this enabled `okteto up` to do all of the long-running stuff and give the user - ## a pretty good env right after - @go mod download -x - @make build - @printf "\n\n To build and run api, run: \n\n # make build run\n\n" +.PHONY: %-down-ec +%-down-ec: + @dev/scripts/down-ec.sh $* + +.PHONY: reset +reset: + kubectl delete -R -f dev/manifests --ignore-not-found # Debugging .PHONY: debug-build @@ -130,26 +117,22 @@ web: source .image.env && ${MAKE} -C web build-kotsadm .PHONY: build-ttl.sh -build-ttl.sh: export GOOS ?= linux -build-ttl.sh: export GOARCH ?= amd64 build-ttl.sh: web kots build - docker build --platform $(GOOS)/$(GOARCH) -f deploy/Dockerfile -t ttl.sh/${CURRENT_USER}/kotsadm:24h . + docker build --platform $(OS)/$(ARCH) -f dev/dockerfiles/kotsadm/Dockerfile.ttlsh -t ttl.sh/${CURRENT_USER}/kotsadm:24h . docker push ttl.sh/${CURRENT_USER}/kotsadm:24h .PHONY: all-ttl.sh -all-ttl.sh: export GOOS ?= linux -all-ttl.sh: export GOARCH ?= amd64 all-ttl.sh: build-ttl.sh source .image.env && \ IMAGE=ttl.sh/${CURRENT_USER}/kotsadm-migrations:24h \ - DOCKER_BUILD_ARGS="--platform $(GOOS)/$(GOARCH)" \ + DOCKER_BUILD_ARGS="--platform $(OS)/$(ARCH)" \ make -C migrations build_schema - docker pull --platform $(GOOS)/$(GOARCH) kotsadm/minio:${MINIO_TAG} + docker pull --platform $(OS)/$(ARCH) kotsadm/minio:${MINIO_TAG} docker tag kotsadm/minio:${MINIO_TAG} ttl.sh/${CURRENT_USER}/minio:${MINIO_TAG} docker push ttl.sh/${CURRENT_USER}/minio:${MINIO_TAG} - docker pull --platform $(GOOS)/$(GOARCH) kotsadm/rqlite:${RQLITE_TAG} + docker pull --platform $(OS)/$(ARCH) kotsadm/rqlite:${RQLITE_TAG} docker tag kotsadm/rqlite:${RQLITE_TAG} ttl.sh/${CURRENT_USER}/rqlite:${RQLITE_TAG} docker push ttl.sh/${CURRENT_USER}/rqlite:${RQLITE_TAG} @@ -174,10 +157,6 @@ kotsadm-bundle-nominio: go run ./scripts/create-airgap-file.go false -.PHONY: cache -cache: - docker build -f hack/dev/skaffoldcache.Dockerfile . -t kotsadm:cache - .PHONY: init-sbom init-sbom: mkdir -p sbom/spdx diff --git a/README.md b/README.md index ba540320ee..c5b42aa49c 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,6 @@ kubectl kots install sentry-pro Set a namespace for the admin console and the application components to be installed, and provide a password for the admin console. After this command completes, the kotsadm Admin Console will be running in your cluster, listening on port :8800 on a ClusterIP service in the namespace you deployed the application to. By default this is exposed to your workstation using kubectl port-forward, but you could set up an ingress/load balancer of your own. -**NOTE** Currently, the kotsadm pod can **only** be scheduled on nodes with the `linux/amd64` platform. - ### Access the Admin Console Visit http://localhost:8800 to access the Admin Console, enter the password. @@ -40,8 +38,7 @@ kubectl kots admin-console --namespace sentry-pro ## Supportability -Currently, the KOTS CLI supports OSX (including Apple Silicon arm64) and Linux platforms. However, the Kubernetes resources -that it creates can **only** be scheduled on nodes with the `linux/amd64` platform. +Supports OSX (including Apple Silicon arm64) and Linux platforms. # Community @@ -61,22 +58,51 @@ cosign verify-blob --key sbom/key.pub --signature sbom/kots-sbom.tgz.sig sbom/ko # Development -## Github Codespaces +### Requirements + +- MacOS +- Docker Desktop with Kubernetes enabled +- jq + +### Running the Development Environment -1. Create your own [codespace](https://github.com/replicatedhq/codespace). 1. Clone the KOTS repo: ```bash - git clone git@github.com:replicatedhq/kots.git + git clone https://github.com/replicatedhq/kots.git + cd kots + ``` + +2. From the root directory, run: + ```bash + make dev + ``` + +### Testing Changes to kotsadm web + +Changes to the kotsadm web component are reflected in real-time, no manual steps required. + +### Testing Changes to kotsadm API + +1. Run the following commands: + ```bash + make kotsadm-up + make build run ``` -1. From the root directory, run: + +2. To test additional changes, stop the current process with Ctrl+C, then run the following command: ```bash - make cache - skaffold dev + make build run ``` -1. Visit the Admin Console URL. For VS Code: - ![Image 2024-02-23 at 2 55 11 PM](https://github.com/replicatedhq/kots/assets/39952863/aa86019f-0111-4d04-a142-3dfc539858a2) -1. If you'll be working on the webapp or plan on using `make all-ttl.sh` for local testing, be sure to setup yarn: +### Testing Changes to kurl-proxy web / API + +1. Run the following commands: ```bash - cd web && yarn - ``` \ No newline at end of file + make kurl-proxy-up + make build run + ``` + +2. To test additional changes, stop the current process with Ctrl+C, then run the following command: + ```bash + make build run + ``` diff --git a/cmd/imagedeps/testdata/schemahero/replacers/expected/test.mk b/cmd/imagedeps/testdata/schemahero/replacers/expected/test.mk index e322f01efc..bee96aacc7 100644 --- a/cmd/imagedeps/testdata/schemahero/replacers/expected/test.mk +++ b/cmd/imagedeps/testdata/schemahero/replacers/expected/test.mk @@ -1,4 +1,4 @@ -CURRENT_USER := $(if $(GITHUB_USER),$(GITHUB_USER),$(shell id -u -n)) +CURRENT_USER := $(shell id -u -n) SCHEMAHERO_TAG ?= 0.13.2 .PHONY: test diff --git a/cmd/imagedeps/testdata/schemahero/replacers/input/test.mk b/cmd/imagedeps/testdata/schemahero/replacers/input/test.mk index d918e5f594..1110517176 100644 --- a/cmd/imagedeps/testdata/schemahero/replacers/input/test.mk +++ b/cmd/imagedeps/testdata/schemahero/replacers/input/test.mk @@ -1,4 +1,4 @@ -CURRENT_USER := $(if $(GITHUB_USER),$(GITHUB_USER),$(shell id -u -n)) +CURRENT_USER := $(shell id -u -n) SCHEMAHERO_TAG ?= 0.13.1 .PHONY: test diff --git a/deploy/kurl/kotsadm/hack/Makefile b/deploy/kurl/kotsadm/hack/Makefile index 148a4864f7..a2c9bb7766 100644 --- a/deploy/kurl/kotsadm/hack/Makefile +++ b/deploy/kurl/kotsadm/hack/Makefile @@ -37,7 +37,7 @@ generate: DEX_TAG=$(shell source ../../../../.image.env && echo "$$DEX_TAG") \ ${MAKE} _generate -_generate: CURRENT_USER = $(if $(GITHUB_USER),$(GITHUB_USER),$(shell id -u -n)) +_generate: CURRENT_USER = $(shell id -u -n) _generate: generate-tag @cd ../template && ./generate.sh $(KOTS_VERSION) ttl.sh $(CURRENT_USER) 24h $(shell realpath ../../../../bin/kots) @rm -rf kurl/addons/kotsadm/$(KOTS_VERSION) diff --git a/deploy/okteto/.dockerignore b/deploy/okteto/.dockerignore deleted file mode 100644 index 1d25942add..0000000000 --- a/deploy/okteto/.dockerignore +++ /dev/null @@ -1,27 +0,0 @@ -.devcontainer -.github -.git -actions -design -deploy -bin -dist -hack -kurl_proxy -kustomize -migrations -scripts -testim -web -.gitignore -.image.env -.stignore -CODE_OF_CONDUCT.md -CODEOWNERS -CONTRIBUTING.md -skaffold.yaml -okteto.yml - -web -!web/webcontent.go -!web/dist \ No newline at end of file diff --git a/deploy/okteto/okteto-v2.Dockerfile b/deploy/okteto/okteto-v2.Dockerfile deleted file mode 100644 index 9abe88103d..0000000000 --- a/deploy/okteto/okteto-v2.Dockerfile +++ /dev/null @@ -1,69 +0,0 @@ -# syntax=docker/dockerfile:1.3 -FROM golang:1.23 - -EXPOSE 2345 - -RUN apt update && apt install --no-install-recommends gnupg2 curl -y \ - && apt update && apt install -y --no-install-recommends ca-certificates \ - && apt update && apt-get install -y --no-install-recommends pipx \ - && pipx install s3cmd && pipx ensurepath \ - && rm -rf /var/lib/apt/lists/* - -ENV PATH="/usr/local/bin:$PATH" - -# Install Kubectl 1.29 -ENV KUBECTL_1_29_VERSION=v1.29.0 -ENV KUBECTL_1_29_URL=https://dl.k8s.io/release/${KUBECTL_1_29_VERSION}/bin/linux/amd64/kubectl -ENV KUBECTL_1_29_SHA256SUM=0e03ab096163f61ab610b33f37f55709d3af8e16e4dcc1eb682882ef80f96fd5 -RUN curl -fsSLO "${KUBECTL_1_29_URL}" \ - && echo "${KUBECTL_1_29_SHA256SUM} kubectl" | sha256sum -c - \ - && chmod +x kubectl \ - && mv kubectl /usr/local/bin//kubectl - -# Install kustomize 5 -ENV KUSTOMIZE5_VERSION=5.1.1 -ENV KUSTOMIZE5_URL=https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${KUSTOMIZE5_VERSION}/kustomize_v${KUSTOMIZE5_VERSION}_linux_amd64.tar.gz -ENV KUSTOMIZE5_SHA256SUM=3b30477a7ff4fb6547fa77d8117e66d995c2bdd526de0dafbf8b7bcb9556c85d -RUN curl -fsSL -o kustomize.tar.gz "${KUSTOMIZE5_URL}" \ - && echo "${KUSTOMIZE5_SHA256SUM} kustomize.tar.gz" | sha256sum -c - \ - && tar -xzvf kustomize.tar.gz \ - && rm kustomize.tar.gz \ - && chmod a+x kustomize \ - && mv kustomize /usr/local/bin/kustomize - -# Install helm v3 -ENV HELM3_VERSION=3.13.2 -ENV HELM3_URL=https://get.helm.sh/helm-v${HELM3_VERSION}-linux-amd64.tar.gz -ENV HELM3_SHA256SUM=55a8e6dce87a1e52c61e0ce7a89bf85b38725ba3e8deb51d4a08ade8a2c70b2d -RUN cd /tmp && curl -fsSL -o helm.tar.gz "${HELM3_URL}" \ - && echo "${HELM3_SHA256SUM} helm.tar.gz" | sha256sum -c - \ - && tar -xzvf helm.tar.gz \ - && chmod a+x linux-amd64/helm \ - && mv linux-amd64/helm /usr/local/bin/helm \ - && rm -rf helm.tar.gz linux-amd64 - -ENV DEBUG_KOTSADM=1 -ENV GOCACHE "/.cache/gocache/" -ENV GOMODCACHE "/.cache/gomodcache/" -ENV PROJECTPATH=/go/src/github.com/replicatedhq/kots - -WORKDIR $PROJECTPATH - -RUN --mount=target=$GOMODCACHE,id=gomodcache,type=cache \ - --mount=target=$GOCACHE,id=gocache,type=cache \ - go install github.com/go-delve/delve/cmd/dlv@v1.9.0 - -## Get deps -COPY go.mod go.sum ./ -RUN --mount=target=$GOMODCACHE,id=kotsadm-gomodcache,type=cache go mod download - - -## Now add the project and compile -COPY . . -RUN --mount=target=$GOCACHE,id=kotsadm-gocache,type=cache \ - --mount=target=$GOMODCACHE,id=kotsadm-gomodcache,type=cache \ - make build kots - -VOLUME [ "$GOCACHE", "$GOMODCACHE" ] - -CMD ["make", "run"] diff --git a/deploy/okteto/okteto.Dockerfile b/deploy/okteto/okteto.Dockerfile deleted file mode 100644 index 42df698b54..0000000000 --- a/deploy/okteto/okteto.Dockerfile +++ /dev/null @@ -1,71 +0,0 @@ -# syntax=docker/dockerfile:1.3 -FROM golang:1.23-bookworm as builder - -EXPOSE 2345 - -ENV GOCACHE "/.cache/gocache/" -ENV GOMODCACHE "/.cache/gomodcache/" -ENV DEBUG_KOTSADM=1 - -RUN apt-get update && apt-get install -y --no-install-recommends gnupg2 s3cmd ca-certificates \ - && rm -rf /var/lib/apt/lists/* - -ENV PATH="/usr/local/bin:$PATH" - -# Install Kubectl 1.29 -ENV KUBECTL_1_29_VERSION=v1.29.0 -ENV KUBECTL_1_29_URL=https://dl.k8s.io/release/${KUBECTL_1_29_VERSION}/bin/linux/amd64/kubectl -ENV KUBECTL_1_29_SHA256SUM=0e03ab096163f61ab610b33f37f55709d3af8e16e4dcc1eb682882ef80f96fd5 -RUN curl -fsSLO "${KUBECTL_1_29_URL}" \ - && echo "${KUBECTL_1_29_SHA256SUM} kubectl" | sha256sum -c - \ - && chmod +x kubectl \ - && mv kubectl /usr/local/bin//kubectl - -# Install kustomize 5 -ENV KUSTOMIZE5_VERSION=5.1.1 -ENV KUSTOMIZE5_URL=https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${KUSTOMIZE5_VERSION}/kustomize_v${KUSTOMIZE5_VERSION}_linux_amd64.tar.gz -ENV KUSTOMIZE5_SHA256SUM=3b30477a7ff4fb6547fa77d8117e66d995c2bdd526de0dafbf8b7bcb9556c85d -RUN curl -fsSL -o kustomize.tar.gz "${KUSTOMIZE5_URL}" \ - && echo "${KUSTOMIZE5_SHA256SUM} kustomize.tar.gz" | sha256sum -c - \ - && tar -xzvf kustomize.tar.gz \ - && rm kustomize.tar.gz \ - && chmod a+x kustomize \ - && mv kustomize /usr/local/bin/kustomize - -# Install helm v3 -ENV HELM3_VERSION=3.13.2 -ENV HELM3_URL=https://get.helm.sh/helm-v${HELM3_VERSION}-linux-amd64.tar.gz -ENV HELM3_SHA256SUM=55a8e6dce87a1e52c61e0ce7a89bf85b38725ba3e8deb51d4a08ade8a2c70b2d -RUN cd /tmp && curl -fsSL -o helm.tar.gz "${HELM3_URL}" \ - && echo "${HELM3_SHA256SUM} helm.tar.gz" | sha256sum -c - \ - && tar -xzvf helm.tar.gz \ - && chmod a+x linux-amd64/helm \ - && mv linux-amd64/helm /usr/local/bin/helm \ - && rm -rf helm.tar.gz linux-amd64 - -RUN --mount=target=$GOMODCACHE,id=gomodcache,type=cache \ - --mount=target=$GOCACHE,id=gocache,type=cache \ - go install github.com/go-delve/delve/cmd/dlv@v1.8.0 - -ENV PROJECTPATH=/go/src/github.com/replicatedhq/kots -WORKDIR $PROJECTPATH - -COPY go.mod go.sum ./ -RUN --mount=target=$GOMODCACHE,id=kots-gomodcache,type=cache go mod download - -COPY . . - -RUN --mount=target=$GOMODCACHE,id=kots-gomodcache,type=cache \ - --mount=target=$GOCACHE,id=kots-gocache,type=cache \ - make build kots && \ - mv ./bin/kotsadm /kotsadm && \ - mv ./bin/kots /kots - -RUN --mount=target=/tmp/.cache/gocache,id=kots-gocache,type=cache \ - --mount=target=/tmp/.cache/gomodcache,id=kots-gomodcache,type=cache \ - mkdir -p $GOCACHE \ - && cp -r /tmp/.cache/gocache/* $GOCACHE \ - && mkdir -p $GOMODCACHE \ - && cp -r /tmp/.cache/gomodcache/* $GOMODCACHE - -ENTRYPOINT [ "/kotsadm", "api"] diff --git a/migrations/skaffold.Dockerfile b/dev/dockerfiles/kotsadm-migrations/Dockerfile.local similarity index 60% rename from migrations/skaffold.Dockerfile rename to dev/dockerfiles/kotsadm-migrations/Dockerfile.local index 10cd37f0ef..98209d1123 100644 --- a/migrations/skaffold.Dockerfile +++ b/dev/dockerfiles/kotsadm-migrations/Dockerfile.local @@ -1,3 +1,3 @@ -FROM schemahero/schemahero:0.13.6 +FROM schemahero/schemahero:0.17.10 ADD --chown=schemahero:schemahero ./tables ./tables diff --git a/migrations/deploy/Dockerfile b/dev/dockerfiles/kotsadm-migrations/Dockerfile.ttlsh similarity index 100% rename from migrations/deploy/Dockerfile rename to dev/dockerfiles/kotsadm-migrations/Dockerfile.ttlsh diff --git a/dev/dockerfiles/kotsadm-web/Dockerfile.local b/dev/dockerfiles/kotsadm-web/Dockerfile.local new file mode 100644 index 0000000000..03a65f1c9b --- /dev/null +++ b/dev/dockerfiles/kotsadm-web/Dockerfile.local @@ -0,0 +1,8 @@ +FROM node:18-alpine +EXPOSE 3000 + +WORKDIR /replicatedhq/kots/web + +RUN apk add --no-cache make bash + +ENTRYPOINT ["make", "serve"] diff --git a/hack/dev/skaffold.Dockerfile b/dev/dockerfiles/kotsadm/Dockerfile.local similarity index 59% rename from hack/dev/skaffold.Dockerfile rename to dev/dockerfiles/kotsadm/Dockerfile.local index 4f69c3e6f6..6a60471335 100644 --- a/hack/dev/skaffold.Dockerfile +++ b/dev/dockerfiles/kotsadm/Dockerfile.local @@ -1,32 +1,10 @@ -FROM kotsadm:cache AS builder +FROM golang:1.23-alpine AS dlv-builder -ENV PROJECTPATH=/go/src/github.com/replicatedhq/kots -WORKDIR $PROJECTPATH -COPY Makefile ./ -COPY Makefile.build.mk ./ -COPY go.mod go.sum ./ -COPY cmd ./cmd -COPY pkg ./pkg -COPY web/webcontent.go ./web/webcontent.go +RUN go install github.com/go-delve/delve/cmd/dlv@v1.22.1 -ARG DEBUG_KOTSADM=0 - -RUN make build kots - -FROM debian:bookworm - -RUN apt-get update && apt-get install -y --no-install-recommends curl gnupg2 \ - && apt-get update && apt-get install -y --no-install-recommends git \ - && rm -rf /var/lib/apt/lists/* +FROM golang:1.23-alpine -ENV GO111MODULE=on -ENV PATH="/usr/local/bin:$PATH" - -RUN apt-get update && apt-get install -y --no-install-recommends \ - curl ca-certificates git gnupg2 s3cmd \ - && for i in 1 2 3 4 5 6 7 8; do mkdir -p "/usr/share/man/man$i"; done \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf /usr/share/man/man* +RUN apk add --no-cache ca-certificates s3cmd curl git make bash # Install Kubectl 1.29 ENV KUBECTL_1_29_VERSION=v1.29.0 @@ -59,17 +37,14 @@ RUN cd /tmp && curl -fsSL -o helm.tar.gz "${HELM3_URL}" \ && mv linux-amd64/helm /usr/local/bin/helm \ && rm -rf helm.tar.gz linux-amd64 -COPY --from=builder /go/bin/dlv . -COPY --from=builder /go/src/github.com/replicatedhq/kots/bin/kotsadm /kotsadm -COPY --from=builder /go/src/github.com/replicatedhq/kots/bin/kots /kots - -EXPOSE 40000 +WORKDIR /replicatedhq/kots -# Should be entrypoint +COPY --from=dlv-builder /go/bin/dlv /dlv +COPY ./bin/kotsadm /kotsadm +COPY ./bin/kots /kots ARG DEBUG_KOTSADM=0 - ENV DEBUG_KOTSADM=${DEBUG_KOTSADM} -ADD hack/dev/entrypoint.sh . +COPY ./dev/dockerfiles/kotsadm/entrypoint.sh ./ ENTRYPOINT [ "./entrypoint.sh"] diff --git a/deploy/Dockerfile b/dev/dockerfiles/kotsadm/Dockerfile.ttlsh similarity index 95% rename from deploy/Dockerfile rename to dev/dockerfiles/kotsadm/Dockerfile.ttlsh index 9d003f9f44..412e3f9039 100644 --- a/deploy/Dockerfile +++ b/dev/dockerfiles/kotsadm/Dockerfile.ttlsh @@ -2,9 +2,7 @@ FROM debian:bookworm-slim RUN apt-get update && apt-get install -y --no-install-recommends \ curl ca-certificates git gnupg2 s3cmd \ - && for i in 1 2 3 4 5 6 7 8; do mkdir -p "/usr/share/man/man$i"; done \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf /usr/share/man/man* + && rm -rf /var/lib/apt/lists/* # Install Kubectl 1.29 ENV KUBECTL_1_29_VERSION=v1.29.0 diff --git a/hack/dev/entrypoint.sh b/dev/dockerfiles/kotsadm/entrypoint.sh similarity index 100% rename from hack/dev/entrypoint.sh rename to dev/dockerfiles/kotsadm/entrypoint.sh diff --git a/dev/dockerfiles/kurl-proxy/Dockerfile.local b/dev/dockerfiles/kurl-proxy/Dockerfile.local new file mode 100644 index 0000000000..237d287057 --- /dev/null +++ b/dev/dockerfiles/kurl-proxy/Dockerfile.local @@ -0,0 +1,11 @@ +FROM golang:1.22-alpine + +RUN apk add --no-cache ca-certificates curl git make bash + +WORKDIR /replicatedhq/kots/kurl_proxy + +COPY ./bin/kurl_proxy /kurl_proxy + +ADD ./assets /assets + +ENTRYPOINT ["/kurl_proxy"] diff --git a/kurl_proxy/deploy/Dockerfile b/dev/dockerfiles/kurl-proxy/Dockerfile.ttlsh similarity index 91% rename from kurl_proxy/deploy/Dockerfile rename to dev/dockerfiles/kurl-proxy/Dockerfile.ttlsh index 14a2b82217..a5a0883afe 100644 --- a/kurl_proxy/deploy/Dockerfile +++ b/dev/dockerfiles/kurl-proxy/Dockerfile.ttlsh @@ -19,6 +19,5 @@ COPY --chown=kotsadm:kotsadm ./assets /assets WORKDIR / EXPOSE 8800 -# ARG version=unknown -# ENV VERSION=${version} + CMD ["/kurl_proxy"] diff --git a/migrations/kustomize/overlays/dev/job.yaml b/dev/manifests/kotsadm-migrations/job.yaml similarity index 89% rename from migrations/kustomize/overlays/dev/job.yaml rename to dev/manifests/kotsadm-migrations/job.yaml index 31ee729f80..6ad3ebbf7f 100644 --- a/migrations/kustomize/overlays/dev/job.yaml +++ b/dev/manifests/kotsadm-migrations/job.yaml @@ -22,8 +22,9 @@ spec: name: kotsadm-rqlite - name: SCHEMAHERO_OUT value: /migrations/plan.yaml - image: kotsadm-migrations + image: kotsadm-migrations-dev name: migrations-plan + imagePullPolicy: Never args: ["plan"] volumeMounts: - name: migrations @@ -39,8 +40,9 @@ spec: secretKeyRef: key: uri name: kotsadm-rqlite - image: kotsadm-migrations + image: kotsadm-migrations-dev name: kotsadm-migrations + imagePullPolicy: Never args: ["apply"] volumeMounts: - name: migrations diff --git a/web/kustomize/base/deployment.yaml b/dev/manifests/kotsadm-web/deployment.yaml similarity index 63% rename from web/kustomize/base/deployment.yaml rename to dev/manifests/kotsadm-web/deployment.yaml index 84dd04ab6d..81e437978e 100644 --- a/web/kustomize/base/deployment.yaml +++ b/dev/manifests/kotsadm-web/deployment.yaml @@ -13,5 +13,8 @@ spec: spec: containers: - name: kotsadm-web - image: kotsadm-web - imagePullPolicy: IfNotPresent + image: kotsadm-web-dev + imagePullPolicy: Never + ports: + - name: http + containerPort: 8080 diff --git a/web/kustomize/overlays/kotsadm/service.yaml b/dev/manifests/kotsadm-web/service.yaml similarity index 84% rename from web/kustomize/overlays/kotsadm/service.yaml rename to dev/manifests/kotsadm-web/service.yaml index caa70ae91a..3f5217b9d3 100644 --- a/web/kustomize/overlays/kotsadm/service.yaml +++ b/dev/manifests/kotsadm-web/service.yaml @@ -5,10 +5,10 @@ metadata: labels: app: kotsadm-web spec: - type: NodePort + type: ClusterIP ports: - name: http - port: 3000 + port: 8080 targetPort: http selector: app: kotsadm-web diff --git a/kustomize/overlays/rbac/cluster-rbac.yaml b/dev/manifests/kotsadm/cluster-rbac.yaml similarity index 100% rename from kustomize/overlays/rbac/cluster-rbac.yaml rename to dev/manifests/kotsadm/cluster-rbac.yaml diff --git a/kustomize/overlays/okteto/deployment.yaml b/dev/manifests/kotsadm/deployment.yaml similarity index 83% rename from kustomize/overlays/okteto/deployment.yaml rename to dev/manifests/kotsadm/deployment.yaml index 838e642517..03e5a0f956 100644 --- a/kustomize/overlays/okteto/deployment.yaml +++ b/dev/manifests/kotsadm/deployment.yaml @@ -6,9 +6,13 @@ metadata: kots.io/kotsadm: 'true' kots.io/backup: velero spec: + selector: + matchLabels: + app: kotsadm template: metadata: labels: + app: kotsadm kots.io/kotsadm: 'true' kots.io/backup: velero annotations: @@ -16,18 +20,29 @@ spec: pre.hook.backup.velero.io/command: '["/bin/bash", "-c", "curl -f http://kotsadm:password@kotsadm-rqlite:4001/db/backup -o /backup/kotsadm-rqlite.sql"]' pre.hook.backup.velero.io/timeout: 3m spec: - serviceAccountName: default + restartPolicy: Always + serviceAccountName: kotsadm containers: - name: kotsadm + image: kotsadm-api-dev + imagePullPolicy: Never + ports: + - name: http + containerPort: 3000 + - name: dlv + containerPort: 30001 + resources: + limits: + cpu: 1 + memory: 2Gi + requests: + cpu: 100m + memory: 100Mi volumeMounts: - mountPath: /backup name: backup - name: kubelet-client-cert mountPath: /etc/kubernetes/pki/kubelet - ports: - - containerPort: 40000 - name: dlv - protocol: TCP env: - name: RQLITE_URI valueFrom: @@ -37,7 +52,7 @@ spec: - name: S3_BUCKET_NAME value: "shipbucket" - name: S3_ENDPOINT - value: http://kotsadm-s3:4569/ + value: http://kotsadm-minio:4569/ - name: S3_ACCESS_KEY_ID value: not-a-key - name: S3_SECRET_ACCESS_KEY @@ -48,6 +63,8 @@ spec: value: "debug" - name: DISABLE_SPA_SERVING value: "1" + - name: KOTSADM_TARGET_NAMESPACE + value: "test" valueFrom: ~ - name: AUTO_CREATE_CLUSTER value: "1" @@ -70,7 +87,7 @@ spec: - name: API_ENDPOINT value: http://kotsadm:3000 - name: API_ADVERTISE_ENDPOINT - value: http://127.0.0.1:30000 + value: http://127.0.0.1:30808 - name: KOTSADM_ENV value: "dev" - name: ENABLE_WEB_PROXY diff --git a/kustomize/overlays/kotsstore/minio/statefulset.yaml b/dev/manifests/kotsadm/minio.yaml similarity index 79% rename from kustomize/overlays/kotsstore/minio/statefulset.yaml rename to dev/manifests/kotsadm/minio.yaml index b004a16218..3665d80a9b 100644 --- a/kustomize/overlays/kotsstore/minio/statefulset.yaml +++ b/dev/manifests/kotsadm/minio.yaml @@ -80,3 +80,34 @@ spec: resources: requests: storage: 2Gi +--- +apiVersion: v1 +kind: Service +metadata: + labels: + kots.io/kotsadm: 'true' + kots.io/backup: velero + app: kotsadm-minio + name: kotsadm-minio +spec: + ports: + - name: service + port: 4569 + protocol: TCP + targetPort: 9000 + selector: + app: kotsadm-minio + type: ClusterIP +--- +apiVersion: v1 +data: + accesskey: bm90LWEta2V5 + secretkey: bm90LWEtc2VjcmV0 +kind: Secret +metadata: + labels: + kots.io/kotsadm: 'true' + kots.io/backup: velero + app: kotsadm-minio + name: kotsadm-minio +type: Opaque diff --git a/kustomize/overlays/dev/namespace.yaml b/dev/manifests/kotsadm/namespace.yaml similarity index 100% rename from kustomize/overlays/dev/namespace.yaml rename to dev/manifests/kotsadm/namespace.yaml diff --git a/migrations/kustomize/overlays/dev/rqlite.yaml b/dev/manifests/kotsadm/rqlite.yaml similarity index 98% rename from migrations/kustomize/overlays/dev/rqlite.yaml rename to dev/manifests/kotsadm/rqlite.yaml index 563b64102c..fcd7047a98 100644 --- a/migrations/kustomize/overlays/dev/rqlite.yaml +++ b/dev/manifests/kotsadm/rqlite.yaml @@ -71,7 +71,7 @@ spec: spec: containers: - name: rqlite - image: kotsadm/rqlite:7.21.4 + image: kotsadm/rqlite:8.30.2-r0 imagePullPolicy: IfNotPresent args: - -disco-mode=dns diff --git a/kustomize/base/service.yaml b/dev/manifests/kotsadm/service.yaml similarity index 81% rename from kustomize/base/service.yaml rename to dev/manifests/kotsadm/service.yaml index 9c46e05ca3..f3ca66f37b 100644 --- a/kustomize/base/service.yaml +++ b/dev/manifests/kotsadm/service.yaml @@ -6,15 +6,13 @@ metadata: kots.io/kotsadm: "true" kots.io/backup: velero app: kotsadm - annotations: - dev.okteto.com/auto-ingress: "true" spec: type: NodePort ports: - name: http port: 3000 targetPort: http - nodePort: 30000 + nodePort: 30808 - name: dlv port: 30001 targetPort: dlv diff --git a/kurl_proxy/kustomize/overlays/dev/configmap.yaml b/dev/manifests/kurl-proxy/configmap.yaml similarity index 100% rename from kurl_proxy/kustomize/overlays/dev/configmap.yaml rename to dev/manifests/kurl-proxy/configmap.yaml diff --git a/kurl_proxy/kustomize/base/deployment.yaml b/dev/manifests/kurl-proxy/deployment.yaml similarity index 93% rename from kurl_proxy/kustomize/base/deployment.yaml rename to dev/manifests/kurl-proxy/deployment.yaml index 522db24b2b..dd7e3b5eb8 100644 --- a/kurl_proxy/kustomize/base/deployment.yaml +++ b/dev/manifests/kurl-proxy/deployment.yaml @@ -15,7 +15,8 @@ spec: spec: containers: - name: proxy - image: kurl-proxy + image: kurl-proxy-dev + imagePullPolicy: Never env: - name: NODE_PORT value: "30880" diff --git a/kurl_proxy/kustomize/base/rbac.yaml b/dev/manifests/kurl-proxy/rbac.yaml similarity index 100% rename from kurl_proxy/kustomize/base/rbac.yaml rename to dev/manifests/kurl-proxy/rbac.yaml diff --git a/kurl_proxy/kustomize/overlays/dev/secret.yaml b/dev/manifests/kurl-proxy/secret.yaml similarity index 100% rename from kurl_proxy/kustomize/overlays/dev/secret.yaml rename to dev/manifests/kurl-proxy/secret.yaml diff --git a/kurl_proxy/kustomize/base/service.yaml b/dev/manifests/kurl-proxy/service.yaml similarity index 100% rename from kurl_proxy/kustomize/base/service.yaml rename to dev/manifests/kurl-proxy/service.yaml diff --git a/dev/metadata.json b/dev/metadata.json new file mode 100644 index 0000000000..a45dd9c4dd --- /dev/null +++ b/dev/metadata.json @@ -0,0 +1,25 @@ +{ + "kotsadm": { + "image": "kotsadm-api-dev", + "dockerfile": "dev/dockerfiles/kotsadm/Dockerfile.local", + "dockercontext": ".", + "deployment": "kotsadm" + }, + "kotsadm-migrations": { + "image": "kotsadm-migrations-dev", + "dockerfile": "dev/dockerfiles/kotsadm-migrations/Dockerfile.local", + "dockercontext": "./migrations" + }, + "kotsadm-web": { + "image": "kotsadm-web-dev", + "dockerfile": "dev/dockerfiles/kotsadm-web/Dockerfile.local", + "dockercontext": "./web", + "deployment": "kotsadm-web" + }, + "kurl-proxy": { + "image": "kurl-proxy-dev", + "dockerfile": "dev/dockerfiles/kurl-proxy/Dockerfile.local", + "dockercontext": "./kurl_proxy", + "deployment": "kurl-proxy-kotsadm" + } +} diff --git a/dev/patches/kotsadm-up.yaml b/dev/patches/kotsadm-up.yaml new file mode 100644 index 0000000000..ea0958a1e7 --- /dev/null +++ b/dev/patches/kotsadm-up.yaml @@ -0,0 +1,33 @@ +spec: + template: + spec: + volumes: + - name: dev + hostPath: + path: __PROJECT_DIR__ + type: Directory + containers: + - name: kotsadm + image: kotsadm-api-dev + command: ["/bin/bash"] + args: ["-c", "while true; do sleep 30; done;"] + volumeMounts: + - name: dev + mountPath: /replicatedhq/kots # workdir in the container + env: + # in order to serve from kotsadm-web even in embedded cluster + - name: DISABLE_SPA_SERVING + value: "1" + - name: ENABLE_WEB_PROXY + value: "1" + - name: GOCACHE + value: /replicatedhq/kots/dev/.gocache # from dev volume mount + - name: GOMODCACHE + value: /replicatedhq/kots/dev/.gomodcache # from dev volume mount + livenessProbe: ~ + readinessProbe: ~ + resources: ~ + securityContext: + runAsUser: 0 + runAsGroup: 0 + runAsNonRoot: false diff --git a/dev/patches/kotsadm-web-up.yaml b/dev/patches/kotsadm-web-up.yaml new file mode 100644 index 0000000000..4a758b3b06 --- /dev/null +++ b/dev/patches/kotsadm-web-up.yaml @@ -0,0 +1,15 @@ +spec: + template: + spec: + volumes: + - name: dev + hostPath: + path: __PROJECT_DIR__/web + type: Directory + containers: + - name: kotsadm-web + image: kotsadm-web-dev + volumeMounts: + - name: dev + mountPath: /replicatedhq/kots/web # workdir in the container + resources: ~ diff --git a/dev/patches/kurl-proxy-up.yaml b/dev/patches/kurl-proxy-up.yaml new file mode 100644 index 0000000000..c924d4fb0c --- /dev/null +++ b/dev/patches/kurl-proxy-up.yaml @@ -0,0 +1,34 @@ +spec: + template: + spec: + volumes: + - name: dev + hostPath: + path: __PROJECT_DIR__ + type: Directory + - name: assets + hostPath: + path: __PROJECT_DIR__/kurl_proxy/assets + type: Directory + containers: + - name: proxy + image: kurl-proxy-dev + command: ["/bin/bash"] + args: ["-c", "while true; do sleep 30; done;"] + volumeMounts: + - name: dev + mountPath: /replicatedhq/kots # parent of workdir in the container + - name: assets + mountPath: /assets + env: + - name: GOCACHE + value: /replicatedhq/kots/dev/.gocache # from dev volume mount + - name: GOMODCACHE + value: /replicatedhq/kots/dev/.gomodcache # from dev volume mount + livenessProbe: ~ + readinessProbe: ~ + resources: ~ + securityContext: + runAsUser: 0 + runAsGroup: 0 + runAsNonRoot: false diff --git a/dev/scripts/common.sh b/dev/scripts/common.sh new file mode 100644 index 0000000000..cbda703d7e --- /dev/null +++ b/dev/scripts/common.sh @@ -0,0 +1,127 @@ +# Get component image name +function image() { + jq -r ".\"$1\".image" dev/metadata.json +} + +# Get component dockerfile path +function dockerfile() { + jq -r ".\"$1\".dockerfile" dev/metadata.json +} + +# Get component dockercontext +function dockercontext() { + jq -r ".\"$1\".dockercontext" dev/metadata.json +} + +# Get component deployment name +function deployment() { + jq -r ".\"$1\".deployment" dev/metadata.json +} + +# Populates local caches and binaries for faster (re)builds +function populate() { + case "$1" in + "kotsadm") + docker run --rm \ + -v "$(pwd):/replicatedhq/kots" \ + -e GOCACHE=/replicatedhq/kots/dev/.gocache \ + -e GOMODCACHE=/replicatedhq/kots/dev/.gomodcache \ + -w /replicatedhq/kots \ + golang:1.22-alpine \ + /bin/sh -c "apk add make bash git && make kots build" + ;; + "kotsadm-web") + docker run --rm \ + -v "$(pwd):/replicatedhq/kots" \ + -w /replicatedhq/kots/web \ + node:18-alpine \ + /bin/sh -c "apk add make bash git && make deps" + ;; + "kurl-proxy") + docker run --rm \ + -v "$(pwd):/replicatedhq/kots" \ + -e GOCACHE=/replicatedhq/kots/dev/.gocache \ + -e GOMODCACHE=/replicatedhq/kots/dev/.gomodcache \ + -w /replicatedhq/kots/kurl_proxy \ + golang:1.22-alpine \ + /bin/sh -c "apk add make bash git && make build" + ;; + esac +} + +# Builds a component's image +function build() { + docker build -t $(image $1) -f $(dockerfile $1) $(dockercontext $1) +} + +# Restarts a component +function restart() { + if [ "$1" == "kotsadm-migrations" ]; then + kubectl delete job $1 --ignore-not-found + elif kubectl get deployment $(deployment $1) &>/dev/null; then + kubectl rollout restart deployment/$(deployment $1) + fi +} + +# The /host_mnt directory on Docker Desktop for macOS is a virtualized path that represents +# the mounted directories from the macOS host filesystem into the Docker Desktop VM. +# This is required for using HostPath volumes in Kubernetes. +function render() { + sed "s|__PROJECT_DIR__|/host_mnt$(pwd)|g" "$1" +} + +# The embedded-cluster container mounts the KOTS project at /replicatedhq/kots +function ec_render() { + sed "s|__PROJECT_DIR__|/replicatedhq/kots|g" "$1" +} + +# Get the embedded cluster node name +function ec_node() { + echo "${EC_NODE:-node0}" +} + +# Executes a command in the embedded cluster container +function ec_exec() { + docker exec -it -w /replicatedhq/kots $(ec_node) $@ +} + +# Patches a component deployment in the embedded cluster +function ec_patch() { + ec_render dev/patches/$1-up.yaml > dev/patches/$1-up-ec.yaml.tmp + ec_exec k0s kubectl patch deployment $(deployment $1) -n kotsadm --patch-file dev/patches/$1-up-ec.yaml.tmp + rm dev/patches/$1-up-ec.yaml.tmp +} + +function ec_build_and_load() { + # Build the image + if docker images | grep -q "$(image $1)"; then + echo "$(image $1) image already exists, skipping build..." + else + echo "Building $1..." + populate $1 + build $1 + fi + + # Load the image into the embedded cluster + if docker exec $(ec_node) k0s ctr images ls | grep -q "$(image $1)"; then + echo "$(image $1) image already loaded in embedded cluster, skipping import..." + else + echo "Loading "$(image $1)" image into embedded cluster..." + docker save "$(image $1)" | docker exec -i $(ec_node) k0s ctr images import - + fi +} + +function up() { + if [ "$1" == "kotsadm-web" ]; then + # Tail the logs of the new pod + newpod=$(kubectl get pods -l app=kotsadm-web --no-headers --sort-by=.metadata.creationTimestamp | awk 'END {print $1}') + kubectl logs -f $newpod --tail=100 + else + # Exec into the deployment + kubectl exec -it deployment/$(deployment $1) -- bash + fi +} + +function ec_up() { + ec_exec k0s kubectl exec -it deployment/$(deployment $1) -n kotsadm -- bash +} diff --git a/dev/scripts/dev.sh b/dev/scripts/dev.sh new file mode 100755 index 0000000000..36669d356a --- /dev/null +++ b/dev/scripts/dev.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -e + +. dev/scripts/common.sh + +# Ensure kubectl context is docker-desktop +if [ $(kubectl config current-context) != "docker-desktop" ]; then + echo "Error: kubectl context is not set to docker-desktop" + exit 1 +fi + +function build_dev() { + echo "Building $1..." + populate $1 + build $1 + restart $1 + echo "" +} + +build_dev kotsadm +build_dev kotsadm-web +build_dev kotsadm-migrations +build_dev kurl-proxy + +kubectl apply -R -f dev/manifests + +# kotsadm-web relies on host files to minimize the image size and +# to enable hot reloading by default, so it should always be "up". +render dev/patches/kotsadm-web-up.yaml | kubectl patch deployment kotsadm-web --patch-file=/dev/stdin diff --git a/dev/scripts/down-ec.sh b/dev/scripts/down-ec.sh new file mode 100755 index 0000000000..c5abe2701d --- /dev/null +++ b/dev/scripts/down-ec.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -e + +. dev/scripts/common.sh + +component=$1 + +# Check if a deployment name was provided +if [ -z "$component" ]; then + echo "Error: No component name provided." + exit 1 +fi + +# Check if already down +if [ ! -f "dev/patches/$component-down-ec.yaml.tmp" ]; then + echo "Error: already down." + exit 1 +fi + +echo "Reverting..." + +if [ "$component" == "kotsadm" ]; then + ec_exec k0s kubectl delete -f dev/manifests/kotsadm-web -n kotsadm +fi + +ec_exec k0s kubectl replace -f dev/patches/$component-down-ec.yaml.tmp --force +ec_exec rm dev/patches/$component-down-ec.yaml.tmp diff --git a/dev/scripts/down.sh b/dev/scripts/down.sh new file mode 100755 index 0000000000..71d28790d9 --- /dev/null +++ b/dev/scripts/down.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +. dev/scripts/common.sh + +component=$1 + +# Check if a deployment name was provided +if [ -z "$component" ]; then + echo "Error: No component name provided." + exit 1 +fi + +# Check if already down +if [ ! -f "dev/patches/$component-down.yaml.tmp" ]; then + echo "Error: already down." + exit 1 +fi + +echo "Reverting..." + +kubectl replace -f dev/patches/$component-down.yaml.tmp --force +rm dev/patches/$component-down.yaml.tmp diff --git a/dev/scripts/up-ec.sh b/dev/scripts/up-ec.sh new file mode 100755 index 0000000000..573c7381c7 --- /dev/null +++ b/dev/scripts/up-ec.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -e + +. dev/scripts/common.sh + +component=$1 + +# Check if a component name was provided +if [ -z "$component" ]; then + echo "Error: No component name provided." + exit 1 +fi + +# Check if already up +if [ -f "dev/patches/$component-down-ec.yaml.tmp" ]; then + ec_up $component + exit 0 +fi + +# Build and load the image into the embedded cluster +ec_build_and_load "$component" + +# The kotsadm dev image does not have a web component, and kotsadm-web service does not exist in embedded cluster. +# Deploy kotsadm-web service instead of shipping a web component in the kotsadm dev image so +# we can achieve a faster dev experience with hot reloading. +if [ "$component" == "kotsadm" ]; then + ec_build_and_load "kotsadm-web" + ec_exec k0s kubectl apply -f dev/manifests/kotsadm-web -n kotsadm + ec_patch "kotsadm-web" +fi + +# Save current deployment state +ec_exec k0s kubectl get deployment $(deployment $component) -n kotsadm -oyaml > dev/patches/$component-down-ec.yaml.tmp + +# Patch the deployment +ec_patch $component + +# Wait for rollout to complete +ec_exec k0s kubectl rollout status deployment/$(deployment $component) -n kotsadm + +# Up into the updated deployment +ec_up $component diff --git a/dev/scripts/up.sh b/dev/scripts/up.sh new file mode 100755 index 0000000000..45ac73af3c --- /dev/null +++ b/dev/scripts/up.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -e + +. dev/scripts/common.sh + +component=$1 + +# Check if a component name was provided +if [ -z "$component" ]; then + echo "Error: No component name provided." + exit 1 +fi + +# Check if already up +if [ -f "dev/patches/$component-down.yaml.tmp" ]; then + up $component + exit 0 +fi + +# Save current state +kubectl get deployment $(deployment $component) -oyaml > dev/patches/$component-down.yaml.tmp + +# Prepare and apply the patch +render dev/patches/$component-up.yaml | kubectl patch deployment $(deployment $component) --patch-file=/dev/stdin + +# Wait for rollout to complete +kubectl rollout status deployment/$(deployment $component) + +# Up into the updated deployment +up $component diff --git a/hack/tests/small.airgap b/e2e/artifacts/small.airgap similarity index 100% rename from hack/tests/small.airgap rename to e2e/artifacts/small.airgap diff --git a/hack/CONTRIBUTING.md b/hack/CONTRIBUTING.md deleted file mode 100644 index 4103d84f3a..0000000000 --- a/hack/CONTRIBUTING.md +++ /dev/null @@ -1,32 +0,0 @@ -# Contributing - -Contributions are definitely welcome! We've published documentation on how to set up a local dev environment (or, least one way to do it!) here: - -## Local Setup - -The recommended configuration to build and run kotsadm on a microk8s cluster, locally. - -Required Software: -- [Skaffold](https://skaffold.dev) 1.10.1 or later -- [Kustomize](https://kustomize.io) 2.0 or later -- Kubernetes (Recommended to run microk8s) - -## Running - -Build Kotsadm go binary: - -``` -GOOS=linux make build -``` - -Next, you can build and run all server components in the Kubernetes cluster with: - -``` -skaffold dev -``` - -To enable delve run: - -``` -DEBUG_KOTSADM=1 skaffold dev -``` diff --git a/hack/build-ttl.sh b/hack/build-ttl.sh deleted file mode 100755 index c06fb70840..0000000000 --- a/hack/build-ttl.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -set -e - -export CURRENT_USER=${GITHUB_USER:-$(id -u -n)} - -make build-ttl.sh - -GREEN='\033[0;32m' -NC='\033[0m' # No Color - -printf "\n\n\n" -printf "Run command: ${GREEN}kubectl edit deployment kotsadm${NC}\n" -printf "Replace image with: ${GREEN}ttl.sh/${CURRENT_USER}/kotsadm:24h${NC}\n" -printf "\n" -printf "These images are good for 24 hours\n" diff --git a/hack/dev/skaffoldcache.Dockerfile b/hack/dev/skaffoldcache.Dockerfile deleted file mode 100644 index 62b8bb3d92..0000000000 --- a/hack/dev/skaffoldcache.Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM golang:1.23 as deps - -RUN go install github.com/go-delve/delve/cmd/dlv@v1.23.0 - -ENV PROJECTPATH=/go/src/github.com/replicatedhq/kots -WORKDIR $PROJECTPATH -COPY Makefile ./ -COPY Makefile.build.mk ./ -COPY go.mod go.sum ./ -COPY cmd ./cmd -COPY pkg ./pkg -COPY web/webcontent.go ./web/webcontent.go - -RUN make build kots diff --git a/hack/microk8s.md b/hack/microk8s.md deleted file mode 100644 index b0158dbeac..0000000000 --- a/hack/microk8s.md +++ /dev/null @@ -1,17 +0,0 @@ -# Running in MicroK8s - -It's possible to run Ship Cluster in Microk8s. - -### Enable the registry - -``` -microk8s.enable registry -``` - -### Use the registry in your dev environment - -Add a `--default-repo localhost:32000` to your Skaffold command. For example: - -``` -skaffold dev --profile github --default-repo localhost:32000 -``` diff --git a/kurl_proxy/Makefile b/kurl_proxy/Makefile index 8303eac60c..9fac8b1cf7 100644 --- a/kurl_proxy/Makefile +++ b/kurl_proxy/Makefile @@ -1,6 +1,6 @@ include ./Makefile.build -CURRENT_USER := $(if $(GITHUB_USER),$(GITHUB_USER),$(shell id -u -n)) +CURRENT_USER := $(shell id -u -n) .PHONY: test test: @@ -10,13 +10,13 @@ test: build: go build ${LDFLAGS} -o bin/kurl_proxy cmd/main.go -.PHONY: up -up: - skaffold dev -f skaffold.yaml +.PHONY: run +run: + ./bin/kurl_proxy .PHONY: build-ttl.sh build-ttl.sh: export GOOS ?= linux build-ttl.sh: export GOARCH ?= amd64 build-ttl.sh: build - docker build --platform $(GOOS)/$(GOARCH) --pull -f deploy/Dockerfile -t ttl.sh/${CURRENT_USER}/kurl-proxy:24h . + docker build --platform $(GOOS)/$(GOARCH) --pull -f dev/Dockerfile.ttlsh -t ttl.sh/${CURRENT_USER}/kurl-proxy:24h . docker push ttl.sh/${CURRENT_USER}/kurl-proxy:24h diff --git a/kurl_proxy/README.md b/kurl_proxy/README.md deleted file mode 100644 index 20efb5d047..0000000000 --- a/kurl_proxy/README.md +++ /dev/null @@ -1,18 +0,0 @@ - -The Dockerfiles, skaffold.yaml, Makefile, and kustomize/ subdirectory in this directory are for developing locally with skaffold. -The kotsadm addon has the deployment yaml that will be installed on a kurl cluster. - -The proxy requires a secret with a cert and key to start. -The kotsadm addon from the [kURL](https://github.com/replicatedhq/kurl) project will generate this secret when installed. -That secret will have the annotation `acceptAnonymousUploads` which allows anybody to upload a new cert at /tls. -After the first upload that flag will be turned off and the cert/key in the secret will be replaced with the uploaded pair. -Navigating to /tls after that will show a warning rather than an upload form. -Manually add the flag back to the secret to re-enable uploads. - -## Developing - -Run `make up` to start the proxy on port 8800 while watching for changes to `assets/` and `main.go`. - -`assets/` is a static directory that also has some html templates. From the insecure page link to files with `/assets/styles.css` and from the `/tls` page with `/tls/assets/styles.css`. - -Delete the secret to return to a state where uploads are accepted. diff --git a/kurl_proxy/kustomize/base/kustomization.yaml b/kurl_proxy/kustomize/base/kustomization.yaml deleted file mode 100644 index 80d0415e3d..0000000000 --- a/kurl_proxy/kustomize/base/kustomization.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- rbac.yaml -- deployment.yaml -- service.yaml diff --git a/kurl_proxy/kustomize/overlays/dev/kustomization.yaml b/kurl_proxy/kustomize/overlays/dev/kustomization.yaml deleted file mode 100644 index a5cc288284..0000000000 --- a/kurl_proxy/kustomize/overlays/dev/kustomization.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- ./secret.yaml -- ./configmap.yaml -- ../../base diff --git a/kurl_proxy/okteto.Dockerfile b/kurl_proxy/okteto.Dockerfile deleted file mode 100644 index 4a4b66c593..0000000000 --- a/kurl_proxy/okteto.Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -# syntax=docker/dockerfile:1.3 -FROM golang:1.23-bookworm - -ENV PROJECTPATH=/go/src/github.com/replicatedhq/kots/kurl_proxy -WORKDIR $PROJECTPATH -COPY go.mod go.sum ./ -RUN go mod download - -COPY Makefile Makefile.build ./ -COPY cmd cmd - -RUN make build - -COPY assets assets - -ENTRYPOINT ["./bin/kurl_proxy"] diff --git a/kurl_proxy/skaffold.Dockerfile b/kurl_proxy/skaffold.Dockerfile deleted file mode 100644 index 5da23c9272..0000000000 --- a/kurl_proxy/skaffold.Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM golang:1.23-bookworm - -ENV PROJECTPATH=/go/src/github.com/replicatedhq/kots/kurl_proxy -WORKDIR $PROJECTPATH -ADD Makefile ./ -ADD Makefile.build ./ -ADD go.mod ./ -ADD go.sum ./ -ADD cmd ./cmd - -RUN make build - -ADD assets /assets - -ENTRYPOINT ["./bin/kurl_proxy"] diff --git a/kustomize/base/deployment.yaml b/kustomize/base/deployment.yaml deleted file mode 100644 index c227fcc36e..0000000000 --- a/kustomize/base/deployment.yaml +++ /dev/null @@ -1,38 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: kotsadm -spec: - selector: - matchLabels: - app: kotsadm - template: - metadata: - labels: - app: kotsadm - spec: - restartPolicy: Always - containers: - - name: kotsadm - image: kotsadm-api - imagePullPolicy: IfNotPresent - resources: - limits: - cpu: 1 - memory: 2Gi - requests: - cpu: 100m - memory: 100Mi - ports: - - name: http - containerPort: 3000 - - name: dlv - containerPort: 30001 - env: - - name: POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - securityContext: - runAsUser: 1001 - fsGroup: 1001 diff --git a/kustomize/base/kustomization.yaml b/kustomize/base/kustomization.yaml deleted file mode 100644 index 6dd2947919..0000000000 --- a/kustomize/base/kustomization.yaml +++ /dev/null @@ -1,6 +0,0 @@ - -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- ./deployment.yaml -- ./service.yaml diff --git a/kustomize/overlays/dev/deployment.yaml b/kustomize/overlays/dev/deployment.yaml deleted file mode 100644 index d0997f488b..0000000000 --- a/kustomize/overlays/dev/deployment.yaml +++ /dev/null @@ -1,93 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: kotsadm - labels: - kots.io/kotsadm: 'true' - kots.io/backup: velero -spec: - template: - metadata: - labels: - kots.io/kotsadm: 'true' - kots.io/backup: velero - annotations: - backup.velero.io/backup-volumes: backup - pre.hook.backup.velero.io/command: '["/bin/bash", "-c", "curl -f http://kotsadm:password@kotsadm-rqlite:4001/db/backup -o /backup/kotsadm-rqlite.sql"]' - pre.hook.backup.velero.io/timeout: 3m - spec: - serviceAccountName: kotsadm - containers: - - name: kotsadm - resources: - limits: - cpu: 1 - memory: 2Gi - requests: - cpu: 100m - memory: 100Mi - volumeMounts: - - mountPath: /backup - name: backup - - name: kubelet-client-cert - mountPath: /etc/kubernetes/pki/kubelet - env: - - name: KOTSADM_LOG_LEVEL - value: "debug" - - name: DISABLE_SPA_SERVING - value: "1" - - name: KOTSADM_TARGET_NAMESPACE - value: "test" - valueFrom: ~ - - name: AUTO_CREATE_CLUSTER - value: "1" - - name: AUTO_CREATE_CLUSTER_NAME - value: "microk8s" - - name: AUTO_CREATE_CLUSTER_TOKEN - value: this-is-definitely-not-a-secret - - name: POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: SHARED_PASSWORD_BCRYPT - value: $2a$10$xZRsZCYgRDG90N1QEjBxGOBDrDGE.rpcMENV4qNNo7pozYTEPGMwS - - name: SESSION_KEY - value: this-is-not-too-secret - - name: API_ENCRYPTION_KEY - value: IvWItkB8+ezMisPjSMBknT1PdKjBx7Xc/txZqOP8Y2Oe7+Jy - - name: REPLICATED_API_ENDPOINT - value: http://replicated-app:3000 - - name: API_ENDPOINT - value: http://kotsadm:3000 - - name: API_ADVERTISE_ENDPOINT - value: http://127.0.0.1:30000 - - name: KOTSADM_ENV - value: "dev" - - name: ENABLE_WEB_PROXY - value: "1" - # - name: DISABLE_OUTBOUND_CONNECTIONS - # value: "true" - - name: KURL_PROXY_TLS_CERT_PATH - value: /etc/kurl-proxy/ca/tls.crt - - name: KOTS_INSTALL_ID - value: dev-1pu4oeY162e2pbLpK4JubK6hxrX - - name: AIRGAP_UPLOAD_PARALLELISM - value: "3" - - name: POD_OWNER_KIND - value: "deployment" - - name: DEBUG - value: "false" - volumes: - - emptyDir: - medium: Memory - sizeLimit: 1Gi - name: backup - - name: kubelet-client-cert - secret: - secretName: kubelet-client-cert - optional: true - hostAliases: - - ip: 172.17.0.1 - hostnames: - - kotsadm.kotsadmdevenv.com - - dex.kotsadmdevenv.com diff --git a/kustomize/overlays/dev/kustomization.yaml b/kustomize/overlays/dev/kustomization.yaml deleted file mode 100644 index d35368a58a..0000000000 --- a/kustomize/overlays/dev/kustomization.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- ./namespace.yaml -- ../../base -- ../rbac -- ../../../web/kustomize/overlays/dev -- ../../../kurl_proxy/kustomize/overlays/dev -labels: -- includeSelectors: true - pairs: - app.kubernetes.io/name: kotsadm -patches: -- path: ./deployment.yaml diff --git a/kustomize/overlays/kotsstore/deployment.yaml b/kustomize/overlays/kotsstore/deployment.yaml deleted file mode 100644 index 1c1aab3f2a..0000000000 --- a/kustomize/overlays/kotsstore/deployment.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: kotsadm -spec: - template: - spec: - containers: - - name: kotsadm - env: - - name: RQLITE_URI - valueFrom: - secretKeyRef: - name: kotsadm-rqlite # This secret is created in the migrations directory - key: uri - - name: S3_BUCKET_NAME - value: "shipbucket" - - name: S3_ENDPOINT - value: http://kotsadm-minio:4569/ - - name: S3_ACCESS_KEY_ID - value: not-a-key - - name: S3_SECRET_ACCESS_KEY - value: not-a-secret - - name: S3_BUCKET_ENDPOINT - value: "true" diff --git a/kustomize/overlays/kotsstore/kustomization.yaml b/kustomize/overlays/kotsstore/kustomization.yaml deleted file mode 100644 index c359b800d8..0000000000 --- a/kustomize/overlays/kotsstore/kustomization.yaml +++ /dev/null @@ -1,9 +0,0 @@ - -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- ../dev -- ./minio -- ../../../migrations/kustomize/overlays/dev -patches: -- path: ./deployment.yaml diff --git a/kustomize/overlays/kotsstore/minio/kustomization.yaml b/kustomize/overlays/kotsstore/minio/kustomization.yaml deleted file mode 100644 index f5b34fb7f9..0000000000 --- a/kustomize/overlays/kotsstore/minio/kustomization.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- ./service.yaml -- ./secret.yaml -- ./statefulset.yaml diff --git a/kustomize/overlays/kotsstore/minio/secret.yaml b/kustomize/overlays/kotsstore/minio/secret.yaml deleted file mode 100644 index 46b9b4f666..0000000000 --- a/kustomize/overlays/kotsstore/minio/secret.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -data: - accesskey: bm90LWEta2V5 - secretkey: bm90LWEtc2VjcmV0 -kind: Secret -metadata: - labels: - kots.io/kotsadm: 'true' - kots.io/backup: velero - app: kotsadm-minio - name: kotsadm-minio -type: Opaque diff --git a/kustomize/overlays/kotsstore/minio/service.yaml b/kustomize/overlays/kotsstore/minio/service.yaml deleted file mode 100644 index 33db23cac4..0000000000 --- a/kustomize/overlays/kotsstore/minio/service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - kots.io/kotsadm: 'true' - kots.io/backup: velero - app: kotsadm-minio - name: kotsadm-minio -spec: - ports: - - name: service - port: 4569 - protocol: TCP - targetPort: 9000 - selector: - app: kotsadm-minio - type: ClusterIP diff --git a/kustomize/overlays/ocistore/deployment.yaml b/kustomize/overlays/ocistore/deployment.yaml deleted file mode 100644 index cae8cf4644..0000000000 --- a/kustomize/overlays/ocistore/deployment.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: kotsadm -spec: - template: - spec: - containers: - - name: kotsadm - env: - - name: STORAGE_BASEURI - value: "docker://kotsadm-storage-registry:5000" - - name: STORAGE_BASEURI_PLAINHTTP - value: "true" diff --git a/kustomize/overlays/ocistore/distribution/distribution.yaml b/kustomize/overlays/ocistore/distribution/distribution.yaml deleted file mode 100644 index 6afa741bf9..0000000000 --- a/kustomize/overlays/ocistore/distribution/distribution.yaml +++ /dev/null @@ -1,116 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: kotsadm-storage-registry-config - labels: - app: docker-registry - release: kots -data: - config.yml: |- - health: - storagedriver: - enabled: true - interval: 10s - threshold: 3 - http: - addr: :5000 - headers: - X-Content-Type-Options: - - nosniff - log: - fields: - service: registry - storage: - cache: - blobdescriptor: inmemory - version: 0.1 ---- -apiVersion: v1 -kind: Service -metadata: - name: kotsadm-storage-registry - labels: - app: docker-registry - release: kots -spec: - type: ClusterIP - ports: - - port: 5000 - protocol: TCP - name: registry - targetPort: 5000 - selector: - app: docker-registry - release: kots ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: kotsadm-storage-registry - labels: - app: docker-registry - release: kots -spec: - selector: - matchLabels: - app: docker-registry - release: kots - replicas: 1 - serviceName: kotsadm-storage-registry - template: - metadata: - labels: - app: docker-registry - release: kots - annotations: - checksum/config: 149b8559e0123ecd57d5a161f88b51b44d7194aefb604f36e44dba2514952398 - spec: - securityContext: - fsGroup: 1000 - runAsUser: 1000 - containers: - - name: docker-registry - image: "registry:2.7.1" - imagePullPolicy: IfNotPresent - command: - - /bin/registry - - serve - - /etc/docker/registry/config.yml - ports: - - containerPort: 5000 - livenessProbe: - httpGet: - path: / - port: 5000 - readinessProbe: - httpGet: - path: / - port: 5000 - resources: - {} - env: - - name: REGISTRY_HTTP_SECRET - value: "password" - - name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY - value: "/var/lib/registry" - volumeMounts: - - name: registry-data - mountPath: /var/lib/registry/ - - name: "kotsadm-storage-registry-config" - mountPath: "/etc/docker/registry" - volumes: - - name: registry-data - persistentVolumeClaim: - claimName: registry-data - - name: kotsadm-storage-registry-config - configMap: - name: kotsadm-storage-registry-config - volumeClaimTemplates: - - metadata: - name: registry-data - spec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 5Gi diff --git a/kustomize/overlays/ocistore/kustomization.yaml b/kustomize/overlays/ocistore/kustomization.yaml deleted file mode 100644 index 526811afba..0000000000 --- a/kustomize/overlays/ocistore/kustomization.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- ./distribution/distribution.yaml -- ../dev -patches: -- path: ./deployment.yaml diff --git a/kustomize/overlays/okteto/kustomization.yaml b/kustomize/overlays/okteto/kustomization.yaml deleted file mode 100644 index 43ccde212b..0000000000 --- a/kustomize/overlays/okteto/kustomization.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- ../../base -- ../../../web/kustomize/overlays/dev -- ../../../migrations/kustomize/overlays/okteto -- ../kotsstore/minio -labels: -- includeSelectors: true - pairs: - app.kubernetes.io/name: kotsadm -patches: -- path: ./deployment.yaml diff --git a/kustomize/overlays/rbac/kustomization.yaml b/kustomize/overlays/rbac/kustomization.yaml deleted file mode 100644 index 4edd3776b1..0000000000 --- a/kustomize/overlays/rbac/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- ./cluster-rbac.yaml diff --git a/migrations/.dockerignore b/migrations/.dockerignore index a5c3391519..6fafe48c11 100644 --- a/migrations/.dockerignore +++ b/migrations/.dockerignore @@ -3,6 +3,5 @@ .gitignore .dockerignore -skaffold.Dockerfile kustomize .buildkite diff --git a/migrations/Makefile b/migrations/Makefile index 0011e1951c..128138666b 100644 --- a/migrations/Makefile +++ b/migrations/Makefile @@ -3,5 +3,5 @@ SCHEMAHERO_TAG ?= 0.17.10 DOCKER_BUILD_ARGS ?= build_schema: - docker build --pull --build-arg SCHEMAHERO_TAG=${SCHEMAHERO_TAG} ${DOCKER_BUILD_ARGS} -f deploy/Dockerfile -t ${IMAGE} . + docker build --pull --build-arg SCHEMAHERO_TAG=${SCHEMAHERO_TAG} ${DOCKER_BUILD_ARGS} -f dev/Dockerfile.ttlsh -t ${IMAGE} . docker push ${IMAGE} diff --git a/migrations/README.md b/migrations/README.md deleted file mode 100644 index df53e93674..0000000000 --- a/migrations/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Kotsadm Migrations - -# Development - -## Okteto - -### How To - -#### Create/update a migration - -1. From the migrations directory `okteto up` -2. Make the changes local. -3. Run `/schemahero plan` -4. You can check the plan file in `/migrations/plan.yaml` to make sure it looks correct. -5. Run `/schemahero apply` and check the output for correctness diff --git a/migrations/build-ttl.sh b/migrations/build-ttl.sh deleted file mode 100755 index 8f9daea0f5..0000000000 --- a/migrations/build-ttl.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -e - -CURRENT_USER=${GITHUB_USER:-$(id -u -n)} -IMAGE=ttl.sh/${CURRENT_USER}/kotsadm-migrations:24h - -docker build -f deploy/Dockerfile -t ${IMAGE} . -docker push ${IMAGE} - -GREEN='\033[0;32m' -NC='\033[0m' # No Color - -printf "\n\n\n" -printf "Run command: ${GREEN}kubectl edit deployment kotsadm${NC}\n" -printf "Replace image with: ${GREEN}${IMAGE}${NC}\n" -printf "\n" -printf "This image is good for 24 hours\n" diff --git a/migrations/kustomize/base/kustomization.yaml b/migrations/kustomize/base/kustomization.yaml deleted file mode 100644 index 419dcad196..0000000000 --- a/migrations/kustomize/base/kustomization.yaml +++ /dev/null @@ -1,3 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: [] \ No newline at end of file diff --git a/migrations/kustomize/overlays/dev/kustomization.yaml b/migrations/kustomize/overlays/dev/kustomization.yaml deleted file mode 100644 index 53a2c3c431..0000000000 --- a/migrations/kustomize/overlays/dev/kustomization.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- ./rqlite.yaml -- ./job.yaml -- ../../base diff --git a/migrations/kustomize/overlays/okteto/kustomization.yaml b/migrations/kustomize/overlays/okteto/kustomization.yaml deleted file mode 100644 index 10d9116314..0000000000 --- a/migrations/kustomize/overlays/okteto/kustomization.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- ./rqlite.yaml -- ./migrations.yaml -- ../../base diff --git a/migrations/kustomize/overlays/okteto/migrations.yaml b/migrations/kustomize/overlays/okteto/migrations.yaml deleted file mode 100644 index a69b0aad69..0000000000 --- a/migrations/kustomize/overlays/okteto/migrations.yaml +++ /dev/null @@ -1,79 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: kotsadm-migrations - labels: - app: kotsadm-migrations - tags.datadoghq.com/env: "dev" -spec: - selector: - matchLabels: - app: kotsadm-migrations - template: - metadata: - labels: - app: kotsadm-migrations - tags.datadoghq.com/env: "dev" - spec: - volumes: - - name: migrations - emptyDir: - medium: Memory - containers: - - image: migrations - name: pause - command: - - sleep - - infinity - volumeMounts: - - name: migrations - mountPath: /migrations - env: - - name: SCHEMAHERO_DRIVER - value: rqlite - - name: SCHEMAHERO_SPEC_FILE - value: /go/src/github.com/replicatedhq/kots/tables - - name: SCHEMAHERO_OUT - value: /migrations/plan.yaml - - name: SCHEMAHERO_DDL - value: /migrations/plan.yaml - - name: SCHEMAHERO_URI - valueFrom: - secretKeyRef: - key: uri - name: kotsadm-rqlite - initContainers: - - image: migrations - name: migrations-plan - volumeMounts: - - name: migrations - mountPath: /migrations - args: ["plan"] - env: - - name: SCHEMAHERO_DRIVER - value: rqlite - - name: SCHEMAHERO_SPEC_FILE - value: /go/src/github.com/replicatedhq/kots/tables - - name: SCHEMAHERO_OUT - value: /migrations/plan.yaml - - name: SCHEMAHERO_URI - valueFrom: - secretKeyRef: - key: uri - name: kotsadm-rqlite - - image: migrations - name: migrations-apply - volumeMounts: - - name: migrations - mountPath: /migrations - args: ["apply"] - env: - - name: SCHEMAHERO_DRIVER - value: rqlite - - name: SCHEMAHERO_DDL - value: /migrations/plan.yaml - - name: SCHEMAHERO_URI - valueFrom: - secretKeyRef: - key: uri - name: kotsadm-rqlite diff --git a/migrations/kustomize/overlays/okteto/rqlite.yaml b/migrations/kustomize/overlays/okteto/rqlite.yaml deleted file mode 100644 index c5a64d8404..0000000000 --- a/migrations/kustomize/overlays/okteto/rqlite.yaml +++ /dev/null @@ -1,126 +0,0 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: kotsadm-rqlite - labels: - app: kotsadm-rqlite -spec: - type: ClusterIP - ports: - - name: rqlite - port: 4001 - targetPort: rqlite - selector: - app: kotsadm-rqlite ---- -apiVersion: v1 -kind: Service -metadata: - name: kotsadm-rqlite-headless -spec: - type: ClusterIP - clusterIP: None - publishNotReadyAddresses: True - selector: - app: kotsadm-rqlite - ports: - - protocol: TCP - port: 4001 - targetPort: rqlite ---- -apiVersion: v1 -kind: Secret -metadata: - name: kotsadm-rqlite - labels: - app: kotsadm-rqlite -type: Opaque -data: - password: "cGFzc3dvcmQ=" - uri: aHR0cDovL2tvdHNhZG06cGFzc3dvcmRAa290c2FkbS1ycWxpdGU6NDAwMT90aW1lb3V0PTYwJmRpc2FibGVDbHVzdGVyRGlzY292ZXJ5PXRydWU= - authconfig.json: WwogIHsKICAgICJ1c2VybmFtZSI6ICJrb3RzYWRtIiwKICAgICJwYXNzd29yZCI6ICJwYXNzd29yZCIsCiAgICAicGVybXMiOiBbImFsbCJdCiAgfSwKICB7CiAgICAidXNlcm5hbWUiOiAiKiIsCiAgICAicGVybXMiOiBbInN0YXR1cyIsICJyZWFkeSJdCiAgfQpdCg== ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: kotsadm-rqlite -spec: - replicas: 1 - serviceName: kotsadm-rqlite-headless - podManagementPolicy: "Parallel" - selector: - matchLabels: - app: kotsadm-rqlite - template: - metadata: - labels: - app: kotsadm-rqlite - spec: - containers: - - name: rqlite - image: kotsadm/rqlite:7.21.4 - imagePullPolicy: IfNotPresent - args: - - -disco-mode=dns - - -disco-config={"name":"kotsadm-rqlite-headless"} - - -bootstrap-expect=1 - - -auth=/auth/config.json - - -join-as=kotsadm - ports: - - name: rqlite - containerPort: 4001 - livenessProbe: - httpGet: - scheme: HTTP - path: /readyz?noleader - port: rqlite - initialDelaySeconds: 30 - timeoutSeconds: 5 - failureThreshold: 3 - readinessProbe: - httpGet: - scheme: HTTP - path: /readyz - port: rqlite - initialDelaySeconds: 1 - timeoutSeconds: 1 - periodSeconds: 1 - resources: - limits: - cpu: 200m - memory: 1Gi - requests: - cpu: 100m - memory: 100Mi - volumeMounts: - - name: kotsadm-rqlite - mountPath: /rqlite/file - - name: authconfig - mountPath: /auth/config.json - subPath: authconfig.json - env: - - name: RQLITE_PASSWORD # this is used by the support bundle collector to get the db backup from rqlite - valueFrom: - secretKeyRef: - name: kotsadm-rqlite - key: password - securityContext: - runAsUser: 1001 - fsGroup: 1001 - volumes: - - name: authconfig - secret: - secretName: kotsadm-rqlite - items: - - key: authconfig.json - path: authconfig.json - volumeClaimTemplates: - - metadata: - name: kotsadm-rqlite - spec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi diff --git a/migrations/okteto.Dockerfile b/migrations/okteto.Dockerfile deleted file mode 100644 index 7b2cd6f2e6..0000000000 --- a/migrations/okteto.Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -# syntax=docker/dockerfile:1.3 -FROM schemahero/schemahero:0.13.6 as schemahero - -USER root -RUN apt-get update && apt-get install -y build-essential -USER schemahero - -WORKDIR /go/src/github.com/replicatedhq/kots/tables -COPY tables/ . \ No newline at end of file diff --git a/migrations/okteto.yml b/migrations/okteto.yml deleted file mode 100644 index e3f8e74705..0000000000 --- a/migrations/okteto.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: kotsadm-migrations -command: bash -sync: - - tables/:/go/src/github.com/replicatedhq/kots/tables -workdir: /go/src/github.com/replicatedhq/kots/tables -resources: - limits: - cpu: "1" - memory: 1Gi \ No newline at end of file diff --git a/okteto-pipeline.yml b/okteto-pipeline.yml deleted file mode 100644 index 97bfe96af5..0000000000 --- a/okteto-pipeline.yml +++ /dev/null @@ -1,13 +0,0 @@ -icon: https://github.com/okteto/polling/raw/master/icon.png -deploy: - - okteto build -f ./deploy/okteto/okteto.Dockerfile -t okteto.dev/kotsadm:${OKTETO_GIT_COMMIT} . - - okteto build -f ./web/okteto.Dockerfile --build-arg OKTETO_NAMESPACE=${OKTETO_NAMESPACE} -t okteto.dev/kotsadm-web:${OKTETO_GIT_COMMIT} web - - okteto build -f ./migrations/okteto.Dockerfile -t okteto.dev/kotsadm-migrations:${OKTETO_GIT_COMMIT} migrations - - okteto build -f ./kurl_proxy/okteto.Dockerfile -t okteto.dev/kurl_proxy:${OKTETO_GIT_COMMIT} kurl_proxy - - - cd kustomize/overlays/okteto && kustomize edit set image kotsadm-api=okteto.dev/kotsadm:${OKTETO_GIT_COMMIT} - - cd kustomize/overlays/okteto && kustomize edit set image kotsadm-web=okteto.dev/kotsadm-web:${OKTETO_GIT_COMMIT} - - cd kustomize/overlays/okteto && kustomize edit set image migrations=okteto.dev/kotsadm-migrations:${OKTETO_GIT_COMMIT} - - cd kustomize/overlays/okteto && kustomize edit set image kurl_proxy=okteto.dev/kurl_proxy:${OKTETO_GIT_COMMIT} - - - kubectl apply -k kustomize/overlays/okteto \ No newline at end of file diff --git a/okteto-v2.yml b/okteto-v2.yml deleted file mode 100644 index 5ed7bbfb7d..0000000000 --- a/okteto-v2.yml +++ /dev/null @@ -1,61 +0,0 @@ -build: - kotsadm: - context: . - dockerfile: deploy/okteto/okteto-v2.Dockerfile - kotsadm-migrations: - context: migrations - dockerfile: migrations/okteto.Dockerfile - kotsadm-web-dev: - context: web - dockerfile: web/okteto.Dockerfile - target: dev - kotsadm-web: - context: web - dockerfile: web/okteto.Dockerfile - args: - - OKTETO_NAMESPACE=${OKTETO_NAMESPACE} - -deploy: - - | - cd kustomize/overlays/okteto - kustomize edit set image kotsadm-api=${OKTETO_BUILD_KOTSADM_IMAGE} - kustomize edit set image kotsadm-web=${OKTETO_BUILD_KOTSADM_WEB_IMAGE} - kustomize edit set image migrations=${OKTETO_BUILD_KOTSADM_MIGRATIONS_IMAGE} -# kustomize edit set image kurl_proxy=${OKTETO_BUILD_KOTSADM_IMAGE} - - - kubectl apply -k kustomize/overlays/okteto -dev: - kotsadm: - command: make okteto-dev && bash - workdir: /go/src/github.com/replicatedhq/kots - sync: - - .:/go/src/github.com/replicatedhq/kots - resources: - limits: - cpu: "2" - memory: 4Gi - forward: - - 2353:2345 - persistentVolume: - enabled: true - size: 10Gi - volumes: - - /.cache/gocache - - /.cache/gomodcache - kotsadm-web: - command: make serve - sync: - - web:/src - image: ${OKTETO_BUILD_KOTSADM_WEB_DEV_IMAGE} - resources: - limits: - cpu: "2" - memory: 4Gi - kotsadm-migrations: - command: bash - sync: - - migrations/tables:/go/src/github.com/replicatedhq/kots/tables - resources: - limits: - cpu: "1" - memory: 1Gi diff --git a/okteto.yml b/okteto.yml deleted file mode 100644 index 4104883b98..0000000000 --- a/okteto.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: kotsadm -command: bash -securityContext: - capabilities: - add: - - SYS_PTRACE -sync: - - .:/go/src/github.com/replicatedhq/kots -workdir: /go/src/github.com/replicatedhq/kots -forward: - - 2353:2345 -resources: - limits: - cpu: "2" - memory: 4Gi \ No newline at end of file diff --git a/skaffold.yaml b/skaffold.yaml deleted file mode 100644 index ebe19fbc9c..0000000000 --- a/skaffold.yaml +++ /dev/null @@ -1,60 +0,0 @@ -apiVersion: skaffold/v4beta8 -kind: Config -build: - artifacts: - - image: kotsadm-web - context: ./web - sync: - manual: - - src: src/**/*.jsx - dest: ./ - - src: src/**/*.js - dest: ./ - - src: src/**/*.png - dest: ./ - - src: src/**/*.scss - dest: ./ - - src: src/**/*.css - dest: ./ - docker: - dockerfile: ./skaffold.Dockerfile - - image: kotsadm-api - context: ./ - docker: - dockerfile: ./hack/dev/skaffold.Dockerfile - - image: kotsadm-migrations - context: ./migrations - docker: - dockerfile: ./skaffold.Dockerfile - - image: kurl-proxy - context: ./kurl_proxy - docker: - dockerfile: ./skaffold.Dockerfile - local: - useBuildkit: true - concurrency: 0 -manifests: - kustomize: - paths: - - ./kustomize/overlays/dev -deploy: - kubectl: {} - statusCheckDeadlineSeconds: 240 -profiles: - - name: kotsstore - activation: - - env: KOTSSTORE= - manifests: - kustomize: - paths: - - ./kustomize/overlays/kotsstore - deploy: - kubectl: {} - - name: debug - activation: - - env: DEBUG_KOTSADM=1 - patches: - - op: add - path: /build/artifacts/1/docker/buildArgs - value: - DEBUG_KOTSADM: 1 \ No newline at end of file diff --git a/web/.dockerignore b/web/.dockerignore index 566f8bac82..ecd0c10503 100644 --- a/web/.dockerignore +++ b/web/.dockerignore @@ -1,7 +1,6 @@ node_modules .vscode/ -skaffold.Dockerfile kustomize .buildkite dist \ No newline at end of file diff --git a/web/.gitignore b/web/.gitignore index 7f912b4d0b..ac007a5f84 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -30,7 +30,6 @@ dist/* #editors .vscode/ -env/skaffold_* logs/ diff --git a/web/deploy/nginx.conf b/web/deploy/nginx.conf deleted file mode 100644 index d41f99c182..0000000000 --- a/web/deploy/nginx.conf +++ /dev/null @@ -1,24 +0,0 @@ -server { - listen 8080; - server_name localhost; - root /usr/share/nginx/html; - - location ~ ^.+\.[^\/]+$ { - try_files $uri =404; - } - - location = /healthz { - access_log off; - return 200; - } - - location = /metricz { - access_log off; - return 200; - } - - # Any route that doesn't have a file extension (e.g. /devices) - location / { - try_files $uri /index.html; - } -} diff --git a/web/env/skaffold.js b/web/env/dev.js similarity index 100% rename from web/env/skaffold.js rename to web/env/dev.js diff --git a/web/env/okteto.js b/web/env/okteto.js deleted file mode 100644 index bf49d43da6..0000000000 --- a/web/env/okteto.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - ENVIRONMENT: "development", - API_ENDPOINT: `https://kotsadm-${process.env.OKTETO_NAMESPACE}.okteto.repldev.com/api/v1`, - KOTSADM_BUILD_VERSION: Date.now() -}; diff --git a/web/kustomize/base/kustomization.yaml b/web/kustomize/base/kustomization.yaml deleted file mode 100644 index 40af899636..0000000000 --- a/web/kustomize/base/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- ./deployment.yaml diff --git a/web/kustomize/overlays/dev/deployment.yaml b/web/kustomize/overlays/dev/deployment.yaml deleted file mode 100644 index 33f9a36f25..0000000000 --- a/web/kustomize/overlays/dev/deployment.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: kotsadm-web -spec: - template: - spec: - containers: - - name: kotsadm-web - ports: - - name: http - containerPort: 8080 \ No newline at end of file diff --git a/web/kustomize/overlays/dev/kustomization.yaml b/web/kustomize/overlays/dev/kustomization.yaml deleted file mode 100644 index 92e6ea785e..0000000000 --- a/web/kustomize/overlays/dev/kustomization.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- ./service.yaml -- ../../base -patches: -- path: ./deployment.yaml diff --git a/web/kustomize/overlays/dev/service.yaml b/web/kustomize/overlays/dev/service.yaml deleted file mode 100644 index 110c303f47..0000000000 --- a/web/kustomize/overlays/dev/service.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: kotsadm-web - labels: - app: kotsadm-web - annotations: - dev.okteto.com/auto-ingress: "true" -spec: - type: ClusterIP - ports: - - name: http - port: 8080 - targetPort: http - selector: - app: kotsadm-web diff --git a/web/kustomize/overlays/kotsadm/configmap.yaml b/web/kustomize/overlays/kotsadm/configmap.yaml deleted file mode 100644 index e20290eca9..0000000000 --- a/web/kustomize/overlays/kotsadm/configmap.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: kotsadm-web-scripts -data: - start-kotsadm-web.sh: | - #!/bin/bash - nginx -g "daemon off;" diff --git a/web/kustomize/overlays/kotsadm/deployment.yaml b/web/kustomize/overlays/kotsadm/deployment.yaml deleted file mode 100644 index 4c57fc7762..0000000000 --- a/web/kustomize/overlays/kotsadm/deployment.yaml +++ /dev/null @@ -1,35 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: kotsadm-web -spec: - template: - spec: - imagePullSecrets: - - name: replicatedregistrykey - containers: - - name: kotsadm-web - image: registry.replicated.com/ship-enterprise/kotsadm-web - args: ["/scripts/start-kotsadm-web.sh"] - ports: - - name: http - containerPort: 3000 - volumeMounts: - - name: kotsadm-web-scripts - mountPath: /scripts/start-kotsadm-web.sh - subPath: start-kotsadm-web.sh - readinessProbe: - failureThreshold: 3 - httpGet: - path: /healthz - port: 3000 - scheme: HTTP - initialDelaySeconds: 2 - periodSeconds: 2 - successThreshold: 1 - timeoutSeconds: 1 - volumes: - - name: kotsadm-web-scripts - configMap: - name: kotsadm-web-scripts - defaultMode: 0744 diff --git a/web/kustomize/overlays/kotsadm/kustomization.yaml b/web/kustomize/overlays/kotsadm/kustomization.yaml deleted file mode 100644 index c70c425207..0000000000 --- a/web/kustomize/overlays/kotsadm/kustomization.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- ./configmap.yaml -- ./service.yaml -- ../../base -patches: -- path: ./deployment.yaml diff --git a/web/okteto.Dockerfile b/web/okteto.Dockerfile deleted file mode 100644 index fb82092cd2..0000000000 --- a/web/okteto.Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -# syntax=docker/dockerfile:1.3 -FROM node:18-bookworm-slim as dev -EXPOSE 8080 - -WORKDIR /src - -RUN apt-get update \ - && apt-get install -y --no-install-recommends make \ - && rm -rf /var/lib/apt/lists/* - -COPY ./package.json ./yarn.lock Makefile ./ -RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn make deps - -COPY . . - -FROM dev as builder -ARG OKTETO_NAMESPACE -RUN --mount=type=cache,target=./node_modules/.cache/webpack make build-local - -FROM nginx:1.21.4-alpine as nginx -COPY --from=builder /src/dist /usr/share/nginx/html -COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf -EXPOSE 8080 \ No newline at end of file diff --git a/web/okteto.yml b/web/okteto.yml deleted file mode 100644 index 0b968d3340..0000000000 --- a/web/okteto.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: kotsadm-web -command: make deps && make serve -sync: - - .:/src -image: - name: okteto.dev/kotsadm-web:${OKTETO_NAMESPACE} - context: . - dockerfile: okteto.Dockerfile - target: dev -resources: - requests: - cpu: "2" - memory: 4Gi -persistentVolume: - enabled: true - storageClass: standard - size: 20Gi \ No newline at end of file diff --git a/web/skaffold.Dockerfile b/web/skaffold.Dockerfile deleted file mode 100644 index 3eac62ad0c..0000000000 --- a/web/skaffold.Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM node:18 -EXPOSE 3000 - -WORKDIR /src -COPY ./Makefile ./ -COPY ./package.json ./yarn.lock ./ - -RUN make deps -COPY . . - -ENTRYPOINT ["make", "serve"] diff --git a/web/webpack.config.dev.js b/web/webpack.config.dev.js index e3313b88c6..6286182705 100644 --- a/web/webpack.config.dev.js +++ b/web/webpack.config.dev.js @@ -37,6 +37,9 @@ module.exports = { compress: true, hot: true, host: "0.0.0.0", + static: { + directory: path.join(__dirname, 'src'), + }, allowedHosts: ["all"], client: { webSocketURL: "auto://0.0.0.0/ws", diff --git a/web/webpack.config.js b/web/webpack.config.js index 4b913d13b2..1c44e6de7a 100644 --- a/web/webpack.config.js +++ b/web/webpack.config.js @@ -11,10 +11,8 @@ const NodePolyfillPlugin = require("node-polyfill-webpack-plugin"); function mapEnvironment(env) { if (env.enterprise) { return "enterprise"; - } else if (process.env.OKTETO_NAMESPACE) { - return "okteto"; } - return "skaffold"; + return "dev"; } // TODO: refactor this to use proper env varibles from webpack https://webpack.js.org/guides/environment-variables/