Skip to content

Commit

Permalink
breaking: capi v1.6.0 update
Browse files Browse the repository at this point in the history
breaking: remove linux/armv7 builds cause they're slow
feat: profiling
- add flags for profiling
- process profiling and tls options
- NOTE: actual profiling may still need more work, this is mostly focused on handling flags
- add flags support for secure metrics server
- switch default metrics server to secured
refactor: main.go
    - use infrav1 instead of infrav1beta1 in main.go
    - functionize inits of webhooks, reconcilers and health checks in
    - don't set ctrl options in line for better readability
    - use caching for namespace watches
    - process restconfig options
- e2e test signature update for 1.6 compatibility
refactor: machine controller and scope
- remove instance id
- get rid of getproviderid()
- add providerid()
- add deviceid which is providerid without prefix
- use deviceid for all api calls
- device/provider id usage now is more similar to upstream and other providers
fix: add RBAC rules for kubebuilder
fix: fix controller gen calls in makefile
    - don't need two calls
    - include main.go
    - add cleanup like upstream has
fix: use real context in metal-go calls
doc: Add v0.8.x upgrade notes
chore: run make generate
chore: use new capi preferred api registration scheme
chore: use packet device id string as provider id (upstream removed noderefutil wrapped provider ids)
chore: metadata updates for 1.6 e2e tests
chore: bump calico to 3.27
chore: Bump kube-vip version to 0.6.4
chore: Bump CPEM to 3.7.0
chore: update readme explain tag changes

Signed-off-by: Chris Privitere <23177737+cprivitere@users.noreply.github.com>
  • Loading branch information
cprivitere committed Dec 20, 2023
1 parent 9cb902b commit d7148f7
Show file tree
Hide file tree
Showing 34 changed files with 1,445 additions and 1,182 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64, linux/arm64, linux/arm/v7
platforms: linux/amd64, linux/arm64

# If PR, put image tags in the PR comments
# from https://github.com/marketplace/actions/create-or-update-comment
Expand Down
193 changes: 95 additions & 98 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Upload Release Asset
on:
push:
tags:
- 'v*'
- "v*"
env:
IMAGE_NAME: cluster-api-provider-packet
GHCR_REGISTRY: ghcr.io/${{ github.repository_owner }}
Expand All @@ -12,7 +12,6 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:

build-image:
name: Build and Push Image
runs-on: ubuntu-latest
Expand All @@ -21,78 +20,77 @@ jobs:
packages: write # needed to push docker image to ghcr.io

steps:

