mirror of https://github.com/kubernetes/kops.git
Move Cloud into CloudupSubContext
This commit is contained in:
parent
0aba1a24b9
commit
f7383b29da
|
@ -64,7 +64,6 @@ func (i *Installation) Run() error {
|
|||
klog.Infof("No package task found; won't update packages")
|
||||
}
|
||||
|
||||
var cloud fi.Cloud
|
||||
var keyStore fi.Keystore
|
||||
var secretStore fi.SecretStore
|
||||
|
||||
|
@ -73,7 +72,7 @@ func (i *Installation) Run() error {
|
|||
}
|
||||
|
||||
checkExisting := true
|
||||
context, err := fi.NewNodeupContext(ctx, target, nil, cloud, keyStore, secretStore, checkExisting, tasks)
|
||||
context, err := fi.NewNodeupContext(ctx, target, nil, keyStore, secretStore, checkExisting, tasks)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error building context: %v", err)
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ func (e *AutoscalingGroup) CompareWithID() *string {
|
|||
|
||||
// Find is used to discover the ASG in the cloud provider
|
||||
func (e *AutoscalingGroup) Find(c *fi.CloudupContext) (*AutoscalingGroup, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
g, err := findAutoscalingGroup(cloud, fi.ValueOf(e.Name))
|
||||
if err != nil {
|
||||
|
@ -165,7 +165,7 @@ func (e *AutoscalingGroup) Find(c *fi.CloudupContext) (*AutoscalingGroup, error)
|
|||
}
|
||||
}
|
||||
if apiLBTask != nil && len(actual.LoadBalancers) > 0 {
|
||||
apiLBDesc, err := c.Cloud.(awsup.AWSCloud).FindELBByNameTag(fi.ValueOf(apiLBTask.Name))
|
||||
apiLBDesc, err := c.T.Cloud.(awsup.AWSCloud).FindELBByNameTag(fi.ValueOf(apiLBTask.Name))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ func findAutoscalingGroup(cloud awsup.AWSCloud, name string) (*autoscaling.Group
|
|||
|
||||
func (e *AutoscalingGroup) Normalize(c *fi.CloudupContext) error {
|
||||
sort.Strings(e.Metrics)
|
||||
c.Cloud.(awsup.AWSCloud).AddTags(e.Name, e.Tags)
|
||||
c.T.Cloud.(awsup.AWSCloud).AddTags(e.Name, e.Tags)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ func (h *AutoscalingLifecycleHook) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (h *AutoscalingLifecycleHook) Find(c *fi.CloudupContext) (*AutoscalingLifecycleHook, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
request := &autoscaling.DescribeLifecycleHooksInput{
|
||||
AutoScalingGroupName: h.AutoscalingGroup.Name,
|
||||
|
|
|
@ -210,7 +210,7 @@ func (e *ClassicLoadBalancer) getHostedZoneId() *string {
|
|||
}
|
||||
|
||||
func (e *ClassicLoadBalancer) Find(c *fi.CloudupContext) (*ClassicLoadBalancer, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
lb, err := cloud.FindELBByNameTag(fi.ValueOf(e.Name))
|
||||
if err != nil {
|
||||
|
@ -346,7 +346,7 @@ func (e *ClassicLoadBalancer) IsForAPIServer() bool {
|
|||
}
|
||||
|
||||
func (e *ClassicLoadBalancer) FindAddresses(context *fi.CloudupContext) ([]string, error) {
|
||||
cloud := context.Cloud.(awsup.AWSCloud)
|
||||
cloud := context.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
lb, err := cloud.FindELBByNameTag(fi.ValueOf(e.Name))
|
||||
if err != nil {
|
||||
|
|
|
@ -52,7 +52,7 @@ func (e *DHCPOptions) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *DHCPOptions) Find(c *fi.CloudupContext) (*DHCPOptions, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
request := &ec2.DescribeDhcpOptionsInput{}
|
||||
if e.ID != nil {
|
||||
|
|
|
@ -50,7 +50,7 @@ type DNSTarget interface {
|
|||
}
|
||||
|
||||
func (e *DNSName) Find(c *fi.CloudupContext) (*DNSName, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
if e.Zone == nil || e.Zone.ZoneID == nil {
|
||||
klog.V(4).Infof("Zone / ZoneID not found for %s, skipping Find", fi.ValueOf(e.ResourceName))
|
||||
|
|
|
@ -52,7 +52,7 @@ func (e *DNSZone) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *DNSZone) Find(c *fi.CloudupContext) (*DNSZone, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
z, err := e.findExisting(cloud)
|
||||
if err != nil {
|
||||
|
|
|
@ -53,7 +53,7 @@ func (e *EBSVolume) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *EBSVolume) Find(context *fi.CloudupContext) (*EBSVolume, error) {
|
||||
cloud := context.Cloud.(awsup.AWSCloud)
|
||||
cloud := context.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
filters := cloud.BuildFilters(e.Name)
|
||||
request := &ec2.DescribeVolumesInput{
|
||||
|
@ -97,7 +97,7 @@ func (e *EBSVolume) Find(context *fi.CloudupContext) (*EBSVolume, error) {
|
|||
}
|
||||
|
||||
func (e *EBSVolume) Normalize(c *fi.CloudupContext) error {
|
||||
c.Cloud.(awsup.AWSCloud).AddTags(e.Name, e.Tags)
|
||||
c.T.Cloud.(awsup.AWSCloud).AddTags(e.Name, e.Tags)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ func findEgressOnlyInternetGateway(cloud awsup.AWSCloud, request *ec2.DescribeEg
|
|||
}
|
||||
|
||||
func (e *EgressOnlyInternetGateway) Find(c *fi.CloudupContext) (*EgressOnlyInternetGateway, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
request := &ec2.DescribeEgressOnlyInternetGatewaysInput{}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ func (e *ElasticIP) CompareWithID() *string {
|
|||
|
||||
// Find returns the actual ElasticIP state, or nil if not found
|
||||
func (e *ElasticIP) Find(context *fi.CloudupContext) (*ElasticIP, error) {
|
||||
return e.find(context.Cloud.(awsup.AWSCloud))
|
||||
return e.find(context.T.Cloud.(awsup.AWSCloud))
|
||||
}
|
||||
|
||||
// find will attempt to look up the elastic IP from AWS
|
||||
|
|
|
@ -48,7 +48,7 @@ func (eb *EventBridgeRule) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (eb *EventBridgeRule) Find(c *fi.CloudupContext) (*EventBridgeRule, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
if eb.Name == nil {
|
||||
return nil, nil
|
||||
|
|
|
@ -46,7 +46,7 @@ func (eb *EventBridgeTarget) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (eb *EventBridgeTarget) Find(c *fi.CloudupContext) (*EventBridgeTarget, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
if eb.Rule == nil || eb.SQSQueue == nil {
|
||||
return nil, nil
|
||||
|
|
|
@ -67,7 +67,7 @@ func findIAMInstanceProfile(cloud awsup.AWSCloud, name string) (*iam.InstancePro
|
|||
}
|
||||
|
||||
func (e *IAMInstanceProfile) Find(c *fi.CloudupContext) (*IAMInstanceProfile, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
p, err := findIAMInstanceProfile(cloud, *e.Name)
|
||||
if err != nil {
|
||||
|
|
|
@ -39,7 +39,7 @@ type IAMInstanceProfileRole struct {
|
|||
}
|
||||
|
||||
func (e *IAMInstanceProfileRole) Find(c *fi.CloudupContext) (*IAMInstanceProfileRole, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
if e.Role == nil || e.Role.ID == nil {
|
||||
klog.V(2).Infof("Role/RoleID not set")
|
||||
|
|
|
@ -51,7 +51,7 @@ func (e *IAMOIDCProvider) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *IAMOIDCProvider) Find(c *fi.CloudupContext) (*IAMOIDCProvider, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
response, err := cloud.IAM().ListOpenIDConnectProviders(&iam.ListOpenIDConnectProvidersInput{})
|
||||
if err != nil {
|
||||
|
|
|
@ -61,7 +61,7 @@ func (e *IAMRole) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *IAMRole) Find(c *fi.CloudupContext) (*IAMRole, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
request := &iam.GetRoleInput{RoleName: e.Name}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ type IAMRolePolicy struct {
|
|||
func (e *IAMRolePolicy) Find(c *fi.CloudupContext) (*IAMRolePolicy, error) {
|
||||
var actual IAMRolePolicy
|
||||
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
// Handle policy overrides
|
||||
if e.ExternalPolicies != nil {
|
||||
|
|
|
@ -63,7 +63,7 @@ func (s *Instance) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *Instance) Find(c *fi.CloudupContext) (*Instance, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
var request *ec2.DescribeInstancesInput
|
||||
|
||||
if fi.ValueOf(e.Shared) {
|
||||
|
|
|
@ -64,7 +64,7 @@ func findInternetGateway(cloud awsup.AWSCloud, request *ec2.DescribeInternetGate
|
|||
}
|
||||
|
||||
func (e *InternetGateway) Find(c *fi.CloudupContext) (*InternetGateway, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
request := &ec2.DescribeInternetGatewaysInput{}
|
||||
|
||||
|
|
|
@ -193,9 +193,9 @@ func (t *LaunchTemplate) RenderAWS(c *awsup.AWSAPITarget, a, e, changes *LaunchT
|
|||
|
||||
// Find is responsible for finding the launch template for us
|
||||
func (t *LaunchTemplate) Find(c *fi.CloudupContext) (*LaunchTemplate, error) {
|
||||
cloud, ok := c.Cloud.(awsup.AWSCloud)
|
||||
cloud, ok := c.T.Cloud.(awsup.AWSCloud)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("invalid cloud provider: %v, expected: %s", c.Cloud, "awsup.AWSCloud")
|
||||
return nil, fmt.Errorf("invalid cloud provider: %v, expected: %s", c.T.Cloud, "awsup.AWSCloud")
|
||||
}
|
||||
|
||||
// @step: get the latest launch template version
|
||||
|
@ -342,9 +342,9 @@ func (t *LaunchTemplate) Find(c *fi.CloudupContext) (*LaunchTemplate, error) {
|
|||
|
||||
// findAllLaunchTemplates returns all the launch templates for us
|
||||
func (t *LaunchTemplate) findAllLaunchTemplates(c *fi.CloudupContext) ([]*ec2.LaunchTemplate, error) {
|
||||
cloud, ok := c.Cloud.(awsup.AWSCloud)
|
||||
cloud, ok := c.T.Cloud.(awsup.AWSCloud)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("invalid cloud provider: %v, expected: %s", c.Cloud, "awsup.AWSCloud")
|
||||
return nil, fmt.Errorf("invalid cloud provider: %v, expected: %s", c.T.Cloud, "awsup.AWSCloud")
|
||||
}
|
||||
|
||||
input := &ec2.DescribeLaunchTemplatesInput{
|
||||
|
@ -370,9 +370,9 @@ func (t *LaunchTemplate) findAllLaunchTemplates(c *fi.CloudupContext) ([]*ec2.La
|
|||
|
||||
// findLatestLaunchTemplateVersion returns the latest template version
|
||||
func (t *LaunchTemplate) findLatestLaunchTemplateVersion(c *fi.CloudupContext) (*ec2.LaunchTemplateVersion, error) {
|
||||
cloud, ok := c.Cloud.(awsup.AWSCloud)
|
||||
cloud, ok := c.T.Cloud.(awsup.AWSCloud)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("invalid cloud provider: %v, expected: awsup.AWSCloud", c.Cloud)
|
||||
return nil, fmt.Errorf("invalid cloud provider: %v, expected: awsup.AWSCloud", c.T.Cloud)
|
||||
}
|
||||
|
||||
input := &ec2.DescribeLaunchTemplateVersionsInput{
|
||||
|
|
|
@ -59,7 +59,7 @@ func (e *NatGateway) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *NatGateway) Find(c *fi.CloudupContext) (*NatGateway, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
var ngw *ec2.NatGateway
|
||||
actual := &NatGateway{}
|
||||
|
||||
|
@ -127,7 +127,7 @@ func (e *NatGateway) Find(c *fi.CloudupContext) (*NatGateway, error) {
|
|||
}
|
||||
|
||||
func (e *NatGateway) findNatGateway(c *fi.CloudupContext) (*ec2.NatGateway, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
id := e.ID
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ func (e *NetworkLoadBalancer) getHostedZoneId() *string {
|
|||
}
|
||||
|
||||
func (e *NetworkLoadBalancer) Find(c *fi.CloudupContext) (*NetworkLoadBalancer, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
lb, err := cloud.FindELBV2ByNameTag(e.Tags["Name"])
|
||||
if err != nil {
|
||||
|
@ -329,7 +329,7 @@ func (e *NetworkLoadBalancer) Find(c *fi.CloudupContext) (*NetworkLoadBalancer,
|
|||
}
|
||||
actual.TargetGroups = append(actual.TargetGroups, &TargetGroup{ARN: targetGroupARN, Name: fi.PtrTo(targetGroupName)})
|
||||
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
descResp, err := cloud.ELBV2().DescribeTargetGroups(&elbv2.DescribeTargetGroupsInput{
|
||||
TargetGroupArns: []*string{targetGroupARN},
|
||||
})
|
||||
|
@ -440,7 +440,7 @@ func (e *NetworkLoadBalancer) IsForAPIServer() bool {
|
|||
func (e *NetworkLoadBalancer) FindAddresses(context *fi.CloudupContext) ([]string, error) {
|
||||
var addresses []string
|
||||
|
||||
cloud := context.Cloud.(awsup.AWSCloud)
|
||||
cloud := context.T.Cloud.(awsup.AWSCloud)
|
||||
cluster := context.Cluster
|
||||
|
||||
{
|
||||
|
@ -844,7 +844,7 @@ func (e *NetworkLoadBalancer) FindDeletions(context *fi.CloudupContext) ([]fi.Cl
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
cloud := context.Cloud.(awsup.AWSCloud)
|
||||
cloud := context.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
lb, err := cloud.FindELBByNameTag(fi.ValueOf(e.CLBName))
|
||||
if err != nil {
|
||||
|
|
|
@ -48,7 +48,7 @@ type Route struct {
|
|||
}
|
||||
|
||||
func (e *Route) Find(c *fi.CloudupContext) (*Route, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
if e.RouteTable == nil || (e.CIDR == nil && e.IPv6CIDR == nil) {
|
||||
// TODO: Move to validate?
|
||||
|
|
|
@ -49,7 +49,7 @@ func (e *RouteTable) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *RouteTable) Find(c *fi.CloudupContext) (*RouteTable, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
var rt *ec2.RouteTable
|
||||
var err error
|
||||
|
|
|
@ -43,7 +43,7 @@ func (s *RouteTableAssociation) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *RouteTableAssociation) Find(c *fi.CloudupContext) (*RouteTableAssociation, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
routeTableID := e.RouteTable.ID
|
||||
subnetID := e.Subnet.ID
|
||||
|
|
|
@ -97,7 +97,7 @@ func (e *SecurityGroup) Find(c *fi.CloudupContext) (*SecurityGroup, error) {
|
|||
}
|
||||
|
||||
func (e *SecurityGroup) findEc2(c *fi.CloudupContext) (*ec2.SecurityGroup, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
request := &ec2.DescribeSecurityGroupsInput{}
|
||||
|
||||
if fi.ValueOf(e.ID) != "" {
|
||||
|
@ -314,7 +314,7 @@ func (e *SecurityGroup) FindDeletions(c *fi.CloudupContext) ([]fi.CloudupDeletio
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
request := &ec2.DescribeSecurityGroupRulesInput{
|
||||
Filters: []*ec2.Filter{
|
||||
|
|
|
@ -55,7 +55,7 @@ type SecurityGroupRule struct {
|
|||
}
|
||||
|
||||
func (e *SecurityGroupRule) Find(c *fi.CloudupContext) (*SecurityGroupRule, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
if e.SecurityGroup == nil || e.SecurityGroup.ID == nil {
|
||||
return nil, nil
|
||||
|
|
|
@ -53,7 +53,7 @@ func (q *SQS) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (q *SQS) Find(c *fi.CloudupContext) (*SQS, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
if q.Name == nil {
|
||||
return nil, nil
|
||||
|
|
|
@ -53,7 +53,7 @@ func (e *SSHKey) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *SSHKey) Find(c *fi.CloudupContext) (*SSHKey, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
return e.find(cloud)
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ func (e *Subnet) Find(c *fi.CloudupContext) (*Subnet, error) {
|
|||
}
|
||||
|
||||
func (e *Subnet) findEc2Subnet(c *fi.CloudupContext) (*ec2.Subnet, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
request := &ec2.DescribeSubnetsInput{}
|
||||
if e.ID != nil {
|
||||
|
|
|
@ -68,7 +68,7 @@ func (e *TargetGroup) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *TargetGroup) Find(c *fi.CloudupContext) (*TargetGroup, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
request := &elbv2.DescribeTargetGroupsInput{}
|
||||
if e.ARN != nil {
|
||||
|
|
|
@ -67,7 +67,7 @@ func (e *VPC) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *VPC) Find(c *fi.CloudupContext) (*VPC, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
request := &ec2.DescribeVpcsInput{}
|
||||
|
||||
|
@ -241,7 +241,7 @@ func (e *VPC) FindDeletions(c *fi.CloudupContext) ([]fi.CloudupDeletion, error)
|
|||
request := &ec2.DescribeVpcsInput{
|
||||
VpcIds: []*string{e.ID},
|
||||
}
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
response, err := cloud.EC2().DescribeVpcs(request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -37,7 +37,7 @@ type VPCDHCPOptionsAssociation struct {
|
|||
}
|
||||
|
||||
func (e *VPCDHCPOptionsAssociation) Find(c *fi.CloudupContext) (*VPCDHCPOptionsAssociation, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
vpcID := e.VPC.ID
|
||||
dhcpOptionsID := e.DHCPOptions.ID
|
||||
|
|
|
@ -38,7 +38,7 @@ type VPCAmazonIPv6CIDRBlock struct {
|
|||
}
|
||||
|
||||
func (e *VPCAmazonIPv6CIDRBlock) Find(c *fi.CloudupContext) (*VPCAmazonIPv6CIDRBlock, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
// If the VPC doesn't (yet) exist, there is no association
|
||||
if e.VPC.ID == nil {
|
||||
|
|
|
@ -40,7 +40,7 @@ type VPCCIDRBlock struct {
|
|||
}
|
||||
|
||||
func (e *VPCCIDRBlock) Find(c *fi.CloudupContext) (*VPCCIDRBlock, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
|
||||
vpcID := aws.StringValue(e.VPC.ID)
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ type WarmPool struct {
|
|||
|
||||
// Find is used to discover the ASG in the cloud provider.
|
||||
func (e *WarmPool) Find(c *fi.CloudupContext) (*WarmPool, error) {
|
||||
cloud := c.Cloud.(awsup.AWSCloud)
|
||||
cloud := c.T.Cloud.(awsup.AWSCloud)
|
||||
svc := cloud.Autoscaling()
|
||||
warmPool, err := svc.DescribeWarmPool(&autoscaling.DescribeWarmPoolInput{
|
||||
AutoScalingGroupName: e.Name,
|
||||
|
|
|
@ -51,7 +51,7 @@ func (d *Disk) CompareWithID() *string {
|
|||
|
||||
// Find discovers the Disk in the cloud provider.
|
||||
func (d *Disk) Find(c *fi.CloudupContext) (*Disk, error) {
|
||||
cloud := c.Cloud.(azure.AzureCloud)
|
||||
cloud := c.T.Cloud.(azure.AzureCloud)
|
||||
l, err := cloud.Disk().List(context.TODO(), *d.ResourceGroup.Name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -80,7 +80,7 @@ func (d *Disk) Find(c *fi.CloudupContext) (*Disk, error) {
|
|||
}
|
||||
|
||||
func (d *Disk) Normalize(c *fi.CloudupContext) error {
|
||||
c.Cloud.(azure.AzureCloud).AddClusterTags(d.Tags)
|
||||
c.T.Cloud.(azure.AzureCloud).AddClusterTags(d.Tags)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,9 @@ func TestDiskRenderAzure(t *testing.T) {
|
|||
func TestDiskFind(t *testing.T) {
|
||||
cloud := NewMockAzureCloud("eastus")
|
||||
ctx := &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
}
|
||||
|
||||
rg := &ResourceGroup{
|
||||
|
@ -133,7 +135,9 @@ func TestDiskFind(t *testing.T) {
|
|||
func TestDiskRun(t *testing.T) {
|
||||
cloud := NewMockAzureCloud("eastus")
|
||||
ctx := &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
Target: azure.NewAzureAPITarget(cloud),
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ func (lb *LoadBalancer) IsForAPIServer() bool {
|
|||
|
||||
// Find discovers the LoadBalancer in the cloud provider
|
||||
func (lb *LoadBalancer) Find(c *fi.CloudupContext) (*LoadBalancer, error) {
|
||||
cloud := c.Cloud.(azure.AzureCloud)
|
||||
cloud := c.T.Cloud.(azure.AzureCloud)
|
||||
l, err := cloud.LoadBalancer().List(context.TODO(), *lb.ResourceGroup.Name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -100,7 +100,7 @@ func (lb *LoadBalancer) Find(c *fi.CloudupContext) (*LoadBalancer, error) {
|
|||
}
|
||||
|
||||
func (lb *LoadBalancer) Normalize(c *fi.CloudupContext) error {
|
||||
c.Cloud.(azure.AzureCloud).AddClusterTags(lb.Tags)
|
||||
c.T.Cloud.(azure.AzureCloud).AddClusterTags(lb.Tags)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,9 @@ func TestLoadBalancerRenderAzure(t *testing.T) {
|
|||
func TestLoadBalancerFind(t *testing.T) {
|
||||
cloud := NewMockAzureCloud("eastus")
|
||||
ctx := &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
}
|
||||
|
||||
rg := &ResourceGroup{
|
||||
|
@ -140,7 +142,9 @@ func TestLoadBalancerFind(t *testing.T) {
|
|||
func TestLoadBalancerRun(t *testing.T) {
|
||||
cloud := NewMockAzureCloud("eastus")
|
||||
ctx := &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
Target: azure.NewAzureAPITarget(cloud),
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ func (p *PublicIPAddress) CompareWithID() *string {
|
|||
|
||||
// Find discovers the Public IP Address in the cloud provider
|
||||
func (p *PublicIPAddress) Find(c *fi.CloudupContext) (*PublicIPAddress, error) {
|
||||
cloud := c.Cloud.(azure.AzureCloud)
|
||||
cloud := c.T.Cloud.(azure.AzureCloud)
|
||||
l, err := cloud.PublicIPAddress().List(context.TODO(), *p.ResourceGroup.Name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -77,7 +77,7 @@ func (p *PublicIPAddress) Find(c *fi.CloudupContext) (*PublicIPAddress, error) {
|
|||
}
|
||||
|
||||
func (p *PublicIPAddress) Normalize(c *fi.CloudupContext) error {
|
||||
c.Cloud.(azure.AzureCloud).AddClusterTags(p.Tags)
|
||||
c.T.Cloud.(azure.AzureCloud).AddClusterTags(p.Tags)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,9 @@ func TestPublicIPAddressRenderAzure(t *testing.T) {
|
|||
func TestPublicIPAddressFind(t *testing.T) {
|
||||
cloud := NewMockAzureCloud("eastus")
|
||||
ctx := &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
}
|
||||
|
||||
rg := &ResourceGroup{
|
||||
|
@ -112,7 +114,9 @@ func TestPublicIPAddressFind(t *testing.T) {
|
|||
func TestPublicIPAddressRun(t *testing.T) {
|
||||
cloud := NewMockAzureCloud("eastus")
|
||||
ctx := &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
Target: azure.NewAzureAPITarget(cloud),
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ func (r *ResourceGroup) CompareWithID() *string {
|
|||
|
||||
// Find discovers the ResourceGroup in the cloud provider.
|
||||
func (r *ResourceGroup) Find(c *fi.CloudupContext) (*ResourceGroup, error) {
|
||||
cloud := c.Cloud.(azure.AzureCloud)
|
||||
cloud := c.T.Cloud.(azure.AzureCloud)
|
||||
l, err := cloud.ResourceGroup().List(context.TODO(), "" /* filter*/)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -76,7 +76,7 @@ func (r *ResourceGroup) Find(c *fi.CloudupContext) (*ResourceGroup, error) {
|
|||
}
|
||||
|
||||
func (r *ResourceGroup) Normalize(c *fi.CloudupContext) error {
|
||||
c.Cloud.(azure.AzureCloud).AddClusterTags(r.Tags)
|
||||
c.T.Cloud.(azure.AzureCloud).AddClusterTags(r.Tags)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,9 @@ func TestResourceGroupRenderAzure(t *testing.T) {
|
|||
func TestResourceGroupFind(t *testing.T) {
|
||||
cloud := NewMockAzureCloud("eastus")
|
||||
ctx := &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
}
|
||||
|
||||
rg := &ResourceGroup{
|
||||
|
@ -141,7 +143,9 @@ func TestResourceGroupFind(t *testing.T) {
|
|||
func TestResourceGroupRun(t *testing.T) {
|
||||
cloud := NewMockAzureCloud("eastus")
|
||||
ctx := &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
Target: azure.NewAzureAPITarget(cloud),
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ func (r *RoleAssignment) Find(c *fi.CloudupContext) (*RoleAssignment, error) {
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
cloud := c.Cloud.(azure.AzureCloud)
|
||||
cloud := c.T.Cloud.(azure.AzureCloud)
|
||||
rs, err := cloud.RoleAssignment().List(context.TODO(), *r.ResourceGroup.Name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -62,7 +62,9 @@ func TestRoleAssignmentRenderAzure(t *testing.T) {
|
|||
func TestRoleAssignmentFind(t *testing.T) {
|
||||
cloud := NewMockAzureCloud("eastus")
|
||||
ctx := &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
}
|
||||
|
||||
rg := &ResourceGroup{
|
||||
|
@ -135,7 +137,9 @@ func TestRoleAssignmentFind(t *testing.T) {
|
|||
func TestRoleAssignmentFind_NoPrincipalID(t *testing.T) {
|
||||
cloud := NewMockAzureCloud("eastus")
|
||||
ctx := &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
}
|
||||
|
||||
// Create a VM Scale Set.
|
||||
|
|
|
@ -49,7 +49,7 @@ func (r *RouteTable) CompareWithID() *string {
|
|||
|
||||
// Find discovers the RouteTable in the cloud provider.
|
||||
func (r *RouteTable) Find(c *fi.CloudupContext) (*RouteTable, error) {
|
||||
cloud := c.Cloud.(azure.AzureCloud)
|
||||
cloud := c.T.Cloud.(azure.AzureCloud)
|
||||
l, err := cloud.RouteTable().List(context.TODO(), *r.ResourceGroup.Name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -76,7 +76,7 @@ func (r *RouteTable) Find(c *fi.CloudupContext) (*RouteTable, error) {
|
|||
}
|
||||
|
||||
func (r *RouteTable) Normalize(c *fi.CloudupContext) error {
|
||||
c.Cloud.(azure.AzureCloud).AddClusterTags(r.Tags)
|
||||
c.T.Cloud.(azure.AzureCloud).AddClusterTags(r.Tags)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ func (s *Subnet) CompareWithID() *string {
|
|||
|
||||
// Find discovers the Subnet in the cloud provider.
|
||||
func (s *Subnet) Find(c *fi.CloudupContext) (*Subnet, error) {
|
||||
cloud := c.Cloud.(azure.AzureCloud)
|
||||
cloud := c.T.Cloud.(azure.AzureCloud)
|
||||
l, err := cloud.Subnet().List(context.TODO(), *s.ResourceGroup.Name, *s.VirtualNetwork.Name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -57,7 +57,9 @@ func TestSubnetRenderAzure(t *testing.T) {
|
|||
func TestSubnetFind(t *testing.T) {
|
||||
cloud := NewMockAzureCloud("eastus")
|
||||
ctx := &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
}
|
||||
|
||||
rg := &ResourceGroup{
|
||||
|
|
|
@ -53,7 +53,7 @@ func (n *VirtualNetwork) CompareWithID() *string {
|
|||
|
||||
// Find discovers the VirtualNetwork in the cloud provider.
|
||||
func (n *VirtualNetwork) Find(c *fi.CloudupContext) (*VirtualNetwork, error) {
|
||||
cloud := c.Cloud.(azure.AzureCloud)
|
||||
cloud := c.T.Cloud.(azure.AzureCloud)
|
||||
l, err := cloud.VirtualNetwork().List(context.TODO(), *n.ResourceGroup.Name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -87,7 +87,7 @@ func (n *VirtualNetwork) Find(c *fi.CloudupContext) (*VirtualNetwork, error) {
|
|||
}
|
||||
|
||||
func (n *VirtualNetwork) Normalize(c *fi.CloudupContext) error {
|
||||
c.Cloud.(azure.AzureCloud).AddClusterTags(n.Tags)
|
||||
c.T.Cloud.(azure.AzureCloud).AddClusterTags(n.Tags)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,9 @@ func TestVirtualNetworkRenderAzure(t *testing.T) {
|
|||
func TestVirtualNetworkFind(t *testing.T) {
|
||||
cloud := NewMockAzureCloud("eastus")
|
||||
ctx := &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
}
|
||||
|
||||
rg := &ResourceGroup{
|
||||
|
@ -122,7 +124,9 @@ func TestVirtualNetworkFind(t *testing.T) {
|
|||
func TestVirtualNetworkRun(t *testing.T) {
|
||||
cloud := NewMockAzureCloud("eastus")
|
||||
ctx := &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
Target: azure.NewAzureAPITarget(cloud),
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ func (s *VMScaleSet) CompareWithID() *string {
|
|||
|
||||
// Find discovers the VMScaleSet in the cloud provider.
|
||||
func (s *VMScaleSet) Find(c *fi.CloudupContext) (*VMScaleSet, error) {
|
||||
cloud := c.Cloud.(azure.AzureCloud)
|
||||
cloud := c.T.Cloud.(azure.AzureCloud)
|
||||
found, err := cloud.VMScaleSet().Get(context.TODO(), *s.ResourceGroup.Name, *s.Name)
|
||||
if err != nil && !strings.Contains(err.Error(), "ResourceNotFound") {
|
||||
return nil, err
|
||||
|
@ -240,7 +240,7 @@ func (s *VMScaleSet) Find(c *fi.CloudupContext) (*VMScaleSet, error) {
|
|||
}
|
||||
|
||||
func (s *VMScaleSet) Normalize(c *fi.CloudupContext) error {
|
||||
c.Cloud.(azure.AzureCloud).AddClusterTags(s.Tags)
|
||||
c.T.Cloud.(azure.AzureCloud).AddClusterTags(s.Tags)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,9 @@ func TestVMScaleSetRenderAzure(t *testing.T) {
|
|||
func TestVMScaleSetFind(t *testing.T) {
|
||||
cloud := NewMockAzureCloud("eastus")
|
||||
ctx := &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
}
|
||||
|
||||
rg := &ResourceGroup{
|
||||
|
@ -302,7 +304,9 @@ func TestVMScaleSetFind(t *testing.T) {
|
|||
func TestVMScaleSetRun(t *testing.T) {
|
||||
cloud := NewMockAzureCloud("eastus")
|
||||
ctx := &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
Target: azure.NewAzureAPITarget(cloud),
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ func (d *Droplet) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (d *Droplet) Find(c *fi.CloudupContext) (*Droplet, error) {
|
||||
cloud := c.Cloud.(do.DOCloud)
|
||||
cloud := c.T.Cloud.(do.DOCloud)
|
||||
|
||||
droplets, err := listDroplets(cloud)
|
||||
if err != nil {
|
||||
|
|
|
@ -70,7 +70,7 @@ func (lb *LoadBalancer) Find(c *fi.CloudupContext) (*LoadBalancer, error) {
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
cloud := c.Cloud.(do.DOCloud)
|
||||
cloud := c.T.Cloud.(do.DOCloud)
|
||||
lbService := cloud.LoadBalancersService()
|
||||
loadbalancer, _, err := lbService.Get(context.TODO(), fi.ValueOf(lb.ID))
|
||||
if err != nil {
|
||||
|
@ -194,7 +194,7 @@ func (lb *LoadBalancer) IsForAPIServer() bool {
|
|||
}
|
||||
|
||||
func (lb *LoadBalancer) FindAddresses(c *fi.CloudupContext) ([]string, error) {
|
||||
cloud := c.Cloud.(do.DOCloud)
|
||||
cloud := c.T.Cloud.(do.DOCloud)
|
||||
loadBalancerService := cloud.LoadBalancersService()
|
||||
address := ""
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ func (v *Volume) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (v *Volume) Find(c *fi.CloudupContext) (*Volume, error) {
|
||||
cloud := c.Cloud.(do.DOCloud)
|
||||
cloud := c.T.Cloud.(do.DOCloud)
|
||||
volService := cloud.VolumeService()
|
||||
|
||||
volumes, _, err := volService.ListVolumes(context.TODO(), &godo.ListVolumeParams{
|
||||
|
|
|
@ -72,7 +72,9 @@ func (f fakeStorageClient) DeleteSnapshot(ctx context.Context, id string) (*godo
|
|||
|
||||
func newContext(cloud fi.Cloud) *fi.CloudupContext {
|
||||
return &fi.CloudupContext{
|
||||
Cloud: cloud,
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: cloud,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ func (v *VPC) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (v *VPC) Find(c *fi.CloudupContext) (*VPC, error) {
|
||||
cloud := c.Cloud.(do.DOCloud)
|
||||
cloud := c.T.Cloud.(do.DOCloud)
|
||||
vpcService := cloud.VPCsService()
|
||||
|
||||
opt := &godo.ListOptions{}
|
||||
|
|
|
@ -43,7 +43,7 @@ func (e *Address) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *Address) Find(c *fi.CloudupContext) (*Address, error) {
|
||||
actual, err := e.find(c.Cloud.(gce.GCECloud))
|
||||
actual, err := e.find(c.T.Cloud.(gce.GCECloud))
|
||||
if actual != nil && err == nil {
|
||||
if e.IPAddress == nil {
|
||||
e.IPAddress = actual.IPAddress
|
||||
|
@ -101,7 +101,7 @@ func (e *Address) IsForAPIServer() bool {
|
|||
}
|
||||
|
||||
func (e *Address) FindAddresses(context *fi.CloudupContext) ([]string, error) {
|
||||
actual, err := e.find(context.Cloud.(gce.GCECloud))
|
||||
actual, err := e.find(context.T.Cloud.(gce.GCECloud))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error querying for IP Address: %v", err)
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ func (e *BackendService) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *BackendService) Find(c *fi.CloudupContext) (*BackendService, error) {
|
||||
actual, err := e.find(c.Cloud.(gce.GCECloud))
|
||||
actual, err := e.find(c.T.Cloud.(gce.GCECloud))
|
||||
if actual != nil && err == nil {
|
||||
// Ignore system fields
|
||||
actual.Lifecycle = e.Lifecycle
|
||||
|
|
|
@ -46,7 +46,7 @@ func (e *Disk) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *Disk) Find(c *fi.CloudupContext) (*Disk, error) {
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
|
||||
r, err := cloud.Compute().Disks().Get(cloud.Project(), *e.Zone, *e.Name)
|
||||
if err != nil {
|
||||
|
|
|
@ -55,7 +55,7 @@ func (e *FirewallRule) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *FirewallRule) Find(c *fi.CloudupContext) (*FirewallRule, error) {
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
|
||||
r, err := cloud.Compute().Firewalls().Get(cloud.Project(), *e.Name)
|
||||
if err != nil {
|
||||
|
|
|
@ -56,7 +56,7 @@ func (e *ForwardingRule) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *ForwardingRule) Find(c *fi.CloudupContext) (*ForwardingRule, error) {
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
name := fi.ValueOf(e.Name)
|
||||
|
||||
r, err := cloud.Compute().ForwardingRules().Get(cloud.Project(), cloud.Region(), name)
|
||||
|
|
|
@ -45,7 +45,7 @@ func (e *HealthCheck) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *HealthCheck) Find(c *fi.CloudupContext) (*HealthCheck, error) {
|
||||
actual, err := e.find(c.Cloud.(gce.GCECloud))
|
||||
actual, err := e.find(c.T.Cloud.(gce.GCECloud))
|
||||
if actual != nil && err == nil {
|
||||
// Ignore system fields
|
||||
actual.Lifecycle = e.Lifecycle
|
||||
|
|
|
@ -42,7 +42,7 @@ func (e *HTTPHealthcheck) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *HTTPHealthcheck) Find(c *fi.CloudupContext) (*HTTPHealthcheck, error) {
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
name := fi.ValueOf(e.Name)
|
||||
r, err := cloud.Compute().HTTPHealthChecks().Get(cloud.Project(), name)
|
||||
if err != nil {
|
||||
|
|
|
@ -63,7 +63,7 @@ func (e *Instance) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *Instance) Find(c *fi.CloudupContext) (*Instance, error) {
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
|
||||
r, err := cloud.Compute().Instances().Get(cloud.Project(), *e.Zone, *e.Name)
|
||||
if err != nil {
|
||||
|
|
|
@ -47,7 +47,7 @@ func (e *InstanceGroupManager) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *InstanceGroupManager) Find(c *fi.CloudupContext) (*InstanceGroupManager, error) {
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
|
||||
r, err := cloud.Compute().InstanceGroupManagers().Get(cloud.Project(), *e.Zone, *e.Name)
|
||||
if err != nil {
|
||||
|
|
|
@ -90,7 +90,7 @@ func (e *InstanceTemplate) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *InstanceTemplate) Find(c *fi.CloudupContext) (*InstanceTemplate, error) {
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
|
||||
templates, err := cloud.Compute().InstanceTemplates().List(context.Background(), cloud.Project())
|
||||
if err != nil {
|
||||
|
|
|
@ -47,7 +47,7 @@ func (e *Network) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *Network) Find(c *fi.CloudupContext) (*Network, error) {
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
project := cloud.Project()
|
||||
if e.Project != nil {
|
||||
project = *e.Project
|
||||
|
|
|
@ -54,7 +54,7 @@ func (e *PoolHealthCheck) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *PoolHealthCheck) Find(c *fi.CloudupContext) (*PoolHealthCheck, error) {
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
name := fi.ValueOf(e.Pool.Name)
|
||||
r, err := cloud.Compute().TargetPools().Get(cloud.Project(), cloud.Region(), name)
|
||||
if err != nil {
|
||||
|
|
|
@ -47,7 +47,7 @@ func (e *ProjectIAMBinding) CompareWithID() *string {
|
|||
func (e *ProjectIAMBinding) Find(c *fi.CloudupContext) (*ProjectIAMBinding, error) {
|
||||
ctx := context.TODO()
|
||||
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
|
||||
projectID := fi.ValueOf(e.Project)
|
||||
member := fi.ValueOf(e.Member)
|
||||
|
|
|
@ -66,7 +66,7 @@ func (r *Router) CompareWithID() *string {
|
|||
|
||||
// Find discovers the Router in the cloud provider.
|
||||
func (r *Router) Find(c *fi.CloudupContext) (*Router, error) {
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
|
||||
found, err := cloud.Compute().Routers().Get(cloud.Project(), *r.Region, *r.Name)
|
||||
if err != nil {
|
||||
|
|
|
@ -48,7 +48,7 @@ func (e *ServiceAccount) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *ServiceAccount) Find(c *fi.CloudupContext) (*ServiceAccount, error) {
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
|
||||
ctx := context.TODO()
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ func (e *StorageBucketAcl) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *StorageBucketAcl) Find(c *fi.CloudupContext) (*StorageBucketAcl, error) {
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
|
||||
bucket := fi.ValueOf(e.Bucket)
|
||||
entity := fi.ValueOf(e.Entity)
|
||||
|
|
|
@ -47,7 +47,7 @@ func (e *StorageBucketIAM) CompareWithID() *string {
|
|||
func (e *StorageBucketIAM) Find(c *fi.CloudupContext) (*StorageBucketIAM, error) {
|
||||
ctx := context.TODO()
|
||||
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
|
||||
bucket := fi.ValueOf(e.Bucket)
|
||||
member := fi.ValueOf(e.Member)
|
||||
|
|
|
@ -46,7 +46,7 @@ func (e *StorageObjectAcl) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *StorageObjectAcl) Find(c *fi.CloudupContext) (*StorageObjectAcl, error) {
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
|
||||
bucket := fi.ValueOf(e.Bucket)
|
||||
object := fi.ValueOf(e.Object)
|
||||
|
|
|
@ -49,7 +49,7 @@ func (e *Subnet) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *Subnet) Find(c *fi.CloudupContext) (*Subnet, error) {
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
_, project, err := gce.ParseNameAndProjectFromNetworkID(c.Cluster.Spec.Networking.NetworkID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error parsing network name from cluster spec: %w", err)
|
||||
|
|
|
@ -41,7 +41,7 @@ func (e *TargetPool) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *TargetPool) Find(c *fi.CloudupContext) (*TargetPool, error) {
|
||||
cloud := c.Cloud.(gce.GCECloud)
|
||||
cloud := c.T.Cloud.(gce.GCECloud)
|
||||
name := fi.ValueOf(e.Name)
|
||||
|
||||
r, err := cloud.Compute().TargetPools().Get(cloud.Project(), cloud.Region(), name)
|
||||
|
|
|
@ -46,7 +46,7 @@ func (v *Firewall) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (v *Firewall) Find(c *fi.CloudupContext) (*Firewall, error) {
|
||||
cloud := c.Cloud.(hetzner.HetznerCloud)
|
||||
cloud := c.T.Cloud.(hetzner.HetznerCloud)
|
||||
client := cloud.FirewallClient()
|
||||
|
||||
// TODO(hakman): Find using label selector
|
||||
|
|
|
@ -63,7 +63,7 @@ func (v *LoadBalancer) FindAddresses(c *fi.CloudupContext) ([]string, error) {
|
|||
}
|
||||
|
||||
ctx := context.TODO()
|
||||
cloud := c.Cloud.(hetzner.HetznerCloud)
|
||||
cloud := c.T.Cloud.(hetzner.HetznerCloud)
|
||||
client := cloud.LoadBalancerClient()
|
||||
|
||||
// TODO(hakman): Find using label selector
|
||||
|
@ -94,7 +94,7 @@ func (v *LoadBalancer) FindAddresses(c *fi.CloudupContext) ([]string, error) {
|
|||
|
||||
func (v *LoadBalancer) Find(c *fi.CloudupContext) (*LoadBalancer, error) {
|
||||
ctx := context.TODO()
|
||||
cloud := c.Cloud.(hetzner.HetznerCloud)
|
||||
cloud := c.T.Cloud.(hetzner.HetznerCloud)
|
||||
client := cloud.LoadBalancerClient()
|
||||
|
||||
// TODO(hakman): Find using label selector
|
||||
|
|
|
@ -50,7 +50,7 @@ func (v *Network) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (v *Network) Find(c *fi.CloudupContext) (*Network, error) {
|
||||
cloud := c.Cloud.(hetzner.HetznerCloud)
|
||||
cloud := c.T.Cloud.(hetzner.HetznerCloud)
|
||||
client := cloud.NetworkClient()
|
||||
|
||||
idOrName := fi.ValueOf(v.Name)
|
||||
|
|
|
@ -55,7 +55,7 @@ type ServerGroup struct {
|
|||
}
|
||||
|
||||
func (v *ServerGroup) Find(c *fi.CloudupContext) (*ServerGroup, error) {
|
||||
cloud := c.Cloud.(hetzner.HetznerCloud)
|
||||
cloud := c.T.Cloud.(hetzner.HetznerCloud)
|
||||
client := cloud.ServerClient()
|
||||
|
||||
labelSelector := []string{
|
||||
|
|
|
@ -48,7 +48,7 @@ func (v *SSHKey) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (v *SSHKey) Find(c *fi.CloudupContext) (*SSHKey, error) {
|
||||
cloud := c.Cloud.(hetzner.HetznerCloud)
|
||||
cloud := c.T.Cloud.(hetzner.HetznerCloud)
|
||||
client := cloud.SSHKeyClient()
|
||||
|
||||
sshkeys, err := client.All(context.TODO())
|
||||
|
|
|
@ -45,7 +45,7 @@ func (v *Volume) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (v *Volume) Find(c *fi.CloudupContext) (*Volume, error) {
|
||||
cloud := c.Cloud.(hetzner.HetznerCloud)
|
||||
cloud := c.T.Cloud.(hetzner.HetznerCloud)
|
||||
client := cloud.VolumeClient()
|
||||
|
||||
volumes, err := client.All(context.TODO())
|
||||
|
|
|
@ -84,7 +84,7 @@ func (e *FloatingIP) FindAddresses(context *fi.CloudupContext) ([]string, error)
|
|||
}
|
||||
}
|
||||
|
||||
cloud := context.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := context.T.Cloud.(openstack.OpenstackCloud)
|
||||
// try to find ip address using LB port
|
||||
if e.ID == nil && e.LB != nil && e.LB.PortID != nil {
|
||||
fips, err := findL3Floating(cloud, l3floatingip.ListOpts{
|
||||
|
@ -132,7 +132,7 @@ func (e *FloatingIP) Find(c *fi.CloudupContext) (*FloatingIP, error) {
|
|||
if e == nil {
|
||||
return nil, nil
|
||||
}
|
||||
cloud := c.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := c.T.Cloud.(openstack.OpenstackCloud)
|
||||
if e.LB != nil && e.LB.PortID != nil {
|
||||
fip, err := findFipByPortID(cloud, fi.ValueOf(e.LB.PortID))
|
||||
if err != nil {
|
||||
|
|
|
@ -109,7 +109,7 @@ func (e *Instance) IsForAPIServer() bool {
|
|||
}
|
||||
|
||||
func (e *Instance) FindAddresses(context *fi.CloudupContext) ([]string, error) {
|
||||
cloud := context.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := context.T.Cloud.(openstack.OpenstackCloud)
|
||||
if e.Port == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ func (e *Instance) Find(c *fi.CloudupContext) (*Instance, error) {
|
|||
if e == nil || e.Name == nil {
|
||||
return nil, nil
|
||||
}
|
||||
cloud := c.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := c.T.Cloud.(openstack.OpenstackCloud)
|
||||
computeClient := cloud.ComputeClient()
|
||||
serverPage, err := servers.List(computeClient, servers.ListOpts{
|
||||
Name: fmt.Sprintf("^%s", fi.ValueOf(e.GroupName)),
|
||||
|
|
|
@ -149,7 +149,7 @@ func (s *LB) Find(context *fi.CloudupContext) (*LB, error) {
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
cloud := context.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := context.T.Cloud.(openstack.OpenstackCloud)
|
||||
lbPage, err := loadbalancers.List(cloud.LoadBalancerClient(), loadbalancers.ListOpts{
|
||||
Name: fi.ValueOf(s.Name),
|
||||
}).AllPages()
|
||||
|
|
|
@ -101,7 +101,7 @@ func (s *LBListener) Find(context *fi.CloudupContext) (*LBListener, error) {
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
cloud := context.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := context.T.Cloud.(openstack.OpenstackCloud)
|
||||
listenerList, err := cloud.ListListeners(listeners.ListOpts{
|
||||
ID: fi.ValueOf(s.ID),
|
||||
Name: fi.ValueOf(s.Name),
|
||||
|
|
|
@ -85,7 +85,7 @@ func (p *LBPool) Find(context *fi.CloudupContext) (*LBPool, error) {
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
cloud := context.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := context.T.Cloud.(openstack.OpenstackCloud)
|
||||
poolList, err := cloud.ListPools(v2pools.ListOpts{
|
||||
ID: fi.ValueOf(p.ID),
|
||||
Name: fi.ValueOf(p.Name),
|
||||
|
|
|
@ -61,7 +61,7 @@ func (n *Network) Find(context *fi.CloudupContext) (*Network, error) {
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
cloud := context.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := context.T.Cloud.(openstack.OpenstackCloud)
|
||||
opt := networks.ListOpts{
|
||||
ID: fi.ValueOf(n.ID),
|
||||
Name: fi.ValueOf(n.Name),
|
||||
|
|
|
@ -64,7 +64,7 @@ func (s *PoolAssociation) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (p *PoolAssociation) Find(context *fi.CloudupContext) (*PoolAssociation, error) {
|
||||
cloud := context.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := context.T.Cloud.(openstack.OpenstackCloud)
|
||||
|
||||
opt := v2pools.ListOpts{
|
||||
Name: fi.ValueOf(p.Pool.Name),
|
||||
|
|
|
@ -51,7 +51,7 @@ func (p *PoolMonitor) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (p *PoolMonitor) Find(context *fi.CloudupContext) (*PoolMonitor, error) {
|
||||
cloud := context.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := context.T.Cloud.(openstack.OpenstackCloud)
|
||||
|
||||
opt := monitors.ListOpts{
|
||||
Name: fi.ValueOf(p.Name),
|
||||
|
|
|
@ -147,7 +147,7 @@ func newPortTaskFromCloud(cloud openstack.OpenstackCloud, lifecycle fi.Lifecycle
|
|||
}
|
||||
|
||||
func (s *Port) Find(context *fi.CloudupContext) (*Port, error) {
|
||||
cloud := context.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := context.T.Cloud.(openstack.OpenstackCloud)
|
||||
opt := ports.ListOpts{
|
||||
Name: fi.ValueOf(s.Name),
|
||||
}
|
||||
|
|
|
@ -373,7 +373,9 @@ func Test_Port_Find(t *testing.T) {
|
|||
Name: "clusterName",
|
||||
},
|
||||
},
|
||||
Cloud: &portCloud{},
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: &portCloud{},
|
||||
},
|
||||
},
|
||||
port: &Port{
|
||||
Name: fi.PtrTo("name"),
|
||||
|
@ -390,21 +392,23 @@ func Test_Port_Find(t *testing.T) {
|
|||
Name: "clusterName",
|
||||
},
|
||||
},
|
||||
Cloud: &portCloud{
|
||||
listPorts: []ports.Port{
|
||||
{
|
||||
ID: "id",
|
||||
Name: "name",
|
||||
NetworkID: "networkID",
|
||||
FixedIPs: []ports.IP{
|
||||
{SubnetID: "subnet-a"},
|
||||
{SubnetID: "subnet-b"},
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: &portCloud{
|
||||
listPorts: []ports.Port{
|
||||
{
|
||||
ID: "id",
|
||||
Name: "name",
|
||||
NetworkID: "networkID",
|
||||
FixedIPs: []ports.IP{
|
||||
{SubnetID: "subnet-a"},
|
||||
{SubnetID: "subnet-b"},
|
||||
},
|
||||
SecurityGroups: []string{
|
||||
"sg-1",
|
||||
"sg-2",
|
||||
},
|
||||
Tags: []string{"clusterName"},
|
||||
},
|
||||
SecurityGroups: []string{
|
||||
"sg-1",
|
||||
"sg-2",
|
||||
},
|
||||
Tags: []string{"clusterName"},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -437,21 +441,23 @@ func Test_Port_Find(t *testing.T) {
|
|||
Name: "clusterName",
|
||||
},
|
||||
},
|
||||
Cloud: &portCloud{
|
||||
listPorts: []ports.Port{
|
||||
{
|
||||
ID: "id",
|
||||
Name: "name",
|
||||
NetworkID: "networkID",
|
||||
FixedIPs: []ports.IP{
|
||||
{SubnetID: "subnet-a"},
|
||||
{SubnetID: "subnet-b"},
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: &portCloud{
|
||||
listPorts: []ports.Port{
|
||||
{
|
||||
ID: "id",
|
||||
Name: "name",
|
||||
NetworkID: "networkID",
|
||||
FixedIPs: []ports.IP{
|
||||
{SubnetID: "subnet-a"},
|
||||
{SubnetID: "subnet-b"},
|
||||
},
|
||||
SecurityGroups: []string{
|
||||
"sg-1",
|
||||
"sg-2",
|
||||
},
|
||||
Tags: []string{"clusterName"},
|
||||
},
|
||||
SecurityGroups: []string{
|
||||
"sg-1",
|
||||
"sg-2",
|
||||
},
|
||||
Tags: []string{"clusterName"},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -486,17 +492,19 @@ func Test_Port_Find(t *testing.T) {
|
|||
Name: "clusterName",
|
||||
},
|
||||
},
|
||||
Cloud: &portCloud{
|
||||
listPorts: []ports.Port{
|
||||
{
|
||||
ID: "id-1",
|
||||
Name: "name",
|
||||
Tags: []string{"clusterName"},
|
||||
},
|
||||
{
|
||||
ID: "id-2",
|
||||
Name: "name",
|
||||
Tags: []string{"clusterName"},
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: &portCloud{
|
||||
listPorts: []ports.Port{
|
||||
{
|
||||
ID: "id-1",
|
||||
Name: "name",
|
||||
Tags: []string{"clusterName"},
|
||||
},
|
||||
{
|
||||
ID: "id-2",
|
||||
Name: "name",
|
||||
Tags: []string{"clusterName"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -516,14 +524,16 @@ func Test_Port_Find(t *testing.T) {
|
|||
Name: "clusterName",
|
||||
},
|
||||
},
|
||||
Cloud: &portCloud{
|
||||
listPorts: []ports.Port{
|
||||
{
|
||||
ID: "id-1",
|
||||
Name: "name",
|
||||
T: fi.CloudupSubContext{
|
||||
Cloud: &portCloud{
|
||||
listPorts: []ports.Port{
|
||||
{
|
||||
ID: "id-1",
|
||||
Name: "name",
|
||||
},
|
||||
},
|
||||
listPortsError: fmt.Errorf("list error"),
|
||||
},
|
||||
listPortsError: fmt.Errorf("list error"),
|
||||
},
|
||||
},
|
||||
port: &Port{
|
||||
|
|
|
@ -54,7 +54,7 @@ func NewRouterTaskFromCloud(cloud openstack.OpenstackCloud, lifecycle fi.Lifecyc
|
|||
}
|
||||
|
||||
func (n *Router) Find(context *fi.CloudupContext) (*Router, error) {
|
||||
cloud := context.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := context.T.Cloud.(openstack.OpenstackCloud)
|
||||
opt := routers.ListOpts{
|
||||
Name: fi.ValueOf(n.Name),
|
||||
ID: fi.ValueOf(n.ID),
|
||||
|
|
|
@ -56,7 +56,7 @@ func (i *RouterInterface) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (i *RouterInterface) Find(context *fi.CloudupContext) (*RouterInterface, error) {
|
||||
cloud := context.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := context.T.Cloud.(openstack.OpenstackCloud)
|
||||
opt := ports.ListOpts{
|
||||
NetworkID: fi.ValueOf(i.Subnet.Network.ID),
|
||||
DeviceID: fi.ValueOf(i.Router.ID),
|
||||
|
|
|
@ -54,7 +54,7 @@ func (s *SecurityGroup) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (s *SecurityGroup) Find(context *fi.CloudupContext) (*SecurityGroup, error) {
|
||||
cloud := context.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := context.T.Cloud.(openstack.OpenstackCloud)
|
||||
// avoid creating new group if it has removegroup flag
|
||||
if s.RemoveGroup {
|
||||
return s, nil
|
||||
|
@ -138,7 +138,7 @@ func (s *SecurityGroup) FindDeletions(c *fi.CloudupContext) ([]fi.CloudupDeletio
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
cloud := c.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := c.T.Cloud.(openstack.OpenstackCloud)
|
||||
if s.RemoveGroup {
|
||||
sg, err := getSecurityGroupByName(s, cloud)
|
||||
if err != nil {
|
||||
|
|
|
@ -74,7 +74,7 @@ func (r *SecurityGroupRule) Find(context *fi.CloudupContext) (*SecurityGroupRule
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
cloud := context.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := context.T.Cloud.(openstack.OpenstackCloud)
|
||||
|
||||
opt := sgr.ListOpts{
|
||||
Direction: fi.ValueOf(r.Direction),
|
||||
|
@ -231,7 +231,7 @@ func (o *SecurityGroupRule) FindDeletions(c *fi.CloudupContext) ([]fi.CloudupDel
|
|||
if !fi.ValueOf(o.Delete) {
|
||||
return nil, nil
|
||||
}
|
||||
cloud := c.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := c.T.Cloud.(openstack.OpenstackCloud)
|
||||
rule, err := sgr.Get(cloud.NetworkingClient(), fi.ValueOf(o.ID)).Extract()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -59,7 +59,7 @@ func (s *ServerGroup) Find(context *fi.CloudupContext) (*ServerGroup, error) {
|
|||
if s == nil || s.Name == nil {
|
||||
return nil, nil
|
||||
}
|
||||
cloud := context.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := context.T.Cloud.(openstack.OpenstackCloud)
|
||||
// TODO: move to cloud, add vfs backoff
|
||||
|
||||
page, err := servergroups.List(cloud.ComputeClient(), servergroups.ListOpts{}).AllPages()
|
||||
|
|
|
@ -46,7 +46,7 @@ func (e *SSHKey) CompareWithID() *string {
|
|||
}
|
||||
|
||||
func (e *SSHKey) Find(c *fi.CloudupContext) (*SSHKey, error) {
|
||||
cloud := c.Cloud.(openstack.OpenstackCloud)
|
||||
cloud := c.T.Cloud.(openstack.OpenstackCloud)
|
||||
rs, err := cloud.GetKeypair(openstackKeyPairName(fi.ValueOf(e.Name)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue