-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #324 from abhinavdahiya/core
Destroy: based on `openshift/hive/contrib: aws_tag_deprovision`
- Loading branch information
Showing
209 changed files
with
125,583 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = [ | ||
"doc.go", | ||
"metadata.go", | ||
"stock.go", | ||
], | ||
importpath = "github.com/openshift/installer/pkg/asset/metadata", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//pkg/asset:go_default_library", | ||
"//pkg/asset/cluster:go_default_library", | ||
"//pkg/asset/installconfig:go_default_library", | ||
"//pkg/types:go_default_library", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Package metadata contains asset targets that generates the metadata.yaml | ||
package metadata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package metadata | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
|
||
"github.com/openshift/installer/pkg/asset" | ||
"github.com/openshift/installer/pkg/asset/installconfig" | ||
"github.com/openshift/installer/pkg/types" | ||
) | ||
|
||
const ( | ||
// MetadataFilename is name of the file where clustermetadata is stored. | ||
MetadataFilename = "metadata.json" | ||
metadataAssetName = "Cluster Metadata" | ||
) | ||
|
||
// Metadata depends on cluster and installconfig, | ||
type Metadata struct { | ||
installConfig asset.Asset | ||
cluster asset.Asset | ||
} | ||
|
||
var _ asset.Asset = (*Metadata)(nil) | ||
|
||
// Name returns the human-friendly name of the asset. | ||
func (m *Metadata) Name() string { | ||
return metadataAssetName | ||
} | ||
|
||
// Dependencies returns the dependency of the MetaData. | ||
func (m *Metadata) Dependencies() []asset.Asset { | ||
return []asset.Asset{m.installConfig, m.cluster} | ||
} | ||
|
||
// Generate generates the metadata.yaml file. | ||
func (m *Metadata) Generate(parents map[asset.Asset]*asset.State) (*asset.State, error) { | ||
installCfg, err := installconfig.GetInstallConfig(m.installConfig, parents) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
cm := &types.ClusterMetadata{ | ||
ClusterName: installCfg.Name, | ||
} | ||
switch { | ||
case installCfg.Platform.AWS != nil: | ||
cm.ClusterPlatformMetadata.AWS = &types.ClusterAWSPlatformMetadata{ | ||
Region: installCfg.Platform.AWS.Region, | ||
Identifier: map[string]string{ | ||
"tectonicClusterID": installCfg.ClusterID, | ||
}, | ||
} | ||
case installCfg.Platform.Libvirt != nil: | ||
cm.ClusterPlatformMetadata.Libvirt = &types.ClusterLibvirtPlatformMetadata{ | ||
URI: installCfg.Platform.Libvirt.URI, | ||
} | ||
default: | ||
return nil, fmt.Errorf("no known platform") | ||
} | ||
|
||
data, err := json.Marshal(cm) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &asset.State{ | ||
Contents: []asset.Content{ | ||
{ | ||
Name: MetadataFilename, | ||
Data: []byte(data), | ||
}, | ||
}, | ||
}, nil | ||
} |
Oops, something went wrong.