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

refactor: move CSV-related annotation & interface to annotations module #705

Merged
merged 1 commit into from
Sep 6, 2023
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
@@ -0,0 +1,121 @@
package io.quarkiverse.operatorsdk.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
@SuppressWarnings("unused")
public @interface CSVMetadata {
String name() default "";

Annotations annotations() default @Annotations;

String description() default "";

String displayName() default "";

Icon[] icon() default {};

String[] keywords() default "";

String maturity() default "";

String version() default "";

String replaces() default "";

Maintainer[] maintainers() default {};

Provider provider() default @Provider;

InstallMode[] installModes() default {};

PermissionRule[] permissionRules() default {};

RequiredCRD[] requiredCRDs() default {};

String minKubeVersion() default "";

Link[] links() default {};

@interface Annotations {
String containerImage() default "";

String repository() default "";

String capabilities() default "";

String categories() default "";

boolean certified() default false;

String almExamples() default "";

String skipRange() default "";

Annotation[] others() default {};

@interface Annotation {
String name();

String value();
}
}

@interface Icon {
String DEFAULT_MEDIA_TYPE = "image/svg+xml";

String fileName();

String mediatype() default DEFAULT_MEDIA_TYPE;
}

@interface Maintainer {
String email() default "";

String name() default "";
}

@interface Provider {
String name() default "";

String url() default "";
}

@interface InstallMode {
String type();

boolean supported() default true;
}

@interface PermissionRule {
String[] apiGroups();

String[] resources();

String[] verbs() default { "get", "list", "watch", "create", "delete", "patch", "update" };

/**
* @return the service account name for the permission rule. If not provided, it will use the default service account
* name.
*/
String serviceAccountName() default "";
}

@interface RequiredCRD {
String kind();

String name();

String version();
}

@interface Link {
String url();

String name();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package io.quarkiverse.operatorsdk.annotations;

public interface SharedCSVMetadata {
}
4 changes: 4 additions & 0 deletions bundle-generator/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
<artifactId>quarkus-junit5-internal</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkiverse.operatorsdk</groupId>
<artifactId>quarkus-operator-sdk-annotations</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@
import io.fabric8.kubernetes.api.model.rbac.ClusterRoleBinding;
import io.fabric8.kubernetes.api.model.rbac.Role;
import io.fabric8.kubernetes.api.model.rbac.RoleBinding;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata;
import io.quarkiverse.operatorsdk.annotations.SharedCSVMetadata;
import io.quarkiverse.operatorsdk.bundle.runtime.BundleGenerationConfiguration;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata.Icon;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadataHolder;
import io.quarkiverse.operatorsdk.bundle.runtime.SharedCSVMetadata;
import io.quarkiverse.operatorsdk.common.*;
import io.quarkiverse.operatorsdk.deployment.GeneratedCRDInfoBuildItem;
import io.quarkiverse.operatorsdk.deployment.VersionBuildItem;
Expand Down Expand Up @@ -367,7 +366,7 @@ private CSVMetadataHolder createMetadataHolder(AnnotationInstance csvMetadata, C
ConfigurationUtils.annotationValueOrDefault(iconAnn[i], "fileName",
AnnotationValue::asString, () -> null),
ConfigurationUtils.annotationValueOrDefault(iconAnn[i], "mediatype",
AnnotationValue::asString, () -> Icon.DEFAULT_MEDIA_TYPE));
AnnotationValue::asString, () -> CSVMetadata.Icon.DEFAULT_MEDIA_TYPE));
}
} else {
icon = mh.icon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata;
import io.quarkiverse.operatorsdk.bundle.runtime.SharedCSVMetadata;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata;
import io.quarkiverse.operatorsdk.annotations.SharedCSVMetadata;

@CSVMetadata(name = "shared", version = "0.0.1")
public class AReconciler implements Reconciler<ConfigMap>, SharedCSVMetadata {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata;

@CSVMetadata(name = "shared", version = "0.0.2")
public class BReconciler implements Reconciler<Service> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata;

@CSVMetadata(name = "illegal")
public class DuplicatedBundleNameWithoutSharedCSVMetadata1 implements Reconciler<Role> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata;

@CSVMetadata(name = "illegal")
public class DuplicatedBundleNameWithoutSharedCSVMetadata2 implements Reconciler<RoleBinding> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import io.fabric8.kubernetes.client.CustomResource;
import io.fabric8.kubernetes.model.annotation.Group;
import io.fabric8.kubernetes.model.annotation.Version;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata;

@Group("halkyon.io")
@Version("v1alpha1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata;

@CSVMetadata(name = "first-operator", version = FirstReconciler.VERSION)
public class FirstReconciler implements Reconciler<First> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata;

@CSVMetadata(name = "second-operator")
public class SecondReconciler implements Reconciler<Second> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import io.fabric8.kubernetes.client.CustomResource;
import io.fabric8.kubernetes.model.annotation.Group;
import io.fabric8.kubernetes.model.annotation.Version;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata;

@Group("samples.javaoperatorsdk.io")
@Version("v1alpha1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;
import io.javaoperatorsdk.operator.api.reconciler.dependent.Dependent;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata.Annotations;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata.Annotations.Annotation;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata.RequiredCRD;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata.Annotations;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata.Annotations.Annotation;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata.RequiredCRD;

@CSVMetadata(name = "third-operator", requiredCRDs = @RequiredCRD(kind = SecondExternal.KIND, name = "externalagains."
+ SecondExternal.GROUP, version = SecondExternal.VERSION), replaces = "1.0.0", annotations = @Annotations(skipRange = ">=1.0.0 <1.0.3", capabilities = "Test", others = @Annotation(name = "foo", value = "bar")))
Expand Down
4 changes: 4 additions & 0 deletions bundle-generator/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-kubernetes</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.operatorsdk</groupId>
<artifactId>quarkus-operator-sdk-annotations</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
@SuppressWarnings("unused")
@Deprecated(since = "6.3.1", forRemoval = true)
/**
* @deprecated Use {@link io.quarkiverse.operatorsdk.annotations.CSVMetadata} instead
*/
public @interface CSVMetadata {
String name() default "";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
package io.quarkiverse.operatorsdk.bundle.runtime;

@SuppressWarnings("unused")
@Deprecated(since = "6.3.1", forRemoval = true)
/**
* @deprecated Use {@link io.quarkiverse.operatorsdk.annotations.CSVMetadata} instead
*/
public interface SharedCSVMetadata {
}
4 changes: 4 additions & 0 deletions samples/joke/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
<groupId>io.quarkiverse.operatorsdk</groupId>
<artifactId>quarkus-operator-sdk-bundle-generator</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.operatorsdk</groupId>
<artifactId>quarkus-operator-sdk-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import io.javaoperatorsdk.operator.api.reconciler.ControllerConfiguration;
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata;
import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata.Icon;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata.Icon;
import io.quarkiverse.operatorsdk.samples.joke.JokeRequestSpec.ExcludedTopic;
import io.quarkiverse.operatorsdk.samples.joke.JokeRequestStatus.State;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.quarkiverse.operatorsdk.samples.pingpong;

import io.quarkiverse.operatorsdk.bundle.runtime.CSVMetadata;
import io.quarkiverse.operatorsdk.bundle.runtime.SharedCSVMetadata;
import io.quarkiverse.operatorsdk.annotations.CSVMetadata;
import io.quarkiverse.operatorsdk.annotations.SharedCSVMetadata;

@CSVMetadata(name = "pingpong-operator")
public class PingPongOperatorCSVMetadata implements SharedCSVMetadata {
Expand Down