Skip to content

Commit 63b5be3

Browse files
Update docker machine operator (#6)
Signed-off-by: Shaad7 <abdullah.alshaad@appscode.com>
1 parent f9780b7 commit 63b5be3

File tree

111 files changed

+521
-1445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+521
-1445
lines changed

api/v1alpha1/helper.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,34 @@ import (
2626
type MachinePhase string
2727

2828
const (
29-
MachineConditionTypeMachineReady kmapi.ConditionType = "MachineReady"
30-
MachineConditionTypeScriptReady kmapi.ConditionType = "ScriptReady"
31-
MachineConditionTypeAuthDataReady kmapi.ConditionType = "AuthDataReady"
32-
MachineConditionTypeClusterReady kmapi.ConditionType = "ClusterReady"
29+
MachineConditionTypeMachineReady kmapi.ConditionType = "MachineReady"
30+
MachineConditionTypeScriptReady kmapi.ConditionType = "ScriptReady"
31+
MachineConditionTypeAuthDataReady kmapi.ConditionType = "AuthDataReady"
32+
MachineConditionTypeScriptComplete kmapi.ConditionType = "ScriptComplete"
3333
)
3434

3535
const (
36-
MachineConditionClusterCreatedSuccessfully = "ClusterCreatedSuccessfully"
37-
MachineConditionClusterCreateFailed = "ClusterCreateFailed"
36+
MachineConditionClusterOperationSuccessful = "ClusterOperationSuccessful"
37+
MachineConditionClusterOperationFailed = "ClusterOperationFailed"
3838
MachineConditionWaitingForScriptCompletion = "WaitingForScriptCompletion"
3939
MachineConditionAuthDataNotFound = "AuthDataNotFound"
4040
MachineConditionScriptDataNotFound = "ScriptDataNotFound"
4141
MachineConditionMachineCreating = "MachineCreating"
4242
)
4343

4444
const (
45-
MachinePhasePending MachinePhase = "Pending"
46-
MachinePhaseInProgress MachinePhase = "InProgress"
47-
MachinePhaseWaitingForClusterReady MachinePhase = "WaitingForClusterReady"
48-
MachinePhaseClusterCreateFailed MachinePhase = "ClusterCreateFailed"
49-
MachinePhaseSuccess MachinePhase = "Success"
50-
MachinePhaseTerminating MachinePhase = "Terminating"
51-
MachinePhaseFailed MachinePhase = "Failed"
45+
MachinePhasePending MachinePhase = "Pending"
46+
MachinePhaseInProgress MachinePhase = "InProgress"
47+
MachinePhaseWaitingForScriptCompletion MachinePhase = "WaitingForScriptCompletion"
48+
MachinePhaseClusterOperationFailed MachinePhase = "ClusterOperationFailed"
49+
MachinePhaseSuccess MachinePhase = "Success"
50+
MachinePhaseTerminating MachinePhase = "Terminating"
51+
MachinePhaseFailed MachinePhase = "Failed"
5252
)
5353

5454
func ConditionsOrder() []kmapi.ConditionType {
5555
return []kmapi.ConditionType{
56-
MachineConditionTypeClusterReady,
56+
MachineConditionTypeScriptComplete,
5757
MachineConditionTypeMachineReady,
5858
MachineConditionTypeAuthDataReady,
5959
MachineConditionTypeScriptReady,
@@ -92,10 +92,10 @@ func GetPhase(obj *Machine) MachinePhase {
9292
return MachinePhaseInProgress
9393
}
9494
if cond.Reason == MachineConditionWaitingForScriptCompletion {
95-
return MachinePhaseWaitingForClusterReady
95+
return MachinePhaseWaitingForScriptCompletion
9696
}
97-
if cond.Reason == MachineConditionClusterCreateFailed {
98-
return MachineConditionClusterCreateFailed
97+
if cond.Reason == MachineConditionClusterOperationFailed {
98+
return MachineConditionClusterOperationFailed
9999
}
100100
return MachinePhaseFailed
101101
}

api/v1alpha1/machine_types.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ import (
2424

2525
// MachineSpec defines the desired state of Machine
2626
type MachineSpec struct {
27-
Driver *core.LocalObjectReference `json:"driver"`
28-
ScriptRef *kmapi.ObjectReference `json:"scriptRef"`
29-
AuthSecret *kmapi.ObjectReference `json:"authSecret"`
30-
Parameters map[string]string `json:"parameters"`
27+
Driver *core.LocalObjectReference `json:"driver"`
28+
// +optional
29+
ScriptRef *kmapi.ObjectReference `json:"scriptRef"`
30+
AuthSecret *kmapi.ObjectReference `json:"authSecret"`
31+
// +optional
32+
Parameters map[string]string `json:"parameters"`
3133
}
3234

3335
// MachineStatus defines the observed state of Machine

config/samples/docker-machine_v1alpha1_machine.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spec:
1010
name: gcp-cred
1111
namespace: demo
1212
scriptRef:
13-
name: gcpscript
13+
name: gcpscriptcreate
1414
namespace: demo
1515
parameters:
1616
"google-project": "appscode-testing"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: docker-machine.klusters.dev/v1alpha1
2+
kind: Machine
3+
metadata:
4+
name: rancher-vm-del
5+
namespace: demo
6+
spec:
7+
driver:
8+
name: google
9+
authSecret:
10+
name: gcp-cred
11+
namespace: demo
12+
scriptRef:
13+
name: gcpscriptdel
14+
namespace: demo
15+
parameters:
16+
"google-project": "appscode-testing"
17+
"google-zone": "us-central1-a"
18+
"google-machine-type": "n1-standard-2"
19+
"google-machine-image": "ubuntu-os-cloud/global/images/ubuntu-2204-jammy-v20230714"
20+
21+

crds/docker-machine.klusters.dev_machines.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ spec:
8383
required:
8484
- authSecret
8585
- driver
86-
- parameters
87-
- scriptRef
8886
type: object
8987
status:
9088
description: MachineStatus defines the observed state of Machine

examples/gcp-driver.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: docker-machine.klusters.dev/v1alpha1
2+
kind: Driver
3+
metadata:
4+
name: google
5+
namespace: demo
6+
spec:
7+
builtin: true

examples/gcp-machine.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: docker-machine.klusters.dev/v1alpha1
2+
kind: Machine
3+
metadata:
4+
name: rancher-vm
5+
namespace: demo
6+
spec:
7+
driver:
8+
name: google
9+
authSecret:
10+
name: gcp-cred
11+
namespace: demo
12+
scriptRef:
13+
name: gcpscriptcreate
14+
namespace: demo
15+
parameters:
16+
"google-project": "appscode-testing"
17+
"google-zone": "us-central1-a"
18+
"google-machine-type": "n1-standard-2"
19+
"google-machine-image": "ubuntu-os-cloud/global/images/ubuntu-2204-jammy-v20230714"
20+
21+

go.mod

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module go.klusters.dev/docker-machine-operator
33
go 1.20
44

55
require (
6-
github.com/appscode/go v0.0.0-20201105063637-5613f3b8169f
76
github.com/aws/aws-sdk-go v1.45.4
87
github.com/go-logr/logr v1.2.4
98
github.com/onsi/ginkgo/v2 v2.9.1
@@ -42,7 +41,7 @@ require (
4241
github.com/go-openapi/jsonpointer v0.19.5 // indirect
4342
github.com/go-openapi/jsonreference v0.19.5 // indirect
4443
github.com/go-openapi/swag v0.19.14 // indirect
45-
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
44+
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
4645
github.com/gogo/protobuf v1.3.2 // indirect
4746
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
4847
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
@@ -78,17 +77,16 @@ require (
7877
go.uber.org/multierr v1.6.0 // indirect
7978
go.uber.org/zap v1.21.0 // indirect
8079
golang.org/x/crypto v0.6.0 // indirect
81-
golang.org/x/net v0.8.0 // indirect
80+
golang.org/x/net v0.10.0 // indirect
8281
golang.org/x/oauth2 v0.5.0 // indirect
83-
golang.org/x/sys v0.6.0 // indirect
84-
golang.org/x/term v0.6.0 // indirect
85-
golang.org/x/text v0.8.0 // indirect
82+
golang.org/x/sys v0.8.0 // indirect
83+
golang.org/x/term v0.8.0 // indirect
84+
golang.org/x/text v0.9.0 // indirect
8685
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
87-
golang.org/x/tools v0.7.0 // indirect
86+
golang.org/x/tools v0.9.1 // indirect
8887
gomodules.xyz/clock v0.0.0-20200817085942-06523dba733f // indirect
8988
gomodules.xyz/flags v0.1.3 // indirect
9089
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
91-
gomodules.xyz/password-generator v0.2.7 // indirect
9290
gomodules.xyz/sets v0.2.1 // indirect
9391
gomodules.xyz/wait v0.2.0 // indirect
9492
google.golang.org/appengine v1.6.7 // indirect

0 commit comments

Comments
 (0)