github.com/openshift/installer@v1.4.17/pkg/asset/manifests/ibmcloud/clustercsidriver.go (about)

     1  package ibmcloud
     2  
     3  import (
     4  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     5  	"sigs.k8s.io/yaml"
     6  
     7  	operatorv1 "github.com/openshift/api/operator/v1"
     8  )
     9  
    10  // ClusterCSIDriverConfig is the IBM Cloud config for the cluster CSI Driver.
    11  type ClusterCSIDriverConfig struct {
    12  	EncryptionKeyCRN string
    13  }
    14  
    15  // YAML generates the cluster CSI Driver config for the IBM Cloud platform.
    16  func (params ClusterCSIDriverConfig) YAML() ([]byte, error) {
    17  	obj := &operatorv1.ClusterCSIDriver{
    18  		TypeMeta: metav1.TypeMeta{
    19  			APIVersion: operatorv1.GroupVersion.String(),
    20  			Kind:       "ClusterCSIDriver",
    21  		},
    22  		ObjectMeta: metav1.ObjectMeta{
    23  			Name: string(operatorv1.IBMVPCBlockCSIDriver),
    24  		},
    25  		Spec: operatorv1.ClusterCSIDriverSpec{
    26  			DriverConfig: operatorv1.CSIDriverConfigSpec{
    27  				DriverType: operatorv1.IBMCloudDriverType,
    28  				IBMCloud: &operatorv1.IBMCloudCSIDriverConfigSpec{
    29  					EncryptionKeyCRN: params.EncryptionKeyCRN,
    30  				},
    31  			},
    32  			OperatorSpec: operatorv1.OperatorSpec{
    33  				ManagementState: operatorv1.Managed,
    34  			},
    35  		},
    36  	}
    37  
    38  	configData, err := yaml.Marshal(obj)
    39  	if err != nil {
    40  		return nil, err
    41  	}
    42  	return configData, nil
    43  }