Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into helm-chart
Browse files Browse the repository at this point in the history
  • Loading branch information
nellyk committed Apr 18, 2024
2 parents 2697906 + 3b400bd commit a75e4ad
Show file tree
Hide file tree
Showing 46 changed files with 1,505 additions and 764 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ CONTROLLER_GEN_VER := v0.14.0
CONTROLLER_GEN_BIN := controller-gen
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER)

CONVERSION_GEN_VER := v0.28.0
CONVERSION_GEN_VER := v0.29.2
CONVERSION_GEN_BIN := conversion-gen
CONVERSION_GEN := $(TOOLS_BIN_DIR)/$(CONVERSION_GEN_BIN)-$(CONVERSION_GEN_VER)

Expand All @@ -85,7 +85,7 @@ GOLANGCI_LINT_VER := v1.55.2
GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)

KUSTOMIZE_VER := v4.5.2
KUSTOMIZE_VER := v5.4.1
KUSTOMIZE_BIN := kustomize
KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER)

Expand Down Expand Up @@ -113,7 +113,7 @@ KUBECTL_VER := v1.28.4
KUBECTL_BIN := kubectl
KUBECTL := $(TOOLS_BIN_DIR)/$(KUBECTL_BIN)-$(KUBECTL_VER)

HELM_VER := v3.12.2
HELM_VER := v3.14.4
HELM_BIN := helm
HELM := $(TOOLS_BIN_DIR)/$(HELM_BIN)-$(HELM_VER)

Expand Down Expand Up @@ -300,7 +300,7 @@ create-management-cluster: $(KUSTOMIZE) $(ENVSUBST) $(KUBECTL) $(KIND) ## Create
./hack/create-custom-cloud-provider-config.sh

# Deploy CAPI
timeout --foreground 300 bash -c "until curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.6.3/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -; do sleep 5; done"
timeout --foreground 300 bash -c "until curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.7.0/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -; do sleep 5; done"

# Deploy CAAPH
timeout --foreground 300 bash -c "until curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api-addon-provider-helm/releases/download/v0.1.0-alpha.10/addon-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -; do sleep 5; done"
Expand Down Expand Up @@ -755,7 +755,7 @@ $(GOLANGCI_LINT): ## Build golangci-lint from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) github.com/golangci/golangci-lint/cmd/golangci-lint $(GOLANGCI_LINT_BIN) $(GOLANGCI_LINT_VER)

$(KUSTOMIZE): ## Build kustomize from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) sigs.k8s.io/kustomize/kustomize/v4 $(KUSTOMIZE_BIN) $(KUSTOMIZE_VER)
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) sigs.k8s.io/kustomize/kustomize/v5 $(KUSTOMIZE_BIN) $(KUSTOMIZE_VER)

$(MOCKGEN): ## Build mockgen from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) go.uber.org/mock/mockgen $(MOCKGEN_BIN) $(MOCKGEN_VER)
Expand Down
2 changes: 1 addition & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ settings = {
"deploy_cert_manager": True,
"preload_images_for_kind": True,
"kind_cluster_name": "capz",
"capi_version": "v1.6.3",
"capi_version": "v1.7.0",
"cert_manager_version": "v1.14.4",
"kubernetes_version": "v1.28.3",
"aks_kubernetes_version": "v1.28.3",
Expand Down
35 changes: 17 additions & 18 deletions api/v1beta1/azuremanagedcluster_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ import (
)

func TestAzureManagedCluster_ValidateUpdate(t *testing.T) {
// NOTE: AzureManagedCluster is behind AKS feature gate flag; the webhook
// must prevent creating new objects in case the feature flag is disabled.
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, true)()

tests := []struct {
name string
oldAMC *AzureManagedCluster
Expand Down Expand Up @@ -95,10 +91,6 @@ func TestAzureManagedCluster_ValidateUpdate(t *testing.T) {
}

func TestAzureManagedCluster_ValidateCreate(t *testing.T) {
// NOTE: AzureManagedCluster is behind AKS feature gate flag; the webhook
// must prevent creating new objects in case the feature flag is disabled.
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, true)()

tests := []struct {
name string
oldAMC *AzureManagedCluster
Expand Down Expand Up @@ -143,27 +135,34 @@ func TestAzureManagedCluster_ValidateCreate(t *testing.T) {

func TestAzureManagedCluster_ValidateCreateFailure(t *testing.T) {
tests := []struct {
name string
amc *AzureManagedCluster
deferFunc func()
name string
amc *AzureManagedCluster
deferFunc func()
expectError bool
}{
{
name: "feature gate explicitly disabled",
amc: getKnownValidAzureManagedCluster(),
deferFunc: utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, false),
name: "feature gate explicitly disabled",
amc: getKnownValidAzureManagedCluster(),
deferFunc: utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, false),
expectError: true,
},
{
name: "feature gate implicitly disabled",
amc: getKnownValidAzureManagedCluster(),
deferFunc: func() {},
name: "feature gate implicitly enabled",
amc: getKnownValidAzureManagedCluster(),
deferFunc: func() {},
expectError: false,
},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
defer tc.deferFunc()
g := NewWithT(t)
_, err := tc.amc.ValidateCreate()
g.Expect(err).To(HaveOccurred())
if tc.expectError {
g.Expect(err).To(HaveOccurred())
} else {
g.Expect(err).NotTo(HaveOccurred())
}
})
}
}
Expand Down
35 changes: 17 additions & 18 deletions api/v1beta1/azuremanagedcontrolplane_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,6 @@ func TestValidateAutoScalerProfile(t *testing.T) {
}

func TestValidatingWebhook(t *testing.T) {
// NOTE: AzureManageControlPlane is behind AKS feature gate flag; the webhook
// must prevent creating new objects in case the feature flag is disabled.
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, true)()
tests := []struct {
name string
amcp AzureManagedControlPlane
Expand Down Expand Up @@ -1379,10 +1376,6 @@ func TestValidatingWebhook(t *testing.T) {
}

func TestAzureManagedControlPlane_ValidateCreate(t *testing.T) {
// NOTE: AzureManageControlPlane is behind AKS feature gate flag; the webhook
// must prevent creating new objects in case the feature flag is disabled.
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, true)()

tests := []struct {
name string
amcp *AzureManagedControlPlane
Expand Down Expand Up @@ -1637,19 +1630,22 @@ func TestAzureManagedControlPlane_ValidateCreate(t *testing.T) {

func TestAzureManagedControlPlane_ValidateCreateFailure(t *testing.T) {
tests := []struct {
name string
amcp *AzureManagedControlPlane
deferFunc func()
name string
amcp *AzureManagedControlPlane
deferFunc func()
expectError bool
}{
{
name: "feature gate explicitly disabled",
amcp: getKnownValidAzureManagedControlPlane(),
deferFunc: utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, false),
name: "feature gate explicitly disabled",
amcp: getKnownValidAzureManagedControlPlane(),
deferFunc: utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, false),
expectError: true,
},
{
name: "feature gate implicitly disabled",
amcp: getKnownValidAzureManagedControlPlane(),
deferFunc: func() {},
name: "feature gate implicitly enabled",
amcp: getKnownValidAzureManagedControlPlane(),
deferFunc: func() {},
expectError: false,
},
}
client := mockClient{ReturnError: false}
Expand All @@ -1661,7 +1657,11 @@ func TestAzureManagedControlPlane_ValidateCreateFailure(t *testing.T) {
Client: client,
}
_, err := mcpw.ValidateCreate(context.Background(), tc.amcp)
g.Expect(err).To(HaveOccurred())
if tc.expectError {
g.Expect(err).To(HaveOccurred())
} else {
g.Expect(err).NotTo(HaveOccurred())
}
})
}
}
Expand Down Expand Up @@ -3219,7 +3219,6 @@ func getAMCPMetaData() metav1.ObjectMeta {
}

