-
-
Notifications
You must be signed in to change notification settings - Fork 4
feat: TLS support #774
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
Merged
Merged
feat: TLS support #774
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a457de3
feat: tls support
dervoeti 4357730
fix: python formatting
dervoeti 94789fe
fix: pre-commit lint fix
dervoeti d5a906d
Update docs/modules/opa/pages/usage-guide/tls.adoc
dervoeti 4da8d2b
Update docs/modules/opa/pages/usage-guide/tls.adoc
dervoeti 176096f
Update docs/modules/opa/pages/usage-guide/tls.adoc
dervoeti c3b732b
Update tests/templates/kuttl/smoke/09-install-secretclass.yaml.j2
dervoeti 700af81
Update tests/templates/kuttl/smoke/10-install-opa.yaml.j2
dervoeti 2897872
refactor: streamline TLS configuration checks and add tls_enabled method
dervoeti ee64394
feat: test OPA using HTTP in smoke test as well
dervoeti 689165e
chore: newline at end of file
dervoeti 5e04a5c
feat: make smoke test use tls dimension
dervoeti 0a20776
chore: newline at end of file
dervoeti 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| = Enabling TLS Encryption | ||
| :description: Learn how to enable TLS encryption for your OPA cluster to secure client connections. | ||
|
|
||
| TLS encryption for securing connections between clients and the OPA server can be configured in the `OpaCluster` resource. When TLS is enabled, OPA will serve requests over HTTPS instead of HTTP. | ||
|
|
||
| == Overview | ||
|
|
||
| TLS encryption in OPA is disabled by default. To enable it, you need to: | ||
|
|
||
| 1. Create a `SecretClass` that provides TLS certificates | ||
| 2. Reference the `SecretClass` in your `OpaCluster` specification | ||
dervoeti marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The operator integrates with the xref:secret-operator:index.adoc[Secret Operator] to automatically provision and mount TLS certificates to the OPA pods. | ||
dervoeti marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| == Configuration | ||
|
|
||
| === Creating a SecretClass | ||
|
|
||
| First, create a `SecretClass` that will provide TLS certificates. Here's an example using xref:secret-operator:secretclass.adoc#backend-autotls[autoTls]: | ||
|
|
||
| [source,yaml] | ||
| ---- | ||
| apiVersion: secrets.stackable.tech/v1alpha1 | ||
| kind: SecretClass | ||
| metadata: | ||
| name: opa-tls | ||
| spec: | ||
| backend: | ||
| autoTls: | ||
| ca: | ||
| autoGenerate: true | ||
| secret: | ||
| name: opa-tls-ca | ||
| namespace: default | ||
| ---- | ||
|
|
||
| This SecretClass uses the autoTls backend, which automatically generates a Certificate Authority (CA) and signs certificates for your OPA cluster. | ||
|
|
||
| Similarly, you can also use xref:secret-operator:secretclass.adoc#backend[other backends] supported by Secret Operator. | ||
|
|
||
| === Enabling TLS in OpaCluster | ||
|
|
||
| Once you have a SecretClass, enable TLS in your OpaCluster by setting the `.spec.clusterConfig.tls.serverSecretClass` field: | ||
|
|
||
| [source,yaml] | ||
| ---- | ||
| kind: OpaCluster | ||
| name: opa-with-tls | ||
| spec: | ||
| clusterConfig: | ||
| tls: | ||
| serverSecretClass: opa-tls # <1> | ||
| ---- | ||
| <1> Reference the SecretClass created above | ||
|
|
||
| == Discovery ConfigMap | ||
|
|
||
| The operator automatically creates a discovery ConfigMap, with the same name as the OPA cluster, that contains the connection URL for your cluster. When TLS is enabled, this ConfigMap will contain an HTTPS URL and the SecretClass name: | ||
|
|
||
| [source,yaml] | ||
| ---- | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: opa-with-tls | ||
| data: | ||
| OPA: "https://opa-with-tls.default.svc.cluster.local:8443/" | ||
| OPA_SECRET_CLASS: "opa-tls" | ||
| ---- | ||
|
|
||
| Applications can use this ConfigMap to discover and connect to the OPA cluster automatically. | ||
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
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
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.