Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions pkg/controller/operconfig/operconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,17 @@ func (r *ReconcileOperConfig) Reconcile(request reconcile.Request) (reconcile.Re
// Compare against previous applied configuration to see if this change
// is safe.
if prev != nil {
// We may need to fill defaults here -- sort of as a poor-man's
// upconversion scheme -- if we add additional fields to the config.
err = network.IsChangeSafe(prev, &operConfig.Spec)
if err != nil {
log.Printf("Not applying unsafe change: %v", err)
r.status.SetDegraded(statusmanager.OperatorConfig, "InvalidOperatorConfig",
fmt.Sprintf("Not applying unsafe configuration change: %v. Use 'oc edit network.operator.openshift.io cluster' to undo the change.", err))
return reconcile.Result{}, err
// Check if the operator is put in the 'Network Migration' mode.
if _, ok := operConfig.GetAnnotations()[names.NetworkMigrationAnnotation]; !ok {
// We may need to fill defaults here -- sort of as a poor-man's
// upconversion scheme -- if we add additional fields to the config.
err = network.IsChangeSafe(prev, &operConfig.Spec)
if err != nil {
log.Printf("Not applying unsafe change: %v", err)
r.status.SetDegraded(statusmanager.OperatorConfig, "InvalidOperatorConfig",
fmt.Sprintf("Not applying unsafe configuration change: %v. Use 'oc edit network.operator.openshift.io cluster' to undo the change.", err))
return reconcile.Result{}, err
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/names/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ const IgnoreObjectErrorAnnotation = "networkoperator.openshift.io/ignore-errors"
// that they are not critical to the functioning of the pod network
const NonCriticalAnnotation = "networkoperator.openshift.io/non-critical"

// NetworkMigrationAnnotation is an annotation on the networks.operator.openshift.io CR to indicate
// that executing network migration (switching the default network type of the cluster) is allowed.
const NetworkMigrationAnnotation = "networkoperator.openshift.io/network-migration"

// SERVICE_CA_CONFIGMAP is the name of the ConfigMap that contains service CA bundle
// that is used in multus admission controller deployment
const SERVICE_CA_CONFIGMAP = "openshift-service-ca"
Expand Down