Skip to content

Commit

Permalink
Standardize resource names across the helm chart.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashwin Venkatesh committed Jan 25, 2022
1 parent 181707e commit 55d9ab1
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ template "consul.fullname" . }}-connect-injector-authmethod-role
name: {{ template "consul.fullname" . }}-connect-injector-authmethod
labels:
app: {{ template "consul.name" . }}
chart: {{ template "consul.chart" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ template "consul.fullname" . }}-connect-injector-authmethod-authdelegator-role-binding
name: {{ template "consul.fullname" . }}-connect-injector-authmethod-authdelegator
labels:
app: {{ template "consul.name" . }}
chart: {{ template "consul.chart" . }}
Expand All @@ -16,13 +16,13 @@ roleRef:
name: "system:auth-delegator"
subjects:
- kind: ServiceAccount
name: {{ template "consul.fullname" . }}-connect-injector-authmethod-svc-account
name: {{ template "consul.fullname" . }}-connect-injector-authmethod
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ template "consul.fullname" . }}-connect-injector-authmethod-serviceaccount-role-binding
name: {{ template "consul.fullname" . }}-connect-injector-authmethod-serviceaccount
labels:
app: {{ template "consul.name" . }}
chart: {{ template "consul.chart" . }}
Expand All @@ -31,10 +31,10 @@ metadata:
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "consul.fullname" . }}-connect-injector-authmethod-role
name: {{ template "consul.fullname" . }}-connect-injector-authmethod
subjects:
- kind: ServiceAccount
name: {{ template "consul.fullname" . }}-connect-injector-authmethod-svc-account
name: {{ template "consul.fullname" . }}-connect-injector-authmethod
namespace: {{ .Release.Namespace }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "consul.fullname" . }}-connect-injector-authmethod-svc-account
name: {{ template "consul.fullname" . }}-connect-injector-authmethod
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "consul.name" . }}
Expand Down
4 changes: 2 additions & 2 deletions charts/consul/templates/connect-inject-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ template "consul.fullname" . }}-connect-injector-webhook
name: {{ template "consul.fullname" . }}-connect-injector
labels:
app: {{ template "consul.name" . }}
chart: {{ template "consul.chart" . }}
Expand All @@ -30,7 +30,7 @@ rules:
- apiGroups: ["policy"]
resources: ["podsecuritypolicies"]
resourceNames:
- {{ template "consul.fullname" . }}-connect-injector-webhook
- {{ template "consul.fullname" . }}-connect-injector
verbs:
- use
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ template "consul.fullname" . }}-connect-injector-webhook-admin-role-binding
name: {{ template "consul.fullname" . }}-connect-injector
labels:
app: {{ template "consul.name" . }}
chart: {{ template "consul.chart" . }}
Expand All @@ -12,9 +12,9 @@ metadata:
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "consul.fullname" . }}-connect-injector-webhook
name: {{ template "consul.fullname" . }}-connect-injector
subjects:
- kind: ServiceAccount
name: {{ template "consul.fullname" . }}-connect-injector-webhook-svc-account
name: {{ template "consul.fullname" . }}-connect-injector
namespace: {{ .Release.Namespace }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/consul/templates/connect-inject-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "consul.fullname" . }}-connect-injector-webhook-deployment
name: {{ template "consul.fullname" . }}-connect-injector
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "consul.name" . }}
Expand Down Expand Up @@ -50,7 +50,7 @@ spec:
{{- end }}
{{- end }}
spec:
serviceAccountName: {{ template "consul.fullname" . }}-connect-injector-webhook-svc-account
serviceAccountName: {{ template "consul.fullname" . }}-connect-injector
containers:
- name: sidecar-injector
image: "{{ default .Values.global.imageK8S .Values.connectInject.image }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ roleRef:
name: {{ template "consul.fullname" . }}-connect-inject-leader-election
subjects:
- kind: ServiceAccount
name: {{ template "consul.fullname" . }}-connect-injector-webhook-svc-account
name: {{ template "consul.fullname" . }}-connect-injector
namespace: {{ .Release.Namespace }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: {{ template "consul.fullname" . }}-connect-injector-cfg
name: {{ template "consul.fullname" . }}-connect-injector
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "consul.name" . }}
Expand All @@ -26,7 +26,7 @@ webhooks:
- "v1"
clientConfig:
service:
name: {{ template "consul.fullname" . }}-connect-injector-svc
name: {{ template "consul.fullname" . }}-connect-injector
namespace: {{ .Release.Namespace }}
path: "/mutate"
rules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: {{ template "consul.fullname" . }}-connect-injector-webhook
name: {{ template "consul.fullname" . }}-connect-injector
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "consul.name" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/consul/templates/connect-inject-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "consul.fullname" . }}-connect-injector-svc
name: {{ template "consul.fullname" . }}-connect-injector
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "consul.name" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/consul/templates/connect-inject-serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "consul.fullname" . }}-connect-injector-webhook-svc-account
name: {{ template "consul.fullname" . }}-connect-injector
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "consul.name" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: {{ template "consul.fullname" . }}-controller-mutating-webhook-configuration
name: {{ template "consul.fullname" . }}-controller
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "consul.name" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/consul/templates/partition-init-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ rules:
resources:
- serviceaccounts
resourceNames:
- {{ template "consul.fullname" . }}-connect-injector-authmethod-svc-account
- {{ template "consul.fullname" . }}-connect-injector-authmethod
verbs:
- get
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/consul/templates/partition-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "consul.fullname" . }}-partition-service
name: {{ template "consul.fullname" . }}-partition
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "consul.name" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/consul/templates/server-acl-init-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ rules:
resources:
- serviceaccounts
resourceNames:
- {{ template "consul.fullname" . }}-connect-injector-authmethod-svc-account
- {{ template "consul.fullname" . }}-connect-injector-authmethod
verbs:
- get
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/consul/templates/ui-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ apiVersion: networking.k8s.io/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ template "consul.fullname" . }}-ingress
name: {{ template "consul.fullname" . }}-ui
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "consul.name" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ rules:
resources:
- podsecuritypolicies
resourceNames:
- {{ template "consul.fullname" . }}-connect-injector-webhook
- {{ template "consul.fullname" . }}-connect-injector
verbs:
- use
{{- end }}
Expand Down
12 changes: 6 additions & 6 deletions charts/consul/templates/webhook-cert-manager-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ data:
[
{{- if .Values.connectInject.enabled }}
{
"name": "{{ template "consul.fullname" . }}-connect-injector-cfg",
"name": "{{ template "consul.fullname" . }}-connect-injector",
"tlsAutoHosts": [
"{{ template "consul.fullname" . }}-connect-injector-svc",
"{{ template "consul.fullname" . }}-connect-injector-svc.{{ .Release.Namespace }}",
"{{ template "consul.fullname" . }}-connect-injector-svc.{{ .Release.Namespace }}.svc",
"{{ template "consul.fullname" . }}-connect-injector-svc.{{ .Release.Namespace }}.svc.cluster.local"
"{{ template "consul.fullname" . }}-connect-injector",
"{{ template "consul.fullname" . }}-connect-injector.{{ .Release.Namespace }}",
"{{ template "consul.fullname" . }}-connect-injector.{{ .Release.Namespace }}.svc",
"{{ template "consul.fullname" . }}-connect-injector.{{ .Release.Namespace }}.svc.cluster.local"
],
"secretName": "{{ template "consul.fullname" . }}-connect-inject-webhook-cert",
"secretNamespace": "{{ .Release.Namespace }}"
}{{- if and .Values.controller.enabled }},{{- end }}{{- end }}
{{- if and .Values.controller.enabled }}
{
"name": "{{ template "consul.fullname" . }}-controller-mutating-webhook-configuration",
"name": "{{ template "consul.fullname" . }}-controller",
"tlsAutoHosts": [
"{{ template "consul.fullname" . }}-controller-webhook",
"{{ template "consul.fullname" . }}-controller-webhook.{{ .Release.Namespace }}",
Expand Down
8 changes: 4 additions & 4 deletions charts/consul/test/unit/webhook-cert-manager-configmap.bats
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ load _helpers
local actual=$(echo $cfg | jq '. | length == 1')
[ "${actual}" = "true" ]

local actual=$(echo $cfg | jq '.[0].name | contains("controller-mutating-webhook-configuration")')
local actual=$(echo $cfg | jq '.[0].name | contains("controller")')
[ "${actual}" = "true" ]
}

Expand All @@ -68,7 +68,7 @@ load _helpers
local actual=$(echo $cfg | jq '. | length == 1')
[ "${actual}" = "true" ]

local actual=$(echo $cfg | jq '.[0].name | contains("controller-mutating-webhook-configuration")')
local actual=$(echo $cfg | jq '.[0].name | contains("controller")')
[ "${actual}" = "false" ]
}

Expand All @@ -85,9 +85,9 @@ load _helpers
local actual=$(echo $cfg | jq '. | length == 2')
[ "${actual}" = "true" ]

local actual=$(echo $cfg | jq '.[0].name | contains("connect-injector-cfg")')
local actual=$(echo $cfg | jq '.[0].name | contains("connect-injector")')
[ "${actual}" = "true" ]

local actual=$(echo $cfg | jq '.[1].name | contains("controller-mutating-webhook-configuration")')
local actual=$(echo $cfg | jq '.[1].name | contains("controller")')
[ "${actual}" = "true" ]
}

0 comments on commit 55d9ab1

Please sign in to comment.