Skip to content

Commit

Permalink
Merge pull request #6271 from aayushrangwala/master
Browse files Browse the repository at this point in the history
[cluster-autoscaler] chore: Rename Cluster Autoscaler Provider package from Packet to EquinixMetal
  • Loading branch information
k8s-ci-robot authored Dec 27, 2023
2 parents 600cda5 + 2793a3e commit d9f1317
Show file tree
Hide file tree
Showing 17 changed files with 45 additions and 47 deletions.
2 changes: 1 addition & 1 deletion cluster-autoscaler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You should also take a look at the notes and "gotchas" for your specific cloud p
* [ClusterAPI](./cloudprovider/clusterapi/README.md)
* [DigitalOcean](./cloudprovider/digitalocean/README.md)
* [Exoscale](./cloudprovider/exoscale/README.md)
* [Equinix Metal](./cloudprovider/packet/README.md#notes)
* [Equinix Metal](cloudprovider/equinixmetal/README.md#notes)
* [External gRPC](./cloudprovider/externalgrpc/README.md)
* [Hetzner](./cloudprovider/hetzner/README.md)
* [HuaweiCloud](./cloudprovider/huaweicloud/README.md)
Expand Down
10 changes: 5 additions & 5 deletions cluster-autoscaler/cloudprovider/builder/builder_all.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !gce && !aws && !azure && !kubemark && !alicloud && !magnum && !digitalocean && !clusterapi && !huaweicloud && !ionoscloud && !linode && !hetzner && !bizflycloud && !brightbox && !packet && !oci && !vultr && !tencentcloud && !scaleway && !externalgrpc && !civo && !rancher && !volcengine && !baiducloud && !cherry && !cloudstack && !exoscale && !kamatera && !ovhcloud && !kwok
// +build !gce,!aws,!azure,!kubemark,!alicloud,!magnum,!digitalocean,!clusterapi,!huaweicloud,!ionoscloud,!linode,!hetzner,!bizflycloud,!brightbox,!packet,!oci,!vultr,!tencentcloud,!scaleway,!externalgrpc,!civo,!rancher,!volcengine,!baiducloud,!cherry,!cloudstack,!exoscale,!kamatera,!ovhcloud,!kwok
//go:build !gce && !aws && !azure && !kubemark && !alicloud && !magnum && !digitalocean && !clusterapi && !huaweicloud && !ionoscloud && !linode && !hetzner && !bizflycloud && !brightbox && !equinixmetal && !oci && !vultr && !tencentcloud && !scaleway && !externalgrpc && !civo && !rancher && !volcengine && !baiducloud && !cherry && !cloudstack && !exoscale && !kamatera && !ovhcloud
// +build !gce,!aws,!azure,!kubemark,!alicloud,!magnum,!digitalocean,!clusterapi,!huaweicloud,!ionoscloud,!linode,!hetzner,!bizflycloud,!brightbox,!equinixmetal,!oci,!vultr,!tencentcloud,!scaleway,!externalgrpc,!civo,!rancher,!volcengine,!baiducloud,!cherry,!cloudstack,!exoscale,!kamatera,!ovhcloud

/*
Copyright 2018 The Kubernetes Authors.
Expand Down Expand Up @@ -32,6 +32,7 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/cloudstack"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/clusterapi"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/digitalocean"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/equinixmetal"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/exoscale"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/externalgrpc"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/gce"
Expand All @@ -44,7 +45,6 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/magnum"
oci "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/oci/instancepools"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/ovhcloud"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/packet"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/rancher"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/scaleway"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/tencentcloud"
Expand Down Expand Up @@ -78,7 +78,7 @@ var AvailableCloudProviders = []string{
cloudprovider.LinodeProviderName,
cloudprovider.BizflyCloudProviderName,
cloudprovider.BrightboxProviderName,
cloudprovider.PacketProviderName,
cloudprovider.EquinixMetalProviderName,
cloudprovider.VultrProviderName,
cloudprovider.TencentcloudProviderName,
cloudprovider.CivoProviderName,
Expand Down Expand Up @@ -128,7 +128,7 @@ func buildCloudProvider(opts config.AutoscalingOptions,
case cloudprovider.HetznerProviderName:
return hetzner.BuildHetzner(opts, do, rl)
case cloudprovider.PacketProviderName, cloudprovider.EquinixMetalProviderName:
return packet.BuildCloudProvider(opts, do, rl)
return equinixmetal.BuildCloudProvider(opts, do, rl)
case cloudprovider.ClusterAPIProviderName:
return clusterapi.BuildClusterAPI(opts, do, rl)
case cloudprovider.IonoscloudProviderName:
Expand Down
12 changes: 6 additions & 6 deletions cluster-autoscaler/cloudprovider/builder/builder_packet.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build packet
// +build packet
//go:build equinixmetal
// +build equinixmetal

/*
Copyright 2019 The Kubernetes Authors.
Expand All @@ -21,13 +21,13 @@ package builder

import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/packet"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/equinixmetal"
"k8s.io/autoscaler/cluster-autoscaler/config"
)

// AvailableCloudProviders supported by the cloud provider builder.
var AvailableCloudProviders = []string{
packet.ProviderName,
cloudprovider.PacketProviderName,
cloudprovider.EquinixMetalProviderName,
}

Expand All @@ -36,8 +36,8 @@ const DefaultCloudProvider = cloudprovider.EquinixMetalProviderName

func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider {
switch opts.CloudProviderName {
case packet.ProviderName, cloudprovider.EquinixMetalProviderName:
return packet.BuildCloudProvider(opts, do, rl)
case cloudprovider.PacketProviderName, cloudprovider.EquinixMetalProviderName:
return equinixmetal.BuildCloudProvider(opts, do, rl)
}

return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ reviewers:
- v-pap

labels:
- area/provider/packet
- area/provider/equinixmetal
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ The credentials for authenticating with Equinix Metal are stored in a secret and
provided as an env var to the container. [examples/cluster-autoscaler-secret](examples/cluster-autoscaler-secret.yaml)
In the above file you can modify the following fields:

| Secret | Key | Value |
|---------------------------------|-------------------------|------------------------------------------------------------------------------------------------------------------------------------|
| cluster-autoscaler-packet | authtoken | Your Equinix Metal API token. It must be base64 encoded. |
| cluster-autoscaler-cloud-config | Global/project-id | Your Equinix Metal project id |
| cluster-autoscaler-cloud-config | Global/api-server | The ip:port for you cluster's k8s api (e.g. K8S_MASTER_PUBLIC_IP:6443) |
| cluster-autoscaler-cloud-config | Global/facility | The Equinix Metal facility for the devices in your nodepool (eg: sv15) |
| cluster-autoscaler-cloud-config | Global/plan | The Equinix Metal plan (aka size/flavor) for new nodes in the nodepool (eg: c3.small.x86) |
| cluster-autoscaler-cloud-config | Global/billing | The billing interval for new nodes (default: hourly) |
| cluster-autoscaler-cloud-config | Global/os | The OS image to use for new nodes (default: ubuntu_18_04). If you change this also update cloudinit. |
| cluster-autoscaler-cloud-config | Global/cloudinit | The base64 encoded [user data](https://metal.equinix.com/developers/docs/servers/user-data/) submitted when provisioning devices. In the example file, the default value has been tested with Ubuntu 18.04 to install Docker & kubelet and then to bootstrap the node into the cluster using kubeadm. The kubeadm, kubelet, kubectl are pinned to version 1.17.4. For a different base OS or bootstrap method, this needs to be customized accordingly|
| cluster-autoscaler-cloud-config | Global/reservation | The values "require" or "prefer" will request the next available hardware reservation for new devices in selected facility & plan. If no hardware reservations match, "require" will trigger a failure, while "prefer" will launch on-demand devices instead (default: none) |
| cluster-autoscaler-cloud-config | Global/hostname-pattern | The pattern for the names of new Equinix Metal devices (default: "k8s-{{.ClusterName}}-{{.NodeGroup}}-{{.RandString8}}" ) |
| Secret | Key | Value |
|-------------------------------------|-------------------------|------------------------------------------------------------------------------------------------------------------------------------|
| cluster-autoscaler-equinixmetal | authtoken | Your Equinix Metal API token. It must be base64 encoded. |
| cluster-autoscaler-cloud-config | Global/project-id | Your Equinix Metal project id |
| cluster-autoscaler-cloud-config | Global/api-server | The ip:port for you cluster's k8s api (e.g. K8S_MASTER_PUBLIC_IP:6443) |
| cluster-autoscaler-cloud-config | Global/facility | The Equinix Metal facility for the devices in your nodepool (eg: sv15) |
| cluster-autoscaler-cloud-config | Global/plan | The Equinix Metal plan (aka size/flavor) for new nodes in the nodepool (eg: c3.small.x86) |
| cluster-autoscaler-cloud-config | Global/billing | The billing interval for new nodes (default: hourly) |
| cluster-autoscaler-cloud-config | Global/os | The OS image to use for new nodes (default: ubuntu_18_04). If you change this also update cloudinit. |
| cluster-autoscaler-cloud-config | Global/cloudinit | The base64 encoded [user data](https://metal.equinix.com/developers/docs/servers/user-data/) submitted when provisioning devices. In the example file, the default value has been tested with Ubuntu 18.04 to install Docker & kubelet and then to bootstrap the node into the cluster using kubeadm. The kubeadm, kubelet, kubectl are pinned to version 1.17.4. For a different base OS or bootstrap method, this needs to be customized accordingly|
| cluster-autoscaler-cloud-config | Global/reservation | The values "require" or "prefer" will request the next available hardware reservation for new devices in selected facility & plan. If no hardware reservations match, "require" will trigger a failure, while "prefer" will launch on-demand devices instead (default: none) |
| cluster-autoscaler-cloud-config | Global/hostname-pattern | The pattern for the names of new Equinix Metal devices (default: "k8s-{{.ClusterName}}-{{.NodeGroup}}-{{.RandString8}}" ) |

You can always update the secret with more nodepool definitions (with different plans etc.) as shown in the example, but you should always provide a default nodepool configuration.

Expand Down Expand Up @@ -106,7 +106,7 @@ environment variable in the deployment:

```
env:
- name: PACKET_CONTROLLER_NODE_IDENTIFIER_LABEL
- name: METAL_CONTROLLER_NODE_IDENTIFIER_LABEL
value: <label>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package packet
package equinixmetal

import (
"fmt"
Expand All @@ -35,8 +35,6 @@ import (
)

const (
// ProviderName is the cloud provider name for Packet cloud provider, now named as equinixmetal
ProviderName = "packet"
// GPULabel is the label added to nodes with GPU resource.
GPULabel = "cloud.google.com/gke-accelerator"
// DefaultControllerNodeLabelKey is the label added to Master/Controller to identify as
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#This is a template of cloud-init script for cluster-autoscaler/cloudprovider/packet
#This is a template of cloud-init script for cluster-autoscaler/cloudprovider/equinixmetal
#This gets base64'd and put into the example cluster-autoscaler-secret.yaml file
sleep 10
sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,17 @@ spec:
- name: BOOTSTRAP_TOKEN_ID
valueFrom:
secretKeyRef:
name: bootstrap-token-cluster-autoscaler-packet
name: bootstrap-token-cluster-autoscaler-equinixmetal
key: token-id
- name: BOOTSTRAP_TOKEN_SECRET
valueFrom:
secretKeyRef:
name: bootstrap-token-cluster-autoscaler-packet
name: bootstrap-token-cluster-autoscaler-equinixmetal
key: token-secret
- name: METAL_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: cluster-autoscaler-packet
name: cluster-autoscaler-equinixmetal
key: authtoken
# You can take advantage of multiple nodepools by adding
# extra arguments on the cluster-autoscaler command.
Expand All @@ -190,7 +190,7 @@ spec:
- --alsologtostderr
- --cluster-name=cluster1
- --cloud-config=/config/cloud-config
- --cloud-provider=packet
- --cloud-provider=equinixmetal
- --expander=price
- --nodes=0:10:pool1
- --nodes=0:10:pool2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ data:
authtoken: YOUR_EQUINIX_METAL_API_TOKEN
kind: Secret
metadata:
name: cluster-autoscaler-packet
name: cluster-autoscaler-equinixmetal
namespace: kube-system
type: Opaque
---
Expand Down Expand Up @@ -51,7 +51,7 @@ apiVersion: v1
kind: Secret
type: bootstrap.kubernetes.io/token
metadata:
name: bootstrap-token-cluster-autoscaler-packet
name: bootstrap-token-cluster-autoscaler-equinixmetal
namespace: kube-system
stringData:
description: "The default bootstrap token used by cluster-autoscaler on Equinix Metal."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package packet
package equinixmetal

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package packet
package equinixmetal

import (
"bytes"
Expand Down Expand Up @@ -58,7 +58,7 @@ type instanceType struct {
GPU int64
}

// InstanceTypes is a map of packet resources
// InstanceTypes is a map of equinix metal resources
var InstanceTypes = map[string]*instanceType{
"a3.large.x86": {
InstanceName: "a3.large.x86",
Expand Down Expand Up @@ -439,7 +439,7 @@ func (mgr *equinixMetalManagerRest) NodeGroupForNode(labels map[string]string, n
return "", fmt.Errorf("could not find group for node: %s", nodeId)
}

// nodeGroupSize gets the current size of the nodegroup as reported by packet tags.
// nodeGroupSize gets the current size of the nodegroup as reported by equinix metal tags.
func (mgr *equinixMetalManagerRest) nodeGroupSize(nodegroup string) (int, error) {
devices, err := mgr.listMetalDevices(context.TODO())
if err != nil {
Expand Down Expand Up @@ -500,7 +500,7 @@ func (mgr *equinixMetalManagerRest) createNode(ctx context.Context, cloudinit, n
return nil
}

// createNodes provisions new nodes on packet and bootstraps them in the cluster.
// createNodes provisions new nodes on equinix metal and bootstraps them in the cluster.
func (mgr *equinixMetalManagerRest) createNodes(nodegroup string, nodes int) error {
klog.Infof("Updating node count to %d for nodegroup %s", nodes, nodegroup)

Expand Down Expand Up @@ -578,7 +578,7 @@ func (mgr *equinixMetalManagerRest) createDeviceRequest(ctx context.Context, cr
// getNodes should return ProviderIDs for all nodes in the node group,
// used to find any nodes which are unregistered in kubernetes.
func (mgr *equinixMetalManagerRest) getNodes(nodegroup string) ([]string, error) {
// Get node ProviderIDs by getting device IDs from Packet
// Get node ProviderIDs by getting device IDs from the Equinix Metal API
devices, err := mgr.listMetalDevices(context.TODO())
if err != nil {
return nil, fmt.Errorf("failed to list devices: %w", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package packet
package equinixmetal

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package packet
package equinixmetal

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package packet
package equinixmetal

import (
"os"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package packet
package equinixmetal

import (
"math"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package packet
package equinixmetal

import (
"math"
Expand Down

0 comments on commit d9f1317

Please sign in to comment.