-
Notifications
You must be signed in to change notification settings - Fork 6
Add self-contained installer container #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
FloThinksPi
wants to merge
1
commit into
cloudfoundry:main
Choose a base branch
from
sap-contributions:container-installer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| .git | ||
| .github | ||
| *.md | ||
| temp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # renovate: datasource=docker depName=alpine | ||
| FROM alpine:3.21@sha256:c3f8e73fdb79deaebaa2037150150191b9dcbfba68b4a46d70103204c53f4709 | ||
|
|
||
| # renovate: datasource=github-releases depName=kubernetes-sigs/kind | ||
| ARG KIND_VERSION=v0.31.0 | ||
| # renovate: datasource=github-releases depName=kubernetes/kubernetes | ||
| ARG KUBECTL_VERSION=v1.35.1 | ||
| # renovate: datasource=github-releases depName=helmfile/helmfile | ||
| ARG HELMFILE_VERSION=v1.3.2 | ||
| # renovate: datasource=github-releases depName=helm/helm | ||
| ARG HELM_VERSION=v4.1.1 | ||
| # renovate: datasource=github-releases depName=cloudfoundry/cli | ||
| ARG CF_CLI_VERSION=v8.17.0 | ||
|
|
||
| RUN apk add --no-cache \ | ||
| bash \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've asked myself: Is If yes, we should also add the bash-completion package to handle the bash autocompletion. |
||
| curl \ | ||
| docker-cli \ | ||
| docker-cli-compose \ | ||
| jq \ | ||
| make \ | ||
| openssh-keygen \ | ||
| openssl | ||
|
|
||
| ARG TARGETARCH | ||
|
|
||
| RUN curl -fsSL "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-${TARGETARCH}" -o /usr/local/bin/kind \ | ||
| && chmod +x /usr/local/bin/kind | ||
|
|
||
| RUN curl -fsSL "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl" -o /usr/local/bin/kubectl \ | ||
| && chmod +x /usr/local/bin/kubectl | ||
|
|
||
| RUN curl -fsSL "https://get.helm.sh/helm-${HELM_VERSION}-linux-${TARGETARCH}.tar.gz" | tar xz -C /tmp \ | ||
| && mv /tmp/linux-${TARGETARCH}/helm /usr/local/bin/helm \ | ||
| && rm -rf /tmp/linux-${TARGETARCH} | ||
|
|
||
| RUN curl -fsSL "https://github.com/helmfile/helmfile/releases/download/${HELMFILE_VERSION}/helmfile_${HELMFILE_VERSION#v}_linux_${TARGETARCH}.tar.gz" | tar xz -C /tmp \ | ||
| && mv /tmp/helmfile /usr/local/bin/helmfile \ | ||
| && rm -rf /tmp/LICENSE /tmp/README* | ||
|
|
||
| RUN CF_ARCH=$([ "${TARGETARCH}" = "amd64" ] && echo "x86-64" || echo "${TARGETARCH}") \ | ||
| && curl -fsSL "https://github.com/cloudfoundry/cli/releases/download/${CF_CLI_VERSION}/cf8-cli_${CF_CLI_VERSION#v}_linux_${CF_ARCH}.tgz" | tar xz -C /tmp \ | ||
| && mv /tmp/cf8 /usr/local/bin/cf \ | ||
| && rm -rf /tmp/LICENSE /tmp/NOTICE | ||
|
|
||
| WORKDIR /workspace | ||
|
|
||
| COPY . . | ||
|
|
||
| ENTRYPOINT ["/bin/bash", "-c"] | ||
| CMD ["make"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,47 +1,79 @@ | ||
| LOCAL = true | ||
| TARGET_ARCH ?= $(if $(filter true,$(LOCAL)),$(shell go env GOARCH),amd64) | ||
| # renovate: dataSource=github-releases depName=helmfile/helmfile | ||
| HELMFILE_VERSION ?= "1.3.2" | ||
| IMAGE ?= cf-kind-deployment:latest | ||
| DOCKER_SOCKET ?= $(shell docker context inspect --format '{{.Endpoints.docker.Host}}' | sed 's|unix://||') | ||
| TTY_FLAG := $(shell [ -t 0 ] && echo "-it" || echo "-i") | ||
|
|
||
| init: temp/certs/ca.key temp/certs/ca.crt temp/certs/ssh_key temp/certs/ssh_key.pub temp/secrets.sh temp/secrets.env | ||
| # Common docker run options | ||
| run_opts = --rm $(TTY_FLAG) \ | ||
| --network host \ | ||
| -v $(DOCKER_SOCKET):/var/run/docker.sock \ | ||
| -v "$$PWD/temp:/workspace/temp" \ | ||
| -e ENABLE_TCP_ROUTING \ | ||
| -e ENABLE_NFS_VOLUME \ | ||
| -e ENABLE_POLICY_SUPPORT \ | ||
| -e ENABLE_LOGGREGATOR \ | ||
| -e DISABLE_CACHE | ||
|
|
||
| temp/certs/ca.key temp/certs/ca.crt temp/certs/ssh_key temp/certs/ssh_key.pub temp/secrets.sh temp/secrets.env: | ||
| @ ./scripts/init.sh | ||
| # Container run command | ||
| run = docker run $(run_opts) $(IMAGE) | ||
|
|
||
| install: | ||
| kind get kubeconfig --name cfk8s > temp/kubeconfig | ||
| docker run --rm --net=host --env-file temp/secrets.env \ | ||
| --env ENABLE_TCP_ROUTING \ | ||
| --env ENABLE_NFS_VOLUME \ | ||
| --env ENABLE_POLICY_SUPPORT \ | ||
| --env ENABLE_LOGGREGATOR \ | ||
| -v "$$PWD/temp/certs:/certs" -v "$$PWD/temp/kubeconfig:/helm/.kube/config:ro" -v "$$PWD:/wd" --workdir /wd ghcr.io/helmfile/helmfile:v$(HELMFILE_VERSION) helmfile sync | ||
| # Default targets (container-based) | ||
| up: _build-installer-quiet | ||
| $(run) "make _create-kind _init _install" | ||
|
|
||
| down: _build-installer-quiet | ||
| $(run) "make _delete-kind" | ||
| rm -rf temp | ||
|
|
||
| login: | ||
| @ . temp/secrets.sh; \ | ||
| @ . ./temp/secrets.sh; \ | ||
| cf login -a https://api.127-0-0-1.nip.io -u ccadmin -p "$$CC_ADMIN_PASSWORD" --skip-ssl-validation | ||
|
|
||
| create-kind: | ||
| bootstrap: _build-installer-quiet | ||
| $(run) "make login _bootstrap" | ||
|
|
||
| bootstrap-complete: _build-installer-quiet | ||
| $(run) "make login _bootstrap-complete" | ||
|
|
||
| shell: _build-installer-quiet | ||
| docker run $(run_opts) -v "$$PWD:/workspace" $(IMAGE) "bash" | ||
|
|
||
| # Build the installer container (verbose) | ||
| build-installer: | ||
| docker build -t $(IMAGE) . | ||
|
|
||
| # Build the installer container (quiet) | ||
| _build-installer-quiet: | ||
| @docker build -q -t $(IMAGE) . > /dev/null | ||
|
|
||
| # Internal targets (run inside container or on host with tools installed) | ||
| _init: temp/certs/ca.key temp/certs/ca.crt temp/certs/ssh_key temp/certs/ssh_key.pub temp/secrets.sh temp/secrets.env | ||
|
|
||
| temp/certs/ca.key temp/certs/ca.crt temp/certs/ssh_key temp/certs/ssh_key.pub temp/secrets.sh temp/secrets.env: | ||
| @ ./scripts/init.sh | ||
|
|
||
| _install: | ||
| kind get kubeconfig --name cfk8s > temp/kubeconfig | ||
| @ . ./temp/secrets.sh && KUBECONFIG=temp/kubeconfig helmfile sync | ||
|
|
||
| _create-kind: | ||
| @ ./scripts/create-kind.sh | ||
|
|
||
| delete-kind: | ||
| _delete-kind: | ||
| @ ./scripts/delete-kind.sh | ||
|
|
||
| create-org: | ||
| _create-org: | ||
| cf create-org test | ||
| cf create-space -o test test | ||
| cf target -o test -s test | ||
| @ ./scripts/set_feature_flags.sh | ||
|
|
||
| bootstrap: create-org | ||
| _bootstrap: _create-org | ||
| @ ./scripts/upload_buildpacks.sh | ||
|
|
||
| bootstrap-complete: create-org | ||
| _bootstrap-complete: _create-org | ||
| @ ALL_BUILDPACKS=true ./scripts/upload_buildpacks.sh | ||
|
|
||
| up: create-kind init install | ||
|
|
||
| down: delete-kind | ||
| @ rm -rf temp | ||
|
|
||
| PHONY: install login create-kind delete-kind up down create-org bootstrap bootstrap-complete | ||
| .PHONY: up down login bootstrap bootstrap-complete shell build-installer | ||
| .PHONY: _init _install _create-kind _delete-kind _create-org _bootstrap _bootstrap-complete _build-installer-quiet |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to use the current Alpine version instead of the old 3.21 release.