Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.
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
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ $ kubectl describe storageoscluster/example-storageos
Name: example-storageos
Namespace: default
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"storageos.com/v1alpha1","kind":"StorageOSCluster","metadata":{"annotations":{},"name":"example-storageos","namespace":"default"},"spec":{"...
API Version: storageos.com/v1alpha1
Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"storageos.com/v1","kind":"StorageOSCluster","metadata":{"annotations":{},"name":"example-storageos","namespace":"default"},"spec":{"...
API Version: storageos.com/v1
Kind: StorageOSCluster
Metadata:
Creation Timestamp: 2018-07-21T12:57:11Z
Generation: 1
Resource Version: 10939030
Self Link: /apis/storageos.com/v1alpha1/namespaces/default/storageosclusters/example-storageos
Self Link: /apis/storageos.com/v1/namespaces/default/storageosclusters/example-storageos
UID: 955b24a4-8ce5-11e8-956a-1866da35eee2
Spec:
Join: test07
Expand Down Expand Up @@ -145,7 +145,7 @@ An existing StorageOS cluster can be upgraded to a new version of StorageOS by
creating an Upgrade Configuration. The cluster-operator takes care of
downloading the new container image and updating all the nodes with new version
of StorageOS.
An example of `StorageOSUpgrade` resource is [storageos_v1alpha1_storageosupgrade_cr.yaml](/deploy/crds/storageos_v1alpha1_storageosupgrade_cr.yaml).
An example of `StorageOSUpgrade` resource is [storageos_v1_storageosupgrade_cr.yaml](/deploy/crds/storageos_v1_storageosupgrade_cr.yaml).

Only offline upgrade is supported for now by cluster-operator. During the
upgrade, StorageOS maintenance mode is enabled, the applications that use
Expand All @@ -164,8 +164,8 @@ $ kubectl describe storageosupgrades example-storageosupgrade
Name: example-storageosupgrade
Namespace: default
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"storageos.com/v1alpha1","kind":"StorageOSUpgrade","metadata":{"annotations":{},"name":"example-storageosupgrade","namespace":"default"},...
API Version: storageos.com/v1alpha1
Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"storageos.com/v1","kind":"StorageOSUpgrade","metadata":{"annotations":{},"name":"example-storageosupgrade","namespace":"default"},...
API Version: storageos.com/v1
Kind: StorageOSUpgrade
...
Spec:
Expand Down Expand Up @@ -208,7 +208,7 @@ all nodes or on selected nodes. This can be used to easily perform cleanup
task. An example would be to create a `Job` resource:

```yaml
apiVersion: storageos.com/v1alpha1
apiVersion: storageos.com/v1
kind: Job
metadata:
name: cleanup-job
Expand Down Expand Up @@ -352,7 +352,7 @@ To enable CSI, set `csi.enable` to `true` in the `StorageOSCluster` resource
config.

```yaml
apiVersion: "storageos.com/v1alpha1"
apiVersion: "storageos.com/v1"
kind: "StorageOSCluster"
metadata:
name: "example-storageos"
Expand All @@ -371,7 +371,7 @@ To enable CSI Credentials, ensure that CSI is enabled by setting `csi.enable` to
`true`:

```yaml
apiVersion: "storageos.com/v1alpha1"
apiVersion: "storageos.com/v1"
kind: "StorageOSCluster"
metadata:
name: "example-storageos"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: storageos.com/v1alpha1
apiVersion: storageos.com/v1
kind: Job
metadata:
name: example-job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ spec:
plural: jobs
singular: job
scope: Namespaced
version: v1alpha1
version: v1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: storageos.com/v1alpha1
apiVersion: storageos.com/v1
kind: StorageOSCluster
metadata:
name: example-storageoscluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
shortNames:
- stos
scope: Namespaced
version: v1alpha1
version: v1
additionalPrinterColumns:
- name: Ready
type: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: storageos.com/v1alpha1
apiVersion: storageos.com/v1
kind: StorageOSUpgrade
metadata:
name: example-storageosupgrade
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ spec:
plural: storageosupgrades
singular: storageosupgrade
scope: Namespaced
version: v1alpha1
version: v1
16 changes: 8 additions & 8 deletions deploy/storageos-operators.configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ data:
shortNames:
- stos
scope: Namespaced
version: v1alpha1
version: v1
additionalPrinterColumns:
- name: Ready
type: string
Expand Down Expand Up @@ -139,7 +139,7 @@ data:
plural: jobs
singular: job
scope: Namespaced
version: v1alpha1
version: v1
- apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
Expand All @@ -152,7 +152,7 @@ data:
plural: storageosupgrades
singular: storageosupgrade
scope: Namespaced
version: v1alpha1
version: v1


clusterServiceVersions: |-
Expand All @@ -165,7 +165,7 @@ data:
annotations:
capabilities: Full Lifecycle
categories: "Storage"
alm-examples: '[{"apiVersion":"storageos.com/v1alpha1","kind":"StorageOSCluster","metadata":{"name":"example-storageos","namespace":"default"},"spec":{"secretRefName":"storageos-api","secretRefNamespace":"default"}},{"apiVersion":"storageos.com/v1alpha1","kind":"Job","metadata":{"name":"example-job","namespace":"default"},"spec":{"image":"storageos/cluster-operator:latest","args":["/var/lib/storageos"],"mountPath":"/var/lib","hostPath":"/var/lib","completionWord":"done"}},{"apiVersion":"storageos.com/v1alpha1","kind":"StorageOSUpgrade","metadata":{"name":"example-upgrade","namespace":"default"},"spec":{"newImage":"storageos/node:latest"}}]'
alm-examples: '[{"apiVersion":"storageos.com/v1","kind":"StorageOSCluster","metadata":{"name":"example-storageos","namespace":"default"},"spec":{"secretRefName":"storageos-api","secretRefNamespace":"default"}},{"apiVersion":"storageos.com/v1","kind":"Job","metadata":{"name":"example-job","namespace":"default"},"spec":{"image":"storageos/cluster-operator:latest","args":["/var/lib/storageos"],"mountPath":"/var/lib","hostPath":"/var/lib","completionWord":"done"}},{"apiVersion":"storageos.com/v1","kind":"StorageOSUpgrade","metadata":{"name":"example-upgrade","namespace":"default"},"spec":{"newImage":"storageos/node:latest"}}]'
description: Cloud-native, persistent storage for containers.
containerImage: storageos/cluster-operator:test
repository: https://github.com/storageos/cluster-operator
Expand Down Expand Up @@ -420,7 +420,7 @@ data:
customresourcedefinitions:
owned:
- name: storageosclusters.storageos.com
version: v1alpha1
version: v1
kind: StorageOSCluster
displayName: StorageOS Cluster
description: StorageOS Cluster installs StorageOS in the cluster. It contains all the configuration for setting up a StorageOS cluster and also shows the status of the running StorageOS cluster.
Expand Down Expand Up @@ -449,12 +449,12 @@ data:
displayName: Ready
path: ready
- name: jobs.storageos.com
version: v1alpha1
version: v1
kind: Job
displayName: StorageOS Job
description: StorageOS Job creates special pods that run on all the node and perform an administrative task. This could be used for cluster maintenance tasks.
- name: storageosupgrades.storageos.com
version: v1alpha1
version: v1
kind: StorageOSUpgrade
displayName: StorageOS Upgrade
description: StorageOS Upgrade automatically upgrades an existing StorageOS cluster as per the upgrade configuration.
Expand All @@ -463,7 +463,7 @@ data:

- packageName: storageos
channels:
- name: alpha
- name: stable
currentCSV: storageosoperator.0.0.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Is 0.0.0 correct?

Copy link
Contributor Author

@darkowlzz darkowlzz Mar 25, 2019

Choose a reason for hiding this comment

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

yes, this is used in the e2e test only. We need not increment it every time.



2 changes: 1 addition & 1 deletion deploy/storageos-operators.olm.cr.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: storageos.com/v1alpha1
apiVersion: storageos.com/v1
kind: StorageOSCluster
metadata:
name: example
Expand Down
2 changes: 1 addition & 1 deletion deploy/storageos-operators.subscription.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ spec:
source: storageos-catalog
sourceNamespace: olm
name: storageos
channel: alpha
channel: stable
10 changes: 10 additions & 0 deletions pkg/apis/addtoscheme_storageos_v1.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package apis

import (
storageosv1 "github.com/storageos/cluster-operator/pkg/apis/storageos/v1"
)

func init() {
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
AddToSchemes = append(AddToSchemes, storageosv1.SchemeBuilder.AddToScheme)
}
10 changes: 0 additions & 10 deletions pkg/apis/addtoscheme_storageos_v1alpha1.go

This file was deleted.

4 changes: 4 additions & 0 deletions pkg/apis/storageos/v1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Package v1 contains API Schema definitions for the cluster v1 API group
// +k8s:deepcopy-gen=package,register
// +groupName=storageos.com
package v1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1alpha1
package v1

import (
corev1 "k8s.io/api/core/v1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// NOTE: Boilerplate only. Ignore this file.

// Package v1alpha1 contains API Schema definitions for the cluster v1alpha1 API group
// Package v1 contains API Schema definitions for the cluster v1 API group
// +k8s:deepcopy-gen=package,register
// +groupName=cluster.storageos.com
package v1alpha1
package v1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
Expand All @@ -12,7 +12,7 @@ import (

var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: "storageos.com", Version: "v1alpha1"}
SchemeGroupVersion = schema.GroupVersion{Group: "storageos.com", Version: "v1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1alpha1
package v1

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1alpha1
package v1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down

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

4 changes: 0 additions & 4 deletions pkg/apis/storageos/v1alpha1/doc.go

This file was deleted.

16 changes: 8 additions & 8 deletions pkg/controller/job/job_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package job
import (
"bytes"
"context"
"fmt"
"io"
"log"
"strings"
"time"
"fmt"

storageosv1alpha1 "github.com/storageos/cluster-operator/pkg/apis/storageos/v1alpha1"
storageosv1 "github.com/storageos/cluster-operator/pkg/apis/storageos/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -50,15 +50,15 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
}

// Watch for changes to primary resource Job
err = c.Watch(&source.Kind{Type: &storageosv1alpha1.Job{}}, &handler.EnqueueRequestForObject{})
err = c.Watch(&source.Kind{Type: &storageosv1.Job{}}, &handler.EnqueueRequestForObject{})
if err != nil {
return err
}

// Watch for changes to secondary resource DaemonSet and requeue the owner Job
err = c.Watch(&source.Kind{Type: &appsv1.DaemonSet{}}, &handler.EnqueueRequestForOwner{
IsController: true,
OwnerType: &storageosv1alpha1.Job{},
OwnerType: &storageosv1.Job{},
})
if err != nil {
return err
Expand Down Expand Up @@ -93,7 +93,7 @@ func (r *ReconcileJob) Reconcile(request reconcile.Request) (reconcile.Result, e
reconcileResult := reconcile.Result{RequeueAfter: reconcilePeriod}

// Fetch the Job instance
instance := &storageosv1alpha1.Job{}
instance := &storageosv1.Job{}
err := r.client.Get(context.TODO(), request.NamespacedName, instance)
if err != nil {
if errors.IsNotFound(err) {
Expand Down Expand Up @@ -164,7 +164,7 @@ func (r *ReconcileJob) Reconcile(request reconcile.Request) (reconcile.Result, e
// checkPods checks the logs of all pods with the given label selector for the
// completionWord and published a "JobCompleted" event when all the pods have
// completed their task.
func checkPods(client kubernetes.Interface, cr *storageosv1alpha1.Job, recorder record.EventRecorder) (bool, error) {
func checkPods(client kubernetes.Interface, cr *storageosv1.Job, recorder record.EventRecorder) (bool, error) {
podListOpts := metav1.ListOptions{
LabelSelector: cr.Spec.GetLabelSelector(),
}
Expand Down Expand Up @@ -225,7 +225,7 @@ func getPlainLogs(req *restclient.Request) (string, error) {
}

// newPodForCR returns a busybox pod with the same name/namespace as the cr
func newDaemonSetForCR(cr *storageosv1alpha1.Job) (*appsv1.DaemonSet, error) {
func newDaemonSetForCR(cr *storageosv1.Job) (*appsv1.DaemonSet, error) {
defaultLabels := map[string]string{
"daemonset": cr.Name + "-daemonset-job",
"job": cr.Name,
Expand Down Expand Up @@ -291,7 +291,7 @@ func newDaemonSetForCR(cr *storageosv1alpha1.Job) (*appsv1.DaemonSet, error) {
if len(tolerations) > 0 {
dset.Spec.Template.Spec.Tolerations = cr.Spec.Tolerations
}

// Add node affinity if defined.
if len(cr.Spec.NodeSelectorTerms) > 0 {
dset.Spec.Template.Spec.Affinity = &corev1.Affinity{NodeAffinity: &corev1.NodeAffinity{
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/storageoscluster/cluster.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package storageoscluster

import (
storageosv1alpha1 "github.com/storageos/cluster-operator/pkg/apis/storageos/v1alpha1"
storageosv1 "github.com/storageos/cluster-operator/pkg/apis/storageos/v1"
"github.com/storageos/cluster-operator/pkg/storageos"
)

// StorageOSCluster stores the current cluster's information. It binds the
// cluster and the deployment together, ensuring deployment interacts with the
// right cluster resource.
type StorageOSCluster struct {
cluster *storageosv1alpha1.StorageOSCluster
cluster *storageosv1.StorageOSCluster
// deployment implements storageoscluster.Deployment interface. This is
// cached for a cluster to avoid recreating it without any change to the
// cluster object. Every new cluster will create its unique deployment.
deployment Deployment
}

// NewStorageOSCluster creates a new StorageOSCluster object.
func NewStorageOSCluster(cluster *storageosv1alpha1.StorageOSCluster) *StorageOSCluster {
func NewStorageOSCluster(cluster *storageosv1.StorageOSCluster) *StorageOSCluster {
return &StorageOSCluster{cluster: cluster}
}

Expand All @@ -34,7 +34,7 @@ func (c *StorageOSCluster) SetDeployment(r *ReconcileStorageOSCluster) {

// IsCurrentCluster compares the cluster attributes to check if the given
// cluster is the same as the current cluster.
func (c *StorageOSCluster) IsCurrentCluster(cluster *storageosv1alpha1.StorageOSCluster) bool {
func (c *StorageOSCluster) IsCurrentCluster(cluster *storageosv1.StorageOSCluster) bool {
if (c.cluster.GetName() == cluster.GetName()) &&
(c.cluster.GetNamespace() == cluster.GetNamespace()) {
return true
Expand Down
Loading