func TestAzureManagedClusterSecurityProfileValidateCreate(t *testing.T) {
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, true)()
testsCreate := []struct {
name string
amcp *AzureManagedControlPlane
Expand Down
30 changes: 17 additions & 13 deletions api/v1beta1/azuremanagedmachinepool_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,6 @@ func TestAzureManagedMachinePoolUpdatingWebhook(t *testing.T) {
}

func TestAzureManagedMachinePool_ValidateCreate(t *testing.T) {
// NOTE: AzureManagedMachinePool is behind AKS feature gate flag; the webhook
// must prevent creating new objects in case the feature flag is disabled.
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, true)()
tests := []struct {
name string
ammp *AzureManagedMachinePool
Expand Down Expand Up @@ -1310,19 +1307,22 @@ func TestAzureManagedMachinePool_ValidateCreate(t *testing.T) {

func TestAzureManagedMachinePool_ValidateCreateFailure(t *testing.T) {
tests := []struct {
name string
ammp *AzureManagedMachinePool
deferFunc func()
name string
ammp *AzureManagedMachinePool
deferFunc func()
expectError bool
}{
{
name: "feature gate explicitly disabled",
ammp: getKnownValidAzureManagedMachinePool(),
deferFunc: utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, false),
name: "feature gate explicitly disabled",
ammp: getKnownValidAzureManagedMachinePool(),
deferFunc: utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, false),
expectError: true,
},
{
name: "feature gate implicitly disabled",
ammp: getKnownValidAzureManagedMachinePool(),
deferFunc: func() {},
name: "feature gate implicitly enabled",
ammp: getKnownValidAzureManagedMachinePool(),
deferFunc: func() {},
expectError: false,
},
}
for _, tc := range tests {
Expand All @@ -1331,7 +1331,11 @@ func TestAzureManagedMachinePool_ValidateCreateFailure(t *testing.T) {
g := NewWithT(t)
mw := &azureManagedMachinePoolWebhook{}
_, err := mw.ValidateCreate(context.Background(), tc.ammp)
g.Expect(err).To(HaveOccurred())
if tc.expectError {
g.Expect(err).To(HaveOccurred())
} else {
g.Expect(err).NotTo(HaveOccurred())
}
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion charts/azure-managed-cluster/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/).
version: 0.2.0
version: 0.2.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
14 changes: 7 additions & 7 deletions charts/azure-managed-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ agentpools:
nodecount: 5
osDiskSizeGB: 100
additionalTags:
- key: test
value: test
# To enable availability zones, uncomment the following lines and set the availability zones
# availabilityZones:
# - "1"
# - "2"
# - "3"
- key: department
value: finance
# To enable availability zones, uncomment the following lines and set the availability zones
# availabilityZones:
# - "1"
# - "2"
# - "3"
nodeLabels:
- key: test
value: test
Expand Down
23 changes: 11 additions & 12 deletions config/aso/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@ resources:
- crds.yaml
- settings.yaml

patchesStrategicMerge:
- patches/visualizer_label_in_bastionhosts.yaml
- patches/visualizer_label_in_extensions.yaml
- patches/visualizer_label_in_fleetmembers.yaml
- patches/visualizer_label_in_managedclusteragentpools.yaml
- patches/visualizer_label_in_managed_clusters.yaml
- patches/visualizer_label_in_natgateways.yaml
- patches/visualizer_label_in_privateendpoints.yaml
- patches/visualizer_label_in_resourcegroups.yaml
- patches/visualizer_label_in_subnets.yaml
- patches/visualizer_label_in_virtualnetworks.yaml

patches:
- path: patches/visualizer_label_in_bastionhosts.yaml
- path: patches/visualizer_label_in_extensions.yaml
- path: patches/visualizer_label_in_fleetmembers.yaml
- path: patches/visualizer_label_in_managedclusteragentpools.yaml
- path: patches/visualizer_label_in_managed_clusters.yaml
- path: patches/visualizer_label_in_natgateways.yaml
- path: patches/visualizer_label_in_privateendpoints.yaml
- path: patches/visualizer_label_in_resourcegroups.yaml
- path: patches/visualizer_label_in_subnets.yaml
- path: patches/visualizer_label_in_virtualnetworks.yaml
- patch: |- # default kustomization includes a namespace already
$patch: delete
apiVersion: v1
Expand Down Expand Up @@ -48,6 +46,7 @@ replacements:
targets:
- select:
version: v1
annotationSelector: cert-manager.io/inject-ca-from
fieldPaths:
- metadata.annotations.cert-manager\.io/inject-ca-from
options:
Expand Down
Loading

0 comments on commit a75e4ad

Please sign in to comment.