Skip to content

Commit

Permalink
sync: switch fec to manual config (#893)
Browse files Browse the repository at this point in the history
* sync: update external libs

* sync: switch fec to manual config

Unfortunately, v2 of the fec types causes issues when synced automatically, ultimately due to the old version of controller-runtime used by the operator. This PR resolves the issue by making a small manual change to the sync and documenting it.

---------

Co-authored-by: kononovn <[email protected]>
  • Loading branch information
klaskosk and kononovn authored Jan 27, 2025
1 parent dd88b10 commit 7a8e606
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 9 deletions.
17 changes: 16 additions & 1 deletion internal/sync/configs/fec-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
---
# Cannot be automatically synced due to the webhook being required by the
# types file. Including the webhook causes issues because it relies on a very
# old controller-runtime version.
#
# The only change made manually was removing these lines from
# `func (in *BBDevConfig) Validate() error` in `sriovfecclusterconfig_types.go`.
#
# ```go
# if err := hasAmbiguousBBDevConfigs(*in); err != nil {
# return err
# }
# ```
- name: fec
sync: true
sync: false
repo_link: "https://github.com/intel/sriov-fec-operator"
branch: main
remote_api_directory: api/sriovfec/v2
local_api_directory: schemes/fec/fectypes
excludes:
- "*_test.go"
- "*_webhook.go"
...
2 changes: 1 addition & 1 deletion pkg/schemes/fec/fectypes/sriovfecclusterconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ type N3000BBDevConfig struct {
// +kubebuilder:default:false
// +kubebuilder:validation:Enum=false
PFMode bool `json:"pfMode,omitempty"`
// +kubebuilder:validation:Optional
// +kubebuilder:validation:Minimum=0
FLRTimeOut int `json:"flrTimeout"`
Downlink UplinkDownlink `json:"downlink"`
Expand Down Expand Up @@ -158,7 +159,6 @@ type validator interface {
}

func (in *BBDevConfig) Validate() error {

for _, config := range []interface{}{in.ACC200, in.ACC100, in.N3000} {
if !isNil(config) {
if validator, ok := config.(validator); ok {
Expand Down
3 changes: 3 additions & 0 deletions pkg/schemes/ocs/operatorv1/storagecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ type ManageCephCluster struct {

// Whether to allow updating the device class after the OSD is initially provisioned
AllowDeviceClassUpdate bool `json:"allowDeviceClassUpdate,omitempty"`

// CephClusterHealthCheckSpec represent the healthcheck for Ceph daemons
HealthCheck *rookCephv1.CephClusterHealthCheckSpec `json:"healthCheck,omitempty"`
}

// ManageCephConfig defines how to reconcile the Ceph configuration
Expand Down
27 changes: 20 additions & 7 deletions pkg/schemes/ocs/operatorv1/topologymap.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package operatorv1

import (
"strings"
corev1 "k8s.io/api/core/v1"
)

// NewNodeTopologyMap returns an initialized NodeTopologyMap
Expand Down Expand Up @@ -61,18 +61,31 @@ func (m *NodeTopologyMap) Add(topologyKey string, value string) {
m.Labels[topologyKey] = append(m.Labels[topologyKey], value)
}

// GetKeyValues returns a node label matching the topologyKey and all values
// for that label across all storage nodes
// GetKeyValues returns a node label matching the supported topologyKey and all values
// for that label across all storage nodes.
func (m *NodeTopologyMap) GetKeyValues(topologyKey string) (string, []string) {
values := []string{}

// Supported failure domain labels
supportedLabels := map[string]string{
"rack": "topology.rook.io/rack",
"hostname": corev1.LabelHostname,
"zone": corev1.LabelZoneFailureDomainStable,
}

// Get the specific label based on the topologyKey
expectedLabel, exists := supportedLabels[topologyKey]
if !exists {
return "", values // Return empty if the topologyKey is unsupported
}

// Match the expected label and fetch the values
for label, labelValues := range m.Labels {
if strings.Contains(label, topologyKey) {
topologyKey = label
if label == expectedLabel {
values = labelValues
break
return label, values
}
}

return topologyKey, values
return "", values // Return empty if no match is found
}
5 changes: 5 additions & 0 deletions pkg/schemes/ocs/operatorv1/zz_generated.deepcopy.go

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

0 comments on commit 7a8e606

Please sign in to comment.