Skip to content

Commit f780f87

Browse files
committed
review updates
1 parent 1e815cc commit f780f87

File tree

6 files changed

+42
-44
lines changed

6 files changed

+42
-44
lines changed

api/v1alpha1/common.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ type MonitoringWithTLogConfig struct {
4343
// Configuration for Rekor transparency log monitoring
4444
//+optional
4545
TLog TlogMonitoring `json:"tlog"`
46+
// TUF service configuration
47+
//+optional
48+
Tuf TufService `json:"tuf,omitempty"`
4649
}
4750

4851
// TrillianService configuration to connect Trillian server
@@ -66,7 +69,6 @@ type TufService struct {
6669
// Port of TUF Server End point
6770
//+kubebuilder:validation:Minimum:=1
6871
//+kubebuilder:validation:Maximum:=65535
69-
//+kubebuilder:default:=8080
7072
//+optional
7173
Port *int32 `json:"port,omitempty"`
7274
}

api/v1alpha1/rekor_types.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ type RekorSpec struct {
1919
// Trillian service configuration
2020
//+kubebuilder:default:={port: 8091}
2121
Trillian TrillianService `json:"trillian,omitempty"`
22-
// TUF service configuration
23-
//+kubebuilder:default:={port: 8080}
24-
//+optional
25-
Tuf TufService `json:"tuf,omitempty"`
2622
// Define whether you want to export service or not
2723
ExternalAccess ExternalAccess `json:"externalAccess,omitempty"`
2824
//Enable Service monitors for rekor

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/rhtas.redhat.com_rekors.yaml

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,19 @@ spec:
12811281
required:
12821282
- enabled
12831283
type: object
1284+
tuf:
1285+
description: TUF service configuration
1286+
properties:
1287+
address:
1288+
description: Address to TUF Server End point
1289+
type: string
1290+
port:
1291+
description: Port of TUF Server End point
1292+
format: int32
1293+
maximum: 65535
1294+
minimum: 1
1295+
type: integer
1296+
type: object
12841297
required:
12851298
- enabled
12861299
type: object
@@ -2705,22 +2718,6 @@ spec:
27052718
- name
27062719
type: object
27072720
x-kubernetes-map-type: atomic
2708-
tuf:
2709-
default:
2710-
port: 8080
2711-
description: TUF service configuration
2712-
properties:
2713-
address:
2714-
description: Address to TUF Server End point
2715-
type: string
2716-
port:
2717-
default: 8080
2718-
description: Port of TUF Server End point
2719-
format: int32
2720-
maximum: 65535
2721-
minimum: 1
2722-
type: integer
2723-
type: object
27242721
type: object
27252722
status:
27262723
description: RekorStatus defines the observed state of Rekor

config/crd/bases/rhtas.redhat.com_securesigns.yaml

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3894,6 +3894,19 @@ spec:
38943894
required:
38953895
- enabled
38963896
type: object
3897+
tuf:
3898+
description: TUF service configuration
3899+
properties:
3900+
address:
3901+
description: Address to TUF Server End point
3902+
type: string
3903+
port:
3904+
description: Port of TUF Server End point
3905+
format: int32
3906+
maximum: 65535
3907+
minimum: 1
3908+
type: integer
3909+
type: object
38973910
required:
38983911
- enabled
38993912
type: object
@@ -5325,22 +5338,6 @@ spec:
53255338
- name
53265339
type: object
53275340
x-kubernetes-map-type: atomic
5328-
tuf:
5329-
default:
5330-
port: 8080
5331-
description: TUF service configuration
5332-
properties:
5333-
address:
5334-
description: Address to TUF Server End point
5335-
type: string
5336-
port:
5337-
default: 8080
5338-
description: Port of TUF Server End point
5339-
format: int32
5340-
maximum: 65535
5341-
minimum: 1
5342-
type: integer
5343-
type: object
53445341
type: object
53455342
trillian:
53465343
description: TrillianSpec defines the desired state of Trillian

internal/controller/rekor/actions/monitor/statefulset.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/securesign/operator/internal/action"
1313
"github.com/securesign/operator/internal/constants"
1414
"github.com/securesign/operator/internal/controller/rekor/actions"
15-
tufConstants "github.com/securesign/operator/internal/controller/tuf/constants"
1615
"github.com/securesign/operator/internal/labels"
1716
cutils "github.com/securesign/operator/internal/utils"
1817
"github.com/securesign/operator/internal/utils/kubernetes"
@@ -54,11 +53,7 @@ func (i statefulSetAction) Handle(ctx context.Context, instance *rhtasv1alpha1.R
5453
result controllerutil.OperationResult
5554
)
5655

57-
switch instance.Spec.Tuf.Address {
58-
case "":
59-
instance.Spec.Tuf.Address = fmt.Sprintf("%s.%s.svc", tufConstants.DeploymentName, instance.Namespace)
60-
}
61-
tufServerHost := fmt.Sprintf("http://%s", instance.Spec.Tuf.Address)
56+
tufServerHost := i.resolveTufUrl(instance)
6257
rekorServerHost := fmt.Sprintf("http://%s.%s.svc", actions.ServerComponentName, instance.Namespace)
6358

6459
labels := labels.For(actions.MonitorComponentName, actions.MonitorStatefulSetName, instance.Name)
@@ -99,6 +94,17 @@ func (i statefulSetAction) Handle(ctx context.Context, instance *rhtasv1alpha1.R
9994
return i.Continue()
10095
}
10196

97+
func (i statefulSetAction) resolveTufUrl(instance *rhtasv1alpha1.Rekor) string {
98+
if instance.Spec.Monitoring.Tuf.Address != "" {
99+
url := instance.Spec.Monitoring.Tuf.Address
100+
if instance.Spec.Monitoring.Tuf.Port != nil {
101+
url = fmt.Sprintf("%s:%d", url, *instance.Spec.Monitoring.Tuf.Port)
102+
}
103+
return url
104+
}
105+
return fmt.Sprintf("http://tuf.%s.svc", instance.Namespace)
106+
}
107+
102108
func (i statefulSetAction) ensureMonitorStatefulSet(instance *rhtasv1alpha1.Rekor, sa string, labels map[string]string, rekorServerHost string, tufServerHost string) func(*v1.StatefulSet) error {
103109
return func(ss *v1.StatefulSet) error {
104110

0 commit comments

Comments
 (0)