Skip to content

Commit

Permalink
Merge pull request #273 from authzed/capath
Browse files Browse the repository at this point in the history
allow configuring the filepath for the ca from the secret
  • Loading branch information
ecordell authored Nov 23, 2023
2 parents b20aeb9 + c94d78b commit c4db624
Show file tree
Hide file tree
Showing 3 changed files with 244 additions and 218 deletions.
2 changes: 2 additions & 0 deletions e2e/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ var _ = Describe("SpiceDBClusters", func() {
"cmd": spicedbCmd,
"tlsSecretName": "spicedb-grpc-tls",
"dispatchUpstreamCASecretName": "spicedb-grpc-tls",
"dispatchUpstreamCAFilePath": "ca.crt",
"serviceAccountName": "spicedb-non-default",
"extraServiceAccountAnnotations": "authzed.com/e2e=true",
"datastoreConnpoolReadMinOpen": 1,
Expand Down Expand Up @@ -577,6 +578,7 @@ var _ = Describe("SpiceDBClusters", func() {
"datastoreEngine": "postgres",
"tlsSecretName": "spicedb-grpc-tls",
"dispatchUpstreamCASecretName": "spicedb-grpc-tls",
"dispatchUpstreamCAFilePath": "ca.crt",
}
cluster.Spec.Version = "v1.13.0"

Expand Down
5 changes: 4 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var (
projectAnnotations = newBoolOrStringKey("projectAnnotations", true)
tlsSecretNameKey = newStringKey("tlsSecretName")
dispatchCAKey = newStringKey("dispatchUpstreamCASecretName")
dispatchCAFilePathKey = newKey("dispatchUpstreamCAFilePath", "tls.crt")
dispatchEnabledKey = newBoolOrStringKey("dispatchEnabled", true)
telemetryCAKey = newStringKey("telemetryCASecretName")
envPrefixKey = newKey("envPrefix", "SPICEDB")
Expand Down Expand Up @@ -149,6 +150,7 @@ type SpiceConfig struct {
TLSSecretName string
DispatchEnabled bool
DispatchUpstreamCASecretName string
DispatchUpstreamCASecretPath string
TelemetryTLSCASecretName string
SecretName string
ExtraPodLabels map[string]string
Expand Down Expand Up @@ -182,6 +184,7 @@ func NewConfig(cluster *v1alpha1.SpiceDBCluster, globalConfig *OperatorConfig, s
TLSSecretName: tlsSecretNameKey.pop(config),
ServiceAccountName: serviceAccountNameKey.pop(config),
DispatchUpstreamCASecretName: dispatchCAKey.pop(config),
DispatchUpstreamCASecretPath: dispatchCAFilePathKey.pop(config),
TelemetryTLSCASecretName: telemetryCAKey.pop(config),
EnvPrefix: envPrefixKey.pop(config),
SpiceDBCmd: spiceDBCmdKey.pop(config),
Expand Down Expand Up @@ -347,7 +350,7 @@ func NewConfig(cluster *v1alpha1.SpiceDBCluster, globalConfig *OperatorConfig, s
}

if len(spiceConfig.DispatchUpstreamCASecretName) > 0 && spiceConfig.DispatchEnabled {
passthroughConfig["dispatchUpstreamCAPath"] = "/dispatch-tls/tls.crt"
passthroughConfig["dispatchUpstreamCAPath"] = "/dispatch-tls/" + spiceConfig.DispatchUpstreamCASecretPath
}

if len(spiceConfig.TelemetryTLSCASecretName) > 0 {
Expand Down
Loading

0 comments on commit c4db624

Please sign in to comment.