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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.24 AS builder
FROM golang:1.25 AS builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
12 changes: 9 additions & 3 deletions api/v1alpha1/volumereplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,15 @@ type VolumeReplicationStatus struct {
Conditions []metav1.Condition `json:"conditions,omitempty"`
// observedGeneration is the last generation change the operator has dealt with
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
LastStartTime *metav1.Time `json:"lastStartTime,omitempty"`
LastCompletionTime *metav1.Time `json:"lastCompletionTime,omitempty"`
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
LastStartTime *metav1.Time `json:"lastStartTime,omitempty"`
LastCompletionTime *metav1.Time `json:"lastCompletionTime,omitempty"`
LastSyncTime *metav1.Time `json:"lastSyncTime,omitempty"`
LastSyncBytes *int64 `json:"lastSyncBytes,omitempty"`
LastSyncDuration *metav1.Duration `json:"lastSyncDuration,omitempty"`
DestinationVolumeID string `json:"destinationVolumeID,omitempty"`
ReplicationStatus string `json:"replicationStatus,omitempty"`
StatusMessage string `json:"statusMessage,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
15 changes: 14 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.

Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.17.2
name: volumereplicationclasses.replication.storage.openshift.io
spec:
group: replication.storage.openshift.io
Expand All @@ -29,27 +27,34 @@ spec:
API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: VolumeReplicationClassSpec specifies parameters that an underlying
storage system uses when creating a volume replica. A specific VolumeReplicationClass
is used by specifying its name in a VolumeReplication object.
description: |-
VolumeReplicationClassSpec specifies parameters that an underlying storage system uses
when creating a volume replica. A specific VolumeReplicationClass is used by specifying
its name in a VolumeReplication object.
properties:
parameters:
additionalProperties:
type: string
description: Parameters is a key-value map with storage provisioner
specific configurations for creating volume replicas
description: |-
Parameters is a key-value map with storage provisioner specific configurations for
creating volume replicas
type: object
provisioner:
description: Provisioner is the name of storage provisioner
Expand All @@ -66,9 +71,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.17.2
name: volumereplications.replication.storage.openshift.io
spec:
group: replication.storage.openshift.io
Expand Down Expand Up @@ -40,33 +38,39 @@ spec:
description: VolumeReplication is the Schema for the volumereplications API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: VolumeReplicationSpec defines the desired state of VolumeReplication.
properties:
autoResync:
description: AutoResync represents the volume to be auto resynced
when ReplicationState is "secondary"
description: |-
AutoResync represents the volume to be auto resynced when
ReplicationState is "secondary"
type: boolean
dataSource:
description: DataSource represents the object associated with the
volume
properties:
apiGroup:
description: APIGroup is the group for the resource being referenced.
If APIGroup is not specified, the specified Kind must be in
the core API group. For any other third-party types, APIGroup
is required.
description: |-
APIGroup is the group for the resource being referenced.
If APIGroup is not specified, the specified Kind must be in the core API group.
For any other third-party types, APIGroup is required.
type: string
kind:
description: Kind is the type of resource being referenced
Expand All @@ -78,14 +82,15 @@ spec:
- kind
- name
type: object
x-kubernetes-map-type: atomic
replicationHandle:
description: replicationHandle represents an existing (but new) replication
id
type: string
replicationState:
description: ReplicationState represents the replication operation
to be performed on the volume. Supported operations are "primary",
"secondary" and "resync"
description: |-
ReplicationState represents the replication operation to be performed on the volume.
Supported operations are "primary", "secondary" and "resync"
enum:
- primary
- secondary
Expand All @@ -107,44 +112,35 @@ spec:
conditions:
description: Conditions are the list of conditions and their status.
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are:
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
\n // other fields }"
description: Condition contains details for one aspect of the current
state of this API Resource.
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: message is a human readable message indicating
details about the transition. This may be an empty string.
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
Expand All @@ -159,10 +155,6 @@ spec:
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
Expand All @@ -174,31 +166,39 @@ spec:
- type
type: object
type: array
destinationVolumeID:
type: string
lastCompletionTime:
format: date-time
type: string
lastStartTime:
format: date-time
type: string
lastSyncBytes:
format: int64
type: integer
lastSyncDuration:
type: string
lastSyncTime:
format: date-time
type: string
message:
type: string
observedGeneration:
description: observedGeneration is the last generation change the
operator has dealt with
format: int64
type: integer
replicationStatus:
type: string
state:
description: State captures the latest state of the replication operation.
type: string
statusMessage:
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
8 changes: 6 additions & 2 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: manager-role
rules:
- apiGroups:
- ramendr.openshift.io
resources:
- volumereplicationgroups
verbs:
- get
- apiGroups:
- replication.storage.openshift.io
resources:
Expand Down
19 changes: 19 additions & 0 deletions controllers/replication/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,25 @@ func (r *Replication) Resync() *Response {
return &Response{Response: resp, Error: err}
}

func (r *Replication) GetInfo() *Response {
resp, err := r.Params.Replication.GetVolumeReplicationInfo(
r.Params.ReplicationSource,
r.Params.ReplicationID,
r.Params.Secrets,
)

return &Response{Response: resp, Error: err}
}

func (r *Replication) GetDestinationInfo() *Response {
resp, err := r.Params.Replication.GetReplicationDestinationInfo(
r.Params.ReplicationSource,
r.Params.Secrets,
)

return &Response{Response: resp, Error: err}
}

func (r *Response) HasKnownGRPCError(knownErrors []codes.Code) bool {
if r.Error == nil {
return false
Expand Down
Loading