Skip to content

Commit 2fa007b

Browse files
committed
use AzureClusterIdentity in e2e tests
1 parent 300757b commit 2fa007b

30 files changed

+4679
-26
lines changed

config/default/aad-pod-identity-deployment.yaml

Lines changed: 196 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,212 @@
11
---
2-
apiVersion: apiextensions.k8s.io/v1beta1
2+
apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
5-
name: azureidentitybindings.aadpodidentity.k8s.io
5+
annotations:
6+
api-approved.kubernetes.io: unapproved
7+
controller-gen.kubebuilder.io/version: v0.5.0
8+
name: azureidentities.aadpodidentity.k8s.io
69
spec:
710
group: aadpodidentity.k8s.io
8-
version: v1
911
names:
10-
kind: AzureIdentityBinding
11-
plural: azureidentitybindings
12+
kind: AzureIdentity
13+
listKind: AzureIdentityList
14+
plural: azureidentities
15+
singular: azureidentity
1216
scope: Namespaced
17+
versions:
18+
- name: v1
19+
schema:
20+
openAPIV3Schema:
21+
description: AzureIdentity is the specification of the identity data structure.
22+
properties:
23+
apiVersion:
24+
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
25+
type: string
26+
kind:
27+
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
28+
type: string
29+
metadata:
30+
type: object
31+
spec:
32+
description: AzureIdentitySpec describes the credential specifications of an identity on Azure.
33+
properties:
34+
adEndpoint:
35+
type: string
36+
adResourceID:
37+
description: For service principal. Option param for specifying the AD details.
38+
type: string
39+
auxiliaryTenantIDs:
40+
description: Service principal auxiliary tenant ids
41+
items:
42+
type: string
43+
nullable: true
44+
type: array
45+
clientID:
46+
description: Both User Assigned MSI and SP can use this field.
47+
type: string
48+
clientPassword:
49+
description: Used for service principal
50+
properties:
51+
name:
52+
description: Name is unique within a namespace to reference a secret resource.
53+
type: string
54+
namespace:
55+
description: Namespace defines the space within which the secret name must be unique.
56+
type: string
57+
type: object
58+
metadata:
59+
type: object
60+
replicas:
61+
format: int32
62+
nullable: true
63+
type: integer
64+
resourceID:
65+
description: User assigned MSI resource id.
66+
type: string
67+
tenantID:
68+
description: Service principal primary tenant id.
69+
type: string
70+
type:
71+
description: UserAssignedMSI or Service Principal
72+
type: integer
73+
type: object
74+
status:
75+
description: AzureIdentityStatus contains the replica status of the resource.
76+
properties:
77+
availableReplicas:
78+
format: int32
79+
type: integer
80+
metadata:
81+
type: object
82+
type: object
83+
type: object
84+
served: true
85+
storage: true
86+
status:
87+
acceptedNames:
88+
kind: ""
89+
plural: ""
90+
conditions: []
91+
storedVersions: []
1392
---
14-
apiVersion: apiextensions.k8s.io/v1beta1
93+
apiVersion: apiextensions.k8s.io/v1
1594
kind: CustomResourceDefinition
1695
metadata:
17-
name: azureidentities.aadpodidentity.k8s.io
96+
annotations:
97+
api-approved.kubernetes.io: unapproved
98+
controller-gen.kubebuilder.io/version: v0.5.0
99+
name: azureidentitybindings.aadpodidentity.k8s.io
18100
spec:
19101
group: aadpodidentity.k8s.io
20-
version: v1
21102
names:
22-
kind: AzureIdentity
23-
singular: azureidentity
24-
plural: azureidentities
103+
kind: AzureIdentityBinding
104+
listKind: AzureIdentityBindingList
105+
plural: azureidentitybindings
106+
singular: azureidentitybinding
25107
scope: Namespaced
108+
versions:
109+
- name: v1
110+
schema:
111+
openAPIV3Schema:
112+
description: AzureIdentityBinding brings together the spec of matching pods and the identity which they can use.
113+
properties:
114+
apiVersion:
115+
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
116+
type: string
117+
kind:
118+
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
119+
type: string
120+
metadata:
121+
type: object
122+
spec:
123+
description: AzureIdentityBindingSpec matches the pod with the Identity. Used to indicate the potential matches to look for between the pod/deployment and the identities present.
124+
properties:
125+
azureIdentity:
126+
type: string
127+
metadata:
128+
type: object
129+
selector:
130+
type: string
131+
weight:
132+
description: Weight is used to figure out which of the matching identities would be selected.
133+
type: integer
134+
type: object
135+
status:
136+
description: AzureIdentityBindingStatus contains the status of an AzureIdentityBinding.
137+
properties:
138+
availableReplicas:
139+
format: int32
140+
type: integer
141+
metadata:
142+
type: object
143+
type: object
144+
type: object
145+
served: true
146+
storage: true
147+
status:
148+
acceptedNames:
149+
kind: ""
150+
plural: ""
151+
conditions: []
152+
storedVersions: []
26153
---
27-
apiVersion: apiextensions.k8s.io/v1beta1
154+
apiVersion: apiextensions.k8s.io/v1
28155
kind: CustomResourceDefinition
29156
metadata:
157+
annotations:
158+
api-approved.kubernetes.io: unapproved
159+
controller-gen.kubebuilder.io/version: v0.5.0
30160
name: azurepodidentityexceptions.aadpodidentity.k8s.io
31161
spec:
32162
group: aadpodidentity.k8s.io
33-
version: v1
34163
names:
35164
kind: AzurePodIdentityException
36-
singular: azurepodidentityexception
165+
listKind: AzurePodIdentityExceptionList
37166
plural: azurepodidentityexceptions
167+
singular: azurepodidentityexception
38168
scope: Namespaced
169+
versions:
170+
- name: v1
171+
schema:
172+
openAPIV3Schema:
173+
description: AzurePodIdentityException contains the pod selectors for all pods that don't require NMI to process and request token on their behalf.
174+
properties:
175+
apiVersion:
176+
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
177+
type: string
178+
kind:
179+
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
180+
type: string
181+
metadata:
182+
type: object
183+
spec:
184+
description: AzurePodIdentityExceptionSpec matches pods with the selector defined. If request originates from a pod that matches the selector, nmi will proxy the request and send response back without any validation.
185+
properties:
186+
metadata:
187+
type: object
188+
podLabels:
189+
additionalProperties:
190+
type: string
191+
type: object
192+
type: object
193+
status:
194+
description: AzurePodIdentityExceptionStatus contains the status of an AzurePodIdentityException.
195+
properties:
196+
metadata:
197+
type: object
198+
status:
199+
type: string
200+
type: object
201+
type: object
202+
served: true
203+
storage: true
204+
status:
205+
acceptedNames:
206+
kind: ""
207+
plural: ""
208+
conditions: []
209+
storedVersions: []
39210
---
40211
apiVersion: rbac.authorization.k8s.io/v1
41212
kind: ClusterRole
@@ -76,7 +247,7 @@ metadata:
76247
labels:
77248
component: nmi
78249
tier: node
79-
k8s-app: aad-pod-id
250+
k8s-app: aad-pod-id
80251
name: nmi
81252
namespace: capz-system
82253
spec:
@@ -106,13 +277,13 @@ spec:
106277
type: FileOrCreate
107278
containers:
108279
- name: nmi
109-
image: "mcr.microsoft.com/oss/azure/aad-pod-identity/nmi:v1.7.1"
280+
image: "mcr.microsoft.com/oss/azure/aad-pod-identity/nmi:v1.8.0"
110281
imagePullPolicy: IfNotPresent
111282
args:
112283
- "--node=$(NODE_NAME)"
113-
- "--forceNamespaced"
114-
- "--http-probe-port=8085"
115284
- "--operation-mode=managed"
285+
- "--forceNamespaced"
286+
- "--http-probe-port=8085"
116287
env:
117288
- name: FORCENAMESPACED
118289
value: "true"
@@ -124,6 +295,8 @@ spec:
124295
valueFrom:
125296
fieldRef:
126297
fieldPath: spec.nodeName
298+
- name: LOG_LEVEL
299+
value: DEBUG
127300
resources:
128301
limits:
129302
cpu: 200m
@@ -134,14 +307,18 @@ spec:
134307
securityContext:
135308
runAsUser: 0
136309
capabilities:
310+
drop:
311+
- ALL
137312
add:
313+
- DAC_READ_SEARCH
138314
- NET_ADMIN
315+
- NET_RAW
139316
volumeMounts:
140317
- mountPath: /run/xtables.lock
141318
name: iptableslock
142319
- name: kubelet-config
143320
mountPath: /etc/default/kubelet
144-
readOnly: true
321+
readOnly: true
145322
livenessProbe:
146323
httpGet:
147324
path: /healthz

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ module sigs.k8s.io/cluster-api-provider-azure
33
go 1.16
44

