github.com/openshift/installer@v1.4.17/pkg/asset/manifests/azure/clustercsidriver.go (about) 1 package azure 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 Azure config for the cluster CSI driver. 11 type ClusterCSIDriverConfig struct { 12 SubscriptionID string 13 ResourceGroupName string 14 DiskEncryptionSetName string 15 } 16 17 // YAML generates the cluster CSI driver config for the Azure platform. 18 func (params ClusterCSIDriverConfig) YAML() ([]byte, error) { 19 obj := &operatorv1.ClusterCSIDriver{ 20 TypeMeta: metav1.TypeMeta{ 21 APIVersion: operatorv1.GroupVersion.String(), 22 Kind: "ClusterCSIDriver", 23 }, 24 ObjectMeta: metav1.ObjectMeta{ 25 Name: string(operatorv1.AzureDiskCSIDriver), 26 }, 27 Spec: operatorv1.ClusterCSIDriverSpec{ 28 DriverConfig: operatorv1.CSIDriverConfigSpec{ 29 DriverType: operatorv1.AzureDriverType, 30 Azure: &operatorv1.AzureCSIDriverConfigSpec{ 31 DiskEncryptionSet: &operatorv1.AzureDiskEncryptionSet{ 32 SubscriptionID: params.SubscriptionID, 33 ResourceGroup: params.ResourceGroupName, 34 Name: params.DiskEncryptionSetName, 35 }, 36 }, 37 }, 38 OperatorSpec: operatorv1.OperatorSpec{ 39 ManagementState: operatorv1.Managed, 40 }, 41 }, 42 } 43 configData, err := yaml.Marshal(obj) 44 if err != nil { 45 return nil, err 46 } 47 return configData, nil 48 }