Skip to content

Commit 400e248

Browse files
committed
env var
1 parent 8700fa1 commit 400e248

File tree

13 files changed

+80
-13
lines changed

13 files changed

+80
-13
lines changed

cmd/appgw-ingress/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func main() {
215215
klog.Fatal(errorLine)
216216
}
217217

218-
if err := cni.ReconcileCNI(context.Background(), azClient, ctrlClient, env.AGICPodNamespace, cpConfig, appGw); err != nil {
218+
if err := cni.ReconcileCNI(context.Background(), azClient, ctrlClient, env.AGICPodNamespace, cpConfig, appGw, env.AddonMode); err != nil {
219219
if agicPod != nil {
220220
recorder.Event(agicPod, v1.EventTypeWarning, events.ReasonFailedCNIConfiguration, err.Error())
221221
}

helm/ingress-azure/templates/cleanup-job.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ spec:
3131
- "--wait"
3232
- "-n"
3333
- "$(AGIC_POD_NAMESPACE)"
34-
- "overlayextensionconfigs.acn.azure.com/agic-overlay-extension-config"
34+
- "overlayextensionconfigs.acn.azure.com"
35+
- "-l"
36+
{{- if .Values.addon }}
37+
- "app.kubernetes.io/managed-by=ingress-azure-addon"
38+
{{- else }}
39+
- "app.kubernetes.io/managed-by=ingress-azure-helm"
40+
{{- end }}
3541
securityContext:
3642
capabilities:
3743
drop:

helm/ingress-azure/tests/snapshots/sample-config-empty/ingress-azure/templates/cleanup-job.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ spec:
3333
- "--wait"
3434
- "-n"
3535
- "$(AGIC_POD_NAMESPACE)"
36-
- "overlayextensionconfigs.acn.azure.com/agic-overlay-extension-config"
36+
- "overlayextensionconfigs.acn.azure.com"
37+
- "-l"
38+
- "app.kubernetes.io/managed-by=ingress-azure-helm"
3739
securityContext:
3840
capabilities:
3941
drop:

helm/ingress-azure/tests/snapshots/sample-config-existing-secret/ingress-azure/templates/cleanup-job.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ spec:
3333
- "--wait"
3434
- "-n"
3535
- "$(AGIC_POD_NAMESPACE)"
36-
- "overlayextensionconfigs.acn.azure.com/agic-overlay-extension-config"
36+
- "overlayextensionconfigs.acn.azure.com"
37+
- "-l"
38+
- "app.kubernetes.io/managed-by=ingress-azure-helm"
3739
securityContext:
3840
capabilities:
3941
drop:

helm/ingress-azure/tests/snapshots/sample-config-prohibited-target/ingress-azure/templates/cleanup-job.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ spec:
3333
- "--wait"
3434
- "-n"
3535
- "$(AGIC_POD_NAMESPACE)"
36-
- "overlayextensionconfigs.acn.azure.com/agic-overlay-extension-config"
36+
- "overlayextensionconfigs.acn.azure.com"
37+
- "-l"
38+
- "app.kubernetes.io/managed-by=ingress-azure-helm"
3739
securityContext:
3840
capabilities:
3941
drop:

helm/ingress-azure/tests/snapshots/sample-config-workload-identity/ingress-azure/templates/cleanup-job.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ spec:
3333
- "--wait"
3434
- "-n"
3535
- "$(AGIC_POD_NAMESPACE)"
36-
- "overlayextensionconfigs.acn.azure.com/agic-overlay-extension-config"
36+
- "overlayextensionconfigs.acn.azure.com"
37+
- "-l"
38+
- "app.kubernetes.io/managed-by=ingress-azure-helm"
3739
securityContext:
3840
capabilities:
3941
drop:

helm/ingress-azure/tests/snapshots/sample-config/ingress-azure/templates/cleanup-job.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ spec:
3333
- "--wait"
3434
- "-n"
3535
- "$(AGIC_POD_NAMESPACE)"
36-
- "overlayextensionconfigs.acn.azure.com/agic-overlay-extension-config"
36+
- "overlayextensionconfigs.acn.azure.com"
37+
- "-l"
38+
- "app.kubernetes.io/managed-by=ingress-azure-helm"
3739
securityContext:
3840
capabilities:
3941
drop:

helm/ingress-azure/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,7 @@ nodeSelector: {}
120120
# Specify if the cluster is RBAC enabled or not
121121
rbac:
122122
enabled: false # true/false
123+
124+
################################################################################
125+
# Specify if the controller is running as an addon.
126+
addon: false # true/false

pkg/cni/cni.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ type Reconciler struct {
1515
armClient azure.AzClient
1616
client client.Client
1717
namespace string
18+
addonMode bool
1819
}
1920

20-
func ReconcileCNI(ctx context.Context, armClient azure.AzClient, client client.Client, namespace string, cpConfig *azure.CloudProviderConfig, appGw n.ApplicationGateway) error {
21+
func ReconcileCNI(ctx context.Context, armClient azure.AzClient, client client.Client, namespace string, cpConfig *azure.CloudProviderConfig, appGw n.ApplicationGateway, addonMode bool) error {
2122
r := &Reconciler{
2223
armClient: armClient,
2324
client: client,
2425
namespace: namespace,
26+
addonMode: addonMode,
2527
}
2628

2729
return r.Reconcile(ctx, cpConfig, appGw)

pkg/cni/kubenet_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ var _ = Describe("Kubenet CNI", func() {
5252
SubscriptionID: "test-sub",
5353
RouteTableResourceGroup: "test-rg",
5454
RouteTableName: "test-rt",
55-
}, appGw)
55+
}, appGw, false)
5656
Expect(err).To(BeNil())
5757
})
5858

@@ -64,7 +64,7 @@ var _ = Describe("Kubenet CNI", func() {
6464

6565
err := cni.ReconcileCNI(ctx, azClient, k8sClient, "test", &azure.CloudProviderConfig{
6666
RouteTableName: "",
67-
}, appGw)
67+
}, appGw, false)
6868
Expect(err).To(BeNil())
6969
})
7070
})

0 commit comments

Comments
 (0)