44 "encoding/json"
55 "fmt"
66
7- "github.com/pkg/errors"
8-
97 machineapi "github.com/openshift/api/machine/v1beta1"
108 "github.com/openshift/installer/pkg/types"
119)
@@ -29,7 +27,6 @@ type config struct {
2927 Auth `json:",inline"`
3028 Region string `json:"gcp_region,omitempty"`
3129 BootstrapInstanceType string `json:"gcp_bootstrap_instance_type,omitempty"`
32- CreateBootstrapSA bool `json:"gcp_create_bootstrap_sa"`
3330 CreateFirewallRules bool `json:"gcp_create_firewall_rules"`
3431 MasterInstanceType string `json:"gcp_master_instance_type,omitempty"`
3532 MasterAvailabilityZones []string `json:"gcp_master_availability_zones"`
@@ -52,6 +49,7 @@ type config struct {
5249 ExtraLabels map [string ]string `json:"gcp_extra_labels,omitempty"`
5350 UserProvisionedDNS bool `json:"gcp_user_provisioned_dns,omitempty"`
5451 ExtraTags map [string ]string `json:"gcp_extra_tags,omitempty"`
52+ IgnitionShim string `json:"gcp_ignition_shim,omitempty"`
5553}
5654
5755// TFVarsSources contains the parameters to be converted into Terraform variables
@@ -67,6 +65,7 @@ type TFVarsSources struct {
6765 InfrastructureName string
6866 UserProvisionedDNS bool
6967 UserTags map [string ]string
68+ IgnitionShim string
7069}
7170
7271// TFVars generates gcp-specific Terraform variables launching the cluster.
@@ -109,6 +108,7 @@ func TFVars(sources TFVarsSources) ([]byte, error) {
109108 ExtraLabels : labels ,
110109 UserProvisionedDNS : sources .UserProvisionedDNS ,
111110 ExtraTags : sources .UserTags ,
111+ IgnitionShim : sources .IgnitionShim ,
112112 }
113113
114114 if masterConfig .Disks [0 ].EncryptionKey != nil {
@@ -124,17 +124,6 @@ func TFVars(sources TFVarsSources) ([]byte, error) {
124124 }
125125 cfg .InstanceServiceAccount = instanceServiceAccount
126126
127- serviceAccount := make (map [string ]interface {})
128-
129- if err := json .Unmarshal ([]byte (cfg .Auth .ServiceAccount ), & serviceAccount ); len (cfg .Auth .ServiceAccount ) > 0 && err != nil {
130- return nil , errors .Wrapf (err , "unmarshaling service account" )
131- }
132-
133- // A private key is needed to sign the URL for bootstrap ignition.
134- // If there is no key in the credentials, we need to generate a new SA.
135- _ , foundKey := serviceAccount ["private_key" ]
136- cfg .CreateBootstrapSA = ! foundKey
137-
138127 return json .MarshalIndent (cfg , "" , " " )
139128}
140129
0 commit comments