Skip to content
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

build: local development in macOS(and Linux) arm64/amd64 using local colima instance #285

Merged
merged 2 commits into from
Jan 11, 2024

Conversation

supershal
Copy link
Contributor

@supershal supershal commented Jan 10, 2024

  • adds colima to devbox
  • uses local instance of container runtime supported by colima to run kind cluster and build container images

Tested on M3 Mac:

❯ make dev.run-on-kind
INFO[0000] starting colima
INFO[0000] runtime: docker
INFO[0000] creating and starting ...                     context=vm
INFO[0033] provisioning ...                              context=docker
INFO[0033] starting ...                                  context=docker
INFO[0034] done
▶ creating kind cluster - capi-runtime-extensions-dev
Creating cluster "capi-runtime-extensions-dev" ...
 ✓ Ensuring node image (ghcr.io/mesosphere/kind-node:v1.27.5) 🖼
 ✓ Preparing nodes 📦
 ✓ Writing configuration 📜
 ✓ Starting control-plane 🕹️
 ✓ Installing CNI 🔌
 ✓ Installing StorageClass 💾
Set kubectl context to "kind-capi-runtime-extensions-dev"
You can now use your cluster with:

kubectl cluster-info --context kind-capi-runtime-extensions-dev

Not sure what to do next? 😅  Check out https://kind.sigs.k8s.io/docs/user/quick-start/
Fetching providers
Installing cert-manager Version="v1.13.2"
Waiting for cert-manager to be available...
Installing Provider="cluster-api" Version="v1.6.0" TargetNamespace="capi-system"
Installing Provider="bootstrap-kubeadm" Version="v1.6.0" TargetNamespace="capi-kubeadm-bootstrap-system"
Installing Provider="control-plane-kubeadm" Version="v1.6.0" TargetNamespace="capi-kubeadm-control-plane-system"
Installing Provider="infrastructure-docker" Version="v1.6.0" TargetNamespace="capd-system"
Installing Provider="infrastructure-aws" Version="v2.3.1" TargetNamespace="capa-system"
Waiting for providers to be available...

Your management cluster has been initialized successfully!

You can now create your first workload cluster by running the following:

  clusterctl generate cluster [name] --kubernetes-version [version] | kubectl apply -f -

WARNING! Your password will be stored unencrypted in /Users/shalinpatel/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
▶ running go generate
▶ go fixing root module
▶ go fixing common module
▶ building snapshot release
  • starting release...
  • loading                                          path=.goreleaser.yml
  • skipping announce, publish and validate...
  • loading environment variables
  • getting and validating git state
    • git state                                      commit=cd4aed11691d45242e11a52bd1f8f93e96bf4689 branch=main current_tag=v0.2.0 previous_tag=v0.1.2 dirty=true
    • pipe skipped                                   reason=disabled during snapshot mode
  • parsing tag
  • setting defaults
  • snapshotting
    • building snapshot...                           version=v0.3.0-dev
  • checking distribution directory
    • cleaning dist
  • loading go mod information
  • build prerequisites
  • writing effective config file
    • writing                                        config=dist/config.yaml
  • building binaries
    • building                                       binary=dist/capi-runtime-extensions_linux_arm64/capi-runtime-extensions
    • building                                       binary=dist/capi-runtime-extensions_linux_amd64_v1/capi-runtime-extensions
    • running hook                                   hook=sh -ec 'if [ true == true ] && [ arm64 == arm64 ]; then
  env GOOS=linux GOARCH=arm64 \
      SOURCE_DATE_EPOCH=$(date +%s) \
      KO_DOCKER_REPO=ko.local/capi-runtime-extensions \
      ko build \
        --bare \
        -t v0.3.0-dev \
        ./cmd
fi'

    • running hook                                   hook=sh -ec 'if [ true == true ] && [ arm64 == amd64 ]; then
  env GOOS=linux GOARCH=amd64 \
      SOURCE_DATE_EPOCH=$(date +%s) \
      KO_DOCKER_REPO=ko.local/capi-runtime-extensions \
      ko build \
        --bare \
        -t v0.3.0-dev \
        ./cmd
fi'

    • took: 9s
  • archives
    • creating                                       archive=dist/capi-runtime-extensions_v0.3.0-dev_linux_amd64.tar.gz
    • creating                                       archive=dist/capi-runtime-extensions_v0.3.0-dev_linux_arm64.tar.gz
    • took: 3s
  • calculating checksums
  • storing release metadata
    • writing                                        file=dist/artifacts.json
    • writing                                        file=dist/metadata.json
  • release succeeded after 11s
  • thanks for using goreleaser!
