Skip to content
Open
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
9 changes: 8 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ var (
httpTLSCertPathKey = newKey("httpTLSCertPath", DefaultTLSCrtFile)
dashboardTLSKeyPathKey = newKey("dashboardTLSKeyPath", DefaultTLSKeyFile)
dashboardTLSCertPathKey = newKey("dashboardTLSCertPath", DefaultTLSCrtFile)
skipTLSWarningKey = newBoolOrStringKey("skipTLSWarning", false)
)

// Warning is an issue with configuration that we will report as undesirable
Expand Down Expand Up @@ -169,6 +170,7 @@ type SpiceConfig struct {
EnvPrefix string
SpiceDBCmd string
TLSSecretName string
SkipTLSWarning bool
DispatchEnabled bool
DispatchUpstreamCASecretName string
DispatchUpstreamCASecretPath string
Expand Down Expand Up @@ -272,6 +274,11 @@ func NewConfig(cluster *v1alpha1.SpiceDBCluster, globalConfig *OperatorConfig, s
errs = append(errs, err)
}

spiceConfig.SkipTLSWarning, err = skipTLSWarningKey.pop(config)
if err != nil {
errs = append(errs, err)
}

// can't run dispatch with memory datastore
if datastoreEngine == "memory" {
spiceConfig.DispatchEnabled = false
Expand Down Expand Up @@ -435,7 +442,7 @@ func NewConfig(cluster *v1alpha1.SpiceDBCluster, globalConfig *OperatorConfig, s
for _, k := range passthroughKeys {
passthroughConfig[k.key] = k.pop(config)
}
} else {
} else if !spiceConfig.SkipTLSWarning {
warnings = append(warnings, fmt.Errorf("no TLS configured, consider setting %q", "tlsSecretName"))
}

Expand Down
85 changes: 85 additions & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,91 @@ func TestNewConfig(t *testing.T) {
},
wantPortCount: 3,
},
{
name: "memory with skipTLSWarning",
args: args{
cluster: v1alpha1.ClusterSpec{
SecretRef: "test-secret",
Config: json.RawMessage(`
{
"datastoreEngine": "memory",
"skipTLSWarning": true
}
`),
},
globalConfig: OperatorConfig{
ImageName: "image",
UpdateGraph: updates.UpdateGraph{
Channels: []updates.Channel{
{
Name: "memory",
Metadata: map[string]string{"datastore": "memory", "default": "true"},
Nodes: []updates.State{
{ID: "v1", Tag: "v1"},
},
Edges: map[string][]string{"v1": {}},
},
},
},
},
secret: &corev1.Secret{Data: map[string][]byte{
"preshared_key": []byte("psk"),
}},
},
wantWarnings: nil,
want: &Config{
MigrationConfig: MigrationConfig{
MigrationLogLevel: "debug",
DatastoreEngine: "memory",
DatastoreURI: "",
TargetSpiceDBImage: "image:v1",
EnvPrefix: "SPICEDB",
SpiceDBCmd: "spicedb",
TargetMigration: "head",
SpiceDBVersion: &v1alpha1.SpiceDBVersion{
Name: "v1",
Channel: "memory",
Attributes: []v1alpha1.SpiceDBVersionAttributes{
v1alpha1.SpiceDBVersionAttributesMigration,
},
},
},
SpiceConfig: SpiceConfig{
LogLevel: "info",
SkipMigrations: false,
SkipTLSWarning: true,
Name: "test",
Namespace: "test",
UID: "1",
Replicas: 1,
PresharedKey: "psk",
EnvPrefix: "SPICEDB",
SpiceDBCmd: "spicedb",
ServiceAccountName: "test",
DispatchEnabled: false,
DispatchUpstreamCASecretPath: "tls.crt",
DatastoreURIRef: ResolvedCredentialRef{SecretName: "test-secret", Key: "datastore_uri"},
PresharedKeyRef: ResolvedCredentialRef{SecretName: "test-secret", Key: "preshared_key"},
MigrationSecretsRef: ResolvedCredentialRef{SecretName: "test-secret", Key: "migration_secrets"},
ProjectLabels: true,
ProjectAnnotations: true,
Passthrough: map[string]string{
"datastoreEngine": "memory",
"dispatchClusterEnabled": "false",
"terminationLogPath": "/dev/termination-log",
},
},
},
wantEnvs: []string{
"SPICEDB_POD_NAME=FIELD_REF=metadata.name",
"SPICEDB_LOG_LEVEL=info",
"SPICEDB_GRPC_PRESHARED_KEY=preshared_key",
"SPICEDB_DATASTORE_ENGINE=memory",
"SPICEDB_DISPATCH_CLUSTER_ENABLED=false",
"SPICEDB_TERMINATION_LOG_PATH=/dev/termination-log",
},
wantPortCount: 3,
},
{
name: "set image with tag explicitly",
args: args{
Expand Down
Loading