Skip to content

Commit 10b6a51

Browse files
committed
fixup
1 parent 1a18276 commit 10b6a51

File tree

9 files changed

+232
-20
lines changed

9 files changed

+232
-20
lines changed

src/operator/config/crd/k8s.otterize.com_clientintents.patched

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ spec:
10181018
resolvedIPs:
10191019
description: |-
10201020
ResolvedIPs stores resolved IPs for a domain name - the network mapper populates it when DNS internetTarget is used
1021-
Deprecated: Use ApprovedClientIntents.Status.ResolvedIPs instead
1021+
Deprecated: Use ApprovedClientIntents.Status.ResolvedIPs instead. This field is kept here for the migration.
10221022
items:
10231023
properties:
10241024
dns:
@@ -1036,7 +1036,6 @@ spec:
10361036
description: |-
10371037
upToDate field reflects whether the client intents have successfully been applied
10381038
to the cluster to the state specified
1039-
Deprecated: Use ApprovedClientIntents.Status.UpToDate instead
10401039
type: boolean
10411040
type: object
10421041
type: object
@@ -1357,7 +1356,7 @@ spec:
13571356
resolvedIPs:
13581357
description: |-
13591358
ResolvedIPs stores resolved IPs for a domain name - the network mapper populates it when DNS internetTarget is used
1360-
Deprecated: Use ApprovedClientIntents.Status.ResolvedIPs instead
1359+
Deprecated: Use ApprovedClientIntents.Status.ResolvedIPs instead. This field is kept here for the migration.
13611360
items:
13621361
properties:
13631362
dns:
@@ -1375,7 +1374,6 @@ spec:
13751374
description: |-
13761375
upToDate field reflects whether the client intents have successfully been applied
13771376
to the cluster to the state specified
1378-
Deprecated: Use ApprovedClientIntents.Status.UpToDate instead
13791377
type: boolean
13801378
type: object
13811379
type: object

src/operator/config/crd/k8s.otterize.com_clientintents.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ spec:
10071007
resolvedIPs:
10081008
description: |-
10091009
ResolvedIPs stores resolved IPs for a domain name - the network mapper populates it when DNS internetTarget is used
1010-
Deprecated: Use ApprovedClientIntents.Status.ResolvedIPs instead
1010+
Deprecated: Use ApprovedClientIntents.Status.ResolvedIPs instead. This field is kept here for the migration.
10111011
items:
10121012
properties:
10131013
dns:
@@ -1026,7 +1026,6 @@ spec:
10261026
description: |-
10271027
upToDate field reflects whether the client intents have successfully been applied
10281028
to the cluster to the state specified
1029-
Deprecated: Use ApprovedClientIntents.Status.UpToDate instead
10301029
type: boolean
10311030
type: object
10321031
type: object
@@ -1347,7 +1346,7 @@ spec:
13471346
resolvedIPs:
13481347
description: |-
13491348
ResolvedIPs stores resolved IPs for a domain name - the network mapper populates it when DNS internetTarget is used
1350-
Deprecated: Use ApprovedClientIntents.Status.ResolvedIPs instead
1349+
Deprecated: Use ApprovedClientIntents.Status.ResolvedIPs instead. This field is kept here for the migration.
13511350
items:
13521351
properties:
13531352
dns:
@@ -1366,7 +1365,6 @@ spec:
13661365
description: |-
13671366
upToDate field reflects whether the client intents have successfully been applied
13681367
to the cluster to the state specified
1369-
Deprecated: Use ApprovedClientIntents.Status.UpToDate instead
13701368
type: boolean
13711369
type: object
13721370
type: object

src/operator/config/rbac/manifests-patched.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ rules:
7373
- get
7474
- list
7575
- watch
76+
- apiGroups:
77+
- admissionregistration.k8s.io
78+
resources:
79+
- endpoints
80+
verbs:
81+
- get
82+
- list
83+
- watch
7684
- apiGroups:
7785
- admissionregistration.k8s.io
7886
resources:
@@ -83,6 +91,22 @@ rules:
8391
- patch
8492
- update
8593
- watch
94+
- apiGroups:
95+
- admissionregistration.k8s.io
96+
resources:
97+
- networkpolicies
98+
verbs:
99+
- get
100+
- list
101+
- watch
102+
- apiGroups:
103+
- admissionregistration.k8s.io
104+
resources:
105+
- services
106+
verbs:
107+
- get
108+
- list
109+
- watch
86110
- apiGroups:
87111
- admissionregistration.k8s.io
88112
resources:

src/operator/config/rbac/role.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ rules:
7373
- get
7474
- list
7575
- watch
76+
- apiGroups:
77+
- admissionregistration.k8s.io
78+
resources:
79+
- endpoints
80+
verbs:
81+
- get
82+
- list
83+
- watch
7684
- apiGroups:
7785
- admissionregistration.k8s.io
7886
resources:
@@ -83,6 +91,22 @@ rules:
8391
- patch
8492
- update
8593
- watch
94+
- apiGroups:
95+
- admissionregistration.k8s.io
96+
resources:
97+
- networkpolicies
98+
verbs:
99+
- get
100+
- list
101+
- watch
102+
- apiGroups:
103+
- admissionregistration.k8s.io
104+
resources:
105+
- services
106+
verbs:
107+
- get
108+
- list
109+
- watch
86110
- apiGroups:
87111
- admissionregistration.k8s.io
88112
resources:

