Skip to content

Commit 56fd57e

Browse files
committed
Refactor pkg/controller and fix typo on CRD name
1 parent ca1e5e5 commit 56fd57e

File tree

8 files changed

+297
-242
lines changed

8 files changed

+297
-242
lines changed

examples/controller/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,18 @@ EOS
6767
Within a few seconds, the controller will reconcile your `Resource` by running `variant run apply --env preview --ref abc1234`.
6868

6969
You can verify that by tailing controller logs by `kubectl logs`, or browsing the `Reconcilation` object that is created by
70-
the controller to record the reconcilation details:
70+
the controller to record the reconciliation details:
7171

7272
```console
73-
$ kubectl get reconcilation
73+
$ kubectl get reconciliation
7474
NAME AGE
7575
myresource-2 12m
7676
```
7777

7878
```console
79-
$ kubectl get -o yaml reconcilation myresource-2
79+
$ kubectl get -o yaml reconciliation myresource-2
8080
apiVersion: core.variant.run/v1beta1
81-
kind: Reconcilation
81+
kind: Reconciliation
8282
metadata:
8383
creationTimestamp: "2020-10-28T12:05:55Z"
8484
generation: 1
@@ -114,15 +114,15 @@ EOS
114114
```
115115

116116
```console
117-
$ kubectl get reconcilation
117+
$ kubectl get reconciliation
118118
NAME AGE
119119
myresource-2 12m
120120
myresource-3 12m
121121
```
122122

123123
```cnosole
124124
apiVersion: core.variant.run/v1beta1urce-3
125-
kind: Reconcilation
125+
kind: Reconciliation
126126
metadata:
127127
creationTimestamp: "2020-10-28T12:06:10Z"
128128
generation: 1
@@ -146,17 +146,17 @@ Finally, deleting the `Resource` will let `variant` destroy the underlying resou
146146
as you've configured:
147147

148148
```console
149-
$ kubectl get reconcilation
149+
$ kubectl get reconciliation
150150
NAME AGE
151151
myresource-2 19m
152152
myresource-3 19m
153153
myresource-4 9s
154154
```
155155

156156
```console
157-
$ kubectl get reconcilation -o yaml myresource-4
157+
$ kubectl get reconciliation -o yaml myresource-4
158158
apiVersion: core.variant.run/v1beta1
159-
kind: Reconcilation
159+
kind: Reconciliation
160160
metadata:
161161
creationTimestamp: "2020-10-28T12:25:32Z"
162162
generation: 1

examples/controller/reconcilation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: core.variant.run/v1beta1
2-
kind: Reconcilation
2+
kind: Reconciliation
33
metadata:
44
name: myresource-abc
55
spec:

examples/controller/variant.crds.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ spec:
1717
apiVersion: apiextensions.k8s.io/v1beta1
1818
kind: CustomResourceDefinition
1919
metadata:
20-
name: reconcilations.core.variant.run
20+
name: reconciliations.core.variant.run
2121
spec:
2222
group: core.variant.run
2323
versions:
2424
- name: v1beta1
2525
served: true
2626
storage: true
2727
names:
28-
kind: Reconcilation
29-
plural: reconcilations
30-
singular: reconcilation
28+
kind: Reconciliation
29+
plural: reconciliations
30+
singular: reconciliation
3131
scope: Namespaced

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ require (
66
github.com/AlecAivazis/survey/v2 v2.0.5
77
github.com/PaesslerAG/jsonpath v0.1.1 // indirect
88
github.com/docker/distribution v2.7.1+incompatible // indirect
9+
github.com/go-logr/logr v0.1.0
910
github.com/go-playground/universal-translator v0.17.0 // indirect
1011
github.com/google/go-cmp v0.4.0
1112
github.com/google/go-github/v27 v27.0.6 // indirect

pkg/controller/api.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package controller
2+
3+
import (
4+
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
5+
"k8s.io/apimachinery/pkg/runtime/schema"
6+
)
7+
8+
const (
9+
coreGroup = "core.variant.run"
10+
coreVersion = "v1beta1"
11+
)
12+
13+
var (
14+
reconciliationGroupVersionKind = schema.GroupVersionKind{
15+
Group: coreGroup,
16+
Version: coreVersion,
17+
Kind: "Reconciliation",
18+
}
19+
)
20+
21+
func newReconciliation() *unstructured.Unstructured {
22+
obj := &unstructured.Unstructured{}
23+
24+
obj.SetGroupVersionKind(reconciliationGroupVersionKind)
25+
26+
return obj
27+
}

0 commit comments

Comments
 (0)