Skip to content

Commit

Permalink
merge nmstate/kubernetes-nmstate v0.44.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cybertron committed Apr 9, 2021
2 parents 4f1b77a + b7e2ef0 commit 9e19439
Show file tree
Hide file tree
Showing 4,780 changed files with 806,500 additions and 181,844 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
74 changes: 67 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ IMAGE_REGISTRY ?= quay.io
IMAGE_REPO ?= nmstate
NAMESPACE ?= nmstate

NMSTATE_CURRENT_COPR_REPO=nmstate-0.3
NM_CURRENT_COPR_REPO=NetworkManager-1.26

NMSTATE_FUTURE_COPR_REPO=nmstate
NM_FUTURE_COPR_REPO=NetworkManager-1.26

ifeq ($(NMSTATE_PIN), future)
NMSTATE_COPR_REPO=$(NMSTATE_FUTURE_COPR_REPO)
NM_COPR_REPO=$(NM_FUTURE_COPR_REPO)
else
NMSTATE_COPR_REPO=$(NMSTATE_CURRENT_COPR_REPO)
NM_COPR_REPO=$(NM_CURRENT_COPR_REPO)
endif

HANDLER_IMAGE_NAME ?= kubernetes-nmstate-handler
HANDLER_IMAGE_TAG ?= latest
HANDLER_IMAGE_FULL_NAME ?= $(IMAGE_REPO)/$(HANDLER_IMAGE_NAME):$(HANDLER_IMAGE_TAG)
Expand All @@ -24,11 +38,11 @@ WHAT ?= ./pkg ./controllers ./api

unit_test_args ?= -r -keepGoing --randomizeAllSpecs --randomizeSuites --race --trace $(UNIT_TEST_ARGS)

export KUBEVIRT_PROVIDER ?= k8s-1.19
export KUBEVIRT_PROVIDER ?= k8s-1.20
export KUBEVIRT_NUM_NODES ?= 2 # 1 master, 1 worker needed for e2e tests
export KUBEVIRT_NUM_SECONDARY_NICS ?= 2

export E2E_TEST_TIMEOUT ?= 40m
export E2E_TEST_TIMEOUT ?= 80m

e2e_test_args = -v -timeout=$(E2E_TEST_TIMEOUT) -slowSpecThreshold=60 $(E2E_TEST_ARGS)

Expand Down Expand Up @@ -61,6 +75,8 @@ export GITHUB_RELEASE ?= $(GOBIN)/github-release
export RELEASE_NOTES ?= $(GOBIN)/release-notes
GOFMT := $(GOBIN)/gofmt
export GO := $(GOBIN)/go
OPM ?= $(GOBIN)/opm
OPERATOR_SDK ?= $(GOBIN)/operator-sdk

LOCAL_REGISTRY ?= registry:5000

Expand All @@ -69,6 +85,23 @@ export MANIFESTS_DIR ?= build/_output/manifests
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"

# Current Operator version
VERSION ?= 0.0.1
# Default bundle image tag
BUNDLE_IMG ?= $(IMAGE_REGISTRY)/$(IMAGE_REPO)/kubernetes-nmstate-operator-bundle:$(VERSION)
# Options for 'bundle-build'
ifneq ($(origin CHANNELS), undefined)
BUNDLE_CHANNELS := --channels=$(CHANNELS)
endif
ifneq ($(origin DEFAULT_CHANNEL), undefined)
BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)

INDEX_VERSION ?= 1.0.0
# Default index image tag
INDEX_IMG ?= $(IMAGE_REGISTRY)/$(IMAGE_REPO)/kubernetes-nmstate-operator-index:$(INDEX_VERSION)

all: check handler

check: vet whitespace-check gofmt-check
Expand Down Expand Up @@ -103,6 +136,10 @@ $(RELEASE_NOTES): go.mod
$(MAKE) tools
$(CONTROLLER_GEN): go.mod
$(MAKE) tools
$(OPM): go.mod
$(MAKE) tools
$(OPERATOR_SDK): go.mod
$(MAKE) tools

gen-k8s: $(CONTROLLER_GEN)
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
Expand All @@ -125,7 +162,7 @@ manager: $(GO)
$(GO) build -o $(BIN_DIR)/manager main.go

handler: manager
$(IMAGE_BUILDER) build . -f build/Dockerfile -t ${HANDLER_IMAGE}
$(IMAGE_BUILDER) build . -f build/Dockerfile -t ${HANDLER_IMAGE} --build-arg NMSTATE_COPR_REPO=$(NMSTATE_COPR_REPO) --build-arg NM_COPR_REPO=$(NM_COPR_REPO)

