Skip to content

Commit 8897af8

Browse files
authored
fix: update deployment if routerConfig changes (#45)
* fix: update deployment if routerConfig changes * test: fix race * test: typo * fix: remove scale
1 parent 70a8862 commit 8897af8

14 files changed

Lines changed: 248 additions & 38 deletions

api/v1beta1/subgraph_types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ type SchemaHTTP struct {
5151
}
5252

5353
type SubGraphStatus struct {
54-
SHA256Checksum string `json:"sha256Checksum,omitempty"`
54+
// ObservedSHA256Checksum is a checksum of the discovered schema
55+
ObservedSHA256Checksum string `json:"observedSHA256Checksum,omitempty"`
5556

5657
// Schema
5758
Schema string `json:"schema,omitempty"`

api/v1beta1/supergraph_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ type SuperGraphStatus struct {
142142
// ConfigMap reference
143143
ConfigMap corev1.LocalObjectReference `json:"configMap,omitempty"`
144144

145+
// ObservedSHA256Checksum is a checksum of the discovered schema
146+
ObservedSHA256Checksum string `json:"observedSHA256Checksum,omitempty"`
147+
145148
// ObservedGeneration is the last generation reconciled by the controller
146149
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
147150
}

api/v1beta1/supergraphschema_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ type SuperGraphSchemaStatus struct {
9393

9494
ComposeErrors []ComposeError `json:"composeErrors,omitempty"`
9595

96+
// ObservedSHA256Checksum is a checkum across all subgraph resources discovered by this resource
9697
ObservedSHA256Checksum string `json:"observedSHA256Checksum,omitempty"`
9798

9899
// ConfigMap reference

chart/apollo-controller/crds/apollo.infra.doodle.com_subgraphs.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,13 @@ spec:
137137
by the controller
138138
format: int64
139139
type: integer
140+
observedSHA256Checksum:
141+
description: ObservedSHA256Checksum is a checksum of the discovered
142+
schema
143+
type: string
140144
schema:
141145
description: Schema
142146
type: string
143-
sha256Checksum:
144-
type: string
145147
type: object
146148
type: object
147149
served: true

chart/apollo-controller/crds/apollo.infra.doodle.com_supergraphs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8894,6 +8894,10 @@ spec:
88948894
by the controller
88958895
format: int64
88968896
type: integer
8897+
observedSHA256Checksum:
8898+
description: ObservedSHA256Checksum is a checksum of the discovered
8899+
schema
8900+
type: string
88978901
type: object
88988902
type: object
88998903
served: true

chart/apollo-controller/crds/apollo.infra.doodle.com_supergraphschemas.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8738,6 +8738,8 @@ spec:
87388738
format: int64
87398739
type: integer
87408740
observedSHA256Checksum:
8741+
description: ObservedSHA256Checksum is a checkum across all subgraph
8742+
resources discovered by this resource
87418743
type: string
87428744
reconciler:
87438745
description: |-

config/base/crd/bases/apollo.infra.doodle.com_subgraphs.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,13 @@ spec:
137137
by the controller
138138
format: int64
139139
type: integer
140+
observedSHA256Checksum:
141+
description: ObservedSHA256Checksum is a checksum of the discovered
142+
schema
143+
type: string
140144
schema:
141145
description: Schema
142146
type: string
143-
sha256Checksum:
144-
type: string
145147
type: object
146148
type: object
147149
served: true

config/base/crd/bases/apollo.infra.doodle.com_supergraphs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8894,6 +8894,10 @@ spec:
88948894
by the controller
88958895
format: int64
88968896
type: integer
8897+
observedSHA256Checksum:
8898+
description: ObservedSHA256Checksum is a checksum of the discovered
8899+
schema
8900+
type: string
88978901
type: object
88988902
type: object
88998903
served: true

config/base/crd/bases/apollo.infra.doodle.com_supergraphschemas.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8738,6 +8738,8 @@ spec:
87388738
format: int64
87398739
type: integer
87408740
observedSHA256Checksum:
8741+
description: ObservedSHA256Checksum is a checkum across all subgraph
8742+
resources discovered by this resource
87418743
type: string
87428744
reconciler:
87438745
description: |-

internal/controllers/subgraph_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func (r *SubGraphReconciler) reconcile(ctx context.Context, subgraph infrav1beta
175175
checksumSha := sha256.New()
176176
checksumSha.Write([]byte(schema))
177177
checksum := fmt.Sprintf("%x", checksumSha.Sum(nil))
178-
subgraph.Status.SHA256Checksum = checksum
178+
subgraph.Status.ObservedSHA256Checksum = checksum
179179
subgraph.Status.Schema = schema
180180

181181
subgraph = infrav1beta1.SubGraphReady(subgraph, metav1.ConditionTrue, "ReconciliationSuccessful", "schema available")

0 commit comments

Comments
 (0)