Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hack/go-fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ else
--env IS_CONTAINER=TRUE \
--volume "${PWD}:/go/src/github.com/openshift/installer:z" \
--workdir /go/src/github.com/openshift/installer \
docker.io/golang:1.18 \
docker.io/golang:1.19 \
./hack/go-fmt.sh "${@}"
fi
33 changes: 17 additions & 16 deletions pkg/asset/agent/manifests/network-scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,28 @@ package manifests
// If the user provides static network configuration, the network config files will be stored in directory
// /etc/assisted/network in the following structure:
// /etc/assisted/network/
// +-- host1
// | +--- *.nmconnection
// | +--- mac_interface.ini
// +-- host2
// +--- *.nmconnection
// +--- mac_interface.ini
// 1. *.nmconnections - files generated by nmstate based on yaml files provided by the user
// 2. mac_interface.ini - the file contains mapping of mac-address to logical interface name.
// There are two usages for the file:
// 1. Map logical interface name to MAC Address of the host. The logical interface name is a
//
// +-- host1
// | +--- *.nmconnection
// | +--- mac_interface.ini
// +-- host2
// +--- *.nmconnection
// +--- mac_interface.ini
// 1. *.nmconnections - files generated by nmstate based on yaml files provided by the user
// 2. mac_interface.ini - the file contains mapping of mac-address to logical interface name.
// There are two usages for the file:
// a. Map logical interface name to MAC Address of the host. The logical interface name is a
// name provided by the user for the interface. It will be replaced by the script with the
// actual network interface name.
// 2. Identify the host directory which belongs to the current host by matching a MAC Address
// b. Identify the host directory which belongs to the current host by matching a MAC Address
// from the mapping file with host network interfaces.
//
// Applying the network configuration of each host will be done by:
// 1. Associate the current host with its matching hostX directory. The association will be done by
// matching host's mac addresses with those in mac_interface.ini.
// 2. Replace logical interface name in nmconnection files with the interface name as set on the host
// 3. Rename nmconnection files to start with the interface name (instead of the logical interface name)
// 4. Copy the nmconnection files to /NetworkManager/system-connections/
// 1. Associate the current host with its matching hostX directory. The association will be done by
// matching host's mac addresses with those in mac_interface.ini.
// 2. Replace logical interface name in nmconnection files with the interface name as set on the host
// 3. Rename nmconnection files to start with the interface name (instead of the logical interface name)
// 4. Copy the nmconnection files to /NetworkManager/system-connections/
const PreNetworkConfigScript = `#!/bin/bash

# The directory that contains nmconnection files of all nodes
Expand Down
4 changes: 2 additions & 2 deletions pkg/asset/installconfig/aws/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ func IsStaticCredentials(credsValue credentials.Value) bool {
}

// errCodeEquals returns true if the error matches all these conditions:
// * err is of type awserr.Error
// * Error.Code() equals code
// - err is of type awserr.Error
// - Error.Code() equals code
func errCodeEquals(err error, code string) bool {
var awsErr awserr.Error
if errors.As(err, &awsErr) {
Expand Down
32 changes: 16 additions & 16 deletions pkg/asset/installconfig/azure/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ import (
"github.com/pkg/errors"
)

//DNSConfig exposes functions to choose the DNS settings
// DNSConfig exposes functions to choose the DNS settings
type DNSConfig struct {
session *Session
}

//ZonesGetter fetches the DNS zones available for the installer
// ZonesGetter fetches the DNS zones available for the installer
type ZonesGetter interface {
GetAllPublicZones() (map[string]string, error)
}

//ZonesClient wraps the azure ZonesClient internal
// ZonesClient wraps the azure ZonesClient internal
type ZonesClient struct {
azureClient azdns.ZonesClient
}

//RecordSetsClient wraps the azure RecordSetsClient internal
// RecordSetsClient wraps the azure RecordSetsClient internal
type RecordSetsClient struct {
azureClient azdns.RecordSetsClient
}

//Zone represents an Azure DNS Zone
// Zone represents an Azure DNS Zone
type Zone struct {
ID string
Name string
Expand All @@ -41,8 +41,8 @@ func (z Zone) String() string {
return z.Name
}

//GetDNSZoneID returns the Azure DNS zone resourceID
//by interpolating the subscriptionID, the resource group and the zone name
// GetDNSZoneID returns the Azure DNS zone resourceID
// by interpolating the subscriptionID, the resource group and the zone name
func (config DNSConfig) GetDNSZoneID(rgName string, zoneName string) string {
return fmt.Sprintf(
"/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnszones/%s",
Expand All @@ -51,8 +51,8 @@ func (config DNSConfig) GetDNSZoneID(rgName string, zoneName string) string {
zoneName)
}

//GetPrivateDNSZoneID returns the Azure Private DNS zone resourceID
//by interpolating the subscriptionID, the resource group and the zone name
// GetPrivateDNSZoneID returns the Azure Private DNS zone resourceID
// by interpolating the subscriptionID, the resource group and the zone name
func (config DNSConfig) GetPrivateDNSZoneID(rgName string, zoneName string) string {
return fmt.Sprintf(
"/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s",
Expand All @@ -61,7 +61,7 @@ func (config DNSConfig) GetPrivateDNSZoneID(rgName string, zoneName string) stri
zoneName)
}

//GetDNSZone returns a DNS zone selected by survey
// GetDNSZone returns a DNS zone selected by survey
func (config DNSConfig) GetDNSZone() (*Zone, error) {
//call azure api using the session to retrieve available base domain
zonesClient := newZonesClient(config.session)
Expand Down Expand Up @@ -95,15 +95,15 @@ func (config DNSConfig) GetDNSZone() (*Zone, error) {

}

//GetDNSRecordSet gets a record set for the zone identified by publicZoneID
// GetDNSRecordSet gets a record set for the zone identified by publicZoneID
func (config DNSConfig) GetDNSRecordSet(rgName string, zoneName string, relativeRecordSetName string, recordType azdns.RecordType) (*azdns.RecordSet, error) {
recordsetsClient := newRecordSetsClient(config.session)
return recordsetsClient.GetRecordSet(rgName, zoneName, relativeRecordSetName, recordType)
}

//NewDNSConfig returns a new DNSConfig struct that helps configuring the DNS
//by querying your subscription and letting you choose
//which domain you wish to use for the cluster
// NewDNSConfig returns a new DNSConfig struct that helps configuring the DNS
// by querying your subscription and letting you choose
// which domain you wish to use for the cluster
func NewDNSConfig(ssn *Session) *DNSConfig {
return &DNSConfig{session: ssn}
}
Expand All @@ -120,7 +120,7 @@ func newRecordSetsClient(session *Session) *RecordSetsClient {
return &RecordSetsClient{azureClient: azureClient}
}

//GetAllPublicZones get all public zones from the current subscription
// GetAllPublicZones get all public zones from the current subscription
func (client *ZonesClient) GetAllPublicZones() (map[string]string, error) {
ctx, cancel := context.WithTimeout(context.TODO(), 30*time.Second)
defer cancel()
Expand All @@ -139,7 +139,7 @@ func (client *ZonesClient) GetAllPublicZones() (map[string]string, error) {
return allZones, nil
}

//GetRecordSet gets an Azure DNS recordset by zone, name and recordset type
// GetRecordSet gets an Azure DNS recordset by zone, name and recordset type
func (client *RecordSetsClient) GetRecordSet(rgName string, zoneName string, relativeRecordSetName string, recordType azdns.RecordType) (*azdns.RecordSet, error) {
ctx, cancel := context.WithTimeout(context.TODO(), 30*time.Second)
defer cancel()
Expand Down
4 changes: 2 additions & 2 deletions pkg/asset/installconfig/azure/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ var (
onceLoggers = map[string]*sync.Once{}
)

//Session is an object representing session for subscription
// Session is an object representing session for subscription
type Session struct {
GraphAuthorizer autorest.Authorizer
Authorizer autorest.Authorizer
Credentials Credentials
Environment azureenv.Environment
}

//Credentials is the data type for credentials as understood by the azure sdk
// Credentials is the data type for credentials as understood by the azure sdk
type Credentials struct {
SubscriptionID string `json:"subscriptionId,omitempty"`
ClientID string `json:"clientId,omitempty"`
Expand Down
14 changes: 7 additions & 7 deletions pkg/asset/installconfig/powervs/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var (
defaultAuthFilePath = filepath.Join(os.Getenv("HOME"), ".powervs", "config.json")
)

//BxClient is struct which provides bluemix session details
// BxClient is struct which provides bluemix session details
type BxClient struct {
*bxsession.Session
APIKey string
Expand All @@ -44,7 +44,7 @@ type BxClient struct {
AccountAPIV2 accountv2.Accounts
}

//User is struct with user details
// User is struct with user details
type User struct {
ID string
Email string
Expand Down Expand Up @@ -100,7 +100,7 @@ func fetchUserDetails(sess *bxsession.Session) (*User, error) {
return &user, nil
}

//NewBxClient func returns bluemix client
// NewBxClient func returns bluemix client
func NewBxClient() (*BxClient, error) {
c := &BxClient{}

Expand Down Expand Up @@ -162,7 +162,7 @@ func NewBxClient() (*BxClient, error) {
return c, nil
}

//GetAccountType func return the type of account TRAIL/PAID
// GetAccountType func return the type of account TRAIL/PAID
func (c *BxClient) GetAccountType() (string, error) {
myAccount, err := c.AccountAPIV2.Get((*c.User).Account)
if err != nil {
Expand All @@ -172,7 +172,7 @@ func (c *BxClient) GetAccountType() (string, error) {
return myAccount.Type, nil
}

//ValidateAccountPermissions Checks permission for provisioning Power VS resources
// ValidateAccountPermissions Checks permission for provisioning Power VS resources
func (c *BxClient) ValidateAccountPermissions() error {
accType, err := c.GetAccountType()
if err != nil {
Expand All @@ -184,7 +184,7 @@ func (c *BxClient) ValidateAccountPermissions() error {
return nil
}

//ValidateDhcpService checks for existing Dhcp service for the provided PowerVS cloud instance
// ValidateDhcpService checks for existing Dhcp service for the provided PowerVS cloud instance
func (c *BxClient) ValidateDhcpService(ctx context.Context, svcInsID string) error {
ctx, cancel := context.WithTimeout(ctx, 2*time.Minute)
defer cancel()
Expand All @@ -202,7 +202,7 @@ func (c *BxClient) ValidateDhcpService(ctx context.Context, svcInsID string) err
return nil
}

//ValidateCloudConnectionInPowerVSRegion counts cloud connection in PowerVS Region
// ValidateCloudConnectionInPowerVSRegion counts cloud connection in PowerVS Region
func (c *BxClient) ValidateCloudConnectionInPowerVSRegion(ctx context.Context, svcInsID string) error {
ctx, cancel := context.WithTimeout(ctx, 2*time.Minute)
defer cancel()
Expand Down
5 changes: 3 additions & 2 deletions pkg/asset/installconfig/vsphere/mock/vsphere_sim.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import (
"github.com/vmware/govmomi/vim25/soap"
)

// StartSimulator starts an instance of the simulator which listens on 127.0.0.1. Call GetClient
// to retrieve a vim25.client which will connect to and trust this simulator
// StartSimulator starts an instance of the simulator which listens on 127.0.0.1.
// Call GetClient to retrieve a vim25.client which will connect to and trust this
// simulator
func StartSimulator() *simulator.Server {
model := simulator.VPX()
model.Folder = 1
Expand Down
2 changes: 1 addition & 1 deletion pkg/asset/machines/nutanix/machinesets.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//Package nutanix generates Machine objects for nutanix.package nutanix
// Package nutanix generates Machine objects for nutanix.package nutanix
package nutanix

import (
Expand Down
2 changes: 1 addition & 1 deletion pkg/asset/machines/vsphere/machinesets.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//Package vsphere generates Machine objects for vsphere.package vsphere
// Package vsphere generates Machine objects for vsphere.package vsphere
package vsphere

import (
Expand Down
6 changes: 3 additions & 3 deletions pkg/asset/manifests/azure/types.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package azure

//authConfig is part of the CloudProviderConfig as defined in https://github.com/kubernetes/kubernetes/blob/v1.13.5/pkg/cloudprovider/providers/azure/auth/azure_auth.go#L32
//resourceManagerEndpoint has been added based on https://github.com/kubernetes-sigs/cloud-provider-azure/blob/v1.0.3/pkg/auth/azure_auth.go
// authConfig is part of the CloudProviderConfig as defined in https://github.com/kubernetes/kubernetes/blob/v1.13.5/pkg/cloudprovider/providers/azure/auth/azure_auth.go#L32
// resourceManagerEndpoint has been added based on https://github.com/kubernetes-sigs/cloud-provider-azure/blob/v1.0.3/pkg/auth/azure_auth.go
type authConfig struct {
// The cloud environment identifier. Takes values from https://github.com/Azure/go-autorest/blob/ec5f4903f77ed9927ac95b19ab8e44ada64c1356/autorest/azure/environments.go#L13
Cloud string `json:"cloud" yaml:"cloud"`
Expand All @@ -28,7 +28,7 @@ type authConfig struct {
ResourceManagerEndpoint string `json:"resourceManagerEndpoint,omitempty" yaml:"resourceManagerEndpoint,omitempty"`
}

//config is the cloud provider config as defined in https://github.com/kubernetes/kubernetes/blob/v1.13.5/pkg/cloudprovider/providers/azure/azure.go#L81
// config is the cloud provider config as defined in https://github.com/kubernetes/kubernetes/blob/v1.13.5/pkg/cloudprovider/providers/azure/azure.go#L81
type config struct {
authConfig

Expand Down
2 changes: 1 addition & 1 deletion pkg/asset/tls/adminkubeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (a *AdminKubeConfigCABundle) Name() string {
return "Certificate (admin-kubeconfig-ca-bundle)"
}

//AdminKubeConfigClientCertKey is the asset that generates the key/cert pair for admin client to apiserver.
// AdminKubeConfigClientCertKey is the asset that generates the key/cert pair for admin client to apiserver.
type AdminKubeConfigClientCertKey struct {
SignedCertKey
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/destroy/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ func (o *ClusterUninstaller) RunWithContext(ctx context.Context) ([]string, erro
}

// findResourcesToDelete returns the resources that should be deleted.
// tagClients - clients of the tagging API to use to search for resources.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
// tagClients - clients of the tagging API to use to search for resources.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
func (o *ClusterUninstaller) findResourcesToDelete(
ctx context.Context,
tagClients []*resourcegroupstaggingapi.ResourceGroupsTaggingAPI,
Expand Down Expand Up @@ -313,8 +313,8 @@ func (o *ClusterUninstaller) findResourcesToDelete(
}

// findResourcesByTag returns the resources with tags that satisfy the filters.
// tagClients - clients of the tagging API to use to search for resources.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
// tagClients - clients of the tagging API to use to search for resources.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
func (o *ClusterUninstaller) findResourcesByTag(
ctx context.Context,
tagClient *resourcegroupstaggingapi.ResourceGroupsTaggingAPI,
Expand Down Expand Up @@ -353,7 +353,7 @@ func (o *ClusterUninstaller) findResourcesByTag(
}

// findUntaggableResources returns the resources for the cluster that cannot be tagged.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
func (o *ClusterUninstaller) findUntaggableResources(ctx context.Context, iamClient *iam.IAM, deleted sets.String) (sets.String, error) {
resources := sets.NewString()
o.Logger.Debug("search for IAM instance profiles")
Expand All @@ -375,7 +375,7 @@ func (o *ClusterUninstaller) findUntaggableResources(ctx context.Context, iamCli
}

// deleteResources deletes the specified resources.
// resources - the resources to be deleted.
// resources - the resources to be deleted.
// The first return is the ARNs of the resources that were successfully deleted
func (o *ClusterUninstaller) deleteResources(ctx context.Context, awsSession *session.Session, resources []string, tracker *errorTracker) (sets.String, error) {
deleted := sets.NewString()
Expand Down
2 changes: 1 addition & 1 deletion pkg/destroy/aws/ec2helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
// findEC2Instances returns the EC2 instances with tags that satisfy the filters.
// returns two lists, first one is the list of all resources that are not terminated and are not in shutdown
// stage and the second list is the list of resources that are not terminated.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
func findEC2Instances(ctx context.Context, ec2Client *ec2.EC2, deleted sets.String, filters []Filter, logger logrus.FieldLogger) ([]string, []string, error) {
if ec2Client.Config.Region == nil {
return nil, nil, errors.New("EC2 client does not have region configured")
Expand Down
4 changes: 2 additions & 2 deletions pkg/destroy/aws/iamhelpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (search *iamUserSearch) arns(ctx context.Context) ([]string, error) {
}

// findIAMRoles returns the IAM roles for the cluster.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
func findIAMRoles(ctx context.Context, search *iamRoleSearch, deleted sets.String, logger logrus.FieldLogger) (sets.String, error) {
logger.Debug("search for IAM roles")
resources, _, err := search.find(ctx)
Expand All @@ -144,7 +144,7 @@ func findIAMRoles(ctx context.Context, search *iamRoleSearch, deleted sets.Strin
}

// findIAMUsers returns the IAM users for the cluster.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
func findIAMUsers(ctx context.Context, search *iamUserSearch, deleted sets.String, logger logrus.FieldLogger) (sets.String, error) {
logger.Debug("search for IAM users")
resources, err := search.arns(ctx)
Expand Down
2 changes: 1 addition & 1 deletion pkg/gather/service/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
// For example, if the filename is "log-bundle-20210329190553/bootstrap/services/release-image.json",
// then the name of the service is "release-image".
// In case the log-bundle is from bootstrap-in-place installation the file name is:
//"log-bundle-20210329190553/log-bundle-bootstrap/bootstrap/services/release-image.json"
// "log-bundle-20210329190553/log-bundle-bootstrap/bootstrap/services/release-image.json"
var serviceEntriesFilePathRegex = regexp.MustCompile(`^[^\/]+(?:\/log-bundle-bootstrap)?\/bootstrap\/services\/([^.]+)\.json$`)

// AnalyzeGatherBundle will analyze the bootstrap gather bundle at the specified path.
Expand Down
Loading