Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit 758f53b

Browse files
authored
Merge pull request #30 from chuckha/controller-logic2
Controller logic2
2 parents 7a638d0 + e661a98 commit 758f53b

39 files changed

+7298
-33
lines changed

api/v1alpha1/kubeadmbootstrapconfig_types.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,12 @@ import (
2222
)
2323

2424
// Phase defines KubeadmBootstrapConfig phases
25-
// +kubebuilder:validation:Enum=Ready;Unknown
2625
type Phase string
2726

2827
// Ready defines the KubeadmBootstrapConfig Ready Phase
2928
const (
3029
// Ready indicates the config is ready to be used by a Machine.
3130
Ready Phase = "Ready"
32-
// Unknown indicates the phase is unknown.
33-
Unknown Phase = "Unknown"
3431
)
3532

3633
// KubeadmBootstrapConfigSpec defines the desired state of KubeadmBootstrapConfig

api/v1alpha1/kubeadmbootstrapconfig_types_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package v1alpha1
1919
import (
2020
. "github.com/onsi/ginkgo"
2121
. "github.com/onsi/gomega"
22-
2322
"golang.org/x/net/context"
2423
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2524
"k8s.io/apimachinery/pkg/types"
@@ -59,9 +58,6 @@ var _ = Describe("KubeadmBootstrapConfig", func() {
5958
Name: "foo",
6059
Namespace: "default",
6160
},
62-
Status: KubeadmBootstrapConfigStatus{
63-
Phase: Unknown,
64-
},
6561
}
6662

6763
By("creating an API obj")

config-capi/BUILD.bazel

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
filegroup(
2+
name = "kustomize-yaml",
3+
srcs = glob([
4+
"crds/*.yaml",
5+
"rbac/*.yaml",
6+
"manager/*.yaml",
7+
"default/*.yaml",
8+
]),
9+
visibility = ["//visibility:public"],
10+
)
11+
12+
genrule(
13+
name = "cluster-api-yaml",
14+
srcs = [
15+
":kustomize-yaml",
16+
":default/kustomization.yaml",
17+
],
18+
outs = ["cluster_api.yaml"],
19+
cmd = "$(location @io_k8s_sigs_kustomize//:kustomize) build $$(dirname $(location :default/kustomization.yaml)) > $@",
20+
tools = ["@io_k8s_sigs_kustomize//:kustomize"],
21+
visibility = ["//visibility:public"],
22+
)

config-capi/ci/kustomization.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Adds namespace to all resources.
2+
namespace: provider-system
3+
4+
# Value of this field is prepended to the
5+
# names of all resources, e.g. a deployment named
6+
# "wordpress" becomes "alices-wordpress".
7+
# Note that it should also match with the prefix (text before '-') of the namespace
8+
# field above.
9+
namePrefix: provider-
10+
11+
bases:
12+
- ./rbac/
13+
- ./manager/
14+
15+
patchesStrategicMerge:
16+
- manager_image_patch.yaml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Each entry in this list must resolve to an existing
2+
# resource definition in YAML. These are the resource
3+
# files that kustomize reads, modifies and emits as a
4+
# YAML string, with resources separated by document
5+
# markers ("---").
6+
resources:
7+
- manager.yaml
8+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: apps/v1
2+
kind: StatefulSet
3+
metadata:
4+
name: controller-manager
5+
namespace: system
6+
spec:
7+
template:
8+
spec:
9+
containers:
10+
- image: gcr.io/k8s-cluster-api/example-provider-controller:latest
11+
name: manager
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Each entry in this list must resolve to an existing
2+
# resource definition in YAML. These are the resource
3+
# files that kustomize reads, modifies and emits as a
4+
# YAML string, with resources separated by document
5+
# markers ("---").
6+
resources:
7+
- role_binding.yaml
8+
- role.yaml

config-capi/crds/cluster.k8s.io_clusters.yaml

Lines changed: 543 additions & 0 deletions
Large diffs are not rendered by default.

config-capi/crds/cluster.k8s.io_machineclasses.yaml

Lines changed: 417 additions & 0 deletions
Large diffs are not rendered by default.

config-capi/crds/cluster.k8s.io_machinedeployments.yaml

Lines changed: 963 additions & 0 deletions
Large diffs are not rendered by default.

config-capi/crds/cluster.k8s.io_machines.yaml

Lines changed: 861 additions & 0 deletions
Large diffs are not rendered by default.

config-capi/crds/cluster.k8s.io_machinesets.yaml

Lines changed: 925 additions & 0 deletions
Large diffs are not rendered by default.

config-capi/crds/cluster.sigs.k8s.io_clusters.yaml

Lines changed: 498 additions & 0 deletions
Large diffs are not rendered by default.

config-capi/crds/cluster.sigs.k8s.io_machinedeployments.yaml

Lines changed: 902 additions & 0 deletions
Large diffs are not rendered by default.

config-capi/crds/cluster.sigs.k8s.io_machines.yaml

Lines changed: 780 additions & 0 deletions
Large diffs are not rendered by default.

config-capi/crds/cluster.sigs.k8s.io_machinesets.yaml

Lines changed: 865 additions & 0 deletions
Large diffs are not rendered by default.

config-capi/crds/kustomization.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Each entry in this list must resolve to an existing
2+
# resource definition in YAML. These are the resource
3+
# files that kustomize reads, modifies and emits as a
4+
# YAML string, with resources separated by document
5+
# markers ("---").
6+
resources:
7+
- cluster.sigs.k8s.io_clusters.yaml
8+
- cluster.sigs.k8s.io_machines.yaml
9+
- cluster.sigs.k8s.io_machinesets.yaml
10+
- cluster.sigs.k8s.io_machinedeployments.yaml
11+
- cluster.k8s.io_clusters.yaml
12+
- cluster.k8s.io_machines.yaml
13+
- cluster.k8s.io_machinesets.yaml
14+
- cluster.k8s.io_machineclasses.yaml
15+
- cluster.k8s.io_machinedeployments.yaml
16+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Adds namespace to all resources.
2+
namespace: cluster-api-system
3+
4+
# Value of this field is prepended to the
5+
# names of all resources, e.g. a deployment named
6+
# "wordpress" becomes "alices-wordpress".
7+
# Note that it should also match with the prefix (text before '-') of the namespace
8+
# field above.
9+
namePrefix: cluster-api-
10+
11+
bases:
12+
- ../crds/
13+
- ../rbac/
14+
- ../manager/
15+
16+
patches:
17+
- manager_image_patch.yaml
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: apps/v1
2+
kind: StatefulSet
3+
metadata:
4+
name: controller-manager
5+
namespace: system
6+
spec:
7+
template:
8+
spec:
9+
containers:
10+
- image: gcr.io/k8s-cluster-api/cluster-api-controller:latest
11+
name: manager
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Each entry in this list must resolve to an existing
2+
# resource definition in YAML. These are the resource
3+
# files that kustomize reads, modifies and emits as a
4+
# YAML string, with resources separated by document
5+
# markers ("---").
6+
resources:
7+
- manager.yaml
8+

config-capi/manager/manager.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
labels:
5+
controller-tools.k8s.io: "1.0"
6+
name: system
7+
---
8+
apiVersion: v1
9+
kind: Service
10+
metadata:
11+
name: controller-manager-service
12+
namespace: system
13+
labels:
14+
control-plane: controller-manager
15+
controller-tools.k8s.io: "1.0"
16+
spec:
17+
selector:
18+
control-plane: controller-manager
19+
controller-tools.k8s.io: "1.0"
20+
ports:
21+
- port: 443
22+
---
23+
apiVersion: apps/v1
24+
kind: StatefulSet
25+
metadata:
26+
name: controller-manager
27+
namespace: system
28+
labels:
29+
control-plane: controller-manager
30+
controller-tools.k8s.io: "1.0"
31+
spec:
32+
selector:
33+
matchLabels:
34+
control-plane: controller-manager
35+
controller-tools.k8s.io: "1.0"
36+
serviceName: controller-manager-service
37+
template:
38+
metadata:
39+
labels:
40+
control-plane: controller-manager
41+
controller-tools.k8s.io: "1.0"
42+
spec:
43+
tolerations:
44+
- effect: NoSchedule
45+
key: node-role.kubernetes.io/master
46+
- key: CriticalAddonsOnly
47+
operator: Exists
48+
- effect: NoExecute
49+
key: node.alpha.kubernetes.io/notReady
50+
operator: Exists
51+
- effect: NoExecute
52+
key: node.alpha.kubernetes.io/unreachable
53+
operator: Exists
54+
containers:
55+
- command:
56+
- /manager
57+
image: controller:latest
58+
name: manager
59+
resources:
60+
limits:
61+
cpu: 100m
62+
memory: 30Mi
63+
requests:
64+
cpu: 100m
65+
memory: 20Mi
66+
terminationGracePeriodSeconds: 10

config-capi/rbac/kustomization.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Each entry in this list must resolve to an existing
2+
# resource definition in YAML. These are the resource
3+
# files that kustomize reads, modifies and emits as a
4+
# YAML string, with resources separated by document
5+
# markers ("---").
6+
resources:
7+
- role_binding.yaml
8+
- role.yaml
9+

config-capi/rbac/role.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
2+
---
3+
apiVersion: rbac.authorization.k8s.io/v1
4+
kind: ClusterRole
5+
metadata:
6+
creationTimestamp: null
7+
name: manager-role
8+
rules:
9+
- apiGroups:
10+
- ""
11+
resources:
12+
- nodes
13+
verbs:
14+
- create
15+
- delete
16+
- get
17+
- list
18+
- patch
19+
- update
20+
- watch
21+
- apiGroups:
22+
- cluster.sigs.k8s.io
23+
resources:
24+
- clusters
25+
- clusters/status
26+
- machinedeployments
27+
- machinedeployments/status
28+
- machines
29+
- machines/status
30+
- machinesets
31+
- machinesets/status
32+
verbs:
33+
- create
34+
- delete
35+
- get
36+
- list
37+
- patch
38+
- update
39+
- watch
40+
- apiGroups:
41+
- bootstrap.cluster.sigs.k8s.io
42+
- infrastructure.cluster.sigs.k8s.io
43+
resources:
44+
- '*'
45+
verbs:
46+
- create
47+
- delete
48+
- get
49+
- list
50+
- patch
51+
- update
52+
- watch
53+
- apiGroups:
54+
- ""
55+
resources:
56+
- events
57+
verbs:
58+
- create
59+
- get
60+
- list
61+
- patch
62+
- watch
63+
- apiGroups:
64+
- ""
65+
resources:
66+
- secrets
67+
verbs:
68+
- get
69+
- list
70+
- watch

config-capi/rbac/role_binding.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
creationTimestamp: null
5+
name: manager-rolebinding
6+
roleRef:
7+
apiGroup: rbac.authorization.k8s.io
8+
kind: ClusterRole
9+
name: manager-role
10+
subjects:
11+
- kind: ServiceAccount
12+
name: default
13+
namespace: system
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: cluster.k8s.io/v1alpha2
2+
kind: Cluster
3+
metadata:
4+
labels:
5+
controller-tools.k8s.io: "1.0"
6+
name: cluster-sample
7+
spec:
8+
# Add fields here
9+
foo: bar
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: cluster.k8s.io/v1alpha2
2+
kind: Machine
3+
metadata:
4+
labels:
5+
controller-tools.k8s.io: "1.0"
6+
name: machine-sample
7+
spec:
8+
# Add fields here
9+
foo: bar
10+
providerSpec:
11+
test: 1
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: cluster.k8s.io/v1alpha2
2+
kind: MachineDeployment
3+
metadata:
4+
labels:
5+
controller-tools.k8s.io: "1.0"
6+
name: machinedeployment-sample
7+
spec:
8+
replicas: 3
9+
selector:
10+
matchLabels:
11+
# Add fields here
12+
foo: bar
13+
template:
14+
metadata:
15+
labels:
16+
foo: bar
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: cluster.k8s.io/v1alpha2
2+
kind: MachineSet
3+
metadata:
4+
labels:
5+
controller-tools.k8s.io: "1.0"
6+
name: machineset-sample
7+
spec:
8+
replicas: 3
9+
selector:
10+
matchLabels:
11+
# Add fields here
12+
foo: bar
13+
template:
14+
metadata:
15+
labels:
16+
foo: bar
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: cluster.k8s.io/v1alpha2
2+
kind: Cluster
3+
metadata:
4+
labels:
5+
controller-tools.k8s.io: "1.0"
6+
name: cluster-sample
7+
spec:
8+
# Add fields here
9+
foo: bar
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: cluster.k8s.io/v1alpha2
2+
kind: Machine
3+
metadata:
4+
labels:
5+
controller-tools.k8s.io: "1.0"
6+
name: machine-sample
7+
spec:
8+
# Add fields here
9+
foo: bar

0 commit comments

Comments
 (0)