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

feat: add isMarkedForDeletion and finalizer-related methods #2607

Merged
merged 9 commits into from
Nov 16, 2020

Conversation

metacosm
Copy link
Collaborator

Description

Adds convenience methods on CustomResource. Not sure if it makes sense to add them at that level?

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

@centos-ci
Copy link

Can one of the admins verify this patch?

@manusa
Copy link
Member

manusa commented Nov 16, 2020

Adds convenience methods on CustomResource. Not sure if it makes sense to add them at that level?

These seem to not be specific for CustomResources but for all cluster types. Maybe add it as part of a utility class?

Or even as a default method in the HasMetadata interface?

public interface HasMetadata extends KubernetesResource {

  ObjectMeta getMetadata();
  void setMetadata(ObjectMeta metadata);

  String getKind();

  String getApiVersion();
  void setApiVersion(String version);

  default boolean isMarkedForDeletion() {
    return StringUtils.isNotBlank(getMetadata().getDeletionTimestamp());
  }
}

@rohanKanojia rohanKanojia requested a review from manusa November 16, 2020 12:21
@rohanKanojia
Copy link
Member

rohanKanojia commented Nov 16, 2020

Could you please add Javadocs for these new methods?

@manusa
Copy link
Member

manusa commented Nov 16, 2020

I'm afraid formatting in the license header breaks the check. Please use the unmodified/unformatted header.

@metacosm
Copy link
Collaborator Author

I'm afraid formatting in the license header breaks the check. Please use the unmodified/unformatted header.

How can I figure out which files are causing the issue?

@manusa
Copy link
Member

manusa commented Nov 16, 2020

mvn -N license:format automates the process

mvn -N license:check Checks which are wrong.

In your case HasMetadata (now contains <p> elements in the license) and its Test

*/
package io.fabric8.kubernetes.api.model;

import org.junit.Test;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import org.junit.Test;
import org.junit.jupiter.api.Test;

@metacosm metacosm self-assigned this Nov 16, 2020
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

83.3% 83.3% Coverage
0.0% 0.0% Duplication

warning The version of Java (1.8.0_275) you have used to run this analysis is deprecated and we will stop accepting it accepting it soon.Please update to at least Java 11.
Read more here

@metacosm metacosm merged commit f4eea6e into fabric8io:master Nov 16, 2020
@metacosm metacosm deleted the cr-improvements branch November 16, 2020 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants