Skip to content

Commit 11622a5

Browse files
authored
mark taint timeAdded as optional (#368)
Signed-off-by: Qing Hao <[email protected]>
1 parent 2458a27 commit 11622a5

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

cluster/v1/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ spec:
152152
required:
153153
- effect
154154
- key
155-
- timeAdded
156155
type: object
157156
type: array
158157
required:

cluster/v1/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ type Taint struct {
110110
Effect TaintEffect `json:"effect"`
111111
// TimeAdded represents the time at which the taint was added.
112112
// +nullable
113-
// +required
113+
// +optional
114114
TimeAdded metav1.Time `json:"timeAdded"`
115115
}
116116

test/integration/api/managedcluster_test.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/onsi/ginkgo"
88
"github.com/onsi/gomega"
99
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
10+
"k8s.io/apimachinery/pkg/types"
1011
"k8s.io/apimachinery/pkg/util/rand"
1112
clusterv1 "open-cluster-management.io/api/cluster/v1"
1213
)
@@ -83,17 +84,26 @@ var _ = ginkgo.Describe("ManagedCluster API test", func() {
8384
_, err = hubClusterClient.ClusterV1().ManagedClusters().Update(context.TODO(), cluster, metav1.UpdateOptions{})
8485
gomega.Expect(err).To(gomega.HaveOccurred())
8586

86-
// Effect is not correct
87+
// key, value, effect is correct and update
8788
cluster.Spec.Taints = []clusterv1.Taint{
8889
{
8990
Key: "test.io/test",
9091
Value: "test",
9192
Effect: clusterv1.TaintEffectNoSelect,
9293
},
9394
}
94-
9595
_, err = hubClusterClient.ClusterV1().ManagedClusters().Update(context.TODO(), cluster, metav1.UpdateOptions{})
9696
gomega.Expect(err).ToNot(gomega.HaveOccurred())
9797

98+
// key, value, effect is correct and patch
99+
_, err = hubClusterClient.ClusterV1().ManagedClusters().Patch(
100+
context.TODO(),
101+
cluster.Name,
102+
types.MergePatchType,
103+
[]byte(`{"spec":{"taints":[{"key":"test.io/test","value":"testnew","effect":"NoSelect"}]}}`),
104+
metav1.PatchOptions{},
105+
)
106+
gomega.Expect(err).ToNot(gomega.HaveOccurred())
107+
98108
})
99109
})

0 commit comments

Comments
 (0)