Skip to content
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

Migrate from phases to conditions #188

Merged
merged 4 commits into from
Feb 15, 2024
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
12 changes: 0 additions & 12 deletions api/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@ package v1alpha1

import v1 "k8s.io/api/core/v1"

type Phase string

const (
PhaseNone Phase = ""
PhaseCreating Phase = "Creating"

PhaseInitialize Phase = "Initialization"
PhaseReady Phase = "Ready"
PhasePending Phase = "Pending"
PhaseError Phase = "Error"
)

type ExternalAccess struct {
// If set to true, the Operator will create an Ingress or a Route resource.
//For the plain Ingress there is no TLS configuration provided Route object uses "edge" termination by default.
Expand Down
3 changes: 1 addition & 2 deletions api/v1alpha1/ctlog_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ type CTlogSpec struct {

// CTlogStatus defines the observed state of CTlog component
type CTlogStatus struct {
Phase Phase `json:"phase"`
// +listType=map
// +listMapKey=type
// +patchStrategy=merge
Expand All @@ -46,7 +45,7 @@ type CTlogStatus struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`,description="The component phase"
//+kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`,description="The component status"

// CTlog is the Schema for the ctlogs API
type CTlog struct {
Expand Down
5 changes: 2 additions & 3 deletions api/v1alpha1/fulcio_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ type OIDCIssuer struct {

// FulcioStatus defines the observed state of Fulcio
type FulcioStatus struct {
Url string `json:"url,omitempty"`
Phase Phase `json:"phase,omitempty"`
Url string `json:"url,omitempty"`
// +listType=map
// +listMapKey=type
// +patchStrategy=merge
Expand All @@ -89,7 +88,7 @@ type FulcioStatus struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`,description="The component phase"
//+kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`,description="The component status"
//+kubebuilder:printcolumn:name="URL",type=string,JSONPath=`.status.url`,description="The component url"

// Fulcio is the Schema for the fulcios API
Expand Down
3 changes: 1 addition & 2 deletions api/v1alpha1/rekor_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ type BackFillRedis struct {
// RekorStatus defines the observed state of Rekor
type RekorStatus struct {
Url string `json:"url,omitempty"`
Phase Phase `json:"phase,omitempty"`
RekorSearchUIUrl string `json:"rekorSearchUIUrl,omitempty"`
// +listType=map
// +listMapKey=type
Expand All @@ -67,7 +66,7 @@ type RekorStatus struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`,description="The component phase"
//+kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`,description="The component status"
//+kubebuilder:printcolumn:name="URL",type=string,JSONPath=`.status.url`,description="The component url"

// Rekor is the Schema for the rekors API
Expand Down
32 changes: 25 additions & 7 deletions api/v1alpha1/securesign_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,35 @@ type SecuresignSpec struct {

// SecuresignStatus defines the observed state of Securesign
type SecuresignStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Trillian string `json:"trillian"`
Fulcio string `json:"fulcio"`
Tuf string `json:"tuf"`
CTlog string `json:"ctlog"`
Rekor string `json:"rekor"`
// +listType=map
// +listMapKey=type
// +patchStrategy=merge
// +patchMergeKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
RekorStatus SecuresignRekorStatus `json:"rekor,omitempty"`
FulcioStatus SecuresignFulcioStatus `json:"fulcio,omitempty"`
TufStatus SecuresignTufStatus `json:"tuf,omitempty"`
}

type SecuresignRekorStatus struct {
Url string `json:"url,omitempty"`
}

type SecuresignFulcioStatus struct {
Url string `json:"url,omitempty"`
}

type SecuresignTufStatus struct {
Url string `json:"url,omitempty"`
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need a trillian type?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, I exposed fulcio, tuf and rekor because they provide URL for users. Trillian is just a backend service that is never touched by end user.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`,description="The Deployment status"
//+kubebuilder:printcolumn:name="Rekor URL",type=string,JSONPath=`.status.rekor.url`,description="The rekor url"
//+kubebuilder:printcolumn:name="Fulcio URL",type=string,JSONPath=`.status.fulcio.url`,description="The fulcio url"
//+kubebuilder:printcolumn:name="Tuf URL",type=string,JSONPath=`.status.tuf.url`,description="The tuf url"

// Securesign is the Schema for the securesigns API
type Securesign struct {
Expand Down
3 changes: 1 addition & 2 deletions api/v1alpha1/trillian_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ type TrillianDB struct {

// TrillianStatus defines the observed state of Trillian
type TrillianStatus struct {
Phase Phase `json:"phase"`
// +listType=map
// +listMapKey=type
// +patchStrategy=merge
Expand All @@ -50,7 +49,7 @@ type TrillianStatus struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`,description="The component phase"
//+kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`,description="The component status"

// Trillian is the Schema for the trillians API
type Trillian struct {
Expand Down
5 changes: 2 additions & 3 deletions api/v1alpha1/tuf_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ type TufKey struct {

// TufStatus defines the observed state of Tuf
type TufStatus struct {
Url string `json:"url,omitempty"`
Phase Phase `json:"phase"`
Url string `json:"url,omitempty"`
// +listType=map
// +listMapKey=type
// +patchStrategy=merge
Expand All @@ -38,7 +37,7 @@ type TufStatus struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`,description="The component phase"
//+kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`,description="The component status"
//+kubebuilder:printcolumn:name="URL",type=string,JSONPath=`.status.url`,description="The component url"

// Tuf is the Schema for the tufs API
Expand Down
57 changes: 56 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

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

14 changes: 13 additions & 1 deletion bundle/manifests/rhtas-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ metadata:
}
]
capabilities: Basic Install
createdAt: "2024-02-12T13:29:51Z"
createdAt: "2024-02-15T11:34:50Z"
operators.operatorframework.io/builder: operator-sdk-v1.32.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
name: rhtas-operator.v0.0.1
Expand Down Expand Up @@ -275,6 +275,18 @@ spec:
- patch
- update
- watch
- apiGroups:
- batch
resources:
- cronjobs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- batch
resources:
Expand Down
10 changes: 3 additions & 7 deletions bundle/manifests/rhtas.redhat.com_ctlogs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: The component phase
jsonPath: .status.phase
name: Phase
- description: The component status
jsonPath: .status.conditions[?(@.type=="Ready")].reason
name: Status
type: string
name: v1alpha1
schema:
Expand Down Expand Up @@ -186,10 +186,6 @@ spec:
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
phase:
type: string
required:
- phase
type: object
type: object
served: true
Expand Down
8 changes: 3 additions & 5 deletions bundle/manifests/rhtas.redhat.com_fulcios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: The component phase
jsonPath: .status.phase
name: Phase
- description: The component status
jsonPath: .status.conditions[?(@.type=="Ready")].reason
name: Status
type: string
- description: The component url
jsonPath: .status.url
Expand Down Expand Up @@ -274,8 +274,6 @@ spec:
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
phase:
type: string
url:
type: string
type: object
Expand Down
20 changes: 15 additions & 5 deletions bundle/manifests/rhtas.redhat.com_rekors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: The component phase
jsonPath: .status.phase
name: Phase
- description: The component status
jsonPath: .status.conditions[?(@.type=="Ready")].reason
name: Status
type: string
- description: The component url
jsonPath: .status.url
Expand All @@ -43,6 +43,18 @@ spec:
spec:
description: RekorSpec defines the desired state of Rekor
properties:
backFillRedis:
description: BackFillRedis CronJob Configuration
properties:
enabled:
default: true
description: Enable the BackFillRedis CronJob
type: boolean
schedule:
default: 0 0 * * *
description: Schedule for the BackFillRedis CronJob
type: string
type: object
externalAccess:
description: Define whether you want to export service or not
properties:
Expand Down Expand Up @@ -189,8 +201,6 @@ spec:
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
phase:
type: string
rekorSearchUIUrl:
type: string
url:
Expand Down
Loading
Loading