Skip to content

Commit ca3d454

Browse files
author
zxBCN Cruz_Martinez
committed
Add support to StatefulSet
1 parent cb4f1a6 commit ca3d454

7 files changed

Lines changed: 22 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Add support for `StatefulSet` resources ([#234](https://github.com/opendevstack/tailor/pull/234)).
6+
57
## [1.3.0] - 2020-11-13
68

79
- Use `oc get` without `--export` flag, which has been removed in Kubernetes 1.19 ([#230](https://github.com/opendevstack/tailor/pull/230)).

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ If you are a Tailor user wanting to migrate to Helm, check out the [migration gu
158158

159159
### Tailor does not recognize a certain resource kind
160160

161-
Tailor currently supports `BuildConfig`, `CronJob`, `Job`, `Deployment`, `DeploymentConfig`, `ImageStream`, `LimitRange`, `PersistentVolumeClaim`, `ResourceQuota`, `RoleBinding`, `Route`, `Secret`, `Service`, `ServiceAccount`, `Template`, `HorizontalPodAutoscaler`. Some resources like `Build`, `Event`, `ImageStreamImage`, `ImageStreamTag`, `PersistentVolume`, `Pod`, `ReplicationController` are not supported by design as they are created and managed automatically by OpenShift. If you want to control a resource with Tailor that is not supported yet, but would be suitable, please [open an issue](https://github.com/opendevstack/tailor/issues/new).
161+
Tailor currently supports `BuildConfig`, `CronJob`, `Job`, `Deployment`, `DeploymentConfig`, `ImageStream`, `LimitRange`, `PersistentVolumeClaim`, `ResourceQuota`, `RoleBinding`, `Route`, `Secret`, `Service`, `ServiceAccount`, `Template`, `HorizontalPodAutoscaler`, and `StatefulSet`. Some resources like `Build`, `Event`, `ImageStreamImage`, `ImageStreamTag`, `PersistentVolume`, `Pod`, `ReplicationController` are not supported by design as they are created and managed automatically by OpenShift. If you want to control a resource with Tailor that is not supported yet, but would be suitable, please [open an issue](https://github.com/opendevstack/tailor/issues/new).
162162

163163
### Why is it required to specify fields which have server defaults?
164164

pkg/openshift/change.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var (
2323
"LimitRange": "limitrange",
2424
"ResourceQuota": "quota",
2525
"HorizontalPodAutoscaler": "hpa",
26+
"StatefulSet": "statefulset",
2627
}
2728
)
2829

pkg/openshift/changeset.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ var (
2424
"Job": "j",
2525
"ImageStream": "k",
2626
"BuildConfig": "l",
27-
"DeploymentConfig": "m",
28-
"Deployment": "n",
29-
"HorizontalPodAutoscaler": "o",
30-
"Service": "p",
31-
"Route": "q",
27+
"StatefulSet": "m",
28+
"DeploymentConfig": "n",
29+
"Deployment": "o",
30+
"HorizontalPodAutoscaler": "p",
31+
"Service": "q",
32+
"Route": "r",
3233
}
3334
)
3435

pkg/openshift/filter.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var availableKinds = []string{
2727
"limitrange",
2828
"quota",
2929
"hpa",
30+
"statefulset",
3031
}
3132

3233
type ResourceFilter struct {

pkg/openshift/filter_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ func TestNewResourceFilter(t *testing.T) {
8383
t.Errorf("Kinds incorrect, got: %v, want: %v.", actual, expected)
8484
}
8585

86+
actual, err = NewResourceFilter("statefulset", "", []string{})
87+
expected = &ResourceFilter{
88+
Kinds: []string{"StatefulSet"},
89+
Name: "",
90+
Label: "",
91+
}
92+
if err != nil || !reflect.DeepEqual(actual, expected) {
93+
t.Errorf("Kinds incorrect, got: %v, want: %v.", actual, expected)
94+
}
95+
8696
}
8797

8898
func TestSatisfiedBy(t *testing.T) {

pkg/openshift/item.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ var (
8080
"resourcequota": "ResourceQuota",
8181
"quota": "ResourceQuota",
8282
"hpa": "HorizontalPodAutoscaler",
83+
"statefulset": "StatefulSet",
8384
}
8485
)
8586

0 commit comments

Comments
 (0)