Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,43 @@ flowchart TD
start@{ shape: start }
stop@{ shape: stop }

enqueue_reconcile(["Enqueue reconcile call for APIServiceBinding"])
enqueue_reconcile(["Enqueue reconcile call
for APIServiceBinding"])

is_apiservicebinding_owned{"binding<br>owned?"}
set_apiservicebinding_condition_connected_to_true(["Set condition 'Connected' to true"])
set_apiservicebinding_condition_connected_to_false(["Set condition 'Connected' to false"])
set_apiservicebinding_condition_schemainsync_to_true(["Set condition 'SchemaInSync' to true"])
set_apiservicebinding_condition_schemainsync_to_false(["Set condition 'SchemaInSync' to false"])

get_apiserviceexport(["Get APIServiceExport"])
convert_apiserviceexport_to_crd(["Convert APIServiceExport to CRD"])
set_apiservicebinding_condition_connected_to_true(["Set condition
'Connected'
to true"])
set_apiservicebinding_condition_connected_to_true2(["Set condition 'Connected'
to true"])

set_apiservicebinding_condition_connected_to_false(["Set condition 'Connected'
to false"])
set_apiservicebinding_condition_connected_to_false2(["Set condition 'Connected'
to false"])

set_apiservicebinding_condition_schemainsync_to_true(["Set condition 'SchemaInSync'
to true"])

get_apiserviceexport(["Get provider
APIServiceExport"])
is_apiserviceexport_present{"export<br>exists?"}
is_apiserviceexport_valid{"export<br>valid?"}

get_apiserviceexportrequest(["Get provider
APIServiceExportRequest"])
is_apiserviceexportrequest_in_failed_state{"Is APIServiceExportRequest<br>in failed state?"}

get_bound_schemas(["Get provider
BoundSchemas referenced in
APIServiceExport"])
bound_schema_fetch_successful(["Fetching BoundSchemas
succeed?"])
reference_bound_schema(["Reference BoundSchema
in APIServiceBinding
status"])
convert_boundschema_to_crd(["Convert BoundSchema
to CRD"])


get_crd(["Get CRD"])
create_crd(["Create CRD"])
Expand All @@ -42,29 +67,35 @@ flowchart TD

is_apiservicebinding_owned --> |yes| get_apiserviceexport
get_apiserviceexport --> is_apiserviceexport_present
is_apiserviceexport_present --> |yes| set_apiservicebinding_condition_connected_to_true
is_apiserviceexport_present --> |no| set_apiservicebinding_condition_connected_to_false
set_apiservicebinding_condition_connected_to_true --> convert_apiserviceexport_to_crd
is_apiserviceexport_present --> |yes| set_apiservicebinding_condition_connected_to_true2
is_apiserviceexport_present --> |no| get_apiserviceexportrequest
get_apiserviceexportrequest --> is_apiserviceexportrequest_in_failed_state
is_apiserviceexportrequest_in_failed_state --> |yes| set_apiservicebinding_condition_connected_to_false2
is_apiserviceexportrequest_in_failed_state --> |no| set_apiservicebinding_condition_connected_to_false2

set_apiservicebinding_condition_connected_to_false2 --> stop
set_apiservicebinding_condition_connected_to_true2 --> get_bound_schemas
get_bound_schemas --> bound_schema_fetch_successful
bound_schema_fetch_successful --> |yes| reference_bound_schema
bound_schema_fetch_successful --> |no| set_apiservicebinding_condition_connected_to_false
reference_bound_schema --> convert_boundschema_to_crd
set_apiservicebinding_condition_connected_to_false --> stop

convert_apiserviceexport_to_crd --> is_apiserviceexport_valid
is_apiserviceexport_valid --> |yes| get_crd
is_apiserviceexport_valid --> |no| set_apiservicebinding_condition_schemainsync_to_false
convert_boundschema_to_crd --> get_crd

get_crd --> is_crd_present
is_crd_present --> |no| create_crd
is_crd_present --> |yes| is_crd_owned
update_crd --> set_apiservicebinding_condition_schemainsync_to_true
create_crd --> set_apiservicebinding_condition_schemainsync_to_true
create_crd --> update_crd

update_crd --> set_apiservicebinding_condition_connected_to_true
set_apiservicebinding_condition_connected_to_true --> set_apiservicebinding_condition_schemainsync_to_true

is_crd_owned --> |yes| update_crd
is_crd_owned --> |no| set_apiservicebinding_condition_schemainsync_to_false
is_crd_owned --> |no| set_apiservicebinding_condition_connected_to_false

set_apiservicebinding_condition_schemainsync_to_true --> get_clusterbinding
set_apiservicebinding_condition_schemainsync_to_false --> get_clusterbinding

get_clusterbinding --> set_apiservicebinding_provider_name

is_apiservicebinding_owned --> |no| stop
set_apiservicebinding_provider_name --> stop
```
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,20 @@ flowchart TD
for APIServiceExport"])
is_apiserviceexport_present{"APIServiceExport<br>exists?"}

get_crd(["Get referenced
CustomResourceDefinition"])
get_crd2(["Get referenced
CustomResourceDefinition"])

is_crd_present{"CRD<br>exists?"}
is_crd_present2{"CRD<br>exists?"}
get_bound_schemas(["Get referenced
BoundSchemas"])
get_bound_schemas2(["Get referenced
BoundSchemas"])
is_bound_schema_present{"BoundSchema<br>exists?"}
update_bound_schema(["Update BoundSchema
status"])

stop_apiserviceexport_sync(["Stop APIServiceExport sync"])

get_binding(["Get referenced
APIServiceBinding"])
get_binding2(["Get referenced APIServiceBinding"])
get_binding2(["Get referenced
APIServiceBinding"])

is_binding_present{"APIServiceBinding<br>exists?"}
is_binding_present2{"APIServiceBinding<br>exists?"}
Expand All @@ -59,6 +60,8 @@ to false"])
set_apiserviceexport_condition_consumerinsync_to_false(["Set condition
'ConsumerInSync' to false"])

get_crd(["Get referenced
CustomResourceDefinition"])
copy_crd_conditions(["Copy CRD conditions
to APIServiceExport
conditions"])
Expand All @@ -71,31 +74,32 @@ to false"])
start --> enqueue_reconcile
enqueue_reconcile --> is_apiserviceexport_present
is_apiserviceexport_present --> |no| stop
is_apiserviceexport_present --> |yes| get_crd
get_crd --> is_crd_present
is_crd_present --> |yes| get_binding
is_crd_present --> |no| stop_apiserviceexport_sync
stop_apiserviceexport_sync --> stop
is_apiserviceexport_present --> |yes| get_binding

get_binding --> is_binding_present
is_binding_present --> |yes| start_new_syncer
is_binding_present --> |yes| get_bound_schemas
is_binding_present --> |no| stop_apiserviceexport_sync
stop_apiserviceexport_sync --> stop

get_bound_schemas --> is_bound_schema_present
is_bound_schema_present --> |yes| start_new_syncer
is_bound_schema_present --> |no| stop_apiserviceexport_sync
stop_apiserviceexport_sync --> stop

start_new_syncer --> get_binding2
get_binding2 --> is_binding_present2
is_binding_present2 --> |yes| set_apiserviceexport_condition_connected_to_true
is_binding_present2 --> |no| set_apiserviceexport_condition_connected_to_false
set_apiserviceexport_condition_connected_to_false --> set_apiserviceexport_condition_consumerinsync_to_false
set_apiserviceexport_condition_connected_to_true --> is_binding_schemainsync
is_binding_schemainsync --> |yes| set_apiserviceexport_condition_consumerinsync_to_true
set_apiserviceexport_condition_consumerinsync_to_true --> get_crd2
set_apiserviceexport_condition_consumerinsync_to_true --> get_bound_schemas2
is_binding_schemainsync --> |no| set_apiserviceexport_condition_consumerinsync_to_false
set_apiserviceexport_condition_consumerinsync_to_false --> get_crd2
set_apiserviceexport_condition_consumerinsync_to_false --> get_bound_schemas2

get_crd2 --> is_crd_present2
is_crd_present2 --> |no| stop
is_crd_present2 --> |yes| copy_crd_conditions
get_bound_schemas2 --> get_crd
get_crd --> copy_crd_conditions
copy_crd_conditions --> set_summary_condition
set_summary_condition --> stop
set_summary_condition --> update_bound_schema
update_bound_schema --> stop
```
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (r *reconciler) ensureCRDs(ctx context.Context, binding *kubebindv1alpha2.A
return nil // nothing we can do here
}

// Get all APIResourceSchema objects referenced by the export
// Get all BoundSchema objects referenced by the export
schemas, err := r.getSchemasFromExport(ctx, export)
if err != nil {
conditions.MarkFalse(
Expand All @@ -148,7 +148,7 @@ func (r *reconciler) ensureCRDs(ctx context.Context, binding *kubebindv1alpha2.A

// Process each schema
for _, schema := range schemas {
if err := r.referenceBoundAPIResourceSchema(ctx, binding, schema.Name); err != nil {
if err := r.referenceBoundSchema(ctx, binding, schema.Name); err != nil {
errs = append(errs, err)
}

Expand All @@ -166,7 +166,7 @@ func (r *reconciler) ensureCRDs(ctx context.Context, binding *kubebindv1alpha2.A
return utilerrors.NewAggregate(errs)
}

func (r *reconciler) referenceBoundAPIResourceSchema(ctx context.Context, binding *kubebindv1alpha2.APIServiceBinding, name string) error {
func (r *reconciler) referenceBoundSchema(ctx context.Context, binding *kubebindv1alpha2.APIServiceBinding, name string) error {
boundSchema, err := r.getBoundSchema(ctx, name)
if err != nil && !errors.IsNotFound(err) {
return fmt.Errorf("failed to get BoundSchema %s: %w", name, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (r *reconciler) ensureControllers(ctx context.Context, name string, export

for _, res := range export.Spec.Resources {
name := res.ResourceGroupName()
// Fetch the APIResourceSchema
// Fetch the BoundSchema
schema, err := r.getRemoteBoundSchema(ctx, name)
if err != nil {
if errors.IsNotFound(err) {
Expand Down