diff --git a/channels/pkg/cmd/apply_channel.go b/channels/pkg/cmd/apply_channel.go index eab77718a0..5b147299d4 100644 --- a/channels/pkg/cmd/apply_channel.go +++ b/channels/pkg/cmd/apply_channel.go @@ -28,7 +28,6 @@ import ( "github.com/spf13/cobra" "go.uber.org/multierr" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" "k8s.io/client-go/restmapper" @@ -40,8 +39,6 @@ import ( type ApplyChannelOptions struct { Yes bool - - configFlags genericclioptions.ConfigFlags } func NewCmdApplyChannel(f *ChannelsFactory, out io.Writer) *cobra.Command { diff --git a/cloudmock/openstack/mockcompute/api.go b/cloudmock/openstack/mockcompute/api.go index 6f50cc60ff..cf8cf371ff 100644 --- a/cloudmock/openstack/mockcompute/api.go +++ b/cloudmock/openstack/mockcompute/api.go @@ -20,8 +20,6 @@ import ( "net/http/httptest" "sync" - "github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions" - "github.com/gophercloud/gophercloud/v2" "github.com/gophercloud/gophercloud/v2/openstack/compute/v2/flavors" @@ -37,13 +35,12 @@ type MockClient struct { openstack.MockOpenstackServer mutex sync.Mutex - serverGroups map[string]servergroups.ServerGroup - servers map[string]servers.Server - keyPairs map[string]keypairs.KeyPair - images map[string]images.Image - flavors map[string]flavors.Flavor - instanceActions map[string]instanceactions.InstanceAction - networkClient *gophercloud.ServiceClient + serverGroups map[string]servergroups.ServerGroup + servers map[string]servers.Server + keyPairs map[string]keypairs.KeyPair + images map[string]images.Image + flavors map[string]flavors.Flavor + networkClient *gophercloud.ServiceClient } // CreateClient will create a new mock networking client diff --git a/pkg/assets/mirrors.go b/pkg/assets/mirrors.go index 22d4f68c28..b5a225c4d2 100644 --- a/pkg/assets/mirrors.go +++ b/pkg/assets/mirrors.go @@ -22,12 +22,6 @@ import ( "k8s.io/kops" ) -const ( - // defaultKopsMirrorBase will be detected and automatically set to pull from the defaultKopsMirrors - kopsDefaultBase = "https://artifacts.k8s.io/binaries/kops/%s/" - githubKopsMirrorBase = "https://github.com/kubernetes/kops/releases/download/v%s/" -) - type mirrorConfig struct { Base string Mirrors []string diff --git a/protokube/pkg/protokube/aws_volume.go b/protokube/pkg/protokube/aws_volume.go index ae7769ea79..fd2a71b508 100644 --- a/protokube/pkg/protokube/aws_volume.go +++ b/protokube/pkg/protokube/aws_volume.go @@ -20,7 +20,6 @@ import ( "context" "fmt" "io" - "sync" "github.com/aws/aws-sdk-go-v2/aws" awsconfig "github.com/aws/aws-sdk-go-v2/config" @@ -35,8 +34,6 @@ import ( // AWSCloudProvider defines the AWS cloud provider implementation type AWSCloudProvider struct { - mutex sync.Mutex - clusterTag string deviceMap map[string]string ec2 ec2.DescribeInstancesAPIClient diff --git a/protokube/pkg/protokube/do_volume.go b/protokube/pkg/protokube/do_volume.go index 48af95f193..4ab1812e3a 100644 --- a/protokube/pkg/protokube/do_volume.go +++ b/protokube/pkg/protokube/do_volume.go @@ -29,7 +29,6 @@ import ( "github.com/digitalocean/godo" "golang.org/x/oauth2" - "k8s.io/kops/protokube/pkg/etcd" "k8s.io/kops/protokube/pkg/gossip" gossipdo "k8s.io/kops/protokube/pkg/gossip/do" ) @@ -154,31 +153,6 @@ func NewDOCloud() (*godo.Client, error) { return client, nil } -// getEtcdClusterSpec returns etcd.EtcdClusterSpec which holds -// necessary information required for starting an etcd server. -// DigitalOcean support on kops only supports single master setup for now -// but in the future when it supports multiple masters this method be -// updated to handle that case. -// TODO: use tags once it's supported for volumes -func (d *DOCloudProvider) getEtcdClusterSpec(vol godo.Volume) (*etcd.EtcdClusterSpec, error) { - nodeName := d.dropletName - - var clusterKey string - if strings.Contains(vol.Name, "etcd-main") { - clusterKey = "main" - } else if strings.Contains(vol.Name, "etcd-events") { - clusterKey = "events" - } else { - return nil, fmt.Errorf("could not determine etcd cluster type for volume: %s", vol.Name) - } - - return &etcd.EtcdClusterSpec{ - ClusterKey: clusterKey, - NodeName: nodeName, - NodeNames: []string{nodeName}, - }, nil -} - func (d *DOCloudProvider) GossipSeeds() (gossip.SeedProvider, error) { for _, dropletTag := range d.dropletTags { if strings.Contains(dropletTag, strings.ReplaceAll(d.ClusterID, ".", "-")) { diff --git a/upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go b/upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go index 31daa6e2dc..cc0ce166ef 100644 --- a/upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go +++ b/upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go @@ -869,24 +869,6 @@ func (e *AutoscalingGroup) getLBsToDetach(currentLBs []*ClassicLoadBalancer) []s return lbsToDetach } -// getTGsToDetach loops through the currently set LBs and builds a list of -// target groups to be detached from the Autoscaling Group -func (e *AutoscalingGroup) getTGsToDetach(currentTGs []*TargetGroup) []*string { - tgsToDetach := []*string{} - desiredTGs := map[string]bool{} - - for _, v := range e.TargetGroups { - desiredTGs[*v.ARN] = true - } - - for _, v := range currentTGs { - if _, ok := desiredTGs[*v.ARN]; !ok { - tgsToDetach = append(tgsToDetach, v.ARN) - } - } - return tgsToDetach -} - // sliceChunks returns a chunked slice func sliceChunks(slice []string, chunkSize int) [][]string { var chunks [][]string diff --git a/upup/pkg/fi/cloudup/awstasks/network_load_balancer.go b/upup/pkg/fi/cloudup/awstasks/network_load_balancer.go index c005c25763..e695205006 100644 --- a/upup/pkg/fi/cloudup/awstasks/network_load_balancer.go +++ b/upup/pkg/fi/cloudup/awstasks/network_load_balancer.go @@ -765,12 +765,6 @@ type deleteNLB struct { obj *awsup.LoadBalancerInfo } -func buildDeleteNLB(obj *awsup.LoadBalancerInfo) *deleteNLB { - d := &deleteNLB{} - d.obj = obj - return d -} - var _ fi.CloudupDeletion = &deleteNLB{} func (d *deleteNLB) Delete(t fi.CloudupTarget) error { diff --git a/upup/pkg/fi/cloudup/awsup/aws_authenticator_test.go b/upup/pkg/fi/cloudup/awsup/aws_authenticator_test.go index 731959c853..4258c94564 100644 --- a/upup/pkg/fi/cloudup/awsup/aws_authenticator_test.go +++ b/upup/pkg/fi/cloudup/awsup/aws_authenticator_test.go @@ -371,12 +371,3 @@ func (s *mockHTTPClient) Do(req *http.Request) (*http.Response, error) { s.t.Fatalf("unexpected request %+v", req) return nil, fmt.Errorf("unexpected request") } - -type mockHTTPTransport struct { - t *testing.T -} - -func (s *mockHTTPTransport) RoundTrip(req *http.Request) (*http.Response, error) { - s.t.Fatalf("unexpected request %+v", req) - return nil, fmt.Errorf("unexpected request") -} diff --git a/upup/pkg/fi/nodeup/command.go b/upup/pkg/fi/nodeup/command.go index 168efd44c6..5c56b5059e 100644 --- a/upup/pkg/fi/nodeup/command.go +++ b/upup/pkg/fi/nodeup/command.go @@ -526,26 +526,6 @@ func evaluateBindAddress(bindAddress string) (string, error) { return bindAddress, nil } -// kernelHasFilesystem checks if /proc/filesystems contains the specified filesystem -func kernelHasFilesystem(fs string) (bool, error) { - contents, err := os.ReadFile("/proc/filesystems") - if err != nil { - return false, fmt.Errorf("error reading /proc/filesystems: %v", err) - } - - for _, line := range strings.Split(string(contents), "\n") { - tokens := strings.Fields(line) - for _, token := range tokens { - // Technically we should skip "nodev", but it doesn't matter - if token == fs { - return true, nil - } - } - } - - return false, nil -} - // modprobe will exec `modprobe ` func modprobe(module string) error { klog.Infof("Doing modprobe for module %v", module) diff --git a/vendor/github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions/doc.go b/vendor/github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions/doc.go deleted file mode 100644 index b6d4318122..0000000000 --- a/vendor/github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions/doc.go +++ /dev/null @@ -1,26 +0,0 @@ -package instanceactions - -/* -Package instanceactions provides the ability to list or get a server instance-action. - -Example to List and Get actions: - - pages, err := instanceactions.List(client, "server-id", nil).AllPages(context.TODO()) - if err != nil { - panic("fail to get actions pages") - } - - actions, err := instanceactions.ExtractInstanceActions(pages) - if err != nil { - panic("fail to list instance actions") - } - - for _, action := range actions { - action, err = instanceactions.Get(context.TODO(), client, "server-id", action.RequestID).Extract() - if err != nil { - panic("fail to get instance action") - } - - fmt.Println(action) - } -*/ diff --git a/vendor/github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions/request.go b/vendor/github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions/request.go deleted file mode 100644 index d34090fe3a..0000000000 --- a/vendor/github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions/request.go +++ /dev/null @@ -1,81 +0,0 @@ -package instanceactions - -import ( - "context" - "net/url" - "time" - - "github.com/gophercloud/gophercloud/v2" - "github.com/gophercloud/gophercloud/v2/pagination" -) - -// ListOptsBuilder allows extensions to add additional parameters to the -// List request. -type ListOptsBuilder interface { - ToInstanceActionsListQuery() (string, error) -} - -// ListOpts represents options used to filter instance action results -// in a List request. -type ListOpts struct { - // Limit is an integer value to limit the results to return. - // This requires microversion 2.58 or later. - Limit int `q:"limit"` - - // Marker is the request ID of the last-seen instance action. - // This requires microversion 2.58 or later. - Marker string `q:"marker"` - - // ChangesSince filters the response by actions after the given time. - // This requires microversion 2.58 or later. - ChangesSince *time.Time `q:"changes-since"` - - // ChangesBefore filters the response by actions before the given time. - // This requires microversion 2.66 or later. - ChangesBefore *time.Time `q:"changes-before"` -} - -// ToInstanceActionsListQuery formats a ListOpts into a query string. -func (opts ListOpts) ToInstanceActionsListQuery() (string, error) { - q, err := gophercloud.BuildQueryString(opts) - if err != nil { - return "", err - } - - params := q.Query() - - if opts.ChangesSince != nil { - params.Add("changes-since", opts.ChangesSince.Format(time.RFC3339)) - } - - if opts.ChangesBefore != nil { - params.Add("changes-before", opts.ChangesBefore.Format(time.RFC3339)) - } - - q = &url.URL{RawQuery: params.Encode()} - return q.String(), nil -} - -// List makes a request against the API to list the servers actions. -func List(client *gophercloud.ServiceClient, id string, opts ListOptsBuilder) pagination.Pager { - url := listURL(client, id) - if opts != nil { - query, err := opts.ToInstanceActionsListQuery() - if err != nil { - return pagination.Pager{Err: err} - } - url += query - } - return pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page { - return InstanceActionPage{pagination.SinglePageBase(r)} - }) -} - -// Get makes a request against the API to get a server action. -func Get(ctx context.Context, client *gophercloud.ServiceClient, serverID, requestID string) (r InstanceActionResult) { - resp, err := client.Get(ctx, instanceActionsURL(client, serverID, requestID), &r.Body, &gophercloud.RequestOpts{ - OkCodes: []int{200}, - }) - _, r.Header, r.Err = gophercloud.ParseResponse(resp, err) - return -} diff --git a/vendor/github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions/results.go b/vendor/github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions/results.go deleted file mode 100644 index 2015be88c2..0000000000 --- a/vendor/github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions/results.go +++ /dev/null @@ -1,194 +0,0 @@ -package instanceactions - -import ( - "encoding/json" - "time" - - "github.com/gophercloud/gophercloud/v2" - "github.com/gophercloud/gophercloud/v2/pagination" -) - -// InstanceAction represents an instance action. -type InstanceAction struct { - // Action is the name of the action. - Action string `json:"action"` - - // InstanceUUID is the UUID of the instance. - InstanceUUID string `json:"instance_uuid"` - - // Message is the related error message for when an action fails. - Message string `json:"message"` - - // Project ID is the ID of the project which initiated the action. - ProjectID string `json:"project_id"` - - // RequestID is the ID generated when performing the action. - RequestID string `json:"request_id"` - - // StartTime is the time the action started. - StartTime time.Time `json:"-"` - - // UserID is the ID of the user which initiated the action. - UserID string `json:"user_id"` -} - -// UnmarshalJSON converts our JSON API response into our instance action struct -func (i *InstanceAction) UnmarshalJSON(b []byte) error { - type tmp InstanceAction - var s struct { - tmp - StartTime gophercloud.JSONRFC3339MilliNoZ `json:"start_time"` - } - err := json.Unmarshal(b, &s) - if err != nil { - return err - } - *i = InstanceAction(s.tmp) - - i.StartTime = time.Time(s.StartTime) - - return err -} - -// InstanceActionPage abstracts the raw results of making a List() request -// against the API. As OpenStack extensions may freely alter the response bodies -// of structures returned to the client, you may only safely access the data -// provided through the ExtractInstanceActions call. -type InstanceActionPage struct { - pagination.SinglePageBase -} - -// IsEmpty returns true if an InstanceActionPage contains no instance actions. -func (r InstanceActionPage) IsEmpty() (bool, error) { - if r.StatusCode == 204 { - return true, nil - } - - instanceactions, err := ExtractInstanceActions(r) - return len(instanceactions) == 0, err -} - -// ExtractInstanceActions interprets a page of results as a slice -// of InstanceAction. -func ExtractInstanceActions(r pagination.Page) ([]InstanceAction, error) { - var resp []InstanceAction - err := ExtractInstanceActionsInto(r, &resp) - return resp, err -} - -// Event represents an event of instance action. -type Event struct { - // Event is the name of the event. - Event string `json:"event"` - - // Host is the host of the event. - // This requires microversion 2.62 or later. - Host *string `json:"host"` - - // HostID is the host id of the event. - // This requires microversion 2.62 or later. - HostID *string `json:"hostId"` - - // Result is the result of the event. - Result string `json:"result"` - - // Traceback is the traceback stack if an error occurred. - Traceback string `json:"traceback"` - - // StartTime is the time the action started. - StartTime time.Time `json:"-"` - - // FinishTime is the time the event finished. - FinishTime time.Time `json:"-"` -} - -// UnmarshalJSON converts our JSON API response into our instance action struct. -func (e *Event) UnmarshalJSON(b []byte) error { - type tmp Event - var s struct { - tmp - StartTime gophercloud.JSONRFC3339MilliNoZ `json:"start_time"` - FinishTime gophercloud.JSONRFC3339MilliNoZ `json:"finish_time"` - } - err := json.Unmarshal(b, &s) - if err != nil { - return err - } - *e = Event(s.tmp) - - e.StartTime = time.Time(s.StartTime) - e.FinishTime = time.Time(s.FinishTime) - - return err -} - -// InstanceActionDetail represents the details of an Action. -type InstanceActionDetail struct { - // Action is the name of the Action. - Action string `json:"action"` - - // InstanceUUID is the UUID of the instance. - InstanceUUID string `json:"instance_uuid"` - - // Message is the related error message for when an action fails. - Message string `json:"message"` - - // Project ID is the ID of the project which initiated the action. - ProjectID string `json:"project_id"` - - // RequestID is the ID generated when performing the action. - RequestID string `json:"request_id"` - - // UserID is the ID of the user which initiated the action. - UserID string `json:"user_id"` - - // Events is the list of events of the action. - // This requires microversion 2.50 or later. - Events *[]Event `json:"events"` - - // UpdatedAt last update date of the action. - // This requires microversion 2.58 or later. - UpdatedAt *time.Time `json:"-"` - - // StartTime is the time the action started. - StartTime time.Time `json:"-"` -} - -// UnmarshalJSON converts our JSON API response into our instance action struct -func (i *InstanceActionDetail) UnmarshalJSON(b []byte) error { - type tmp InstanceActionDetail - var s struct { - tmp - UpdatedAt *gophercloud.JSONRFC3339MilliNoZ `json:"updated_at"` - StartTime gophercloud.JSONRFC3339MilliNoZ `json:"start_time"` - } - err := json.Unmarshal(b, &s) - if err != nil { - return err - } - *i = InstanceActionDetail(s.tmp) - - i.UpdatedAt = (*time.Time)(s.UpdatedAt) - i.StartTime = time.Time(s.StartTime) - return err -} - -// InstanceActionResult is the result handler of Get. -type InstanceActionResult struct { - gophercloud.Result -} - -// Extract interprets a result as an InstanceActionDetail. -func (r InstanceActionResult) Extract() (InstanceActionDetail, error) { - var s InstanceActionDetail - err := r.ExtractInto(&s) - return s, err -} - -func (r InstanceActionResult) ExtractInto(v any) error { - return r.Result.ExtractIntoStructPtr(v, "instanceAction") -} - -func ExtractInstanceActionsInto(r pagination.Page, v any) error { - return r.(InstanceActionPage).Result.ExtractIntoSlicePtr(v, "instanceActions") -} diff --git a/vendor/github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions/urls.go b/vendor/github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions/urls.go deleted file mode 100644 index baf4e23a93..0000000000 --- a/vendor/github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions/urls.go +++ /dev/null @@ -1,11 +0,0 @@ -package instanceactions - -import "github.com/gophercloud/gophercloud/v2" - -func listURL(client *gophercloud.ServiceClient, id string) string { - return client.ServiceURL("servers", id, "os-instance-actions") -} - -func instanceActionsURL(client *gophercloud.ServiceClient, serverID, requestID string) string { - return client.ServiceURL("servers", serverID, "os-instance-actions", requestID) -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 68ef7aa5a7..a0dd3dbaf0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -692,7 +692,6 @@ github.com/gophercloud/gophercloud/v2/openstack/blockstorage/v3/volumes github.com/gophercloud/gophercloud/v2/openstack/compute/v2/attachinterfaces github.com/gophercloud/gophercloud/v2/openstack/compute/v2/availabilityzones github.com/gophercloud/gophercloud/v2/openstack/compute/v2/flavors -github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions github.com/gophercloud/gophercloud/v2/openstack/compute/v2/keypairs github.com/gophercloud/gophercloud/v2/openstack/compute/v2/servergroups github.com/gophercloud/gophercloud/v2/openstack/compute/v2/servers