Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clean up AB linting errors #3885

Merged
merged 3 commits into from
Nov 30, 2023
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
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 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're sure we don't have any further usage of this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep there are no other calls to it in the repo

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