Skip to content

Commit

Permalink
fix: clean up AB linting errors (#3885)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlisonB319 authored Nov 30, 2023
1 parent 06561fd commit 1f84772
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 74 deletions.
1 change: 1 addition & 0 deletions pkg/agent/bakerapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func NewAgentBaker() (AgentBaker, error) {

type agentBakerImpl struct{}

//nolint:revive, nolintlint // ctx is not used, but may be in the future
func (agentBaker *agentBakerImpl) GetNodeBootstrapping(ctx context.Context,
config *datamodel.NodeBootstrappingConfiguration) (*datamodel.NodeBootstrapping, error) {
// validate and fix input before passing config to the template generator.
Expand Down
71 changes: 0 additions & 71 deletions pkg/agent/datamodel/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,77 +3,6 @@

package datamodel

import (
"github.com/Azure/go-autorest/autorest/to"
"github.com/google/uuid"
)

// CreateMockContainerService returns a mock container service for testing purposes.
func CreateMockContainerService(containerServiceName, orchestratorVersion string, masterCount, agentCount int, certs bool) *ContainerService {
cs := ContainerService{}
cs.ID = uuid.Must(uuid.NewRandom()).String()
cs.Location = "eastus"
cs.Name = containerServiceName

cs.Properties = &Properties{}

cs.Properties.AgentPoolProfiles = []*AgentPoolProfile{}
agentPool := &AgentPoolProfile{}
agentPool.Name = "agentpool1"
agentPool.VMSize = "Standard_D2_v2"
agentPool.AvailabilityProfile = "AvailabilitySet"
agentPool.StorageProfile = "StorageAccount"

cs.Properties.AgentPoolProfiles = append(cs.Properties.AgentPoolProfiles, agentPool)

cs.Properties.LinuxProfile = &LinuxProfile{
AdminUsername: "azureuser",
SSH: struct {
PublicKeys []PublicKey `json:"publicKeys"`
}{},
}

cs.Properties.LinuxProfile.AdminUsername = "azureuser"
cs.Properties.LinuxProfile.SSH.PublicKeys = append(
cs.Properties.LinuxProfile.SSH.PublicKeys, PublicKey{KeyData: "test"})

cs.Properties.ServicePrincipalProfile = &ServicePrincipalProfile{}
cs.Properties.ServicePrincipalProfile.ClientID = "DEC923E3-1EF1-4745-9516-37906D56DEC4"
cs.Properties.ServicePrincipalProfile.Secret = "DEC923E3-1EF1-4745-9516-37906D56DEC4"

cs.Properties.OrchestratorProfile = &OrchestratorProfile{}
cs.Properties.OrchestratorProfile.OrchestratorType = Kubernetes
cs.Properties.OrchestratorProfile.OrchestratorVersion = orchestratorVersion
const gcLowThreshold = 80
const gcHighThreshold = 85
const maxPods = 30
cs.Properties.OrchestratorProfile.KubernetesConfig = &KubernetesConfig{
EnableSecureKubelet: to.BoolPtr(true),
EnableRbac: to.BoolPtr(true),
DockerBridgeSubnet: "172.17.0.1/16",
GCLowThreshold: gcLowThreshold,
GCHighThreshold: gcHighThreshold,
MaxPods: maxPods,
ClusterSubnet: "10.240.0.0/12",
ContainerRuntime: Docker,
NetworkPlugin: "kubenet",
LoadBalancerSku: "Basic",
ControllerManagerConfig: make(map[string]string),
}

cs.Properties.CertificateProfile = &CertificateProfile{}
if certs {
cs.Properties.CertificateProfile.CaCertificate = "cacert"
cs.Properties.CertificateProfile.KubeConfigCertificate = "kubeconfigcert"
cs.Properties.CertificateProfile.KubeConfigPrivateKey = "kubeconfigkey"
cs.Properties.CertificateProfile.APIServerCertificate = "apiservercert"
cs.Properties.CertificateProfile.ClientCertificate = "clientcert"
cs.Properties.CertificateProfile.ClientPrivateKey = "clientkey"
}

return &cs
}

// GetK8sDefaultProperties returns a struct of type Properties for testing purposes.
func GetK8sDefaultProperties(hasWindows bool) *Properties {
p := &Properties{
Expand Down
6 changes: 3 additions & 3 deletions pkg/vhdbuilder/datamodel/component_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type DockerKubeProxyImages struct {
ContainerImages []*ContainerImage `json:"ContainerImages"`
}

func loadJsonFromFile(path string, v interface{}) error {
func loadJSONFromFile(path string, v interface{}) error {
configFile, err := os.Open(path)
if err != nil {
return err
Expand Down Expand Up @@ -71,7 +71,7 @@ func toImageList(downloadURL string, imageTagList []string) ([]string, error) {
func NewComponentsFromFile(path string) (*Components, error) {
ret := &Components{}

err := loadJsonFromFile(path, ret)
err := loadJSONFromFile(path, ret)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -115,7 +115,7 @@ The given file should be in JSON format.
func NewKubeProxyImagesFromFile(path string) (*KubeProxyImages, error) {
ret := &KubeProxyImages{}

err := loadJsonFromFile(path, ret)
err := loadJSONFromFile(path, ret)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 1f84772

Please sign in to comment.