Skip to content

Commit

Permalink
Update nmstate dep to 0.60.0
Browse files Browse the repository at this point in the history
At the moment OSPdO relies on nmstate.io/v1alpha1 NodeNetworkConfigurationPolicy which is deprecated, should use nmstate.io/v1 NodeNetworkConfigurationPolicy:

~~~
W1017 15:14:09.429827 1 warnings.go:70] nmstate.io/v1alpha1 NodeNetworkConfigurationPolicy is deprecated; use nmstate.io/v1 NodeNetworkConfigurationPolicy
W1017 15:24:01.432766 1 warnings.go:70] nmstate.io/v1alpha1 NodeNetworkConfigurationPolicy is deprecated; use nmstate.io/v1 NodeNetworkConfigurationPolicy
~~~

This updates to 0.60.0 which introduces v1.
NodeNetworkConfigurationEnactment is still v1beta1.
  • Loading branch information
stuggi committed Oct 24, 2022
1 parent 9889038 commit 0bf210d
Show file tree
Hide file tree
Showing 8 changed files with 265 additions and 67 deletions.
9 changes: 5 additions & 4 deletions api/v1beta1/openstackdeploy_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/webhook"

nmstateshared "github.com/nmstate/kubernetes-nmstate/api/shared"
nmstatev1alpha1 "github.com/nmstate/kubernetes-nmstate/api/v1alpha1"
nmstatev1 "github.com/nmstate/kubernetes-nmstate/api/v1"
nmstatev1beta1 "github.com/nmstate/kubernetes-nmstate/api/v1beta1"
"github.com/openstack-k8s-operators/osp-director-operator/api/shared"
nmstate "github.com/openstack-k8s-operators/osp-director-operator/pkg/nmstate"
)
Expand Down Expand Up @@ -125,7 +126,7 @@ func (r *OpenStackDeploy) validateNNCP() error {
osnetcfgName := osctlplane.GetLabels()[shared.OpenStackNetConfigReconcileLabel]

// 2) get all nncp with osnetcfg ref label ospdirectorv1beta1.OpenStackNetConfigReconcileLabel
nncpList := &nmstatev1alpha1.NodeNetworkConfigurationPolicyList{}
nncpList := &nmstatev1.NodeNetworkConfigurationPolicyList{}
listOpts := []client.ListOption{
client.MatchingLabels(
map[string]string{
Expand Down Expand Up @@ -157,7 +158,7 @@ func (r *OpenStackDeploy) validateNNCP() error {
} else if condition.Type == nmstateshared.NodeNetworkConfigurationPolicyConditionDegraded {

// get NNCE list to receive more details on why nncp is Degraded
nnceList := &nmstatev1alpha1.NodeNetworkConfigurationEnactmentList{}
nnceList := &nmstatev1beta1.NodeNetworkConfigurationEnactmentList{}
listOpts := []client.ListOption{
client.MatchingLabels(
map[string]string{
Expand All @@ -171,7 +172,7 @@ func (r *OpenStackDeploy) validateNNCP() error {
}

var nnceError string
var nnce nmstatev1alpha1.NodeNetworkConfigurationEnactment
var nnce nmstatev1beta1.NodeNetworkConfigurationEnactment
for _, nnce = range nnceList.Items {
if nnce.Status.Conditions != nil && len(nnce.Status.Conditions) > 0 {
condition := nmstate.GetCurrentCondition(nnce.Status.Conditions)
Expand Down
34 changes: 34 additions & 0 deletions config/crd/bases/osp-director.openstack.org_openstackbackups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,14 @@ spec:
the policy
type: object
x-kubernetes-preserve-unknown-fields: true
maxUnavailable:
anyOf:
- type: integer
- type: string
description: MaxUnavailable specifies percentage
or number of machines that can be updating
at a time. Default is "50%".
x-kubernetes-int-or-string: true
nodeSelector:
additionalProperties:
type: string
Expand Down Expand Up @@ -1656,6 +1664,15 @@ spec:
of the policy
type: object
x-kubernetes-preserve-unknown-fields: true
maxUnavailable:
anyOf:
- type: integer
- type: string
description: MaxUnavailable specifies
percentage or number of machines that
can be updating at a time. Default is
"50%".
x-kubernetes-int-or-string: true
nodeSelector:
additionalProperties:
type: string
Expand Down Expand Up @@ -4599,6 +4616,14 @@ spec:
the policy
type: object
x-kubernetes-preserve-unknown-fields: true
maxUnavailable:
anyOf:
- type: integer
- type: string
description: MaxUnavailable specifies percentage
or number of machines that can be updating
at a time. Default is "50%".
x-kubernetes-int-or-string: true
nodeSelector:
additionalProperties:
type: string
Expand Down Expand Up @@ -4835,6 +4860,15 @@ spec:
of the policy
type: object
x-kubernetes-preserve-unknown-fields: true
maxUnavailable:
anyOf:
- type: integer
- type: string
description: MaxUnavailable specifies
percentage or number of machines that
can be updating at a time. Default is
"50%".
x-kubernetes-int-or-string: true
nodeSelector:
additionalProperties:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ spec:
description: The desired configuration of the policy
type: object
x-kubernetes-preserve-unknown-fields: true
maxUnavailable:
anyOf:
- type: integer
- type: string
description: MaxUnavailable specifies percentage or number
of machines that can be updating at a time. Default is "50%".
x-kubernetes-int-or-string: true
nodeSelector:
additionalProperties:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ spec:
description: The desired configuration of the policy
type: object
x-kubernetes-preserve-unknown-fields: true
maxUnavailable:
anyOf:
- type: integer
- type: string
description: MaxUnavailable specifies percentage or number
of machines that can be updating at a time. Default is
"50%".
x-kubernetes-int-or-string: true
nodeSelector:
additionalProperties:
type: string
Expand Down
10 changes: 5 additions & 5 deletions controllers/openstacknetattachment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (

"github.com/go-logr/logr"
nmstateshared "github.com/nmstate/kubernetes-nmstate/api/shared"
nmstatev1alpha1 "github.com/nmstate/kubernetes-nmstate/api/v1alpha1"
nmstatev1 "github.com/nmstate/kubernetes-nmstate/api/v1"
sriovnetworkv1 "github.com/openshift/sriov-network-operator/api/v1"
"github.com/openstack-k8s-operators/osp-director-operator/api/shared"
ospdirectorv1beta1 "github.com/openstack-k8s-operators/osp-director-operator/api/v1beta1"
Expand Down Expand Up @@ -301,7 +301,7 @@ func (r *OpenStackNetAttachmentReconciler) SetupWithManager(mgr ctrl.Manager) er

return ctrl.NewControllerManagedBy(mgr).
For(&ospdirectorv1beta1.OpenStackNetAttachment{}).
Watches(&source.Kind{Type: &nmstatev1alpha1.NodeNetworkConfigurationPolicy{}}, ownerLabelWatcher).
Watches(&source.Kind{Type: &nmstatev1.NodeNetworkConfigurationPolicy{}}, ownerLabelWatcher).
Watches(&source.Kind{Type: &sriovnetworkv1.SriovNetwork{}}, ownerLabelWatcher).
Watches(&source.Kind{Type: &sriovnetworkv1.SriovNetworkNodePolicy{}}, ownerLabelWatcher).
Complete(r)
Expand All @@ -326,7 +326,7 @@ func (r *OpenStackNetAttachmentReconciler) createOrUpdateNodeNetworkConfiguratio
return err
}

networkConfigurationPolicy := &nmstatev1alpha1.NodeNetworkConfigurationPolicy{}
networkConfigurationPolicy := &nmstatev1.NodeNetworkConfigurationPolicy{}
networkConfigurationPolicy.Name = bridgeName

// set bridgeName to instance status to be able to consume information from there
Expand Down Expand Up @@ -382,7 +382,7 @@ func (r *OpenStackNetAttachmentReconciler) getNodeNetworkConfigurationPolicyStat
instance *ospdirectorv1beta1.OpenStackNetAttachment,
cond *shared.Condition,
) error {
networkConfigurationPolicy := &nmstatev1alpha1.NodeNetworkConfigurationPolicy{}
networkConfigurationPolicy := &nmstatev1.NodeNetworkConfigurationPolicy{}

err := r.Get(ctx, types.NamespacedName{Name: instance.Status.BridgeName}, networkConfigurationPolicy)
if err != nil {
Expand Down Expand Up @@ -425,7 +425,7 @@ func (r *OpenStackNetAttachmentReconciler) cleanupNodeNetworkConfigurationPolicy
instance *ospdirectorv1beta1.OpenStackNetAttachment,
cond *shared.Condition,
) (ctrl.Result, error) {
networkConfigurationPolicy := &nmstatev1alpha1.NodeNetworkConfigurationPolicy{}
networkConfigurationPolicy := &nmstatev1.NodeNetworkConfigurationPolicy{}

err := r.Get(ctx, types.NamespacedName{Name: instance.Status.BridgeName}, networkConfigurationPolicy)
if err != nil && !k8s_errors.IsNotFound(err) {
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/gophercloud/gophercloud v1.0.0
github.com/k8snetworkplumbingwg/network-attachment-definition-client v0.0.0-20200626054723-37f83d1996bc
github.com/metal3-io/baremetal-operator/apis v0.0.0-20220105105621-0ee9ce37c7bc
github.com/nmstate/kubernetes-nmstate v0.33.0
github.com/nmstate/kubernetes-nmstate v0.60.0
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.22.1
github.com/openshift/cluster-api v0.0.0-20191129101638-b09907ac6668
Expand Down Expand Up @@ -54,7 +54,7 @@ require (
)

require (
cloud.google.com/go v0.97.0 // indirect
cloud.google.com/go v0.99.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Microsoft/go-winio v0.4.17 // indirect
Expand Down Expand Up @@ -85,7 +85,7 @@ require (
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.12 // indirect
Expand All @@ -111,7 +111,7 @@ require (
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
Expand Down
Loading

0 comments on commit 0bf210d

Please sign in to comment.