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

Object Storage (LEP 20230430) #2136

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
9b58eef
Object Endpoint
m-ildefons Jul 14, 2023
bd79b49
improve code generation script
m-ildefons Jul 14, 2023
e20c3cf
Add generated files
m-ildefons Jul 14, 2023
c86937b
object store: Add controller skeleton
m-ildefons Jul 14, 2023
c17f81b
object store: deploy resources
m-ildefons Jul 20, 2023
2f371cd
object store: Implement Delete
m-ildefons Jul 25, 2023
919f962
object store: Add internal API endpoints
m-ildefons Jul 27, 2023
84d7447
object endpoint controller: address review
m-ildefons Aug 11, 2023
7b387b5
object endpoint: error handling
m-ildefons Aug 11, 2023
91d5cef
Object Endpoint: Unittests, CRDs, Review
m-ildefons Aug 16, 2023
5d40040
object endpoint: manage filesystem parameters
m-ildefons Aug 22, 2023
ed333cc
object endpoint: K8s owner relationships
m-ildefons Aug 25, 2023
c9876e3
object endpoint: configure s3gw ui container
m-ildefons Aug 30, 2023
da08917
object store: static provisioning, tests, ui
m-ildefons Sep 4, 2023
ef38d5f
object store: expose UI, volume fixes
m-ildefons Sep 14, 2023
7095924
object store: add struct fields for backup
m-ildefons Sep 14, 2023
16f3b6a
object store: replace credentials and labels
m-ildefons Sep 19, 2023
ed4a92d
object store: rename informer and lister
m-ildefons Sep 19, 2023
bac0280
object store: Fixup manager API
m-ildefons Sep 19, 2023
51bbe25
object store: consolidate creation functions
m-ildefons Sep 21, 2023
f7df6f0
object store: simplify deletion
m-ildefons Sep 25, 2023
56633a7
object store: fix spelling
m-ildefons Sep 27, 2023
3f4216c
object store: fix unit tests
m-ildefons Sep 28, 2023
ac4ba92
object store: unit test initialization
m-ildefons Sep 29, 2023
c0ed496
object store: deploy ingress
m-ildefons Oct 20, 2023
c5125e1
object store: Move to an event driven model, fixes
m-ildefons Oct 25, 2023
7162d79
object store: webhook, ownership, ingresses
m-ildefons Oct 27, 2023
e41dddb
object store: sync list of tls secrets
m-ildefons Oct 31, 2023
57195cd
object store: fixes, secrets API
m-ildefons Nov 2, 2023
833d9ab
object store: rebase and fix
m-ildefons Nov 2, 2023
8dfdfb4
object store: fixes for review
m-ildefons Nov 6, 2023
3e915bb
object store: fix deletes, remove ingress
m-ildefons Nov 7, 2023
72e07be
object store: web socket fixes, error handling
m-ildefons Nov 8, 2023
8e1fc25
object store: usage information to the UI
m-ildefons Nov 9, 2023
9bf594a
object store: fix event trigger
m-ildefons Nov 9, 2023
fad0bd0
object store: fix secret creation
m-ildefons Nov 9, 2023
87ae4b5
object store: fix volume expansion, update
m-ildefons Nov 14, 2023
c905be8
object store: error handling
m-ildefons Nov 15, 2023
95899d5
object store: update CRDs, webhooks controller
m-ildefons Nov 16, 2023
53750c6
object store: safe image modifications
m-ildefons Nov 16, 2023
a7689ec
object store: fix secret creation, sc controller
m-ildefons Nov 17, 2023
11f5677
object store: stop propagating image settings
m-ildefons Nov 17, 2023
32358c6
object store: fix race condition, error handling
m-ildefons Nov 17, 2023
7065db2
object store: fix typo
m-ildefons Nov 17, 2023
0f7dae7
object store: launch options, cleanup secrets
m-ildefons Nov 21, 2023
a55f3e5
object store: fix, metrics, telemetry
m-ildefons Nov 22, 2023
519ddad
object store: foreground deletion, validation
m-ildefons Nov 27, 2023
5a6d625
object store: reorder checks ; clean up
m-ildefons Nov 28, 2023
1a93355
object store: rebase and update vendored modules
m-ildefons Nov 29, 2023
cbaa80e
object store: simplify deletes
m-ildefons Dec 1, 2023
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ _testmain.go
*.exe
*.test
*.prof
coverage.out

# Rancher
.dapper
Expand Down
132 changes: 132 additions & 0 deletions api/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,62 @@ type SnapshotCRListOutput struct {
Type string `json:"type"`
}

type ObjectStore struct {
client.Resource
Name string `json:"name"`
State longhorn.ObjectStoreState `json:"state"`
Endpoints []string `json:"endpoints"`
Size int64 `json:"size"` // number of bytes allocated
ActualSize int64 `json:"actualSize"` // number of bytes occupied
Image string `json:"image"`
UIImage string `json:"uiImage"`
}