push-handler: handler
$(IMAGE_BUILDER) push $(HANDLER_IMAGE)
Expand All @@ -141,10 +178,10 @@ test/unit: $(GINKGO)
INTERFACES_FILTER="" NODE_NAME=node01 $(GINKGO) $(unit_test_args) $(WHAT)

test-e2e-handler: $(GINKGO)
KUBECONFIG=$(shell ./cluster/kubeconfig.sh) $(GINKGO) $(e2e_test_args) ./test/e2e/handler ... -- $(E2E_TEST_SUITE_ARGS)
KUBECONFIG=$(KUBECONFIG) OPERATOR_NAMESPACE=$(OPERATOR_NAMESPACE) $(GINKGO) $(e2e_test_args) ./test/e2e/handler ... -- $(E2E_TEST_SUITE_ARGS)

test-e2e-operator: manifests $(GINKGO)
KUBECONFIG=$(shell ./cluster/kubeconfig.sh) $(GINKGO) $(e2e_test_args) ./test/e2e/operator ... -- $(E2E_TEST_SUITE_ARGS)
KUBECONFIG=$(KUBECONFIG) OPERATOR_NAMESPACE=$(OPERATOR_NAMESPACE) $(GINKGO) $(e2e_test_args) ./test/e2e/operator ... -- $(E2E_TEST_SUITE_ARGS)

test-e2e: test-e2e-operator test-e2e-handler

Expand Down Expand Up @@ -180,6 +217,27 @@ vendor: $(GO)
tools: $(GO)
./hack/install-tools.sh

# Generate bundle manifests and metadata, then validate generated files.
bundle: $(OPERATOR_SDK) gen-crds manifests
$(OPERATOR_SDK) generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS) --deploy-dir $(MANIFESTS_DIR) --crds-dir deploy/crds
$(OPERATOR_SDK) bundle validate ./bundle

# Build the bundle image.
bundle-build:
$(IMAGE_BUILDER) build -f bundle.Dockerfile -t $(BUNDLE_IMG) .

# Build the index
index-build: $(OPM) bundle-build
$(OPM) index add --bundles $(BUNDLE_IMG) --tag $(INDEX_IMG)

bundle-push: bundle-build
$(IMAGE_BUILDER) push $(BUNDLE_IMG)

index-push: index-build
$(IMAGE_BUILDER) push $(INDEX_IMG)

olm-push: bundle-push index-push

.PHONY: \
all \
check \
Expand All @@ -202,5 +260,7 @@ tools: $(GO)
vendor \
whitespace-check \
whitespace-format \
manifests \
tools
generate-manifests \
tools \
bundle \
bundle-build
11 changes: 3 additions & 8 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@ approvers:
- phoracek
- qinqon
- bcrochet
- yboaron
- cybertron
- celebdor
- rhrazdil
reviewers:
- phoracek
- qinqon
- oshoval
- AlonaKaplan
- bcrochet
- yboaron
- RamLavi
- rhrazdil
- cybertron
- celebdor

# Bugzilla info;
component: Networking
subcomponent: kubernetes-nmstate-operator,kubernetes-nmstate
subcomponent: kubernetes-nmstate-operator
subcomponent: kubernetes-nmstate

3 changes: 3 additions & 0 deletions api/shared/nodenetworkconfigurationenactment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ const (
NodeNetworkConfigurationEnactmentConditionFailing ConditionType = "Failing"
NodeNetworkConfigurationEnactmentConditionProgressing ConditionType = "Progressing"
NodeNetworkConfigurationEnactmentConditionMatching ConditionType = "Matching"
NodeNetworkConfigurationEnactmentConditionAborted ConditionType = "Aborted"
)

var NodeNetworkConfigurationEnactmentConditionTypes = [...]ConditionType{
NodeNetworkConfigurationEnactmentConditionAvailable,
NodeNetworkConfigurationEnactmentConditionFailing,
NodeNetworkConfigurationEnactmentConditionProgressing,
NodeNetworkConfigurationEnactmentConditionMatching,
NodeNetworkConfigurationEnactmentConditionAborted,
}

