Skip to content

Commit

Permalink
Merge branch 'main' into wait-pause
Browse files Browse the repository at this point in the history
# Conflicts:
#	docs/book/src/developer/providers/migrations/v1.4-to-v1.5.md
  • Loading branch information
nojnhuh committed Jul 3, 2023
2 parents e58bc1d + 730f63d commit 8f173a1
Show file tree
Hide file tree
Showing 326 changed files with 16,819 additions and 4,684 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ updates:
commit-message:
prefix: ":seedling:"
labels:
- "area/ci"
- "ok-to-test"
# Go
- package-ecosystem: "gomod"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # tag=v3.5.2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # tag=v3.5.3
- name: Calculate go version
id: vars
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- test
- hack/tools
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # tag=v3.5.2
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # tag=v3.5.3
- name: Calculate go version
id: vars
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
Expand All @@ -28,7 +28,7 @@ jobs:
with:
go-version: ${{ steps.vars.outputs.go_version }}
- name: golangci-lint
uses: golangci/golangci-lint-action@5f1fec7010f6ae3b84ea4f7b2129beb8639b564f # tag=v3.5.0
uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # tag=v3.6.0
with:
version: v1.52.1
working-directory: ${{matrix.working-directory}}
2 changes: 1 addition & 1 deletion .github/workflows/lint-docs-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
name: Broken Links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # tag=v3.5.2
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # tag=v3.5.3
- uses: gaurav-nelson/github-action-markdown-link-check@5c5dfc0ac2e225883c0e5f03a85311ec2830d368 # tag=v1
with:
use-quiet-mode: 'yes'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-docs-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
branch: [ main, release-1.4, release-1.3 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # tag=v3.5.2
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # tag=v3.5.3
with:
ref: ${{ matrix.branch }}
- uses: gaurav-nelson/github-action-markdown-link-check@5c5dfc0ac2e225883c0e5f03a85311ec2830d368 # tag=v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set env
run: echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # tag=v3.5.2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # tag=v3.5.3
with:
fetch-depth: 0
- name: Calculate go version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # tag=v3.5.2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # tag=v3.5.3
with:
ref: ${{ matrix.branch }}
- name: Calculate go version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-release-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
branch: [ main, release-1.4, release-1.3 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # tag=v3.5.2
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # tag=v3.5.3
with:
ref: ${{ matrix.branch }}
fetch-depth: 0
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ hack/tools/bin

# E2E test templates
test/e2e/data/infrastructure-docker/**/cluster-template*.yaml
test/e2e/data/infrastructure-inmemory/**/cluster-template*.yaml

# Output of Makefile targets using sed on MacOS systems
*.yaml-e
Expand Down
36 changes: 19 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ GINGKO_VER := $(call get_go_version,github.com/onsi/ginkgo/v2)
GINKGO := $(abspath $(TOOLS_BIN_DIR)/$(GINKGO_BIN)-$(GINGKO_VER))
GINKGO_PKG := github.com/onsi/ginkgo/v2/ginkgo

GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT_VER := $(shell cat .github/workflows/golangci-lint.yml | grep [[:space:]]version: | sed 's/.*version: //')
GOLANGCI_LINT := $(abspath $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER))
GOLANGCI_LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint

CONVERSION_VERIFIER_BIN := conversion-verifier
CONVERSION_VERIFIER := $(abspath $(TOOLS_BIN_DIR)/$(CONVERSION_VERIFIER_BIN))

Expand All @@ -175,9 +180,6 @@ RUNTIME_OPENAPI_GEN := $(abspath $(TOOLS_BIN_DIR)/$(RUNTIME_OPENAPI_GEN_BIN))
TILT_PREPARE_BIN := tilt-prepare
TILT_PREPARE := $(abspath $(TOOLS_BIN_DIR)/$(TILT_PREPARE_BIN))

GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT := $(abspath $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN))