type ObjectStoreInput struct {
Name string `json:"name"`
Size string `json:"size"`

AccessKey string `json:"accesskey"`
SecretKey string `json:"secretkey"`

Endpoints []ObjectEndpointInput `json:"endpoints"`

NumberOfReplicas int `json:"numberOfReplicas"`
ReplicaSoftAntiAffinity longhorn.ReplicaSoftAntiAffinity `json:"replicaSoftAntiAffinity"`
ReplicaZoneSoftAntiAffinity longhorn.ReplicaZoneSoftAntiAffinity `json:"replicaZoneSoftAntiAffinity"`
ReplicaDiskSoftAntiAffinity longhorn.ReplicaDiskSoftAntiAffinity `json:"replicaDiskSoftAntiAffinity"`
DiskSelector []string `json:"diskSelector"`
NodeSelector []string `json:"nodeSelector"`
DataLocality longhorn.DataLocality `json:"dataLocality"`
FromBackup string `json:"fromBackup"`
StaleReplicaTimeout int `json:"staleReplicaTimeout"`
RecurringJobSelector []longhorn.VolumeRecurringJob `json:"recurringJobSelector"`
ReplicaAutoBalance longhorn.ReplicaAutoBalance `json:"replicaAutoBalance"`
RevisionCounterDisabled bool `json:"revisionCounterDisabled"`
UnmapMarkSnapChainRemoved longhorn.UnmapMarkSnapChainRemoved `json:"unmapMarkSnapChainRemoved"`
BackendStoreDriver longhorn.BackendStoreDriverType `json:"backendStoreDriver"`
TargetState longhorn.ObjectStoreState `json:"targetState"`
Image string `json:"image"`
UIImage string `json:"uiImage"`
}

type ObjectEndpointInput struct {
DomainName string `json:"domainName"`
SecretName string `json:"secretName"`
SecretNamespace string `json:"secretNamespace"`
}

type ObjectStoreListOutput struct {
Data []ObjectStore `json:"data"`
Type string `json:"type"`
}

type SecretRef struct {
client.Resource
Name string `json:"name"`
Namespace string `json:"namespace"`
}

func NewSchema() *client.Schemas {
schemas := &client.Schemas{}

Expand Down Expand Up @@ -625,6 +681,9 @@ func NewSchema() *client.Schemas {
systemRestoreSchema(schemas.AddType("systemRestore", SystemRestore{}))
snapshotCRListOutputSchema(schemas.AddType("snapshotCRListOutput", SnapshotCRListOutput{}))

objectStoreSchema(schemas.AddType("objectStore", ObjectStore{}))
secretRefSchema(schemas.AddType("secretRef", SecretRef{}))

return schemas
}

Expand Down Expand Up @@ -1190,6 +1249,37 @@ func volumeAttachmentSchema(volumeAttachment *client.Schema) {
volumeAttachment.ResourceFields["attachments"] = attachments
}

func objectStoreSchema(objectStore *client.Schema) {
objectStore.CollectionMethods = []string{"GET", "POST"}
objectStore.ResourceMethods = []string{"GET", "PUT", "DELETE"}

name := objectStore.ResourceFields["name"]
name.Required = true
name.Unique = true
name.Create = true
objectStore.ResourceFields["name"] = name
}

func secretRefSchema(secretRef *client.Schema) {
secretRef.CollectionMethods = []string{"GET"}

name := secretRef.ResourceFields["name"]
name.Required = true
name.Unique = true
name.Create = true
secretRef.ResourceFields["name"] = name
}

func storageClassSchema(storageClass *client.Schema) {
storageClass.CollectionMethods = []string{"GET"}

name := storageClass.ResourceFields["name"]
name.Required = true
name.Unique = true
name.Create = true
storageClass.ResourceFields["name"] = name
}

func toEmptyResource() *Empty {
return &Empty{
Resource: client.Resource{
Expand Down Expand Up @@ -2124,3 +2214,45 @@ func sliceToMap(conditions []longhorn.Condition) map[string]longhorn.Condition {
}
return converted
}

func toObjectStoreResource(store *longhorn.ObjectStore, size, actualSize int64, image, uiImage string) *ObjectStore {
return &ObjectStore{
Resource: client.Resource{
Id: store.Name,
Type: "objectStore",
},
Name: store.Name,
State: store.Status.State,
Endpoints: store.Status.Endpoints,
Size: size,
ActualSize: actualSize,
Image: image,
UIImage: uiImage,
}
}

func toSecretRefResource(secret *corev1.Secret) *SecretRef {
return &SecretRef{
Resource: client.Resource{
Id: secret.Name,
Type: "secretRef",
},
Name: secret.Name,
Namespace: secret.Namespace,
}
}

func toSecretRefCollection(secrets []*corev1.Secret, apiContext *api.ApiContext) *client.GenericCollection {
data := []interface{}{}

for _, secret := range secrets {
data = append(data, toSecretRefResource(secret))
}

return &client.GenericCollection{
Data: data,
Collection: client.Collection{
ResourceType: "secretRef",
},
}
}
Loading