Skip to content
Merged
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
61 changes: 50 additions & 11 deletions api/config/v2alpha2/projectconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,25 +222,28 @@ type OPAControlPlaneConfig struct {
SystemDatasourceChanged string `json:"systemDatasourceChanged,omitempty"`
// LibraryDatasourceChanged is the URL to be called when a library datasource has changed.
LibraryDatasourceChanged string `json:"libraryDatasourceChanged,omitempty"`

// DecisionAPIConfig contains configuration for which api OPAs should use to and how
DecisionAPIConfig *DecisionAPIConfig `json:"decisionAPIConfig,omitempty"`
}

// UserCredentialHandler defines the structure of possible user credential handlers
type UserCredentialHandler struct {
S3 *S3Handler `json:"s3,omitempty"`
S3 *S3Handler `json:"s3,omitempty" yaml:"s3,omitempty"`
}

// S3Handler defines the structure for S3 handler configuration.
type S3Handler struct {
Bucket string `json:"bucket"`
URL string `json:"url"`
Region string `json:"region"`
AccessKeyID string `json:"accessKeyID"`
SecretAccessKey string `json:"secretAccessKey"`
Bucket string `json:"bucket" yaml:"bucket"`
URL string `json:"url" yaml:"url"`
Region string `json:"region" yaml:"region"`
AccessKeyID string `json:"accessKeyID" yaml:"accessKeyID"`
SecretAccessKey string `json:"secretAccessKey" yaml:"secretAccessKey"`
}

// BundleObjectStorage defines the structure for object storage configuration used by bundles
type BundleObjectStorage struct {
S3 *S3ObjectStorage `json:"s3,omitempty"`
S3 *S3ObjectStorage `json:"s3,omitempty" yaml:"s3,omitempty"`
}

