rbac-helm/playbooks/tasks/setup-test-context.yaml
Mohammed Naser f9900bebd2 Added basic RBAC
Depends-On: https://review.opendev.org/721365
Depends-On: https://review.opendev.org/721369
Change-Id: Id7a01e39d9cd2bbecdb77bd5285b98e92eecf7c2
2020-04-20 21:11:45 -04:00

38 lines
1.2 KiB
YAML

---
# Copyright 2020 VEXXHOST, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Create ServiceAccount
shell: |
cat <<EOF | kubectl apply -f-
apiVersion: v1
kind: ServiceAccount
metadata:
name: test-member
EOF
- name: Get secret name
shell: kubectl get sa/test-member -ojsonpath='{.secrets[0].name}'
register: _kubectl_get_sa
- name: Get account token
shell: kubectl get secret/{{ _kubectl_get_sa.stdout }} -ojsonpath='{.data.token}' | base64 --decode
register: _token
- name: Create credentials
shell: kubectl config set-credentials test-member --token={{ _token.stdout }}
- name: Create test context
shell: kubectl config set-context test --cluster=minikube --user=test-member