| 92 | } |
| 93 | |
| 94 | func PostgresSecretInputToCRD(storageCRD *v1alpha1.Storage, input *model.PostgresInput) (*corev1.Secret, error) { |
| 95 | secretCRD := &corev1.Secret{ |
| 96 | ObjectMeta: v1.ObjectMeta{ |
| 97 | Name: storageCRD.Name, |
| 98 | Namespace: storageCRD.Namespace, |
| 99 | }, |
| 100 | } |
| 101 | secretCRD.StringData = map[string]string{ |
| 102 | "host": input.Host, |
| 103 | "port": fmt.Sprintf("%d", input.Port), |
| 104 | "database": input.Database, |
| 105 | "username": input.Username, |
| 106 | "password": input.Password, |
| 107 | "ssl_mode": input.SSLMode, |
| 108 | "timezone": input.Timezone, |
| 109 | } |
| 110 | return secretCRD, nil |
| 111 | } |