-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split util package to reduce dependencies of premain
- Loading branch information
Showing
9 changed files
with
96 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) Edgeless Systems GmbH. | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
package k8sutil | ||
|
||
import corev1 "k8s.io/api/core/v1" | ||
|
||
const ( | ||
IntelEpc corev1.ResourceName = "sgx.intel.com/epc" | ||
IntelEnclave corev1.ResourceName = "sgx.intel.com/enclave" | ||
IntelProvision corev1.ResourceName = "sgx.intel.com/provision" | ||
AzureEpc corev1.ResourceName = "kubernetes.azure.com/sgx_epc_mem_in_MiB" | ||
AlibabaEpc corev1.ResourceName = "alibabacloud.com/sgx_epc_MiB" | ||
) | ||
|
||
// GetEPCResourceLimit returns the amount of EPC to set for k8s deployments depending on the used sgx device plugin. | ||
func GetEPCResourceLimit(resourceKey string) string { | ||
switch resourceKey { | ||
case AzureEpc.String(): | ||
// azure device plugin expects epc in MiB | ||
return "10" | ||
case AlibabaEpc.String(): | ||
// alibaba device plugin expects epc in MiB | ||
return "10" | ||
case IntelEpc.String(): | ||
// intels device plugin expects epc as a k8s resource quantity | ||
return "10Mi" | ||
default: | ||
return "10" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters