Work with Shared Resources
Work with Shared Resources builds for Red Hat OpenShift 1.3 Using Shared Resources CSI Driver Operator Red Hat OpenShift Documentation Team
apiVersion: sharedresource.openshift.io/v1alpha1 kind: SharedSecret metadata: name: shared-test-secret 1 spec: secretRef: name: test-secret namespace: <name_of_the_source_namespace> . apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: use-shared-test-secret 1 rules: - apiGroups: - sharedresource.openshift.io resources: - sharedsecrets resourceNames: - shared-test-secret verbs: - use apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: share-etc-pki-entitlement 1 namespace: openshift-config-managed rules: - apiGroups: - "" resources: - secrets resourceNames: - etc-pki-entitlement verbs: - get - list - watch apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: share-etc-pki-entitlement 1 namespace: openshift-config-managed roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: share-etc-pki-entitlement 2 subjects: - kind: ServiceAccount name: csi-driver-shared-resource 3 namespace: openshift-builds apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: use-shared-secret 1 namespace: app-namespace roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: use-shared-secret subjects: - kind: ServiceAccount name: <service_account_name> 2 apiVersion: v1 kind: Pod metadata: name: example-shared-secret namespace: <app_namespace> 1 spec: serviceAccountName: default volumes: - name: shared-secret csi: readOnly: true driver: csi.sharedresource.openshift.io volumeAttributes: sharedSecret: shared-test-secret 2 apiVersion: sharedresource.openshift.io/v1alpha1 kind: SharedConfigMap metadata: name: share-test-config 1 spec: configMapRef: name: shared-config namespace: <name_of_the_source_namespace> 2 apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: <cluster_role_name> 1 rules: - apiGroups: - sharedresource.openshift.io resources: - sharedconfigmaps resourceNames: - share-test-config 2 verbs: - use apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: shared-test-config namespace: test-share-source 1 rules: - apiGroups: [""] resources: ["configmaps"] resourceNames: ["shared-config"] verbs: ["get", "list", "watch"] apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: shared-test-config namespace: test-share-source 1 roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: shared-test-config subjects: 2 - kind: ServiceAccount name: csi-driver-shared-resource namespace: openshift-builds apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: use-shared-config namespace: <app_namespace> 1 roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: use-shared-config subjects: - kind: ServiceAccount name: <service_account_name> 2 apiVersion: v1 kind: Pod metadata: name: example-shared-config namespace: <app_namespace> 1 spec: serviceAccountName: default volumes: - name: shared-config csi: readOnly: true driver: csi.sharedresource.openshift.io volumeAttributes: sharedConfigMap: share-test-config 2 oc apply -f -<<EOF apiVersion: sharedresource.openshift.io/v1alpha1 kind: SharedSecret metadata: name: etc-pki-entitlement spec: secretRef: name: etc-pki-entitlement namespace: openshift-config-managed EOF apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: use-share-etc-pki-entitlement 1 rules: - apiGroups: - sharedresource.openshift.io resources: - sharedsecrets resourceNames: - etc-pki-entitlement verbs: - use apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: share-etc-pki-entitlement 1 namespace: openshift-config-managed rules: - apiGroups: - "" resources: - secrets resourceNames: - etc-pki-entitlement verbs: - get - list - watch apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: share-etc-pki-entitlement 1 namespace: openshift-config-managed roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: share-etc-pki-entitlement subjects: - kind: ServiceAccount name: csi-driver-shared-resource namespace: openshift-builds 2 apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: use-share-etc-pki-entitlement 1 roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: use-share-etc-pki-entitlement subjects: - kind: ServiceAccount name: pipeline - kind: ServiceAccount name: builder oc apply -f -<<EOF apiVersion: shipwright.io/v1beta1 kind: Build metadata: name: buildah-rhel spec: source: type: Git git: url: https://github.com/redhat-openshift-builds/samples contextDir: buildah-build strategy: name: buildah kind: ClusterBuildStrategy paramValues: - name: dockerfile value: DockerFile volumes: - csi: driver: csi.sharedresource.openshift.io readOnly: true 1 volumeAttributes: sharedSecret: <sharedsecret_object_name> 2 name: etc-pki-entitlement output: image: <output_image_location> 3 EOF