Skip to content

Commit

Permalink
Adoption: be a little better at resolving deploy_ids in Refs; Google:…
Browse files Browse the repository at this point in the history
…:ContainerCluster: don't add dependencies for service accounts in other deploys
  • Loading branch information
jstange committed Mar 4, 2020
1 parent c2bd3ff commit 67b165a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions modules/mu/adoption.rb
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,9 @@ def scrub_globals(h, field)

def resolveReferences(cfg, deploy, parent)
if cfg.is_a?(MU::Config::Ref)
cfg.kitten(deploy) || cfg.kitten
hashcfg = cfg.to_h

if cfg.kitten(deploy)
littermate = deploy.findLitterMate(type: cfg.type, name: cfg.name, cloud_id: cfg.id, habitat: cfg.habitat)

Expand All @@ -496,14 +498,14 @@ def resolveReferences(cfg, deploy, parent)
hashcfg.delete("name") if cfg.id and !cfg.deploy_id
end
end
elsif hashcfg["id"] # reference to raw cloud ids is reasonable
elsif hashcfg["id"] and !hashcfg["name"]
hashcfg.delete("deploy_id")
hashcfg.delete("name")
else
pp parent.cloud_desc
raise Incomplete, "Failed to resolve reference on behalf of #{parent}"
end
hashcfg.delete("deploy_id") if hashcfg['deploy_id'] == deploy.deploy_id

if parent and parent.config
cred_cfg = MU::Cloud.const_get(parent.cloud).credConfig(parent.credentials)

Expand Down
3 changes: 2 additions & 1 deletion modules/mu/clouds/google/container_cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,8 @@ def self.validateConfig(cluster, configurator)
type: "habitats"
)
if cluster['service_account']['name'] and
!cluster['service_account']['id']
!cluster['service_account']['id'] and
!cluster['service_account']['deploy_id']
cluster['dependencies'] ||= []
cluster['dependencies'] << {
"type" => "user",
Expand Down

0 comments on commit 67b165a

Please sign in to comment.