Skip to content

Commit

Permalink
default rbac for oap (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
innerpeacez committed Mar 9, 2023
1 parent 9f69825 commit 7d3837e
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 147 deletions.
271 changes: 135 additions & 136 deletions chart/skywalking/README.md

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion chart/skywalking/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
Create the name of the service account to use for the oap cluster
*/}}
{{- define "skywalking.serviceAccountName.oap" -}}
{{ default (include "skywalking.oap.fullname" .) .Values.serviceAccounts.oap }}
{{- if .Values.serviceAccounts.oap.create -}}
{{ default (include "skywalking.oap.fullname" .) .Values.serviceAccounts.oap.name }}
{{- else -}}
{{ default "default" .Values.serviceAccounts.oap.name }}
{{- end -}}
{{- end -}}

{{/*
Expand Down
4 changes: 2 additions & 2 deletions chart/skywalking/templates/oap-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{{- if .Values.oap.envoy.als.enabled }}
{{- if .Values.serviceAccounts.oap.create }}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
Expand All @@ -30,4 +30,4 @@ rules:
- apiGroups: ["extensions"]
resources: ["deployments", "replicasets"]
verbs: ["get", "watch", "list"]
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion chart/skywalking/templates/oap-clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{{- if .Values.oap.envoy.als.enabled }}
{{- if .Values.serviceAccounts.oap.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
Expand Down
2 changes: 1 addition & 1 deletion chart/skywalking/templates/oap-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{{- if not .Values.oap.envoy.als.enabled }}
{{- if .Values.serviceAccounts.oap.create }}
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
Expand Down
2 changes: 1 addition & 1 deletion chart/skywalking/templates/oap-rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{{- if not .Values.oap.envoy.als.enabled }}
{{- if .Values.serviceAccounts.oap.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
Expand Down
2 changes: 2 additions & 0 deletions chart/skywalking/templates/oap-serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{{- if .Values.serviceAccounts.oap.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
Expand All @@ -23,3 +24,4 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "skywalking.serviceAccountName.oap" . }}
{{- end }}
7 changes: 3 additions & 4 deletions chart/skywalking/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

serviceAccounts:
oap:
# By default, create SkyWalking's ServiceAccount. If set to false, you also need to change `serviceAccounts.oap.name` value to a custom ServiceAccount name.
create: true
name: ""

imagePullSecrets: []

Expand Down Expand Up @@ -76,10 +79,6 @@ oap:
# runAsUser: 1000
# runAsGroup: 1000
# fsGroup: 1000
envoy:
als:
enabled: false
# more envoy ALS ,please refer to https://github.com/apache/skywalking/blob/master/docs/en/setup/envoy/als_setting.md#observe-service-mesh-through-als
env:
# more env, please refer to https://hub.docker.com/r/apache/skywalking-oap-server
# or https://github.com/apache/skywalking-docker/blob/master/6/6.4/oap/README.md#sw_telemetry
Expand Down
1 change: 0 additions & 1 deletion test/e2e/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ setup:
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.env.SW_ENVOY_METRIC_ALS_TCP_ANALYSIS=k8s-mesh \
--set oap.env.K8S_SERVICE_NAME_RULE='e2e::${service.metadata.name}' \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
--set ui.image.repository=$UI_REPO \
--set ui.image.tag=$UI_TAG \
Expand Down

0 comments on commit 7d3837e

Please sign in to comment.