Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change ResoruceItem API of query for ready and deleted resoruce #160

Merged
merged 1 commit into from
Aug 7, 2024
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 @@ -61,18 +61,18 @@ public interface ResourceType<T extends HasMetadata> {
void replace(String resourceName, Consumer<T> editor);

/**
* Waits for {@link T} to be ready (created/running)
* Confirms that {@link T} is ready (created/running)
*
* @param resource resource
* @return result of the readiness check
*/
boolean waitForReadiness(T resource);
boolean isReady(T resource);

/**
* Waits for {@link T} to be deleted
* Confirms that {@link T} is deleted
*
* @param resource resource
* @return result of the deletion
*/
boolean waitForDeletion(T resource);
boolean isDeleted(T resource);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public record ResourceCondition<T extends HasMetadata>(Predicate<T> predicate, S
* @return The ResourceCondition representing readiness.
*/
public static <T extends HasMetadata> ResourceCondition<T> readiness(ResourceType<T> type) {
return new ResourceCondition<>(type::waitForReadiness, "readiness");
return new ResourceCondition<>(type::isReady, "readiness");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void replace(String resourceName, Consumer<ClusterRoleBinding> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(ClusterRoleBinding resource) {
public boolean isReady(ClusterRoleBinding resource) {
return resource != null;
}

Expand All @@ -109,7 +109,7 @@ public boolean waitForReadiness(ClusterRoleBinding resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(ClusterRoleBinding resource) {
public boolean isDeleted(ClusterRoleBinding resource) {
return resource == null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void replace(String resourceName, Consumer<ClusterRole> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(ClusterRole resource) {
public boolean isReady(ClusterRole resource) {
return resource != null;
}

Expand All @@ -108,7 +108,7 @@ public boolean waitForReadiness(ClusterRole resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(ClusterRole resource) {
public boolean isDeleted(ClusterRole resource) {
return resource == null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void replace(String resourceName, Consumer<ConfigMap> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(ConfigMap resource) {
public boolean isReady(ConfigMap resource) {
return resource != null;
}

Expand All @@ -155,7 +155,7 @@ public boolean waitForReadiness(ConfigMap resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(ConfigMap resource) {
public boolean isDeleted(ConfigMap resource) {
return resource == null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void replace(String resourceName, Consumer<CustomResourceDefinition> edit
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(CustomResourceDefinition resource) {
public boolean isReady(CustomResourceDefinition resource) {
return resource != null;
}

Expand All @@ -109,7 +109,7 @@ public boolean waitForReadiness(CustomResourceDefinition resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(CustomResourceDefinition resource) {
public boolean isDeleted(CustomResourceDefinition resource) {
return resource == null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void replace(String resourceName, Consumer<Deployment> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(Deployment resource) {
public boolean isReady(Deployment resource) {
return client.resource(resource).isReady();
}

Expand All @@ -108,7 +108,7 @@ public boolean waitForReadiness(Deployment resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(Deployment resource) {
public boolean isDeleted(Deployment resource) {
return resource == null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void replace(String resourceName, Consumer<Job> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(Job resource) {
public boolean isReady(Job resource) {
return client.resource(resource).isReady();
}

Expand All @@ -156,7 +156,7 @@ public boolean waitForReadiness(Job resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(Job resource) {
public boolean isDeleted(Job resource) {
return resource == null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void replace(String resourceName, Consumer<Lease> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(Lease resource) {
public boolean isReady(Lease resource) {
return client.resource(resource).isReady();
}

Expand All @@ -108,7 +108,7 @@ public boolean waitForReadiness(Lease resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(Lease resource) {
public boolean isDeleted(Lease resource) {
return resource == null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void replace(String resourceName, Consumer<Namespace> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(Namespace resource) {
public boolean isReady(Namespace resource) {
return resource != null;
}

Expand All @@ -124,7 +124,7 @@ public boolean waitForReadiness(Namespace resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(Namespace resource) {
public boolean isDeleted(Namespace resource) {
return resource == null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void replace(String resourceName, Consumer<NetworkPolicy> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(NetworkPolicy resource) {
public boolean isReady(NetworkPolicy resource) {
return resource != null;
}

Expand All @@ -108,7 +108,7 @@ public boolean waitForReadiness(NetworkPolicy resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(NetworkPolicy resource) {
public boolean isDeleted(NetworkPolicy resource) {
return resource == null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void replace(String resourceName, Consumer<RoleBinding> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(RoleBinding resource) {
public boolean isReady(RoleBinding resource) {
return resource != null;
}

Expand All @@ -108,7 +108,7 @@ public boolean waitForReadiness(RoleBinding resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(RoleBinding resource) {
public boolean isDeleted(RoleBinding resource) {
return resource == null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void replace(String resourceName, Consumer<Role> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(Role resource) {
public boolean isReady(Role resource) {
return resource != null;
}

Expand All @@ -108,7 +108,7 @@ public boolean waitForReadiness(Role resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(Role resource) {
public boolean isDeleted(Role resource) {
return resource == null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void replace(String resourceName, Consumer<Secret> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(Secret resource) {
public boolean isReady(Secret resource) {
return false;
}

Expand All @@ -127,7 +127,7 @@ public boolean waitForReadiness(Secret resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(Secret resource) {
public boolean isDeleted(Secret resource) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void replace(String resourceName, Consumer<ServiceAccount> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(ServiceAccount resource) {
public boolean isReady(ServiceAccount resource) {
return resource != null;
}

Expand All @@ -108,7 +108,7 @@ public boolean waitForReadiness(ServiceAccount resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(ServiceAccount resource) {
public boolean isDeleted(ServiceAccount resource) {
return resource == null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void replace(String resourceName, Consumer<Service> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(Service resource) {
public boolean isReady(Service resource) {
return resource != null;
}

Expand All @@ -108,7 +108,7 @@ public boolean waitForReadiness(Service resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(Service resource) {
public boolean isDeleted(Service resource) {
return resource == null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void replace(String resourceName, Consumer<ValidatingWebhookConfiguration
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(ValidatingWebhookConfiguration resource) {
public boolean isReady(ValidatingWebhookConfiguration resource) {
return resource != null;
}

Expand All @@ -113,7 +113,7 @@ public boolean waitForReadiness(ValidatingWebhookConfiguration resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(ValidatingWebhookConfiguration resource) {
public boolean isDeleted(ValidatingWebhookConfiguration resource) {
return resource == null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void replace(String resourceName, Consumer<InstallPlan> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(InstallPlan resource) {
public boolean isReady(InstallPlan resource) {
return resource != null;
}

Expand All @@ -108,7 +108,7 @@ public boolean waitForReadiness(InstallPlan resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(InstallPlan resource) {
public boolean isDeleted(InstallPlan resource) {
return resource == null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void replace(String resourceName, Consumer<OperatorGroup> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(OperatorGroup resource) {
public boolean isReady(OperatorGroup resource) {
return resource != null;
}

Expand All @@ -108,7 +108,7 @@ public boolean waitForReadiness(OperatorGroup resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(OperatorGroup resource) {
public boolean isDeleted(OperatorGroup resource) {
return resource == null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void replace(String resourceName, Consumer<Subscription> editor) {
* @return result of the readiness check
*/
@Override
public boolean waitForReadiness(Subscription resource) {
public boolean isReady(Subscription resource) {
return resource != null;
}

Expand All @@ -108,7 +108,7 @@ public boolean waitForReadiness(Subscription resource) {
* @return result of the deletion
*/
@Override
public boolean waitForDeletion(Subscription resource) {
public boolean isDeleted(Subscription resource) {
return resource == null;
}

Expand Down
Loading