зеркало из https://github.com/Azure/aks-engine.git
Merge pull request #1005 from colemickens/colemickens-custom-hyperkube
feat(custom hyperkube): support customHyperkubeImage in kubernetesConfig
This commit is contained in:
Коммит
add7a95daf
|
@ -4,7 +4,8 @@
|
|||
"orchestratorProfile": {
|
||||
"orchestratorType": "Kubernetes",
|
||||
"kubernetesConfig": {
|
||||
"useManagedIdentity": true
|
||||
"useManagedIdentity": true,
|
||||
"customHyperkubeImage": "docker.io/colemickens/hyperkube-amd64:3b15e8a446fa09d68a2056e2a5e650c90ae849ed"
|
||||
}
|
||||
},
|
||||
"masterProfile": {
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
CLUSTER_SERVICE_PRINCIPAL_CLIENT_ID=msi
|
||||
CLUSTER_SERVICE_PRINCIPAL_CLIENT_SECRET=msi
|
||||
|
||||
CUSTOM_HYPERKUBE_SPEC=docker.io/colemickens/hyperkube-amd64:531664519485fdbb543e1e83c90bac6fef829d73
|
||||
|
||||
EXPECTED_NODE_COUNT=5
|
|
@ -381,6 +381,12 @@ func getParameters(cs *api.ContainerService, isClassicMode bool) (map[string]int
|
|||
// Kubernetes Parameters
|
||||
if properties.OrchestratorProfile.OrchestratorType == api.Kubernetes {
|
||||
KubernetesVersion := properties.OrchestratorProfile.OrchestratorVersion
|
||||
|
||||
kubernetesHyperkubeSpec := properties.OrchestratorProfile.KubernetesConfig.KubernetesImageBase + KubeImages[KubernetesVersion]["hyperkube"]
|
||||
if properties.OrchestratorProfile.KubernetesConfig.CustomHyperkubeImage != "" {
|
||||
kubernetesHyperkubeSpec = properties.OrchestratorProfile.KubernetesConfig.CustomHyperkubeImage
|
||||
}
|
||||
|
||||
addSecret(parametersMap, "apiServerCertificate", properties.CertificateProfile.APIServerCertificate, true)
|
||||
addSecret(parametersMap, "apiServerPrivateKey", properties.CertificateProfile.APIServerPrivateKey, true)
|
||||
addSecret(parametersMap, "caCertificate", properties.CertificateProfile.CaCertificate, true)
|
||||
|
@ -390,7 +396,7 @@ func getParameters(cs *api.ContainerService, isClassicMode bool) (map[string]int
|
|||
addSecret(parametersMap, "kubeConfigCertificate", properties.CertificateProfile.KubeConfigCertificate, true)
|
||||
addSecret(parametersMap, "kubeConfigPrivateKey", properties.CertificateProfile.KubeConfigPrivateKey, true)
|
||||
addValue(parametersMap, "dockerEngineDownloadRepo", cloudSpecConfig.DockerSpecConfig.DockerEngineRepo)
|
||||
addValue(parametersMap, "kubernetesHyperkubeSpec", properties.OrchestratorProfile.KubernetesConfig.KubernetesImageBase+KubeImages[KubernetesVersion]["hyperkube"])
|
||||
addValue(parametersMap, "kubernetesHyperkubeSpec", kubernetesHyperkubeSpec)
|
||||
addValue(parametersMap, "kubernetesAddonManagerSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+KubeImages[KubernetesVersion]["addonmanager"])
|
||||
addValue(parametersMap, "kubernetesAddonResizerSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+KubeImages[KubernetesVersion]["addonresizer"])
|
||||
addValue(parametersMap, "kubernetesDashboardSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+KubeImages[KubernetesVersion]["dashboard"])
|
||||
|
@ -811,6 +817,9 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) map[str
|
|||
switch attr {
|
||||
case "kubernetesHyperkubeSpec":
|
||||
val = cs.Properties.OrchestratorProfile.KubernetesConfig.KubernetesImageBase + KubeImages[kubernetesVersion]["hyperkube"]
|
||||
if cs.Properties.OrchestratorProfile.KubernetesConfig.CustomHyperkubeImage != "" {
|
||||
val = cs.Properties.OrchestratorProfile.KubernetesConfig.CustomHyperkubeImage
|
||||
}
|
||||
case "kubernetesAddonManagerSpec":
|
||||
val = cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase + KubeImages[kubernetesVersion]["addonmanager"]
|
||||
case "kubernetesAddonResizerSpec":
|
||||
|
|
|
@ -561,6 +561,7 @@ func convertKubernetesConfigToVLabs(api *KubernetesConfig, vlabs *vlabs.Kubernet
|
|||
vlabs.CloudProviderRateLimitBucket = api.CloudProviderRateLimitBucket
|
||||
vlabs.CloudProviderRateLimitQPS = api.CloudProviderRateLimitQPS
|
||||
vlabs.UseManagedIdentity = api.UseManagedIdentity
|
||||
vlabs.CustomHyperkubeImage = api.CustomHyperkubeImage
|
||||
}
|
||||
|
||||
func convertMasterProfileToV20160930(api *MasterProfile, v20160930 *v20160930.MasterProfile) {
|
||||
|
|
|
@ -580,6 +580,7 @@ func convertVLabsKubernetesConfig(vlabs *vlabs.KubernetesConfig, api *Kubernetes
|
|||
api.CloudProviderRateLimitBucket = vlabs.CloudProviderRateLimitBucket
|
||||
api.CloudProviderRateLimitQPS = vlabs.CloudProviderRateLimitQPS
|
||||
api.UseManagedIdentity = vlabs.UseManagedIdentity
|
||||
api.CustomHyperkubeImage = vlabs.CustomHyperkubeImage
|
||||
}
|
||||
|
||||
func convertV20160930MasterProfile(v20160930 *v20160930.MasterProfile, api *MasterProfile) {
|
||||
|
|
|
@ -146,6 +146,7 @@ type KubernetesConfig struct {
|
|||
CloudProviderRateLimitQPS float64 `json:"cloudProviderRateLimitQPS,omitempty"`
|
||||
CloudProviderRateLimitBucket int `json:"cloudProviderRateLimitBucket,omitempty"`
|
||||
UseManagedIdentity bool `json:"useManagedIdentity,omitempty"`
|
||||
CustomHyperkubeImage string `json:"customHyperkubeImage,omitempty"`
|
||||
}
|
||||
|
||||
// MasterProfile represents the definition of the master cluster
|
||||
|
|
|
@ -1,9 +1,31 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"log"
|
||||
"testing"
|
||||
)
|
||||
|
||||
const exampleCustomHyperkubeImage = `example.azurecr.io/example/hyperkube-amd64:custom`
|
||||
|
||||
const exampleAPIModel = `{
|
||||
"apiVersion": "vlabs",
|
||||
"properties": {
|
||||
"orchestratorProfile": {
|
||||
"orchestratorType": "Kubernetes",
|
||||
"kubernetesConfig": {
|
||||
"customHyperkubeImage": "` + exampleCustomHyperkubeImage + `"
|
||||
}
|
||||
},
|
||||
"masterProfile": { "count": 1, "dnsPrefix": "", "vmSize": "Standard_D2_v2" },
|
||||
"agentPoolProfiles": [ { "name": "linuxpool1", "count": 2, "vmSize": "Standard_D2_v2", "availabilityProfile": "AvailabilitySet" } ],
|
||||
"windowsProfile": { "adminUsername": "azureuser", "adminPassword": "replacepassword1234$" },
|
||||
"linuxProfile": { "adminUsername": "azureuser", "ssh": { "publicKeys": [ { "keyData": "" } ] }
|
||||
},
|
||||
"servicePrincipalProfile": { "servicePrincipalClientID": "", "servicePrincipalClientSecret": "" }
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
func TestIsDCOS(t *testing.T) {
|
||||
dCOSProfile := &OrchestratorProfile{
|
||||
OrchestratorType: "DCOS",
|
||||
|
@ -20,3 +42,16 @@ func TestIsDCOS(t *testing.T) {
|
|||
t.Fatalf("unexpectedly detected DCOS orchestrator profile from OrchestratorType=%s", kubernetesProfile.OrchestratorType)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCustomHyperkubeImageField(t *testing.T) {
|
||||
log.Println(exampleAPIModel)
|
||||
apimodel, _, err := DeserializeContainerService([]byte(exampleAPIModel), false)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpectedly error deserializing the example apimodel: %s", err)
|
||||
}
|
||||
|
||||
actualCustomHyperkubeImage := apimodel.Properties.OrchestratorProfile.KubernetesConfig.CustomHyperkubeImage
|
||||
if actualCustomHyperkubeImage != exampleCustomHyperkubeImage {
|
||||
t.Fatalf("kubernetesConfig->customHyperkubeImage field value was unexpected: got(%s), expected(%s)", actualCustomHyperkubeImage, exampleCustomHyperkubeImage)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,6 +150,7 @@ type KubernetesConfig struct {
|
|||
CloudProviderRateLimitQPS float64 `json:"cloudProviderRateLimitQPS,omitempty"`
|
||||
CloudProviderRateLimitBucket int `json:"cloudProviderRateLimitBucket,omitempty"`
|
||||
UseManagedIdentity bool `json:"useManagedIdentity,omitempty"`
|
||||
CustomHyperkubeImage string `json:"customHyperkubeImage,omitempty"`
|
||||
}
|
||||
|
||||
// MasterProfile represents the definition of the master cluster
|
||||
|
|
Загрузка…
Ссылка в новой задаче