# Define Docker related variables. Releases should modify and double check these vars.
REGISTRY ?= gcr.io/$(shell gcloud config get-value project)
PROD_REGISTRY ?= registry.k8s.io/cluster-api
Expand Down Expand Up @@ -505,6 +507,7 @@ generate-modules: ## Run go mod tidy to ensure modules are up to date
generate-e2e-templates: $(KUSTOMIZE) $(addprefix generate-e2e-templates-, v0.4 v1.0 v1.3 v1.4 main) ## Generate cluster templates for all versions

DOCKER_TEMPLATES := test/e2e/data/infrastructure-docker
INMEMORY_TEMPLATES := test/e2e/data/infrastructure-inmemory

.PHONY: generate-e2e-templates-v0.4
generate-e2e-templates-v0.4: $(KUSTOMIZE)
Expand Down Expand Up @@ -535,7 +538,6 @@ generate-e2e-templates-main: $(KUSTOMIZE)
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-machine-pool --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-machine-pool.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-node-drain --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-node-drain.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-upgrades --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-upgrades.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-upgrades-cgroupfs --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-upgrades-cgroupfs.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-upgrades-runtimesdk --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-upgrades-runtimesdk.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-kcp-scale-in --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-kcp-scale-in.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-ipv6 --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-ipv6.yaml
Expand All @@ -546,13 +548,15 @@ generate-e2e-templates-main: $(KUSTOMIZE)
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-topology --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-topology.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-ignition --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-ignition.yaml

$(KUSTOMIZE) build $(INMEMORY_TEMPLATES)/main/cluster-template --load-restrictor LoadRestrictionsNone > $(INMEMORY_TEMPLATES)/main/cluster-template.yaml

.PHONY: generate-metrics-config
generate-metrics-config: $(ENVSUBST_BIN) ## Generate ./hack/observability/kube-state-metrics/crd-config.yaml
OUTPUT_FILE="${OBSERVABILITY_DIR}/kube-state-metrics/crd-config.yaml"; \
METRICS_DIR="${OBSERVABILITY_DIR}/kube-state-metrics/metrics"; \
echo "# This file was auto-generated via: make generate-metrics-config" > "$${OUTPUT_FILE}"; \
cat "$${METRICS_DIR}/header.yaml" >> "$${OUTPUT_FILE}"; \
for resource in cluster kubeadmcontrolplane machine machinedeployment machinehealthcheck machineset machinepool; do \
for resource in clusterclass cluster kubeadmcontrolplane kubeadmconfig machine machinedeployment machinehealthcheck machineset machinepool; do \
cat "$${METRICS_DIR}/$${resource}.yaml"; \
RESOURCE="$${resource}" ${ENVSUBST_BIN} < "$${METRICS_DIR}/common_metrics.yaml"; \
if [[ "$${resource}" != "cluster" ]]; then \
Expand Down Expand Up @@ -734,7 +738,7 @@ docker-build-docker-infrastructure: ## Build the docker image for docker infrast

.PHONY: docker-build-in-memory-infrastructure
docker-build-in-memory-infrastructure: ## Build the docker image for in-memory infrastructure controller manager
cd $(CAPIM_DIR); DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$(ARCH) --build-arg ldflags="$(LDFLAGS)" ../../.. -t $(CAPIM_CONTROLLER_IMG)-$(ARCH):$(TAG) --file ../../../Dockerfile
cd $(CAPIM_DIR); DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$(ARCH) --build-arg ldflags="$(LDFLAGS)" ../../.. -t $(CAPIM_CONTROLLER_IMG)-$(ARCH):$(TAG) --file Dockerfile
$(MAKE) set-manifest-image MANIFEST_IMG=$(CAPIM_CONTROLLER_IMG)-$(ARCH) MANIFEST_TAG=$(TAG) TARGET_RESOURCE="$(CAPIM_DIR)/config/default/manager_image_patch.yaml"
$(MAKE) set-manifest-pull-policy TARGET_RESOURCE="$(CAPIM_DIR)/config/default/manager_pull_policy.yaml"