const (
Expand All @@ -40,6 +42,7 @@ const (
NodeNetworkConfigurationEnactmentConditionConfigurationProgressing ConditionReason = "ConfigurationProgressing"
NodeNetworkConfigurationEnactmentConditionNodeSelectorNotMatching ConditionReason = "NodeSelectorNotMatching"
NodeNetworkConfigurationEnactmentConditionNodeSelectorAllSelectorsMatching ConditionReason = "AllSelectorsMatching"
NodeNetworkConfigurationEnactmentConditionConfigurationAborted ConditionReason = "ConfigurationAborted"
)

func EnactmentKey(node string, policy string) types.NamespacedName {
Expand Down
12 changes: 12 additions & 0 deletions api/shared/nodenetworkconfigurationpolicy_types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package shared

import "k8s.io/apimachinery/pkg/util/intstr"

// NodeNetworkConfigurationPolicySpec defines the desired state of NodeNetworkConfigurationPolicy
type NodeNetworkConfigurationPolicySpec struct {
// NodeSelector is a selector which must be true for the policy to be applied to the node.
Expand All @@ -11,11 +13,21 @@ type NodeNetworkConfigurationPolicySpec struct {
// +kubebuilder:validation:XPreserveUnknownFields
// The desired configuration of the policy
DesiredState State `json:"desiredState,omitempty"`

// MaxUnavailable specifies percentage or number
// of machines that can be updating at a time. Default is "50%".
// +optional
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
}

// NodeNetworkConfigurationPolicyStatus defines the observed state of NodeNetworkConfigurationPolicy
type NodeNetworkConfigurationPolicyStatus struct {
Conditions ConditionList `json:"conditions,omitempty" optional:"true"`

// UnavailableNodeCount represents the total number of potentially unavailable nodes that are
// processing a NodeNetworkConfigurationPolicy
// +optional
UnavailableNodeCount int `json:"unavailableNodeCount,omitempty" optional:"true"`
}

const (
Expand Down
2 changes: 1 addition & 1 deletion api/shared/state_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type RawState []byte
// State contains the namestatectl yaml [1] as string instead of golang struct
// so we don't need to be in sync with the schema.
//
// [1] https://github.com/nmstate/nmstate/blob/master/libnmstate/schemas/operational-state.yaml
// [1] https://github.com/nmstate/nmstate/blob/base/libnmstate/schemas/operational-state.yaml
// +kubebuilder:validation:Type=object
type State struct {
Raw RawState `json:"-"`
Expand Down
8 changes: 5 additions & 3 deletions automation/check-patch.e2e-k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ teardown() {
}

main() {
export KUBEVIRT_PROVIDER='k8s-1.19'
export KUBEVIRT_NUM_NODES=3 # 1 master, 2 workers
export KUBEVIRT_NUM_NODES=5 # 1 master, 4 workers
source automation/check-patch.setup.sh
cd ${TMP_PROJECT_PATH}

Expand All @@ -31,7 +30,10 @@ main() {
make cluster-up
trap teardown EXIT SIGINT SIGTERM SIGSTOP
make cluster-sync
make E2E_TEST_TIMEOUT=1h E2E_TEST_ARGS="-noColor" E2E_TEST_SUITE_ARGS="--junit-output=$ARTIFACTS/junit.functest.xml" test-e2e-handler

export E2E_TEST_SUITE_ARGS="--junit-output=$ARTIFACTS/junit.functest.xml"

make E2E_TEST_TIMEOUT=1h E2E_TEST_ARGS="-noColor" test-e2e-handler
}

[[ "${BASH_SOURCE[0]}" == "$0" ]] && main "$@"
1 change: 0 additions & 1 deletion automation/check-patch.e2e-operator-k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ teardown() {
}

main() {
export KUBEVIRT_PROVIDER='k8s-1.19'
export KUBEVIRT_NUM_NODES=3 # 1 master, 2 workers
source automation/check-patch.setup.sh
cd ${TMP_PROJECT_PATH}
Expand Down
3 changes: 1 addition & 2 deletions automation/check-patch.setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ export E2E_LOGS=${TMP_PROJECT_PATH}/test_logs/e2e
export ARTIFACTS=${ARTIFACTS-$tmp_dir/artifacts}
mkdir -p $ARTIFACTS

rsync -rt --links --filter=':- .gitignore' $(pwd)/ $TMP_PROJECT_PATH

rsync -rt --links $(pwd)/ $TMP_PROJECT_PATH
4 changes: 3 additions & 1 deletion automation/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ publish_docs() {
(
cd /tmp/gh-pages
git add -A
git config user.name $GITHUB_USER
git config user.email $GITHUB_EMAIL
git commit -m "updated $(date +"%d.%m.%Y %H:%M:%S")"
git push https://${GITHUB_USER}github.com/nmstate/kubernetes-nmstate gh-pages
git push https://${GITHUB_USER}@github.com/nmstate/kubernetes-nmstate gh-pages
)
echo -e "\033[0;32mdemo updated $(date +"%d.%m.%Y %H:%M:%S")\033[0m"
}
Expand Down
8 changes: 5 additions & 3 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM centos:8

ARG NMSTATE_COPR_REPO
ARG NM_COPR_REPO
RUN dnf install -b -y dnf-plugins-core && \
dnf copr enable -y networkmanager/NetworkManager-1.22 && \
dnf copr enable -y nmstate/nmstate-0.2 && \
dnf copr enable -y networkmanager/$NM_COPR_REPO && \
dnf copr enable -y nmstate/$NMSTATE_COPR_REPO && \
dnf copr enable -y nmstate/nispor && \
dnf install -b -y nmstate iproute iputils && \
dnf remove -y dnf-plugins-core && \
dnf clean all
Expand Down
4 changes: 2 additions & 2 deletions build/Dockerfile.openshift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.15-openshift-4.7 AS builder
FROM registry.svc.ci.openshift.org/openshift/release:golang-1.15 AS builder
WORKDIR /go/src/github.com/openshift/kubernetes-nmstate
COPY . .
RUN GO111MODULE=on go build --mod=vendor -o build/_output/bin/manager main.go

FROM registry.ci.openshift.org/ocp/4.7:base
FROM ubi8-minimal

RUN \
microdnf -y update && \
Expand Down
8 changes: 2 additions & 6 deletions build/Dockerfile.operator.openshift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.15-openshift-4.7 AS builder
FROM registry.svc.ci.openshift.org/openshift/release:golang-1.15 AS builder
WORKDIR /go/src/github.com/openshift/kubernetes-nmstate
COPY . .
RUN GO111MODULE=on go build --mod=vendor -o build/_output/bin/manager main.go

FROM registry.ci.openshift.org/ocp/4.7:base
FROM registry.access.redhat.com/ubi8/ubi-minimal

COPY --from=builder /go/src/github.com/openshift/kubernetes-nmstate/build/_output/bin/manager /usr/bin/
COPY deploy/crds/nmstate.io_nodenetwork*.yaml /bindata/kubernetes-nmstate/crds/
Expand All @@ -12,13 +12,9 @@ COPY deploy/handler/operator.yaml /bindata/kubernetes-nmstate/handler/handler.ya
COPY deploy/handler/service_account.yaml /bindata/kubernetes-nmstate/rbac/
COPY deploy/handler/role.yaml /bindata/kubernetes-nmstate/rbac/
COPY deploy/handler/role_binding.yaml /bindata/kubernetes-nmstate/rbac/
COPY --from=builder /go/src/github.com/openshift/kubernetes-nmstate/manifests /manifests
COPY --from=builder /go/src/github.com/openshift/kubernetes-nmstate/metadata /metadata

ENTRYPOINT ["manager"]

LABEL io.k8s.display-name="kubernetes-nmstate-operator" \
io.k8s.description="Operator for Node network configuration through Kubernetes API" \
io.openshift.tags="openshift,kubernetes-nmstate-operator" \
com.redhat.delivery.appregistry=true \
maintainer="Yossi Boaron <[email protected]>"
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ spec:
- name: PROFILER_PORT
value: "6060"
- name: RUN_OPERATOR
- name: HANDLER_IMAGE
- name: RELATED_IMAGE_HANDLER_IMAGE
value: quay.io/nmstate/kubernetes-nmstate-handler:latest
- name: HANDLER_IMAGE_PULL_POLICY
value: Always
Expand Down
6 changes: 4 additions & 2 deletions cluster/kubevirtci.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
export KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER:-'k8s-1.19'}
export KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER:-'k8s-1.20'}

KUBEVIRTCI_VERSION='d5d8e3e376b4c3b45824fbfe320b4c5175b37171'
KUBEVIRTCI_VERSION='4a15921fbd605363b4a0dc893f8d19f8ac124b55'
KUBEVIRTCI_REPO='https://github.com/kubevirt/kubevirtci.git'
KUBEVIRTCI_PATH="${PWD}/_kubevirtci"

export KUBEVIRTCI_TAG='2102030941-4a15921'

function kubevirtci::_get_repo() {
git --git-dir ${KUBEVIRTCI_PATH}/.git remote get-url origin
}
Expand Down
5 changes: 5 additions & 0 deletions controllers/labels.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package controllers

const (
forceRefreshLabel = "nmstate.io/force-nns-refresh"
)
Loading

0 comments on commit 9e19439

Please sign in to comment.