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

     1  package aws
     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 AWS config for the cluster CSI driver.
    11  type ClusterCSIDriverConfig struct {
    12  	KMSKeyARN string
    13  }
    14  
    15  // YAML generates the cluster CSI driver config for the AWS 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.AWSEBSCSIDriver),
    24  		},
    25  		Spec: operatorv1.ClusterCSIDriverSpec{
    26  			DriverConfig: operatorv1.CSIDriverConfigSpec{
    27  				DriverType: operatorv1.AWSDriverType,
    28  				AWS: &operatorv1.AWSCSIDriverConfigSpec{
    29  					KMSKeyARN: params.KMSKeyARN,
    30  				},
    31  			},
    32  			OperatorSpec: operatorv1.OperatorSpec{
    33  				ManagementState: operatorv1.Managed,
    34  			},
    35  		},
    36  	}
    37  	configData, err := yaml.Marshal(obj)
    38  	if err != nil {
    39  		return nil, err
    40  	}
    41  	return configData, nil
    42  }