- name: Checkout git repo
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to ghcr.io registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log into DockerHub
uses: docker/login-action@v3
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
if: ${{ env.DOCKER_USERNAME != '' }}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log into quay.io
uses: docker/login-action@v3
env:
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
if: ${{ env.QUAY_USERNAME != '' }}
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.QUAY_REGISTRY }}/${{ env.IMAGE_NAME }}
${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}
${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=auto
tags: |
- name: Checkout git repo
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to ghcr.io registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log into DockerHub
uses: docker/login-action@v3
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
if: ${{ env.DOCKER_USERNAME != '' }}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log into quay.io
uses: docker/login-action@v3
env:
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
if: ${{ env.QUAY_USERNAME != '' }}
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.QUAY_REGISTRY }}/${{ env.IMAGE_NAME }}
${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}
${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=auto
tags: |
type=semver,pattern={{version}}
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha
- name: Setup Env
run: |
DOCKER_BUILD_LDFLAGS="$(hack/version.sh)"
echo 'DOCKER_BUILD_LDFLAGS<<EOF' >> $GITHUB_ENV
echo $DOCKER_BUILD_LDFLAGS >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Docker Build and Push
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args: |
LDFLAGS=${{ env.DOCKER_BUILD_LDFLAGS }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64, linux/arm64, linux/arm/v7
- name: Setup Env
run: |
DOCKER_BUILD_LDFLAGS="$(hack/version.sh)"
echo 'DOCKER_BUILD_LDFLAGS<<EOF' >> $GITHUB_ENV
echo $DOCKER_BUILD_LDFLAGS >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Docker Build and Push
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args: |
LDFLAGS=${{ env.DOCKER_BUILD_LDFLAGS }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64, linux/arm64

outputs:
image-tag: "${{ steps.docker_meta.outputs.version }}"
Expand All @@ -106,33 +104,32 @@ jobs:
REGISTRY: quay.io/${{ secrets.QUAY_ORG }}

steps:

- name: checkout
uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
go-version-file: './go.mod'

- name: Make Release
run: make release

- name: Generate Release Notes
run: |
release_notes=$(gh api repos/{owner}/{repo}/releases/generate-notes -F tag_name=${{ github.ref }} --jq .body)
echo 'RELEASE_NOTES<<EOF' >> $GITHUB_ENV
echo "${release_notes}" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}

- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: out/release/*
body: ${{ env.RELEASE_NOTES }}
draft: false
prerelease: false
- name: checkout
uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
go-version-file: "./go.mod"

- name: Make Release
run: make release

- name: Generate Release Notes
run: |
release_notes=$(gh api repos/{owner}/{repo}/releases/generate-notes -F tag_name=${{ github.ref }} --jq .body)
echo 'RELEASE_NOTES<<EOF' >> $GITHUB_ENV
echo "${release_notes}" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}

- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: out/release/*
body: ${{ env.RELEASE_NOTES }}
draft: false
prerelease: false
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ endif
## Binaries.

# Sync to controller-tools version in https://github.com/kubernetes-sigs/cluster-api/blob/v{VERSION}/hack/tools/go.mod
CONTROLLER_GEN_VER := v0.12.0
CONTROLLER_GEN_VER := v0.13.0
CONTROLLER_GEN_BIN := controller-gen
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER)

# Sync to k8s.io/* versions in https://github.com/kubernetes-sigs/cluster-api/blob/v{VERSION}/go.mod
CONVERSION_GEN_VER := v0.27.8
CONVERSION_GEN_VER := v0.28.4
CONVERSION_GEN_BIN := conversion-gen
CONVERSION_GEN := $(TOOLS_BIN_DIR)/$(CONVERSION_GEN_BIN)-$(CONVERSION_GEN_VER)

Expand All @@ -84,7 +84,7 @@ ENVSUBST_BIN := envsubst
ENVSUBST := $(TOOLS_BIN_DIR)/$(ENVSUBST_BIN)

# Bump as necessary/desired to latest that supports our version of go at https://github.com/golangci/golangci-lint/releases
GOLANGCI_LINT_VER := v1.53.3
GOLANGCI_LINT_VER := v1.55.2
GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)

Expand All @@ -95,7 +95,7 @@ KUSTOMIZE_BIN := kustomize
KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER)

# Sync to github.com/onsi/ginkgo verison in https://github.com/kubernetes-sigs/cluster-api/blob/v{VERSION}/go.mod
GINKGO_VER := v2.11.0
GINKGO_VER := v2.13.1
GINKGO_BIN := ginkgo
GINKGO := $(abspath $(TOOLS_BIN_DIR)/$(GINKGO_BIN)-$(GINKGO_VER))
GINKGO_PKG := github.com/onsi/ginkgo/v2/ginkgo
Expand Down Expand Up @@ -296,17 +296,17 @@ generate-go: $(CONTROLLER_GEN) $(CONVERSION_GEN) ## Runs Go related generate tar

.PHONY: generate-manifests
generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc.
$(MAKE) clean-generated-yaml SRC_DIRS="$(CRD_ROOT),$(WEBHOOK_ROOT)/manifests.yaml"
$(CONTROLLER_GEN) \
paths=./ \
paths=./api/... \
paths=./controllers/... \
crd:crdVersions=v1 \
rbac:roleName=manager-role \
output:crd:dir=$(CRD_ROOT) \
output:rbac:dir=$(RBAC_ROOT) \
output:webhook:dir=$(WEBHOOK_ROOT) \
webhook
$(CONTROLLER_GEN) \
paths=./controllers/... \
output:rbac:dir=$(RBAC_ROOT) \
rbac:roleName=manager-role

## --------------------------------------
## Docker
Expand Down Expand Up @@ -405,6 +405,10 @@ clean-bin: ## Remove all generated binaries
rm -rf bin
rm -rf hack/tools/bin

.PHONY: clean-generated-yaml
clean-generated-yaml: ## Remove files generated by conversion-gen from the mentioned dirs. Example SRC_DIRS="./api/v1alpha4"
(IFS=','; for i in $(SRC_DIRS); do find $$i -type f -name '*.yaml' -exec rm -f {} \;; done)

.PHONY: clean-temporary
clean-temporary: ## Remove all temporary files and folders
rm -f minikube.kubeconfig
Expand Down
Loading

0 comments on commit d7148f7

Please sign in to comment.