Expand Down Expand Up @@ -965,7 +969,7 @@ release-manifests: $(RELEASE_DIR) $(KUSTOMIZE) $(RUNTIME_OPENAPI_GEN) ## Build t
release-manifests-dev: $(RELEASE_DIR) $(KUSTOMIZE) ## Build the development manifests and copies them in the release folder
cd $(CAPD_DIR); $(KUSTOMIZE) build config/default > ../../../$(RELEASE_DIR)/infrastructure-components-development.yaml
cp $(CAPD_DIR)/templates/* $(RELEASE_DIR)/
cd $(CAPIM_DIR); $(KUSTOMIZE) build config/default > ../../../$(RELEASE_DIR)/infrastructure-components-inmemory-development.yaml
cd $(CAPIM_DIR); $(KUSTOMIZE) build config/default > ../../../$(RELEASE_DIR)/infrastructure-components-in-memory-development.yaml
cp $(CAPIM_DIR)/templates/* $(RELEASE_DIR)/
cd $(TEST_EXTENSION_DIR); $(KUSTOMIZE) build config/default > ../../$(RELEASE_DIR)/runtime-extension-components-development.yaml

Expand Down Expand Up @@ -1157,7 +1161,7 @@ clean-tilt: clean-charts clean-kind ## Remove all files generated by Tilt

.PHONY: clean-charts
clean-charts: ## Remove all local copies of Helm charts in ./hack/observability
(for path in "./hack/observability/*"; do rm -rf $$path/charts ; done)
(for path in "./hack/observability/*"; do rm -rf $$path/.charts ; done)

.PHONY: clean-book
clean-book: ## Remove all generated GitBook files
Expand Down Expand Up @@ -1237,11 +1241,11 @@ $(YQ_BIN): $(YQ) ## Build a local copy of yq
.PHONY: $(TILT_PREPARE_BIN)
$(TILT_PREPARE_BIN): $(TILT_PREPARE) ## Build a local copy of tilt-prepare.

.PHONY: $(GOLANGCI_LINT_BIN)
$(GOLANGCI_LINT_BIN): $(GOLANGCI_LINT) ## Build a local copy of golangci-lint

.PHONY: $(GINKGO_BIN)
$(GINKGO_BIN): $(GINKGO) ## Build a local copy of ginkgo
$(GINKGO_BIN): $(GINKGO) ## Build a local copy of ginkgo.

.PHONY: $(GOLANGCI_LINT_BIN)
$(GOLANGCI_LINT_BIN): $(GOLANGCI_LINT) ## Build a local copy of golangci-lint.

$(CONTROLLER_GEN): # Build controller-gen from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(CONTROLLER_GEN_PKG) $(CONTROLLER_GEN_BIN) $(CONTROLLER_GEN_VER)
Expand Down Expand Up @@ -1288,14 +1292,12 @@ $(KPROMO):
$(YQ):
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(YQ_PKG) $(YQ_BIN) ${YQ_VER}

$(GOLANGCI_LINT): .github/workflows/golangci-lint.yml # Download golangci-lint using hack script into tools folder.
hack/ensure-golangci-lint.sh \
-b $(TOOLS_BIN_DIR) \
$(shell cat .github/workflows/golangci-lint.yml | grep [[:space:]]version: | sed 's/.*version: //')

$(GINKGO): # Build ginkgo from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(GINKGO_PKG) $(GINKGO_BIN) $(GINGKO_VER)

$(GOLANGCI_LINT): # Build golangci-lint from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(GOLANGCI_LINT_PKG) $(GOLANGCI_LINT_BIN) $(GOLANGCI_LINT_VER)

## --------------------------------------
## Helpers
## --------------------------------------
Expand Down
26 changes: 18 additions & 8 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,10 @@ envsubst_cmd = "./hack/tools/bin/envsubst"
clusterctl_cmd = "./bin/clusterctl"
kubectl_cmd = "kubectl"
default_build_engine = "docker"
kubernetes_version = "v1.27.1"

if str(local("command -v " + kubectl_cmd + " || true", quiet = True)) == "":
fail("Required command '" + kubectl_cmd + "' not found in PATH")
kubernetes_version = "v1.27.3"

load("ext://uibutton", "cmd_button", "location", "text_input")

# detect if docker images should be built using podman
if "Podman Engine" in str(local("docker version || podman version", quiet = True)):
default_build_engine = "podman"

# set defaults
version_settings(True, ">=0.30.8")

Expand All @@ -36,6 +29,13 @@ os.putenv("CAPI_KIND_CLUSTER_NAME", settings.get("kind_cluster_name"))

allow_k8s_contexts(settings.get("allowed_contexts"))

if str(local("command -v " + kubectl_cmd + " || true", quiet = True)) == "":
fail("Required command '" + kubectl_cmd + "' not found in PATH")

# detect if docker images should be built using podman
if "Podman Engine" in str(local("docker version || podman version", quiet = True)):
default_build_engine = "podman"

os_name = str(local("go env GOOS")).rstrip("\n")
os_arch = str(local("go env GOARCH")).rstrip("\n")

Expand Down Expand Up @@ -432,6 +432,12 @@ def deploy_observability():
],
)

if "tempo" in settings.get("deploy_observability", []):
k8s_yaml(read_file("./.tiltbuild/yaml/tempo.observability.yaml"), allow_duplicates = True)

# Port-forward the tracing port to localhost, so we can also send traces from local.
k8s_resource(workload = "tempo", port_forwards = "4317:4317", extra_pod_selectors = [{"app": "tempo"}], labels = ["observability"])

if "grafana" in settings.get("deploy_observability", []):
k8s_yaml(read_file("./.tiltbuild/yaml/grafana.observability.yaml"), allow_duplicates = True)
k8s_resource(workload = "grafana", port_forwards = "3001:3000", extra_pod_selectors = [{"app": "grafana"}], labels = ["observability"], objects = ["grafana:serviceaccount"])
Expand All @@ -448,6 +454,10 @@ def deploy_observability():
k8s_yaml(read_file("./.tiltbuild/yaml/parca.observability.yaml"), allow_duplicates = True)
k8s_resource(workload = "parca", new_name = "parca", port_forwards = "7070", extra_pod_selectors = [{"app": "parca"}], labels = ["observability"], objects = ["parca:serviceaccount"])

if "metrics-server" in settings.get("deploy_observability", []):
k8s_yaml(read_file("./.tiltbuild/yaml/metrics-server.observability.yaml"), allow_duplicates = True)
k8s_resource(workload = "metrics-server", new_name = "metrics-server", extra_pod_selectors = [{"app": "metrics-server"}], labels = ["observability"], objects = ["metrics-server:serviceaccount"])

if "visualizer" in settings.get("deploy_observability", []):
k8s_yaml(read_file("./.tiltbuild/yaml/visualizer.observability.yaml"), allow_duplicates = True)
k8s_resource(
Expand Down
4 changes: 3 additions & 1 deletion api/v1beta1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ type Topology struct {

// RolloutAfter performs a rollout of the entire cluster one component at a time,
// control plane first and then machine deployments.
// +optional
//
// Deprecated: This field has no function and is going to be removed in the next apiVersion.
//
// +optional
RolloutAfter *metav1.Time `json:"rolloutAfter,omitempty"`

// ControlPlane describes the cluster control plane.
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/condition_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ const (
// not yet completed because Control Plane is not yet updated to match the desired topology spec.
TopologyReconciledControlPlaneUpgradePendingReason = "ControlPlaneUpgradePending"

// TopologyReconciledMachineDeploymentsCreatePendingReason (Severity=Info) documents reconciliation of a Cluster topology
// not yet completed because at least one of the MachineDeployments is yet to be created.
// This generally happens because new MachineDeployment creations are held off while the ControlPlane is not stable.
TopologyReconciledMachineDeploymentsCreatePendingReason = "MachineDeploymentsCreatePending"

// TopologyReconciledMachineDeploymentsUpgradePendingReason (Severity=Info) documents reconciliation of a Cluster topology
// not yet completed because at least one of the MachineDeployments is not yet updated to match the desired topology spec.
TopologyReconciledMachineDeploymentsUpgradePendingReason = "MachineDeploymentsUpgradePending"
Expand Down
40 changes: 27 additions & 13 deletions api/v1beta1/machine_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,19 @@ func TestMachineBootstrapValidation(t *testing.T) {
Spec: MachineSpec{Bootstrap: tt.bootstrap},
}
if tt.expectErr {
_, err := m.ValidateCreate()
warnings, err := m.ValidateCreate()
g.Expect(err).To(HaveOccurred())
_, err = m.ValidateUpdate(m)
g.Expect(warnings).To(BeEmpty())
warnings, err = m.ValidateUpdate(m)
g.Expect(err).To(HaveOccurred())
g.Expect(warnings).To(BeEmpty())
} else {
_, err := m.ValidateCreate()
warnings, err := m.ValidateCreate()
g.Expect(err).ToNot(HaveOccurred())
_, err = m.ValidateUpdate(m)
g.Expect(warnings).To(BeEmpty())
warnings, err = m.ValidateUpdate(m)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(warnings).To(BeEmpty())
}
})
}
Expand Down Expand Up @@ -141,15 +145,19 @@ func TestMachineNamespaceValidation(t *testing.T) {
}

if tt.expectErr {
_, err := m.ValidateCreate()
warnings, err := m.ValidateCreate()
g.Expect(err).To(HaveOccurred())
_, err = m.ValidateUpdate(m)
g.Expect(warnings).To(BeEmpty())
warnings, err = m.ValidateUpdate(m)
g.Expect(err).To(HaveOccurred())
g.Expect(warnings).To(BeEmpty())
} else {
_, err := m.ValidateCreate()
warnings, err := m.ValidateCreate()
g.Expect(err).ToNot(HaveOccurred())
_, err = m.ValidateUpdate(m)
g.Expect(warnings).To(BeEmpty())
warnings, err = m.ValidateUpdate(m)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(warnings).To(BeEmpty())
}
})
}
Expand Down Expand Up @@ -193,11 +201,13 @@ func TestMachineClusterNameImmutable(t *testing.T) {
},
}

_, err := newMachine.ValidateUpdate(oldMachine)
warnings, err := newMachine.ValidateUpdate(oldMachine)
if tt.expectErr {
g.Expect(err).To(HaveOccurred())
g.Expect(warnings).To(BeEmpty())
} else {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(warnings).To(BeEmpty())
}
})
}
Expand Down Expand Up @@ -248,15 +258,19 @@ func TestMachineVersionValidation(t *testing.T) {
}

if tt.expectErr {
_, err := m.ValidateCreate()
warnings, err := m.ValidateCreate()
g.Expect(err).To(HaveOccurred())
_, err = m.ValidateUpdate(m)
g.Expect(warnings).To(BeEmpty())
warnings, err = m.ValidateUpdate(m)
g.Expect(err).To(HaveOccurred())
g.Expect(warnings).To(BeEmpty())
} else {
_, err := m.ValidateCreate()
warnings, err := m.ValidateCreate()
g.Expect(err).ToNot(HaveOccurred())
_, err = m.ValidateUpdate(m)
g.Expect(warnings).To(BeEmpty())
warnings, err = m.ValidateUpdate(m)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(warnings).To(BeEmpty())
}
})
}
Expand Down
Loading

0 comments on commit 8f173a1

Please sign in to comment.