55
require (
6-
github.com/Azure/aad-pod-identity v1.7.1
7-
github.com/Azure/azure-sdk-for-go v55.2.0+incompatible
6+
github.com/Azure/aad-pod-identity v1.8.0
7+
github.com/Azure/azure-sdk-for-go v53.1.0+incompatible
88
github.com/Azure/go-autorest/autorest v0.11.18
99
github.com/Azure/go-autorest/autorest/adal v0.9.13
1010
github.com/Azure/go-autorest/autorest/azure/auth v0.5.3

go.sum

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,14 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9
4141
contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRqYosuDstRB9un7SOx2k/9ckA=
4242
contrib.go.opencensus.io/exporter/prometheus v0.1.0/go.mod h1:cGFniUXGZlKRjzOyuZJ6mgB+PgBcCIa79kEKR8YCW+A=
4343
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
44+
<<<<<<< HEAD
4445
github.com/Azure/aad-pod-identity v1.7.1 h1:M8Wze7x2jnE96E++Dg259egrXtIT6deXPOB8BL4H5NU=
4546
github.com/Azure/aad-pod-identity v1.7.1/go.mod h1:dAEKh6VM1xLJc2Nkwa9+iRLl6BYQuLCvLMF18wXyMVk=
4647
github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
48+
=======
49+
github.com/Azure/aad-pod-identity v1.8.0 h1:VrVNJ5fL1NudN3+DnHAHkjSBxHnP/jZnFyxXBE36eyg=
50+
github.com/Azure/aad-pod-identity v1.8.0/go.mod h1:z1+AHOskemFNCHmSdtF3DMqw6mBb/Va7/wLY9+4Aauk=
51+
>>>>>>> 39028cd9... use AzureClusterIdentity in e2e tests
4752
github.com/Azure/azure-sdk-for-go v40.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
4853
github.com/Azure/azure-sdk-for-go v55.2.0+incompatible h1:TL2/vJWJEPOrmv97nHcbvjXES0Ntlb9P95hqGA1J2dU=
4954
github.com/Azure/azure-sdk-for-go v55.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
@@ -55,7 +60,10 @@ github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSW
5560
github.com/Azure/go-autorest/autorest v0.1.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg=
5661
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
5762
github.com/Azure/go-autorest/autorest v0.9.6/go.mod h1:/FALq9T/kS7b5J5qsQ+RSTUdAmGFqi0vUdVNNx8q630=
63+
<<<<<<< HEAD
5864
github.com/Azure/go-autorest/autorest v0.10.0/go.mod h1:/FALq9T/kS7b5J5qsQ+RSTUdAmGFqi0vUdVNNx8q630=
65+
=======
66+
>>>>>>> 39028cd9... use AzureClusterIdentity in e2e tests
5967
github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw=
6068
github.com/Azure/go-autorest/autorest v0.11.9/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw=
6169
github.com/Azure/go-autorest/autorest v0.11.12/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw=
@@ -1254,7 +1262,6 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w
12541262
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
12551263
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
12561264
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
1257-
golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
12581265
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
12591266
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
12601267
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -1603,8 +1610,8 @@ k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8
16031610
k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
16041611
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
16051612
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
1606-
k8s.io/klog/v2 v2.3.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
16071613
k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
1614+
k8s.io/klog/v2 v2.5.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
16081615
k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
16091616
k8s.io/klog/v2 v2.9.0 h1:D7HV+n1V57XeZ0m6tdRkfknthUaM06VFbWldOFh8kzM=
16101617
k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func init() {
8888
// +kubebuilder:scaffold:scheme
8989

9090
// Add aadpodidentity v1 to the scheme.
91-
aadPodIdentityGroupVersion := schema.GroupVersion{Group: aadpodv1.CRDGroup, Version: aadpodv1.CRDVersion}
91+
aadPodIdentityGroupVersion := schema.GroupVersion{Group: aadpodv1.GroupName, Version: "v1"}
9292
scheme.AddKnownTypes(aadPodIdentityGroupVersion,
9393
&aadpodv1.AzureIdentity{},
9494
&aadpodv1.AzureIdentityList{},

templates/test/ci/cluster-template-prow-ci-version.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ spec:
2929
buildProvenance: ${BUILD_PROVENANCE}
3030
creationTimestamp: ${TIMESTAMP}
3131
jobName: ${JOB_NAME}
32+
identityRef:
33+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
34+
kind: AzureClusterIdentity
35+
name: ${CLUSTER_IDENTITY_NAME}
36+
namespace: ${CLUSTER_IDENTITY_NAMESPACE}
3237
location: ${AZURE_LOCATION}
3338
networkSpec:
3439
vnet:
@@ -397,6 +402,20 @@ spec:
397402
name: cni-${CLUSTER_NAME}-calico
398403
strategy: ApplyOnce
399404
---
405+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
406+
kind: AzureClusterIdentity
407+
metadata:
408+
name: ${CLUSTER_IDENTITY_NAME}
409+
namespace: default
410+
spec:
411+
allowedNamespaces: {}
412+
clientID: ${AZURE_CLUSTER_IDENTITY_CLIENT_ID}
413+
clientSecret:
414+
name: ${AZURE_CLUSTER_IDENTITY_SECRET_NAME}
415+
namespace: ${AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE}
416+
tenantID: ${AZURE_TENANT_ID}
417+
type: ServicePrincipal
418+
---
400419
apiVersion: v1
401420
data:
402421
resources: |

0 commit comments

Comments
 (0)