Image: "ko.local/capi-runtime-extensions:v0.3.0-dev" with ID "sha256:7b313af702d8bef15c6eebbb8a39e5bf0fdd7a30940650021b3d548dbd99da83" not yet present on node "capi-runtime-extensions-dev-control-plane", loading...
Release "capi-runtime-extensions" does not exist. Installing it now.
NAME: capi-runtime-extensions
LAST DEPLOYED: Wed Jan 10 08:51:56 2024
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
deployment.apps/capi-runtime-extensions restarted
Waiting for deployment "capi-runtime-extensions" rollout to finish: 1 old replicas are pending termination...
Waiting for deployment "capi-runtime-extensions" rollout to finish: 1 old replicas are pending termination...
deployment "capi-runtime-extensions" successfully rolled out

TODO:

  • I will be testing it on Linux and update here.
  • Test on M1 Mac

make/goreleaser.mk Outdated Show resolved Hide resolved
make/dev.mk Outdated Show resolved Hide resolved
make/dev.mk Outdated Show resolved Hide resolved
make/dev.mk Outdated Show resolved Hide resolved
devbox.json Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
Co-authored-by: Dimitri Koshkin <dimitri.koshkin@gmail.com>
Signed-off-by: Jimmi Dyson <jimmi.dyson@nutanix.com>
@jimmidyson jimmidyson enabled auto-merge (squash) January 11, 2024 07:22
@jimmidyson jimmidyson merged commit fa1c6e7 into main Jan 11, 2024
9 checks passed
@jimmidyson jimmidyson deleted the shalin/build-with-colima branch January 11, 2024 07:24
@github-actions github-actions bot mentioned this pull request Jan 11, 2024
dkoshkin pushed a commit that referenced this pull request Feb 8, 2024
🤖 I have created a release *beep* *boop*
---


## 0.3.0 (2024-02-07)

<!-- Release notes generated using configuration in .github/release.yaml
at main -->

## What's Changed
### Exciting New Features 🎉
* feat: starts additional sec groups by @faiq in
#252
* feat: add control-plane load balancer scheme patch by @dkoshkin in
#228
* feat: Pull in CAAPH APIs by @jimmidyson in
#282
* feat: Use latest dynamic credential provider and v1 kubelet API by
@jimmidyson in
#293
* feat: Add ClusterResourceSet strategy for CNI installation by
@jimmidyson in
#288
* feat: Use CAAPH to deploy Calico on workload clusters by @jimmidyson
in #283
* feat: containerd configuration for mirror registry by @supershal in
#292
* feat: introduce a Go module for /api by @dkoshkin in
#331
### Fixes 🔧
* fix: Stable EBS CSI manifests by @jimmidyson in
#270
* fix: Ensure registry credentials are namespace local to Cluster by
@jimmidyson in
#332
### Other Changes
* build: Upgrade devbox tools by @jimmidyson in
#271
* ci: Update release please configuration for v4 action by @jimmidyson
in #274
* build: Add release conventional commut type for release PRs by
@jimmidyson in
#276
* docs: Add intro page to user docs by @jimmidyson in
#280
* build: Use ko for building OCI image by @jimmidyson in
#281
* build: Add files for clusterctl compatibility by @jimmidyson in
#284
* build: local development in macOS(and Linux) arm64/amd64 using local
colima instance by @supershal in
#285
* build: Lint for missed errors in tests too by @jimmidyson in
#287
* build: Remove unused upx makefile stuff by @jimmidyson in
#291
* docs: Fix indentation of AWS secret example by @jimmidyson in
#294
* build: Add k8s 1.28 KinD for testing by default by @jimmidyson in
#295
* build: Add devbox update scheduled job by @jimmidyson in
#310
* build(main): Latest devbox update (2024-01-22) by @github-actions in
#315
* ci: Group k8s mod updates for dependabot by @jimmidyson in
#316
* build(main): Latest devbox update (2024-01-24) by
@d2iq-labs-actions-pr-bot in
#320
* build(main): Latest devbox update (2024-02-05) by
@d2iq-labs-actions-pr-bot in
#326
* docs: fix cluster name in README by @dkoshkin in
#330
* ci: Consistent bash defaults in workflows by @jimmidyson in
#336
* ci: Tag api module on release by @jimmidyson in
#335

## New Contributors
* @d2iq-labs-actions-pr-bot made their first contribution in
#320

**Full Changelog**:
v0.2.0...v0.3.0

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants