Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/dot-github/actions…
Browse files Browse the repository at this point in the history
…/install-deps/action-deps-138f444b14
  • Loading branch information
tallaxes authored Dec 17, 2024
2 parents 7ac74cc + 6041dd1 commit f613be7
Show file tree
Hide file tree
Showing 8 changed files with 40,106 additions and 29,233 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/install-deps
- run: make vulncheck
- uses: github/codeql-action/init@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
- uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
with:
languages: ${{ matrix.language }}
- uses: github/codeql-action/autobuild@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
- uses: github/codeql-action/analyze@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
- uses: github/codeql-action/autobuild@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
- uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion hack/codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ skugen() {
NO_UPDATE=" pkg/fake/zz_generated.sku.$location.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)"
SUBJECT="SKUGEN"

go run hack/code/instancetype_testdata_gen/main.go -- "${GENERATED_FILE}" "$location" "Standard_B1s,Standard_A0,Standard_D2_v2,Standard_D2_v3,Standard_DS2_v2,Standard_D2s_v3,Standard_D2_v5,Standard_D16plds_v5,Standard_F16s_v2,Standard_NC6s,Standard_NC6s_v3,Standard_NC16as_T4_v3,Standard_NC24ads_A100_v4,Standard_M8-2ms,Standard_D4s_v3,Standard_D64s_v3,Standard_DC8s_v3"
go run hack/code/instancetype_testdata_gen/main.go -- "${GENERATED_FILE}" "$location" "Standard_B1s,Standard_A0,Standard_D2_v2,Standard_D2_v3,Standard_DS2_v2,Standard_D2s_v3,Standard_D2_v5,Standard_D16plds_v5,Standard_F16s_v2,Standard_NC6s,Standard_NC6s_v3,Standard_NC16as_T4_v3,Standard_NC24ads_A100_v4,Standard_M8-2ms,Standard_D4s_v3,Standard_D64s_v3,Standard_DC8s_v3,Standard_D2as_v6"
go fmt "${GENERATED_FILE}"

GIT_DIFF=$(git diff --stat "${GENERATED_FILE}")
Expand Down
150 changes: 112 additions & 38 deletions pkg/fake/zz_generated.sku.eastus.go

Large diffs are not rendered by default.

134 changes: 116 additions & 18 deletions pkg/fake/zz_generated.sku.westcentralus.go

Large diffs are not rendered by default.

21 changes: 18 additions & 3 deletions pkg/providers/instancetype/instancetypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
corev1 "k8s.io/api/core/v1"
karpv1 "sigs.k8s.io/karpenter/pkg/apis/v1"

"github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/karpenter-provider-azure/pkg/apis/v1alpha2"
kcache "github.com/Azure/karpenter-provider-azure/pkg/cache"
Expand Down Expand Up @@ -274,7 +275,8 @@ func (p *DefaultProvider) getInstanceTypes(ctx context.Context) (map[string]*ske
continue
}

if !skus[i].HasLocationRestriction(p.region) && p.isSupported(&skus[i], vmsize) {
useSIG := false // replace with options.FromContext(ctx).UseSIG when available
if !skus[i].HasLocationRestriction(p.region) && p.isSupported(&skus[i], vmsize, useSIG) {
instanceTypes[skus[i].GetName()] = &skus[i]
}
}
Expand All @@ -291,13 +293,14 @@ func (p *DefaultProvider) getInstanceTypes(ctx context.Context) (map[string]*ske
}

// isSupported indicates SKU is supported by AKS, based on SKU properties
func (p *DefaultProvider) isSupported(sku *skewer.SKU, vmsize *skewer.VMSizeType) bool {
func (p *DefaultProvider) isSupported(sku *skewer.SKU, vmsize *skewer.VMSizeType, useSIG bool) bool {
return p.hasMinimumCPU(sku) &&
p.hasMinimumMemory(sku) &&
!p.isUnsupportedByAKS(sku) &&
!p.isUnsupportedGPU(sku) &&
!p.hasConstrainedCPUs(vmsize) &&
!p.isConfidential(sku)
!p.isConfidential(sku) &&
isCompatibleImageAvailable(sku, useSIG)
}

// at least 2 cpus
Expand Down Expand Up @@ -406,3 +409,15 @@ var (
func hasZonalSupport(region string) bool {
return zonalRegions.Has(region)
}

func isCompatibleImageAvailable(sku *skewer.SKU, useSIG bool) bool {
hasSCSISupport := func(sku *skewer.SKU) bool { // TODO: move capability determination to skewer
const diskControllerTypeCapability = "DiskControllerTypes"
declaresSCSI := sku.HasCapabilityWithSeparator(diskControllerTypeCapability, string(compute.SCSI))
declaresNVMe := sku.HasCapabilityWithSeparator(diskControllerTypeCapability, string(compute.NVMe))
declaresNothing := !(declaresSCSI || declaresNVMe)
return declaresSCSI || declaresNothing // if nothing is declared, assume SCSI is supported
}

return useSIG || hasSCSISupport(sku) // CIG images are not currently tagged for NVMe
}
3 changes: 3 additions & 0 deletions pkg/providers/instancetype/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ var _ = Describe("InstanceType Provider", func() {
It("should not include confidential SKUs", func() {
Expect(instanceTypes).ShouldNot(ContainElement(WithTransform(getName, Equal("Standard_DC8s_v3"))))
})
It("should not include SKUs without compatible image", func() {
Expect(instanceTypes).ShouldNot(ContainElement(WithTransform(getName, Equal("Standard_D2as_v6"))))
})
})
Context("Filtering GPU SKUs ProviderList(AzureLinux)", func() {
var instanceTypes corecloudprovider.InstanceTypes
Expand Down
Loading

0 comments on commit f613be7

Please sign in to comment.