forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fully support generation of K8s RBAC resources
These changes address a long-time issue in regards of K8s RBAC resources (see related issues). These changes allow to generate custom Roles, ClusterRoles, ServiceAccount, and RoleBindings. Plus, it allows the Kubernetes Client and Kubernetes Config extensions to configure the role binding to generate. Fix quarkusio#16612 Fix quarkusio#19286 Fix quarkusio#15422
- Loading branch information
Showing
50 changed files
with
1,734 additions
and
153 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
16 changes: 16 additions & 0 deletions
16
...i/src/main/java/io/quarkus/kubernetes/client/spi/KubernetesClientCapabilityBuildItem.java
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,16 @@ | ||
package io.quarkus.kubernetes.client.spi; | ||
|
||
import io.quarkus.builder.item.SimpleBuildItem; | ||
|
||
public final class KubernetesClientCapabilityBuildItem extends SimpleBuildItem { | ||
|
||
private final boolean generateRbac; | ||
|
||
public KubernetesClientCapabilityBuildItem(boolean generateRbac) { | ||
this.generateRbac = generateRbac; | ||
} | ||
|
||
public boolean isGenerateRbac() { | ||
return generateRbac; | ||
} | ||
} |
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
...-config/runtime/src/main/java/io/quarkus/kubernetes/config/runtime/SecretsRoleConfig.java
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 @@ | ||
package io.quarkus.kubernetes.config.runtime; | ||
|
||
import java.util.Optional; | ||
|
||
import io.quarkus.runtime.annotations.ConfigGroup; | ||
import io.quarkus.runtime.annotations.ConfigItem; | ||
|
||
@ConfigGroup | ||
public class SecretsRoleConfig { | ||
|
||
/** | ||
* The name of the role. | ||
*/ | ||
@ConfigItem(defaultValue = "view-secrets") | ||
public String name; | ||
|
||
/** | ||
* The namespace of the role. | ||
*/ | ||
@ConfigItem | ||
public Optional<String> namespace; | ||
|
||
/** | ||
* Whether the role is cluster wide or not. By default, it's not a cluster wide role. | ||
*/ | ||
@ConfigItem(defaultValue = "false") | ||
public boolean clusterWide; | ||
|
||
/** | ||
* If the current role is meant to be generated or not. If not, it will only be used to generate the role binding resource. | ||
*/ | ||
@ConfigItem(defaultValue = "true") | ||
public boolean generate; | ||
} |
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
43 changes: 43 additions & 0 deletions
43
...ubernetes/spi/src/main/java/io/quarkus/kubernetes/spi/KubernetesClusterRoleBuildItem.java
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,43 @@ | ||
package io.quarkus.kubernetes.spi; | ||
|
||
import java.util.List; | ||
|
||
import io.quarkus.builder.item.MultiBuildItem; | ||
|
||
/** | ||
* Produce this build item to request the Kubernetes extension to generate | ||
* a Kubernetes {@code ClusterRole} resource. | ||
*/ | ||
public final class KubernetesClusterRoleBuildItem extends MultiBuildItem { | ||
/** | ||
* Name of the generated {@code ClusterRole} resource. | ||
*/ | ||
private final String name; | ||
/** | ||
* The {@code PolicyRule} resources for this {@code ClusterRole}. | ||
*/ | ||
private final List<PolicyRule> rules; | ||
|
||
/** | ||
* The target manifest that should include this role. | ||
*/ | ||
private final String target; | ||
|
||
public KubernetesClusterRoleBuildItem(String name, List<PolicyRule> rules, String target) { | ||
this.name = name; | ||
this.rules = rules; | ||
this.target = target; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public List<PolicyRule> getRules() { | ||
return rules; | ||
} | ||
|
||
public String getTarget() { | ||
return target; | ||
} | ||
} |
Oops, something went wrong.