Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix helm chart to generate correct NicClusterPolicy #546

Merged

Conversation

ykulazhenkov
Copy link
Collaborator

To be able to use server-side apply YAML spec
should not contain "null" values

Changes:

  • quote strings without default to always include a empty string value
  • use empty list for imagePullSecrets field if secrets are not configured

Fixes #452

Example of generated NicClusterPolicy

apiVersion: mellanox.com/v1alpha1                                                                                                                                                                                                                                                                                                [101/7155]
kind: NicClusterPolicy                                                                                                                                                                                        
metadata:                                                                                                                                                                                                     
  name: nic-cluster-policy                                                                                                                                                                                    
spec:                                                                                                                                                                                                         
  ofedDriver:                                                                                                                                                                                                 
    image: mofed                                                                                                                                                                                              
    repository: nvcr.io/nvidia/mellanox                                                                                                                                                                       
    version: 5.9-0.5.6.0                                                                                                                                                                                      
    imagePullSecrets: []                                                                                                                                                                                      
    terminationGracePeriodSeconds: 300                                                                                                                                                                        
    startupProbe:                                                                                                                                                                                             
      initialDelaySeconds: 60                                                                                                                                                                                 
      periodSeconds: 60                                                                                                                                                                                       
    livenessProbe:                              
      initialDelaySeconds: 30                   
      periodSeconds: 30                                                                                
    readinessProbe:                                                                                    
      initialDelaySeconds: 10                                                                          
      periodSeconds: 30
    upgradePolicy:                                                                                     
      autoUpgrade: false                  
      maxParallelUpgrades: 1
      drain:               
        enable: true                                                                                   
        force: false                   
        podSelector: ""                  
        timeoutSeconds: 300                                                                            
        deleteEmptyDir: false
  rdmaSharedDevicePlugin:               
    # [map[name:rdma_shared_device_a vendors:[15b3]]]                                                  
    image: k8s-rdma-shared-dev-plugin
    repository: nvcr.io/nvidia/cloud-native
    version: v1.3.2                                                                                                                                                                                           
    imagePullSecrets: []                                                                               
    # The config below directly propagates to k8s-rdma-shared-device-plugin configuration.
    # Replace 'devices' with your (RDMA capable) netdevice name.
    config: |
      {
        "configList": [
          {
            "resourceName": "rdma_shared_device_a", 
            "rdmaHcaMax": 1000,
            "selectors": {
              "vendors": ["15b3"],
              "deviceIDs": [],
              "drivers": [],
              "ifNames": [],
              "linkTypes": []                              
            }                                              
          }                                                
        ]                                                           
      }                                                             
  psp:                                                              
    enabled: false 

With imagePullSecrets

apiVersion: mellanox.com/v1alpha1               
kind: NicClusterPolicy                      
metadata:                                   
  name: nic-cluster-policy                                         
spec:                                 
  ofedDriver:                                      
    image: mofed
    repository: nvcr.io/nvidia/mellanox
    version: 5.9-0.5.6.0
    imagePullSecrets: ["foo","bar"]     
    terminationGracePeriodSeconds: 300
    startupProbe:                                  
      initialDelaySeconds: 60                   
      periodSeconds: 60                              
    livenessProbe:                               
      initialDelaySeconds: 30             
      periodSeconds: 30                                
    readinessProbe:                                
      initialDelaySeconds: 10                                   
      periodSeconds: 30                  
    upgradePolicy:                                                 
      autoUpgrade: false    
      maxParallelUpgrades: 1                                                
      drain:                           
        enable: true                            
        force: false  
        podSelector: ""
        timeoutSeconds: 300
        deleteEmptyDir: false                         
  rdmaSharedDevicePlugin:            
    # [map[name:rdma_shared_device_a vendors:[15b3]]]
    image: k8s-rdma-shared-dev-plugin                                                                                                                                
    repository: nvcr.io/nvidia/cloud-native
    version: v1.3.2
    imagePullSecrets: ["foo","bar"]
    # The config below directly propagates to k8s-rdma-shared-device-plugin configuration.
    # Replace 'devices' with your (RDMA capable) netdevice name.
    config: |
      {
        "configList": [
          {
            "resourceName": "rdma_shared_device_a",
            "rdmaHcaMax": 1000,
            "selectors": {
              "vendors": ["15b3"],
              "deviceIDs": [],
              "drivers": [],
              "ifNames": [],
              "linkTypes": []
            }
          }
        ]
      }
  psp:
    enabled: false

To be able to use server-side apply YAML spec
should not contain "null" values

Changes:
- quote strings without default to always include
a empty string value
- use empty list for imagePullSecrets field if
  secrets are not configured

Signed-off-by: Yury Kulazhenkov <ykulazhenkov@nvidia.com>
Copy link
Member

@rollandf rollandf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adrianchiris adrianchiris merged commit e1267e8 into Mellanox:master Jun 5, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NicClusterPolicy generated by Helm chart is not valid
3 participants