Skip to content

Commit

Permalink
Merge remote-tracking branch 'auto-sync-script-upstream/main' into au…
Browse files Browse the repository at this point in the history
…to_sync_upstream_2022-10-21-06-12
  • Loading branch information
qinqon committed Oct 21, 2022
2 parents a278f8d + cdb7a4c commit 46378f2
Show file tree
Hide file tree
Showing 61 changed files with 4,240 additions and 413 deletions.
2 changes: 2 additions & 0 deletions .github/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
approvers:
- qinqon
2 changes: 1 addition & 1 deletion .github/workflows/clusterkubevirtadm-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18
- name: Checkout code
uses: actions/checkout@v2
- name: Test
Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/create_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
on:
push:
tags:
- "v*"

name: Upload Release Asset

jobs:
build-and-push-image:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: build image
shell: bash
env:
QUAY_TOKEN: ${{secrets.QUAY_TOKEN}}
REGISTRY: "quay.io/capk"
TAG: ${{ github.ref_name }}
run: |
echo $QUAY_TOKEN | docker login -u="capk+capk_robot" quay.io --password-stdin
make docker-build-all
make docker-push-all
build:
name: Upload Release Asset
needs: build-and-push-image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.18'
- name: Install kustomize
run: curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
- name: Create infrastructure components
env:
REGISTRY: "quay.io/capk"
IMAGE_NAME: "capk-manager"
TAG: ${{ github.ref_name }}
run: |
make create-infrastructure-components
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload infrastructure-components.yaml
id: upload-infrastructure-components
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./infrastructure-components.yaml
asset_name: infrastructure-components.yaml
asset_content_type: text/plain
- name: Upload metadata.yaml
id: upload-metadata
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./metadata.yaml
asset_name: metadata.yaml
asset_content_type: text/plain
- name: Upload cluster-template.yaml
id: upload-cluster-template
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./templates/cluster-template.yaml
asset_name: cluster-template.yaml
asset_content_type: text/plain
6 changes: 4 additions & 2 deletions .github/workflows/image_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: build image
shell: bash
env:
Expand All @@ -16,5 +18,5 @@ jobs:
TAG: "dev-latest"
run: |
echo $QUAY_TOKEN | docker login -u="capk+capk_robot" quay.io --password-stdin
make docker-build
make docker-push
make docker-build-all
make docker-push-all
21 changes: 17 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ jobs:
if: (github.repository == 'kubernetes-sigs/cluster-api-provider-kubevirt')
strategy:
matrix:
go-version: [1.17.x]
go-version: [1.18.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
Expand All @@ -27,7 +27,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x
go-version: 1.18.x
- name: Checkout code
uses: actions/checkout@v2
- name: Test with coverage
Expand All @@ -51,3 +51,16 @@ jobs:
uses: golangci/golangci-lint-action@v2
with: # TODO: remove this when the deprecated function will be removed (issue #85)
args: --exclude SA1019 --timeout=5m

check-gen:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.18.x
- uses: actions/checkout@v2
- name: Check that 'make generate' has being call
run: make check-gen


3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
cluster-up/
.kubevirtci/
hack/tools/bin/
bin/
.idea/
infrastructure-components.yaml
_artifacts
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# Build the manager binary
# Run this with docker build --build-arg builder_image=<golang:x.y.z>
ARG builder_image=golang:1.17.2
ARG builder_image=golang:1.18.2
FROM ${builder_image} as builder
WORKDIR /workspace

Expand Down
67 changes: 52 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# If you update this file, please follow:
# https://suva.sh/posts/well-documented-makefiles/

ROOT = $$GOPATH/pkg/mod/sigs.k8s.io/cluster-api@v0.3.11-0.20210525210043-6c7878e7b4a9

.DEFAULT_GOAL:=help
TARGET ?= target
TESTS = $(shell go list ./... | grep -vE "./(i|apply)tests")
Expand Down Expand Up @@ -50,13 +48,11 @@ endif
CONTROLLER_GEN := $(abspath $(TOOLS_BIN_DIR)/controller-gen)
CONVERSION_GEN := $(abspath $(TOOLS_BIN_DIR)/conversion-gen)
GOTESTSUM := $(abspath $(TOOLS_BIN_DIR)/gotestsum)
KUSTOMIZE := $(abspath $(TOOLS_BIN_DIR)/kustomize)

$(KUSTOMIZE): # Build kustomize from tools folder.
$(MAKE) -C $(ROOT) kustomize
KUSTOMIZE_IMAGE = k8s.gcr.io/kustomize/kustomize:v3.8.7
KUSTOMIZE ?= docker run $(KUSTOMIZE_IMAGE)

# Define Docker related variables. Releases should modify and double check these vars.
REGISTRY ?= localhost:5000
REGISTRY ?= 127.0.0.1:5000
IMAGE_NAME ?= capk-manager
CONTROLLER_IMG ?= $(REGISTRY)/$(IMAGE_NAME)
ARCH ?= amd64
Expand All @@ -77,7 +73,7 @@ help: ## Display this help
## Testing
## --------------------------------------

ARTIFACTS ?= $(ROOT)/_artifacts
ARTIFACTS ?= _artifacts

.PHONY: test
test: ## Run tests.
Expand All @@ -89,6 +85,7 @@ test-verbose: ## Run tests with verbose settings.

.PHONY: test-junit
test-junit: $(GOTESTSUM) ## Run tests with verbose setting and generate a junit report.
mkdir -p $(ARTIFACTS)
(go test -json ./... $(TEST_ARGS); echo $$? > $(ARTIFACTS)/junit.infra_docker.exitcode) | tee $(ARTIFACTS)/junit.infra_docker.stdout
$(GOTESTSUM) --junitfile $(ARTIFACTS)/junit.infra_docker.xml --raw-command cat $(ARTIFACTS)/junit.infra_docker.stdout
exit $$(cat $(ARTIFACTS)/junit.infra_docker.exitcode)
Expand All @@ -102,6 +99,18 @@ build-e2e-test: ## Builds the test binary
e2e-test: build-e2e-test ## run e2e tests
BIN_DIR=$(BIN_DIR) ./hack/run-e2e.sh

.PHONY: functest
functest:
./hack/functest.sh

.PHONY: conformance
conformance:
./hack/conformance.sh

.PHONY: run-conformance
run-conformance:
./hack/run-conformance.sh

## --------------------------------------
## Binaries
## --------------------------------------
Expand Down Expand Up @@ -146,6 +155,10 @@ gotestsum: $(GOTESTSUM) ## Build a local copy of gotestsum.
## Generate / Manifests
## --------------------------------------

.PHONY: check-gen
check-gen: generate
hack/check-gen.sh

.PHONY: generate
generate: $(CONTROLLER_GEN) ## Generate code
$(MAKE) generate-manifests
Expand All @@ -154,15 +167,15 @@ generate: $(CONTROLLER_GEN) ## Generate code
.PHONY: generate-go
generate-go: $(CONTROLLER_GEN) $(CONVERSION_GEN) ## Runs Go related generate targets
$(CONTROLLER_GEN) \
object:headerFile=$(ROOT)/hack/boilerplate/boilerplate.generatego.txt \
object:headerFile=hack/boilerplate.generatego.txt \
paths=./api/...
(IFS=','; for i in "./api/v1alpha1"; do find $$i -type f -name 'zz_generated.conversion*' -exec rm -f {} \;; done)
$(CONVERSION_GEN) \
--input-dirs=./api/v1alpha1 \
--build-tag=ignore_autogenerated_capk_v1alpha1 \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \
--output-file-base=zz_generated.conversion $(CONVERSION_GEN_OUTPUT_BASE) \
--go-header-file=$(ROOT)/hack/boilerplate/boilerplate.generatego.txt
--go-header-file=hack/boilerplate.generatego.txt

.PHONY: generate-manifests
generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc.
Expand All @@ -175,6 +188,10 @@ generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc.
output:webhook:dir=./config/webhook \
webhook

.PHONY: generate-kccm-flavors
generate-kccm-flavors:
./hack/kccm-flavor-gen.sh

.PHONY: modules
modules: ## Runs go mod to ensure modules are up to date.
go mod tidy
Expand All @@ -187,7 +204,7 @@ modules: ## Runs go mod to ensure modules are up to date.
.PHONY: docker-pull-prerequisites
docker-pull-prerequisites:
docker pull docker.io/docker/dockerfile:1.1-experimental
docker pull docker.io/library/golang:1.17.2
docker pull docker.io/library/golang:1.18.2
docker pull gcr.io/distroless/static:latest

.PHONY: docker-build
Expand Down Expand Up @@ -244,6 +261,18 @@ else
sed -i -e 's@imagePullPolicy: .*@imagePullPolicy: '"$(PULL_POLICY)"'@' ./config/default/manager_pull_policy.yaml
endif

## --------------------------------------
## Deployment
## --------------------------------------
##> infrastructure-components.yaml
set_controller_image:
echo setting controller image to be ${CONTROLLER_IMG}:${TAG}
cd config/default && kustomize edit set image controller=${CONTROLLER_IMG}:${TAG}

create-infrastructure-components: generate-manifests set_controller_image
kustomize build config/default > infrastructure-components.yaml


## --------------------------------------
## Cleanup / Verification
## --------------------------------------
Expand Down Expand Up @@ -282,9 +311,17 @@ verify-gen: generate
echo "generated files are out of date, run make generate"; exit 1; \
fi

.PHONY: functest
functest:
./hack/functest.sh
.PHONY: cluster-up
cluster-up:
./kubevirtci up

.PHONY: cluster-down
cluster-down:
./kubevirtci down

.PHONY: cluster-sync
cluster-sync:
./kubevirtci sync

.PHONY: goimports
goimports:
Expand All @@ -298,4 +335,4 @@ linter:
golangci-lint run --exclude SA1019

.PHONY: sanity
sanity: linter goimports test
sanity: linter goimports test
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ We also encourage ALL active community participants to act as if they are mainta
- Join the [SIG Cluster Lifecycle](https://groups.google.com/g/kubernetes-sig-cluster-lifecycle) Google Group to documents and calendar.
- Participate in the conversations on [Kubernetes Discuss](https://discuss.kubernetes.io/c/contributors/cluster-api/23)

- **Meetings:**
- **Meetings:**
- Cluster API Provider KubeVirt Syncup Meetings: [Tuesdays at 8:00 PT (Pacific Time)](https://zoom.us/j/94685513559?pwd=cnI3RUQyZ3RrckpOc1BQNDA1Q1BrZz09) (weekly starting Tuesday December 7th, 2021). [Convert to your timezone](http://www.thetimezoneconverter.com/?t=8:00&tz=PT%20%28Pacific%20Time%29).
- [Meeting notes and Agenda](https://docs.google.com/document/d/1ZAnRLCKOVbDqrsrYis2OR0aZIAlqp576gCJVCkMNiHM/edit?usp=sharing).

Expand All @@ -54,7 +54,7 @@ We also have a issue tracker to track features. If you think you have a feature
- Open a feature request
- Remember users might be searching for the issue in future, so please make sure to give it a meaningful title to help others.
- Clearly define the use case with concrete examples. Example: type `this` and cluster-api-provider-kubevirt does `that`.
- Some of our larger features will require some design. If you would like to include a techincal design to your feature, please go ahead.
- Some of our larger features will require some design. If you would like to include a technical design to your feature, please go ahead.
- After the new feature is well understood, and the design is agreed upon we can start coding the feature. We would love for you to code it. So please open up a **WIP** *(work in progress)* PR and happy coding!

### Code of conduct
Expand Down
6 changes: 5 additions & 1 deletion api/v1alpha1/kubevirtcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ const (
ClusterFinalizer = "kubevirtcluster.infrastructure.cluster.x-k8s.io"
)

const (
const ( //labels
KubevirtMachineNameLabel = "capk.cluster.x-k8s.io/kubevirt-machine-name"
KubevirtMachineNamespaceLabel = "capk.cluster.x-k8s.io/kubevirt-machine-namespace"

KubevirtMachineVMTerminalLabel = "capk.cluster.x-k8s.io/vm-is-terminal"
)

const ( // annotations
VmiDeletionGraceTime = "capk.cluster.x-k8s.io/vmi-deletion-grace-time"
)

// KubevirtClusterSpec defines the desired state of KubevirtCluster.
type KubevirtClusterSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clusterctl-settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "infrastructure-kubevirt",
"name": "kubevirt",
"config": {
"componentsFile": "infrastructure-components.yaml",
"nextVersion": "v0.1.0"
Expand Down
Loading

0 comments on commit 46378f2

Please sign in to comment.