src/operator/controllers/intents_controller.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,6 @@ func (r *IntentsReconciler) removeOrphanedApprovedIntents(ctx context.Context) e
368368
}
369369

370370
func (r *IntentsReconciler) handleCloudAppliedIntentsRequests(ctx context.Context, intents otterizev2alpha1.ClientIntents) error {
371-
if intents.Status.ReviewStatus == otterizev2alpha1.ReviewStatusApproved || !intents.DeletionTimestamp.IsZero() {
372-
// Will be handled elsewhere
373-
return nil
374-
}
375371
if intents.Status.ReviewStatus == "" {
376372
if err := r.updateClientIntentsStatus(ctx, intents, otterizev2alpha1.ReviewStatusPending); err != nil {
377373
return errors.Wrap(err)
@@ -398,14 +394,14 @@ func (r *IntentsReconciler) periodicQueryAppliedIntentsRequestsStatus(ctx contex
398394
case <-ctx.Done():
399395
return
400396
case <-approvalQueryTicker.C:
401-
if err := r.queryAppliedIntentsRequestsStatus(ctx); err != nil {
397+
if err := r.findAndHandlePendingRequests(ctx); err != nil {
402398
logrus.WithError(err).Error("periodic intents approval query failed")
403399
}
404400
}
405401
}
406402
}
407403

408-
func (r *IntentsReconciler) queryAppliedIntentsRequestsStatus(ctx context.Context) error {
404+
func (r *IntentsReconciler) findAndHandlePendingRequests(ctx context.Context) error {
409405
clientIntentsList := &otterizev2alpha1.ClientIntentsList{}
410406
statusSelector := fields.OneTermEqualSelector(ReviewStatusIndexField, string(otterizev2alpha1.ReviewStatusPending))
411407
if err := r.client.List(ctx, clientIntentsList, &client.ListOptions{FieldSelector: statusSelector}); err != nil {
@@ -443,15 +439,15 @@ func (r *IntentsReconciler) handlePendingRequests(ctx context.Context, pendingCl
443439
continue
444440
}
445441

446-
if err := r.handleRequestStatusChanges(ctx, request, clientIntents); err != nil {
442+
if err := r.handleRequestStatusResponse(ctx, request, clientIntents); err != nil {
447443
return errors.Wrap(err)
448444
}
449445
}
450446

451447
return nil
452448
}
453449

454-
func (r *IntentsReconciler) handleRequestStatusChanges(ctx context.Context, request operator_cloud_client.AppliedIntentsRequestStatus, clientIntents otterizev2alpha1.ClientIntents) error {
450+
func (r *IntentsReconciler) handleRequestStatusResponse(ctx context.Context, request operator_cloud_client.AppliedIntentsRequestStatus, clientIntents otterizev2alpha1.ClientIntents) error {
455451
if request.Status == graphqlclient.AppliedIntentsRequestStatusLabelPending {
456452
logrus.Debugf("Received pending status for intents request %v", request.ResourceGeneration)
457453
return nil

src/operator/otterizecrds/clientintents-customresourcedefinition.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ spec:
10181018
resolvedIPs:
10191019
description: |-
10201020
ResolvedIPs stores resolved IPs for a domain name - the network mapper populates it when DNS internetTarget is used
1021-
Deprecated: Use ApprovedClientIntents.Status.ResolvedIPs instead
1021+
Deprecated: Use ApprovedClientIntents.Status.ResolvedIPs instead. This field is kept here for the migration.
10221022
items:
10231023
properties:
10241024
dns:
@@ -1036,7 +1036,6 @@ spec:
10361036
description: |-
10371037
upToDate field reflects whether the client intents have successfully been applied
10381038
to the cluster to the state specified
1039-
Deprecated: Use ApprovedClientIntents.Status.UpToDate instead
10401039
type: boolean
10411040
type: object
10421041
type: object
@@ -1357,7 +1356,7 @@ spec:
13571356
resolvedIPs:
13581357
description: |-
13591358
ResolvedIPs stores resolved IPs for a domain name - the network mapper populates it when DNS internetTarget is used
1360-
Deprecated: Use ApprovedClientIntents.Status.ResolvedIPs instead
1359+
Deprecated: Use ApprovedClientIntents.Status.ResolvedIPs instead. This field is kept here for the migration.
13611360
items:
13621361
properties:
13631362
dns:
@@ -1375,7 +1374,6 @@ spec:
13751374
description: |-
13761375
upToDate field reflects whether the client intents have successfully been applied
13771376
to the cluster to the state specified
1378-
Deprecated: Use ApprovedClientIntents.Status.UpToDate instead
13791377
type: boolean
13801378
type: object
13811379
type: object

0 commit comments

Comments
 (0)