Skip to content

Commit

Permalink
Change k8s.io/api/core/v1 pkg alias to core (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamalsaha authored Oct 21, 2017
1 parent d938ead commit ed12717
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions apis/stash/types.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package stash

import (
apiv1 "k8s.io/api/core/v1"
core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -33,9 +33,9 @@ type ResticSpec struct {
Schedule string `json:"schedule,omitempty"`
UseAutoPrefix PrefixType `json:"useAutoPrefix,omitempty"`
// Pod volumes to mount into the sidecar container's filesystem.
VolumeMounts []apiv1.VolumeMount `json:"volumeMounts,omitempty"`
VolumeMounts []core.VolumeMount `json:"volumeMounts,omitempty"`
// Compute Resources required by the sidecar container.
Resources apiv1.ResourceRequirements `json:"resources,omitempty"`
Resources core.ResourceRequirements `json:"resources,omitempty"`
}

type ResticStatus struct {
Expand Down Expand Up @@ -71,7 +71,7 @@ type RecoverySpec struct {
// Path string `json:"path,omitempty"`
// Host string `json:"path,omitempty"`
// target volume where snapshot will be restored
VolumeMounts []apiv1.VolumeMount `json:"volumeMounts,omitempty"`
VolumeMounts []core.VolumeMount `json:"volumeMounts,omitempty"`
}

type RecoveryStatus struct {
Expand Down Expand Up @@ -109,8 +109,8 @@ type Backend struct {
}

type LocalSpec struct {
VolumeSource apiv1.VolumeSource `json:"volumeSource,omitempty"`
Path string `json:"path,omitempty"`
VolumeSource core.VolumeSource `json:"volumeSource,omitempty"`
Path string `json:"path,omitempty"`
}

type S3Spec struct {
Expand Down
10 changes: 5 additions & 5 deletions apis/stash/v1alpha1/objectref.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package v1alpha1

import (
apiv1 "k8s.io/api/core/v1"
core "k8s.io/api/core/v1"
)

func (r Restic) ObjectReference() *apiv1.ObjectReference {
return &apiv1.ObjectReference{
func (r Restic) ObjectReference() *core.ObjectReference {
return &core.ObjectReference{
APIVersion: SchemeGroupVersion.String(),
Kind: ResourceKindRestic,
Namespace: r.Namespace,
Expand All @@ -15,8 +15,8 @@ func (r Restic) ObjectReference() *apiv1.ObjectReference {
}
}

func (r Recovery) ObjectReference() *apiv1.ObjectReference {
return &apiv1.ObjectReference{
func (r Recovery) ObjectReference() *core.ObjectReference {
return &core.ObjectReference{
APIVersion: SchemeGroupVersion.String(),
Kind: ResourceKindRecovery,
Namespace: r.Namespace,
Expand Down
12 changes: 6 additions & 6 deletions apis/stash/v1alpha1/types.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package v1alpha1

import (
apiv1 "k8s.io/api/core/v1"
core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -32,9 +32,9 @@ type ResticSpec struct {
Schedule string `json:"schedule,omitempty"`
UseAutoPrefix PrefixType `json:"useAutoPrefix,omitempty"`
// Pod volumes to mount into the sidecar container's filesystem.
VolumeMounts []apiv1.VolumeMount `json:"volumeMounts,omitempty"`
VolumeMounts []core.VolumeMount `json:"volumeMounts,omitempty"`
// Compute Resources required by the sidecar container.
Resources apiv1.ResourceRequirements `json:"resources,omitempty"`
Resources core.ResourceRequirements `json:"resources,omitempty"`
}

type ResticStatus struct {
Expand Down Expand Up @@ -70,7 +70,7 @@ type RecoverySpec struct {
// Path string `json:"path,omitempty"`
// Host string `json:"path,omitempty"`
// target volume where snapshot will be restored
VolumeMounts []apiv1.VolumeMount `json:"volumeMounts,omitempty"`
VolumeMounts []core.VolumeMount `json:"volumeMounts,omitempty"`
}

type RecoveryStatus struct {
Expand Down Expand Up @@ -108,8 +108,8 @@ type Backend struct {
}

type LocalSpec struct {
VolumeSource apiv1.VolumeSource `json:"volumeSource,omitempty"`
Path string `json:"path,omitempty"`
VolumeSource core.VolumeSource `json:"volumeSource,omitempty"`
Path string `json:"path,omitempty"`
}

type S3Spec struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/scheduler/restic.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/appscode/stash/pkg/eventer"
"github.com/appscode/stash/pkg/util"
"github.com/golang/glog"
apiv1 "k8s.io/api/core/v1"
core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
rt "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/runtime"
Expand Down Expand Up @@ -146,7 +146,7 @@ func (c *Controller) runResticScheduler(key string) error {
if err != nil {
c.recorder.Eventf(
r.ObjectReference(),
apiv1.EventTypeWarning,
core.EventTypeWarning,
eventer.EventReasonFailedToBackup,
"Failed to start Stash scheduler reason %v",
err,
Expand Down
12 changes: 6 additions & 6 deletions pkg/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/push"
"gopkg.in/robfig/cron.v2"
apiv1 "k8s.io/api/core/v1"
core "k8s.io/api/core/v1"
kerr "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/runtime"
Expand Down Expand Up @@ -153,7 +153,7 @@ func (c *Controller) configureScheduler() error {
}
_, err := c.cron.AddFunc(r.Spec.Schedule, func() {
if err := c.runOnce(); err != nil {
c.recorder.Event(r.ObjectReference(), apiv1.EventTypeWarning, eventer.EventReasonFailedCronJob, err.Error())
c.recorder.Event(r.ObjectReference(), core.EventTypeWarning, eventer.EventReasonFailedCronJob, err.Error())
log.Errorln(err)
}
})
Expand Down Expand Up @@ -185,7 +185,7 @@ func (c *Controller) runOnce() (err error) {
err = errors.New("missing repository secret name")
return
}
var secret *apiv1.Secret
var secret *core.Secret
secret, err = c.k8sClient.CoreV1().Secrets(resource.Namespace).Get(resource.Spec.Backend.StorageSecretName, metav1.GetOptions{})
if err != nil {
return
Expand Down Expand Up @@ -266,18 +266,18 @@ func (c *Controller) runOnce() (err error) {
err = c.measure(c.resticCLI.Backup, resource, fg, backupOpMetric)
if err != nil {
log.Errorln("Backup operation failed for Reestic %s/%s due to %s", resource.Namespace, resource.Name, err)
c.recorder.Event(resource.ObjectReference(), apiv1.EventTypeNormal, eventer.EventReasonFailedToBackup, " Error taking backup: "+err.Error())
c.recorder.Event(resource.ObjectReference(), core.EventTypeNormal, eventer.EventReasonFailedToBackup, " Error taking backup: "+err.Error())
return
} else {
hostname, _ := os.Hostname()
c.recorder.Event(resource.ObjectReference(), apiv1.EventTypeNormal, eventer.EventReasonSuccessfulBackup, "Backed up pod:"+hostname+" path:"+fg.Path)
c.recorder.Event(resource.ObjectReference(), core.EventTypeNormal, eventer.EventReasonSuccessfulBackup, "Backed up pod:"+hostname+" path:"+fg.Path)
}

forgetOpMetric := restic_session_duration_seconds.WithLabelValues(sanitizeLabelValue(fg.Path), "forget")
err = c.measure(c.resticCLI.Forget, resource, fg, forgetOpMetric)
if err != nil {
log.Errorln("Failed to forget old snapshots for Restic %s/%s due to %s", resource.Namespace, resource.Name, err)
c.recorder.Event(resource.ObjectReference(), apiv1.EventTypeNormal, eventer.EventReasonFailedToRetention, " Error forgetting snapshots: "+err.Error())
c.recorder.Event(resource.ObjectReference(), core.EventTypeNormal, eventer.EventReasonFailedToRetention, " Error forgetting snapshots: "+err.Error())
return
}
}
Expand Down

0 comments on commit ed12717

Please sign in to comment.