-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add support for cert-manager #13017
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
Open
tinaselenge
wants to merge
15
commits into
strimzi:main
Choose a base branch
from
tinaselenge:cert-manager-integration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add support for cert-manager #13017
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
757dbe6
Add cert-manager API classes
katheris f4fbe00
Add support for issuing certificates via cert-manager
katheris 160d047
Add docs for using cert-manager
tinaselenge 7414f60
Address review comments
katheris 6639047
Address review comments
tinaselenge 1ba8963
Address ppatierno review comments
katheris 77d46b8
Remove use of feature gate
katheris e821241
Address review comments from Paolo and Jakub:
tinaselenge 173a209
Merge system test cases into a single test
tinaselenge d70fde4
Instead of a separate role and binding for entity operator, add the c…
tinaselenge 6d564d3
Integrate cert-manager role/rolebinding to the existing installation …
tinaselenge 663731f
Address review comments:
tinaselenge 8f6633e
Update docs to have a dedicated file for concept
tinaselenge 428615a
'Fix system test
tinaselenge da30b4e
Address comments from Jakub
tinaselenge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
33 changes: 33 additions & 0 deletions
33
api/src/main/java/io/strimzi/api/kafka/model/common/CertificateManagerType.java
This file contains hidden or 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,33 @@ | ||
| /* | ||
| * Copyright Strimzi authors. | ||
| * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). | ||
| */ | ||
| package io.strimzi.api.kafka.model.common; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import com.fasterxml.jackson.annotation.JsonValue; | ||
|
|
||
| /** | ||
| * Defines values for the spec.clusterCa/clientsCa.type field | ||
| */ | ||
| public enum CertificateManagerType { | ||
| STRIMZI, | ||
| CERT_MANAGER; | ||
|
|
||
| @JsonCreator | ||
| public static CertificateManagerType forValue(String value) { | ||
| return switch (value) { | ||
| case "strimzi" -> STRIMZI; | ||
| case "cert-manager" -> CERT_MANAGER; | ||
| default -> throw new IllegalArgumentException(String.format("Unknown certificate manager type: %s. Must be %s or %s.", value, STRIMZI.toValue(), CERT_MANAGER.toValue())); | ||
| }; | ||
| } | ||
|
|
||
| @JsonValue | ||
| public String toValue() { | ||
| return switch (this) { | ||
| case STRIMZI -> "strimzi"; | ||
| case CERT_MANAGER -> "cert-manager"; | ||
| }; | ||
| } | ||
| } |
70 changes: 70 additions & 0 deletions
70
api/src/main/java/io/strimzi/api/kafka/model/kafka/certmanager/CaCertRef.java
This file contains hidden or 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,70 @@ | ||
| /* | ||
| * Copyright Strimzi authors. | ||
| * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). | ||
| */ | ||
| package io.strimzi.api.kafka.model.kafka.certmanager; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
| import io.strimzi.api.kafka.model.common.Constants; | ||
| import io.strimzi.api.kafka.model.common.UnknownPropertyPreserving; | ||
| import io.strimzi.crdgenerator.annotations.Description; | ||
| import io.sundr.builder.annotations.Buildable; | ||
| import lombok.EqualsAndHashCode; | ||
| import lombok.ToString; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| @Description("Reference to the Secret containing the CA certificate (public key) " + | ||
| "that trusts certificates issued by cert-manager. " + | ||
| "This only applies if the CA type is set to `cert-manager`.") | ||
| @Buildable( | ||
| editableEnabled = false, | ||
| builderPackage = Constants.FABRIC8_KUBERNETES_API | ||
| ) | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| @JsonPropertyOrder({ "secretName", "certificate" }) | ||
| @EqualsAndHashCode | ||
| @ToString | ||
| public class CaCertRef implements UnknownPropertyPreserving { | ||
| private String secretName; | ||
| private String certificate; | ||
| private Map<String, Object> additionalProperties; | ||
|
|
||
| @Description("The name of the Secret. " + | ||
| "Required.") | ||
|
tinaselenge marked this conversation as resolved.
|
||
| @JsonProperty(required = true) | ||
| public String getSecretName() { | ||
| return secretName; | ||
| } | ||
|
|
||
| public void setSecretName(String secretName) { | ||
| this.secretName = secretName; | ||
| } | ||
|
|
||
| @Description("The key under which the CA certificate is stored in the Secret. " + | ||
| "Required.") | ||
| @JsonProperty(required = true) | ||
| public String getCertificate() { | ||
| return certificate; | ||
| } | ||
|
|
||
| public void setCertificate(String certificate) { | ||
| this.certificate = certificate; | ||
| } | ||
|
|
||
| @Override | ||
| public Map<String, Object> getAdditionalProperties() { | ||
| return this.additionalProperties != null ? this.additionalProperties : Map.of(); | ||
| } | ||
|
|
||
| @Override | ||
| public void setAdditionalProperty(String name, Object value) { | ||
| if (this.additionalProperties == null) { | ||
| this.additionalProperties = new HashMap<>(2); | ||
| } | ||
| this.additionalProperties.put(name, value); | ||
| } | ||
| } | ||
70 changes: 70 additions & 0 deletions
70
api/src/main/java/io/strimzi/api/kafka/model/kafka/certmanager/CertManager.java
This file contains hidden or 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,70 @@ | ||
| /* | ||
| * Copyright Strimzi authors. | ||
| * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). | ||
| */ | ||
| package io.strimzi.api.kafka.model.kafka.certmanager; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
| import io.strimzi.api.kafka.model.common.Constants; | ||
| import io.strimzi.api.kafka.model.common.UnknownPropertyPreserving; | ||
| import io.strimzi.crdgenerator.annotations.Description; | ||
| import io.sundr.builder.annotations.Buildable; | ||
| import lombok.EqualsAndHashCode; | ||
| import lombok.ToString; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| @Description("Configuration for using cert-manager to issue certificates. " + | ||
| "This only applies if the CA type is set to `cert-manager`.") | ||
| @Buildable( | ||
| editableEnabled = false, | ||
| builderPackage = Constants.FABRIC8_KUBERNETES_API | ||
| ) | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| @JsonPropertyOrder({ "issuerRef", "caCertRef" }) | ||
| @EqualsAndHashCode | ||
| @ToString | ||
| public class CertManager implements UnknownPropertyPreserving { | ||
| private IssuerRef issuerRef; | ||
| private CaCertRef caCertRef; | ||
| private Map<String, Object> additionalProperties; | ||
|
|
||
| @Description("Reference to the cert-manager issuer to use for issuing certificates. " + | ||
| "Required.") | ||
|
tinaselenge marked this conversation as resolved.
|
||
| @JsonProperty(required = true) | ||
| public IssuerRef getIssuerRef() { | ||
| return issuerRef; | ||
| } | ||
|
|
||
| public void setIssuerRef(IssuerRef issuerRef) { | ||
| this.issuerRef = issuerRef; | ||
| } | ||
|
|
||
| @Description("Reference to the Secret containing the CA certificate (public key) " + | ||
| "that trusts certificates issued by cert-manager. " + | ||
| "Required.") | ||
| @JsonProperty(required = true) | ||
| public CaCertRef getCaCertRef() { | ||
| return caCertRef; | ||
| } | ||
|
scholzj marked this conversation as resolved.
|
||
|
|
||
| public void setCaCertRef(CaCertRef caCertRef) { | ||
| this.caCertRef = caCertRef; | ||
| } | ||
|
|
||
| @Override | ||
| public Map<String, Object> getAdditionalProperties() { | ||
| return this.additionalProperties != null ? this.additionalProperties : Map.of(); | ||
| } | ||
|
|
||
| @Override | ||
| public void setAdditionalProperty(String name, Object value) { | ||
| if (this.additionalProperties == null) { | ||
| this.additionalProperties = new HashMap<>(2); | ||
| } | ||
| this.additionalProperties.put(name, value); | ||
| } | ||
| } | ||
47 changes: 47 additions & 0 deletions
47
api/src/main/java/io/strimzi/api/kafka/model/kafka/certmanager/IssuerKind.java
This file contains hidden or 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,47 @@ | ||
| /* | ||
| * Copyright Strimzi authors. | ||
| * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). | ||
| */ | ||
| package io.strimzi.api.kafka.model.kafka.certmanager; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import com.fasterxml.jackson.annotation.JsonValue; | ||
|
|
||
| /** | ||
| * The type of Issuer to use for Certificate resources that will be reconciled by cert-manager. | ||
| * cert-manager supports two kinds: Issuer and ClusterIssuer. | ||
| */ | ||
| public enum IssuerKind { | ||
|
tinaselenge marked this conversation as resolved.
|
||
| /** | ||
| * Issuer kind that is referenced by Certificate resources in the same namespace | ||
| */ | ||
| ISSUER, | ||
| /** | ||
| * Issuer that kind that can be referenced by Certificate resources in any namespace | ||
| */ | ||
| CLUSTER_ISSUER; | ||
|
tinaselenge marked this conversation as resolved.
|
||
|
|
||
| @JsonCreator | ||
| public static IssuerKind forValue(String value) { | ||
| switch (value) { | ||
| case "Issuer": | ||
| return ISSUER; | ||
| case "ClusterIssuer": | ||
| return CLUSTER_ISSUER; | ||
| default: | ||
| throw new IllegalArgumentException("Unknown IssuerKind: " + value + ". Must be 'Issuer' or 'ClusterIssuer'."); | ||
| } | ||
| } | ||
|
|
||
| @JsonValue | ||
| public String toValue() { | ||
| switch (this) { | ||
| case ISSUER: | ||
| return "Issuer"; | ||
| case CLUSTER_ISSUER: | ||
| return "ClusterIssuer"; | ||
| default: | ||
| return null; | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.