Skip to content

Commit

Permalink
Add status.observedGeneration (#927)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamalsaha authored Oct 18, 2019
1 parent f618141 commit 65095df
Show file tree
Hide file tree
Showing 50 changed files with 555 additions and 435 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ lint: $(BUILD_DIRS)
--env GO111MODULE=on \
--env GOFLAGS="-mod=vendor" \
$(BUILD_IMAGE) \
golangci-lint run --enable $(ADDTL_LINTERS)
golangci-lint run --enable $(ADDTL_LINTERS) --deadline=10m --skip-files="generated.*\.go$\" --skip-dirs-use-default --skip-dirs=client,vendor

$(BUILD_DIRS):
@mkdir -p $@
Expand Down
12 changes: 11 additions & 1 deletion api/crds/stash.appscode.com_backupbatches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ spec:
plural: backupbatches
singular: backupbatch
scope: Namespaced
subresources: {}
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand Down Expand Up @@ -3784,6 +3785,15 @@ spec:
required:
- retentionPolicy
type: object
status:
properties:
observedGeneration:
description: ObservedGeneration is the most recent generation observed
for this BackupBatch. It corresponds to the BackupBatch's generation,
which is updated on mutation by the API Server.
format: int64
type: integer
type: object
type: object
versions:
- name: v1beta1
Expand Down
2 changes: 2 additions & 0 deletions api/crds/stash.appscode.com_backupblueprints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1647,6 +1647,8 @@ spec:
type: string
prefix:
type: string
region:
type: string
type: object
storageSecretName:
type: string
Expand Down
12 changes: 11 additions & 1 deletion api/crds/stash.appscode.com_backupconfigurations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ spec:
- bc
singular: backupconfiguration
scope: Namespaced
subresources: {}
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand Down Expand Up @@ -2923,6 +2924,15 @@ spec:
required:
- retentionPolicy
type: object
status:
properties:
observedGeneration:
description: ObservedGeneration is the most recent generation observed
for this BackupConfiguration. It corresponds to the BackupConfiguration's
generation, which is updated on mutation by the API Server.
format: int64
type: integer
type: object
type: object
versions:
- name: v1beta1
Expand Down
5 changes: 0 additions & 5 deletions api/crds/stash.appscode.com_backupsessions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,6 @@ spec:
type: object
status:
properties:
observedGeneration:
description: ObservedGeneration is the most recent generation observed
for this resource. It corresponds to the resource's generation, which
is updated on mutation by the API Server.
type: string
phase:
description: Phase indicates the overall phase of the backup process
for this BackupSession. Phase will be "Succeeded" only if phase of
Expand Down
11 changes: 7 additions & 4 deletions api/crds/stash.appscode.com_repositories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,8 @@ spec:
type: string
prefix:
type: string
region:
type: string
type: object
storageSecretName:
type: string
Expand Down Expand Up @@ -1698,10 +1700,11 @@ spec:
format: date-time
type: string
observedGeneration:
description: observedGeneration is the most recent generation observed
for this resource. It corresponds to the resource's generation, which
is updated on mutation by the API Server.
type: string
description: ObservedGeneration is the most recent generation observed
for this Repository. It corresponds to the Repository's generation,
which is updated on mutation by the API Server.
format: int64
type: integer
size:
description: Size show size of repository after last backup
type: string
Expand Down
2 changes: 2 additions & 0 deletions api/crds/stash.appscode.com_restics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1654,6 +1654,8 @@ spec:
type: string
prefix:
type: string
region:
type: string
type: object
storageSecretName:
type: string
Expand Down
5 changes: 0 additions & 5 deletions api/crds/stash.appscode.com_restoresessions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3352,11 +3352,6 @@ spec:
type: object
status:
properties:
observedGeneration:
description: observedGeneration is the most recent generation observed
for this resource. It corresponds to the resource's generation, which
is updated on mutation by the API Server.
type: string
phase:
description: Phase indicates the overall phase of the restore process
for this RestoreSession. Phase will be "Succeeded" only if phase of
Expand Down
42 changes: 32 additions & 10 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -9140,8 +9140,9 @@
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time"
},
"observedGeneration": {
"description": "observedGeneration is the most recent generation observed for this resource. It corresponds to the resource's generation, which is updated on mutation by the API Server.",
"$ref": "#/definitions/com.github.appscode.go.encoding.json.types.IntHash"
"description": "ObservedGeneration is the most recent generation observed for this Repository. It corresponds to the Repository's generation, which is updated on mutation by the API Server.",
"type": "integer",
"format": "int64"
},
"size": {
"description": "Size show size of repository after last backup",
Expand Down Expand Up @@ -9344,6 +9345,9 @@
},
"spec": {
"$ref": "#/definitions/dev.appscode.stash.stash.apis.stash.v1beta1.BackupBatchSpec"
},
"status": {
"$ref": "#/definitions/dev.appscode.stash.stash.apis.stash.v1beta1.BackupBatchStatus"
}
},
"x-kubernetes-group-version-kind": [
Expand Down Expand Up @@ -9427,6 +9431,16 @@
}
}
},
"dev.appscode.stash.stash.apis.stash.v1beta1.BackupBatchStatus": {
"type": "object",
"properties": {
"observedGeneration": {
"description": "ObservedGeneration is the most recent generation observed for this BackupBatch. It corresponds to the BackupBatch's generation, which is updated on mutation by the API Server.",
"type": "integer",
"format": "int64"
}
}
},
"dev.appscode.stash.stash.apis.stash.v1beta1.BackupBlueprint": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -9542,6 +9556,9 @@
},
"spec": {
"$ref": "#/definitions/dev.appscode.stash.stash.apis.stash.v1beta1.BackupConfigurationSpec"
},
"status": {
"$ref": "#/definitions/dev.appscode.stash.stash.apis.stash.v1beta1.BackupConfigurationStatus"
}
},
"x-kubernetes-group-version-kind": [
Expand Down Expand Up @@ -9638,6 +9655,16 @@
}
}
},
"dev.appscode.stash.stash.apis.stash.v1beta1.BackupConfigurationStatus": {
"type": "object",
"properties": {
"observedGeneration": {
"description": "ObservedGeneration is the most recent generation observed for this BackupConfiguration. It corresponds to the BackupConfiguration's generation, which is updated on mutation by the API Server.",
"type": "integer",
"format": "int64"
}
}
},
"dev.appscode.stash.stash.apis.stash.v1beta1.BackupConfigurationTemplate": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -9782,10 +9809,6 @@
"dev.appscode.stash.stash.apis.stash.v1beta1.BackupSessionStatus": {
"type": "object",
"properties": {
"observedGeneration": {
"description": "ObservedGeneration is the most recent generation observed for this resource. It corresponds to the resource's generation, which is updated on mutation by the API Server.",
"$ref": "#/definitions/com.github.appscode.go.encoding.json.types.IntHash"
},
"phase": {
"description": "Phase indicates the overall phase of the backup process for this BackupSession. Phase will be \"Succeeded\" only if phase of all hosts are \"Succeeded\". If any of the host fail to complete backup, Phase will be \"Failed\".",
"type": "string"
Expand Down Expand Up @@ -10193,10 +10216,6 @@
"dev.appscode.stash.stash.apis.stash.v1beta1.RestoreSessionStatus": {
"type": "object",
"properties": {
"observedGeneration": {
"description": "observedGeneration is the most recent generation observed for this resource. It corresponds to the resource's generation, which is updated on mutation by the API Server.",
"$ref": "#/definitions/com.github.appscode.go.encoding.json.types.IntHash"
},
"phase": {
"description": "Phase indicates the overall phase of the restore process for this RestoreSession. Phase will be \"Succeeded\" only if phase of all hosts are \"Succeeded\". If any of the host fail to complete restore, Phase will be \"Failed\".",
"type": "string"
Expand Down Expand Up @@ -13383,6 +13402,9 @@
},
"prefix": {
"type": "string"
},
"region": {
"type": "string"
}
}
},
Expand Down
6 changes: 6 additions & 0 deletions apis/repositories/v1alpha1/openapi_generated.go

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

13 changes: 10 additions & 3 deletions apis/stash/v1alpha1/openapi_generated.go

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

3 changes: 1 addition & 2 deletions apis/stash/v1alpha1/recovery_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package v1alpha1
import (
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
crdutils "kmodules.xyz/client-go/apiextensions/v1beta1"
"stash.appscode.dev/stash/apis"
)

func (c Recovery) CustomResourceDefinition() *apiextensions.CustomResourceDefinition {
Expand All @@ -28,7 +27,7 @@ func (c Recovery) CustomResourceDefinition() *apiextensions.CustomResourceDefini
SpecDefinitionName: "stash.appscode.dev/stash/apis/stash/v1alpha1.Recovery",
EnableValidation: true,
GetOpenAPIDefinitions: GetOpenAPIDefinitions,
EnableStatusSubresource: apis.EnableStatusSubresource,
EnableStatusSubresource: true,
AdditionalPrinterColumns: []apiextensions.CustomResourceColumnDefinition{
{
Name: "Repository-NS",
Expand Down
3 changes: 1 addition & 2 deletions apis/stash/v1alpha1/repository_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package v1alpha1
import (
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
crdutils "kmodules.xyz/client-go/apiextensions/v1beta1"
"stash.appscode.dev/stash/apis"
)

func (c Repository) CustomResourceDefinition() *apiextensions.CustomResourceDefinition {
Expand Down Expand Up @@ -33,7 +32,7 @@ func (c Repository) CustomResourceDefinition() *apiextensions.CustomResourceDefi
SpecDefinitionName: "stash.appscode.dev/stash/apis/stash/v1beta1.Repository",
EnableValidation: true,
GetOpenAPIDefinitions: GetOpenAPIDefinitions,
EnableStatusSubresource: apis.EnableStatusSubresource,
EnableStatusSubresource: true,
AdditionalPrinterColumns: []apiextensions.CustomResourceColumnDefinition{
{
Name: "Integrity",
Expand Down
7 changes: 3 additions & 4 deletions apis/stash/v1alpha1/repository_types.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package v1alpha1

import (
"github.com/appscode/go/encoding/json/types"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
store "kmodules.xyz/objectstore-api/api/v1"
)
Expand Down Expand Up @@ -40,10 +39,10 @@ type RepositorySpec struct {
}

type RepositoryStatus struct {
// observedGeneration is the most recent generation observed for this resource. It corresponds to the
// resource's generation, which is updated on mutation by the API Server.
// ObservedGeneration is the most recent generation observed for this Repository. It corresponds to the
// Repository's generation, which is updated on mutation by the API Server.
// +optional
ObservedGeneration *types.IntHash `json:"observedGeneration,omitempty"`
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// FirstBackupTime indicates the timestamp when the first backup was taken
FirstBackupTime *metav1.Time `json:"firstBackupTime,omitempty"`
// LastBackupTime indicates the timestamp when the latest backup was taken
Expand Down
3 changes: 1 addition & 2 deletions apis/stash/v1alpha1/restic_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
hashutil "k8s.io/kubernetes/pkg/util/hash"
crdutils "kmodules.xyz/client-go/apiextensions/v1beta1"
"stash.appscode.dev/stash/apis"
)

func (r Restic) GetSpecHash() string {
Expand Down Expand Up @@ -38,7 +37,7 @@ func (c Restic) CustomResourceDefinition() *apiextensions.CustomResourceDefiniti
SpecDefinitionName: "stash.appscode.dev/stash/apis/stash/v1alpha1.Restic",
EnableValidation: true,
GetOpenAPIDefinitions: GetOpenAPIDefinitions,
EnableStatusSubresource: apis.EnableStatusSubresource,
EnableStatusSubresource: true,
AdditionalPrinterColumns: []apiextensions.CustomResourceColumnDefinition{
{
Name: "Selector",
Expand Down
4 changes: 0 additions & 4 deletions apis/stash/v1alpha1/zz_generated.deepcopy.go

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

7 changes: 4 additions & 3 deletions apis/stash/v1beta1/backup_batch_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ func (b BackupBatch) CustomResourceDefinition() *apiextensions.CustomResourceDef
Labels: crdutils.Labels{
LabelsMap: map[string]string{"app": "stash"},
},
SpecDefinitionName: "stash.appscode.dev/stash/apis/stash/v1beta1.BackupBatch",
EnableValidation: true,
GetOpenAPIDefinitions: GetOpenAPIDefinitions,
SpecDefinitionName: "stash.appscode.dev/stash/apis/stash/v1beta1.BackupBatch",
EnableValidation: true,
GetOpenAPIDefinitions: GetOpenAPIDefinitions,
EnableStatusSubresource: true,
AdditionalPrinterColumns: []apiextensions.CustomResourceColumnDefinition{
{
Name: "Schedule",
Expand Down
Loading

0 comments on commit 65095df

Please sign in to comment.