-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2645 from justinsb/opt_in_to_new_controller
feat: allow users to opt-in to direct reconciliation
- Loading branch information
Showing
12 changed files
with
1,242 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package predicate | ||
|
||
import "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||
|
||
// AnnotationKeyAlphaReconciler allows customers to opt-in to using the direct reconciler. | ||
const AnnotationKeyAlphaReconciler = "alpha.cnrm.cloud.google.com/reconciler" | ||
|
||
// OptInToDirectReconciliation allows users to opt in to direct reconciliation | ||
// by specifying an AnnotationKeyAlphaReconciler annotation. | ||
type OptInToDirectReconciliation struct { | ||
} | ||
|
||
var _ ReconcileGate = &OptInToDirectReconciliation{} | ||
|
||
// ShouldReconcile returns true if the reconciler should be used to for the resource. | ||
func (r *OptInToDirectReconciliation) ShouldReconcile(o *unstructured.Unstructured) bool { | ||
v := o.GetAnnotations()[AnnotationKeyAlphaReconciler] | ||
return v == "direct" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...wflextemplatejob-direct/_generated_object_batchdataflowflextemplatejob-direct.golden.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
apiVersion: dataflow.cnrm.cloud.google.com/v1beta1 | ||
kind: DataflowFlexTemplateJob | ||
metadata: | ||
annotations: | ||
alpha.cnrm.cloud.google.com/reconciler: direct | ||
cnrm.cloud.google.com/management-conflict-prevention-policy: none | ||
cnrm.cloud.google.com/on-delete: cancel | ||
cnrm.cloud.google.com/project-id: ${projectId} | ||
finalizers: | ||
- cnrm.cloud.google.com/finalizer | ||
- cnrm.cloud.google.com/deletion-defender | ||
generation: 1 | ||
labels: | ||
cnrm-test: "true" | ||
name: dataflowflextemplatejob-${uniqueId} | ||
namespace: ${uniqueId} | ||
spec: | ||
containerSpecGcsPath: gs://dataflow-templates/2022-10-03-00_RC00/flex/File_Format_Conversion | ||
parameters: | ||
inputFileFormat: csv | ||
inputFileSpec: gs://config-connector-samples/dataflowflextemplate/numbertest.csv | ||
outputBucket: gs://storagebucket-${uniqueId} | ||
outputFileFormat: avro | ||
schema: gs://config-connector-samples/dataflowflextemplate/numbers.avsc | ||
region: us-central1 | ||
status: | ||
conditions: | ||
- lastTransitionTime: "1970-01-01T00:00:00Z" | ||
message: The resource is up to date | ||
reason: UpToDate | ||
status: "True" | ||
type: Ready | ||
jobId: ${jobID} | ||
observedGeneration: 1 |
Oops, something went wrong.