// S3ObjectStorage defines the structure for S3 object storage configuration.
Expand All @@ -263,14 +266,50 @@ type GitCredentials struct {

// OPAConfig contains default configuration for the opa config generated by the styra-controller
type OPAConfig struct {
DecisionLogs DecisionLog `json:"decision_logs"`
PersistBundle bool `json:"persist_bundle,omitempty"`
PersistBundleDirectory string `json:"persist_bundle_directory,omitempty"`
DecisionLogs DecisionLog `json:"decisionLogs,omitempty" yaml:"decisionLogs,omitempty"`
Metrics MetricsConfig `json:"metrics,omitempty" yaml:"metrics,omitempty"`
PersistBundle bool `json:"persist_bundle,omitempty" yaml:"persist_bundle,omitempty"`
PersistBundleDirectory string `json:"persist_bundle_directory,omitempty" yaml:"persist_bundle_directory,omitempty"` //nolint:lll
BundleServer *OPABundleServer `json:"bundleServer,omitempty" yaml:"bundleServer,omitempty"`
}

// OPABundleServer contains configuration for the OPA bundle server
type OPABundleServer struct {
URL string `json:"url,omitempty" yaml:"url,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
}

// MetricsConfig contains configuration for OPA metrics
type MetricsConfig struct {
Prometheus PrometheusMetricsConfig `json:"prometheus,omitempty" yaml:"prometheus,omitempty"`
}

// PrometheusMetricsConfig contains configuration for Prometheus metrics
type PrometheusMetricsConfig struct {
HTTP HTTPMetricsConfig `json:"http,omitempty" yaml:"http,omitempty"`
}

// HTTPMetricsConfig contains configuration for HTTP metrics
type HTTPMetricsConfig struct {
Buckets []float64 `json:"buckets,omitempty" yaml:"buckets,omitempty"`
}

// DecisionLog contains configuration for the decision logs
type DecisionLog struct {
RequestContext RequestContext `json:"request_context"`
RequestContext RequestContext `json:"requestContext,omitempty"`
}

// DecisionAPIConfig contains configuration for decision log dispatch
type DecisionAPIConfig struct {
ServiceURL string `json:"serviceUrl,omitempty"`
Reporting DecisionLogReporting `json:"reporting,omitempty"`
}

// DecisionLogReporting contains configuration for decision log reporting
type DecisionLogReporting struct {
MaxDelaySeconds int `json:"maxDelaySeconds,omitempty" yaml:"maxDelaySeconds,omitempty"`
MinDelaySeconds int `json:"minDelaySeconds,omitempty" yaml:"minDelaySeconds,omitempty"`
UploadSizeLimitBytes int `json:"uploadSizeLimitBytes,omitempty" yaml:"uploadSizeLimitBytes,omitempty"`
}

// RequestContext contains configuration for the RequestContext in the decision logs
Expand Down
109 changes: 109 additions & 0 deletions api/config/v2alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 39 additions & 2 deletions config/default/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,52 @@ systemUserRoles:

#decisionsExporter:

opa:
bundleServer:
url: https://minio-host
path: /ocp
metrics:
prometheus:
http:
buckets:
- 0.0005
- 0.001
- 0.002
- 0.003
- 0.004
- 0.005
- 0.006
- 0.007
- 0.008
- 0.009
- 0.01
- 0.02
- 0.03
- 0.04
- 0.05
- 0.06
- 0.07
- 0.08
- 0.09
- 0.1
- 0.2
- 0.3
- 0.4
- 0.5
- 0.6
- 0.7
- 0.8
- 0.9
- 1

#activityExporter:

podRestart:
slpRestart:
enabled: true
deploymentType: StatefulSet


#opa:
# opa:
# decision_logs:
# request_context:
# http:
Expand Down
2 changes: 1 addition & 1 deletion docs/apis/styra/v1alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -458,5 +458,5 @@ GitRepo
<hr/>
<p><em>
Generated with <code>gen-crd-api-reference-docs</code>
on git commit <code>b550add7</code>.
on git commit <code>4901ef1</code>.
</em></p>
21 changes: 19 additions & 2 deletions docs/apis/styra/v1beta1.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ the configuration of the System are updated in Styra.</p>
</td>
</tr><tr><td><p>&#34;SystemSourceUpdated&#34;</p></td>
<td><p>ConditionTypeSystemSourceUpdated is a ConditionType used when
the datasources of the System are updated in Styra.</p>
the source for the System is updated in OCP.</p>
</td>
</tr></tbody>
</table>
Expand Down Expand Up @@ -457,13 +457,21 @@ secret referenced by the System resource under Spec.SourceControl.Origin.Credent
<td><p>EventErrorCredentialsSecretNotFound is an EventType used when the controller gets a 404 when fetching
secret referenced by the System resource under Spec.SourceControl.Origin.CredentialsSecretName.</p>
</td>
</tr><tr><td><p>&#34;ErrorDeleteBundleInOCP&#34;</p></td>
<td><p>EventErrorDeleteBundleInOCP is an EventType used when the controller fails
to delete the System&rsquo;s Bundle in OCP.</p>
</td>
</tr><tr><td><p>&#34;ErrorDeleteDatasource&#34;</p></td>
<td><p>EventErrorDeleteDatasource is an EventType used when the controller fails to delete a datasource in Styra.</p>
</td>
</tr><tr><td><p>&#34;ErrorDeleteDefaultPolicy&#34;</p></td>
<td><p>EventErrorDeleteDefaultPolicy is an EventType used when the controller fails to delete the default policy
in the System in Styra.</p>
</td>
</tr><tr><td><p>&#34;ErrorDeleteSourceInOCP&#34;</p></td>
<td><p>EventErrorDeleteSourceInOCP is an EventType used when the controller fails
to delete the System&rsquo;s Source in OCP.</p>
</td>
</tr><tr><td><p>&#34;ErrorDeleteSystemInStyra&#34;</p></td>
<td><p>EventErrorDeleteSystemInStyra is an EventType used when the controller fails
to delete the System in Styra.</p>
Expand Down Expand Up @@ -542,9 +550,15 @@ the finalizer on the System resource.</p>
<td><p>EventErrorStatefulSetNotFound is an EventType used when a system with &lsquo;localPlane&rsquo; enabled but which
does not have a StatefulSet created for the SLP.</p>
</td>
</tr><tr><td><p>&#34;ErrorUpdateBundle&#34;</p></td>
<td><p>EventErrorUpdateBundle is an EventType used when the controller fails to update the Source in OCP.</p>
</td>
</tr><tr><td><p>&#34;ErrorUpdateOPAConfigMap&#34;</p></td>
<td><p>EventErrorUpdateOPAConfigMap is an EventType used when the controller fails to update the OPA ConfigMap.</p>
</td>
</tr><tr><td><p>&#34;ErrorUpdateOPASecret&#34;</p></td>
<td><p>EventErrorUpdateOPASecret is an EventType used when the controller fails to update the OPA ConfigMap.</p>
</td>
</tr><tr><td><p>&#34;ErrorUpdateOPATokenSecret&#34;</p></td>
<td><p>EventErrorUpdateOPATokenSecret is an EventType used when the controller fails to update the OPA token Secret.</p>
</td>
Expand All @@ -555,6 +569,9 @@ for a user in Styra.</p>
</tr><tr><td><p>&#34;ErrorUpdateSLPConfigMap&#34;</p></td>
<td><p>EventErrorUpdateSLPConfigmap is an EventType used when the controller fails to update the SLP ConfigMap.</p>
</td>
</tr><tr><td><p>&#34;ErrorUpdateSource&#34;</p></td>
<td><p>EventErrorUpdateSource is an EventType used when the controller fails to update the Source in OCP.</p>
</td>
</tr><tr><td><p>&#34;ErrorUpdateStatus&#34;</p></td>
<td><p>EventErrorUpdateStatus is an EventType used when the controller fails to update
the status of the System resource.</p>
Expand Down Expand Up @@ -1407,5 +1424,5 @@ System.</p>
<hr/>
<p><em>
Generated with <code>gen-crd-api-reference-docs</code>
on git commit <code>b550add7</code>.
on git commit <code>4901ef1</code>.
</em></p>
Loading
Loading