Skip to content

Commit d979ab9

Browse files
authored
Merge pull request #98 from Charliekenney23/fix-skip-configmap-auth
Hardcode --authentication-skip-lookup=true to short-circuit ConfigMap auth
2 parents e413513 + fcf17a0 commit d979ab9

File tree

3 files changed

+54
-6
lines changed

3 files changed

+54
-6
lines changed

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ run: build
6868
dist/linode-cloud-controller-manager \
6969
--logtostderr=true \
7070
--stderrthreshold=INFO \
71-
--cloud-provider=linode \
7271
--kubeconfig=${KUBECONFIG}
7372

7473
.PHONY: run-debug
@@ -77,7 +76,6 @@ run-debug: build
7776
dist/linode-cloud-controller-manager \
7877
--logtostderr=true \
7978
--stderrthreshold=INFO \
80-
--cloud-provider=linode \
8179
--kubeconfig=${KUBECONFIG} \
8280
--linodego-debug
8381

deploy/ccm-linode-template.yaml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,44 @@ metadata:
1515
name: ccm-linode
1616
namespace: kube-system
1717
---
18+
apiVersion: rbac.authorization.k8s.io/v1
19+
kind: ClusterRole
20+
metadata:
21+
name: ccm-linode-clusterrole
22+
rules:
23+
- apiGroups: [""]
24+
resources: ["endpoints"]
25+
verbs: ["get", "watch", "list", "update", "create"]
26+
- apiGroups: [""]
27+
resources: ["nodes"]
28+
verbs: ["get", "watch", "list", "update", "delete", "patch"]
29+
- apiGroups: [""]
30+
resources: ["nodes/status"]
31+
verbs: ["get", "watch", "list", "update", "delete", "patch"]
32+
- apiGroups: [""]
33+
resources: ["events"]
34+
verbs: ["get", "watch", "list", "update", "create", "patch"]
35+
- apiGroups: [""]
36+
resources: ["persistentvolumes"]
37+
verbs: ["get", "watch", "list", "update"]
38+
- apiGroups: [""]
39+
resources: ["secrets"]
40+
verbs: ["get"]
41+
- apiGroups: [""]
42+
resources: ["services"]
43+
verbs: ["get", "watch", "list"]
44+
- apiGroups: [""]
45+
resources: ["services/status"]
46+
verbs: ["get", "watch", "list", "update", "patch"]
47+
---
1848
kind: ClusterRoleBinding
1949
apiVersion: rbac.authorization.k8s.io/v1
2050
metadata:
21-
name: system:ccm-linode
51+
name: ccm-linode-clusterrolebinding
2252
roleRef:
2353
apiGroup: rbac.authorization.k8s.io
2454
kind: ClusterRole
25-
# TODO: make these permissions more fine-grained
26-
name: cluster-admin
55+
name: ccm-linode-clusterrole
2756
subjects:
2857
- kind: ServiceAccount
2958
name: ccm-linode
@@ -72,7 +101,6 @@ spec:
72101
imagePullPolicy: Always
73102
name: ccm-linode
74103
args:
75-
- --cloud-provider=linode
76104
- --leader-elect-resource-lock=endpoints
77105
- --v=3
78106
- --port=0

main.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,28 @@ func main() {
6969
// Add Linode-specific flags
7070
command.Flags().BoolVar(&linode.Options.LinodeGoDebug, "linodego-debug", false, "enables debug output for the LinodeAPI wrapper")
7171

72+
// Set static flags
73+
command.Flags().VisitAll(func(fl *pflag.Flag) {
74+
var err error
75+
switch fl.Name {
76+
case "cloud-provider":
77+
err = fl.Value.Set(linode.ProviderName)
78+
case
79+
// Prevent reaching out to an authentication-related ConfigMap that
80+
// we do not need, and thus do not intend to create RBAC permissions
81+
// for. See also
82+
// https://github.com/linode/linode-cloud-controller-manager/issues/91
83+
// and https://github.com/kubernetes/cloud-provider/issues/29.
84+
"authentication-skip-lookup":
85+
err = fl.Value.Set("true")
86+
}
87+
88+
if err != nil {
89+
fmt.Fprintf(os.Stderr, "failed to set flag %q: %s\n", fl.Name, err)
90+
os.Exit(1)
91+
}
92+
})
93+
7294
// Make the Linode-specific CCM bits aware of the kubeconfig flag
7395
linode.Options.KubeconfigFlag = command.Flags().Lookup("kubeconfig")
7496
if linode.Options.KubeconfigFlag == nil {

0 commit comments

Comments
 (0)