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

ci: use cloud controller manager in disconnected pipeline #165

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"kubernetesConfig": {
"useCloudControllerManager": true,
"useManagedIdentity": true,
"containerRuntime": "containerd",
"addons": [
{
"name": "azuredisk-csi-driver",
Expand Down
2 changes: 2 additions & 0 deletions examples/no_outbound.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"properties": {
"orchestratorProfile": {
"kubernetesConfig": {
"useCloudControllerManager": true,
"containerRuntime": "containerd",
"addons": [
{
"name": "azuredisk-csi-driver",
Expand Down
14 changes: 7 additions & 7 deletions pkg/api/addons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2102,7 +2102,7 @@ func TestSetAddonsConfig(t *testing.T) {
expectedAddons: concatenateDefaultAddons([]KubernetesAddon{
{
Name: common.AzureFileCSIDriverAddonName,
Enabled: to.BoolPtr(true),
Enabled: to.BoolPtr(false),
Containers: []KubernetesContainerSpec{
{
Name: common.CSIProvisionerContainerName,
Expand Down Expand Up @@ -2290,7 +2290,7 @@ func TestSetAddonsConfig(t *testing.T) {
expectedAddons: concatenateDefaultAddons([]KubernetesAddon{
{
Name: common.AzureFileCSIDriverAddonName,
Enabled: to.BoolPtr(true),
Enabled: to.BoolPtr(false),
Containers: []KubernetesContainerSpec{
{
Name: common.CSIProvisionerContainerName,
Expand Down Expand Up @@ -2528,7 +2528,7 @@ func TestSetAddonsConfig(t *testing.T) {
expectedAddons: concatenateDefaultAddons([]KubernetesAddon{
{
Name: common.AzureFileCSIDriverAddonName,
Enabled: to.BoolPtr(true),
Enabled: to.BoolPtr(false),
Containers: []KubernetesContainerSpec{
{
Name: common.CSIProvisionerContainerName,
Expand Down Expand Up @@ -2720,7 +2720,7 @@ func TestSetAddonsConfig(t *testing.T) {
expectedAddons: concatenateDefaultAddons([]KubernetesAddon{
{
Name: common.AzureFileCSIDriverAddonName,
Enabled: to.BoolPtr(true),
Enabled: to.BoolPtr(false),
Containers: []KubernetesContainerSpec{
{
Name: common.CSIProvisionerContainerName,
Expand Down Expand Up @@ -2926,7 +2926,7 @@ func TestSetAddonsConfig(t *testing.T) {
expectedAddons: concatenateDefaultAddons([]KubernetesAddon{
{
Name: common.AzureFileCSIDriverAddonName,
Enabled: to.BoolPtr(true),
Enabled: to.BoolPtr(false),
Containers: []KubernetesContainerSpec{
{
Name: common.CSIProvisionerContainerName,
Expand Down Expand Up @@ -3137,7 +3137,7 @@ func TestSetAddonsConfig(t *testing.T) {
expectedAddons: concatenateDefaultAddons([]KubernetesAddon{
{
Name: common.AzureFileCSIDriverAddonName,
Enabled: to.BoolPtr(true),
Enabled: to.BoolPtr(false),
Containers: []KubernetesContainerSpec{
{
Name: common.CSIProvisionerContainerName,
Expand Down Expand Up @@ -3343,7 +3343,7 @@ func TestSetAddonsConfig(t *testing.T) {
expectedAddons: concatenateDefaultAddons([]KubernetesAddon{
{
Name: common.AzureFileCSIDriverAddonName,
Enabled: to.BoolPtr(true),
Enabled: to.BoolPtr(false),
Containers: []KubernetesContainerSpec{
{
Name: common.CSIProvisionerContainerName,
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const (
// DefaultAzureDiskCSIDriverAddonEnabled determines the aks-engine provided default for enabling Azure Disk CSI Driver
DefaultAzureDiskCSIDriverAddonEnabled = true
// DefaultAzureFileCSIDriverAddonEnabled determines the aks-engine provided default for enabling Azure File CSI Driver
DefaultAzureFileCSIDriverAddonEnabled = true
DefaultAzureFileCSIDriverAddonEnabled = false
// DefaultClusterAutoscalerAddonEnabled determines the aks-engine provided default for enabling cluster autoscaler addon
DefaultClusterAutoscalerAddonEnabled = false
// DefaultBlobfuseFlexVolumeAddonEnabled determines the aks-engine provided default for enabling blobfuse flexvolume addon
Expand Down
16 changes: 16 additions & 0 deletions pkg/engine/networksecuritygroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,24 @@ func CreateNetworkSecurityGroup(cs *api.ContainerService) NetworkSecurityGroupAR
},
}

allowARMRule := network.SecurityRule{
Name: to.StringPtr("allow_ARM"),
SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{
Access: network.SecurityRuleAccessAllow,
Description: to.StringPtr("Allow outbound internet to ARM"),
DestinationAddressPrefix: to.StringPtr("AzureResourceManager"),
DestinationPortRange: to.StringPtr("443"),
Direction: network.SecurityRuleDirectionOutbound,
Priority: to.Int32Ptr(100),
Protocol: network.SecurityRuleProtocolTCP,
SourceAddressPrefix: to.StringPtr("*"),
SourcePortRange: to.StringPtr("*"),
},
}

securityRules = append(securityRules, vnetRule)
securityRules = append(securityRules, blockOutBoundRule)
securityRules = append(securityRules, allowARMRule)
}

nsg := network.SecurityGroup{
Expand Down
17 changes: 16 additions & 1 deletion pkg/engine/networksecuritygroups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,22 @@ func TestCreateNetworkSecurityGroup(t *testing.T) {
},
}

rules = append(rules, rdpRule, vnetRule, blockOutBoundRule)
allowARMRule := network.SecurityRule{
Name: to.StringPtr("allow_ARM"),
SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{
Access: network.SecurityRuleAccessAllow,
Description: to.StringPtr("Allow outbound internet to ARM"),
DestinationAddressPrefix: to.StringPtr("AzureResourceManager"),
DestinationPortRange: to.StringPtr("443"),
Direction: network.SecurityRuleDirectionOutbound,
Priority: to.Int32Ptr(100),
Protocol: network.SecurityRuleProtocolTCP,
SourceAddressPrefix: to.StringPtr("*"),
SourcePortRange: to.StringPtr("*"),
},
}

rules = append(rules, rdpRule, vnetRule, blockOutBoundRule, allowARMRule)

expected.SecurityRules = &rules

Expand Down
23 changes: 10 additions & 13 deletions test/e2e/kubernetes/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1429,12 +1429,6 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu
azureDiskProvisioner = "kubernetes.io/azure-disk"
}

if isUsingAzureFileCSIDriver, _ = eng.HasAddon(common.AzureFileCSIDriverAddonName); isUsingAzureFileCSIDriver {
azureFileProvisioner = "file.csi.azure.com"
} else {
azureFileProvisioner = "kubernetes.io/azure-file"
}

azureDiskStorageClasses := []string{"default"}
// Managed disk is used by default when useCloudControllerManager is enabled
if to.Bool(eng.ExpandedDefinition.Properties.OrchestratorProfile.KubernetesConfig.UseCloudControllerManager) || util.IsUsingManagedDisks(eng.ExpandedDefinition.Properties.AgentPoolProfiles) {
Expand Down Expand Up @@ -1462,13 +1456,16 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu
}
}

for _, azureFileStorageClass := range []string{"azurefile"} {
sc, err := storageclass.Get(azureFileStorageClass)
Expect(err).NotTo(HaveOccurred())
Expect(sc.Provisioner).To(Equal(azureFileProvisioner))
Expect(sc.VolumeBindingMode).To(Equal("Immediate"))
if isUsingAzureFileCSIDriver && common.IsKubernetesVersionGe(eng.ExpandedDefinition.Properties.OrchestratorProfile.OrchestratorVersion, "1.16.0") {
Expect(sc.AllowVolumeExpansion).To(BeTrue())
if isUsingAzureFileCSIDriver, _ = eng.HasAddon(common.AzureFileCSIDriverAddonName); isUsingAzureFileCSIDriver {
azureFileProvisioner = "file.csi.azure.com"
for _, azureFileStorageClass := range []string{"azurefile"} {
sc, err := storageclass.Get(azureFileStorageClass)
Expect(err).NotTo(HaveOccurred())
Expect(sc.Provisioner).To(Equal(azureFileProvisioner))
Expect(sc.VolumeBindingMode).To(Equal("Immediate"))
if common.IsKubernetesVersionGe(eng.ExpandedDefinition.Properties.OrchestratorProfile.OrchestratorVersion, "1.16.0") {
Expect(sc.AllowVolumeExpansion).To(BeTrue())
}
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/kubernetes/workloads/pod-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
kubernetes.io/os: linux
containers:
- name: myfrontend
image: nginx
image: mcr.microsoft.com/mirror/docker/library/nginx:1.23
volumeMounts:
- mountPath: "/mnt/azure"
name: volume
Expand Down
11 changes: 11 additions & 0 deletions vhd/packer/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,17 @@ for CLUSTER_PROPORTIONAL_AUTOSCALER_VERSION in ${CLUSTER_PROPORTIONAL_AUTOSCALER
echo " - ${CONTAINER_IMAGE}" >> ${VHD_LOGS_FILEPATH}
done

# for testing pipeline
NGINX_VERSIONS="
1.23
"

for NGINX_VERSION in ${NGINX_VERSIONS}; do
CONTAINER_IMAGE="mcr.microsoft.com/mirror/docker/library/nginx:${NGINX_VERSION}"
loadContainerImage ${CONTAINER_IMAGE}
echo " - ${CONTAINER_IMAGE}" >> ${VHD_LOGS_FILEPATH}
done

df -h

# warn at 75% space taken
Expand Down