Comments (6)
@LuisPiedra @allamand this is now possible with kiosk v0.2.0:
apiVersion: config.kiosk.sh/v1alpha1
kind: Template
metadata:
name: space-template
resources:
manifests:
- apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: utils-admin-dev-space3
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: utils-admin
namespace: '${NAMESPACE}'
from kiosk.
@allamand thanks for opening this issue! I see the use case, however it is usually not a good idea to create cluster scoped objects via the template like ClusterRoleBinding, because multiple templateinstances will create conflicts with overriding the existing objects. It is possible to do that, however it is not encouraged. The idea of templates is to specify namespace scoped resources that will enforce some sort of restriction for a newly created space and kiosk ensures the template instances are created during space creation.
I think in your use case it would be better to use a RoleBinding that only grants namespace access to a ServiceAccount and here you wouldn't need a namespace identifier:
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: test
subjects:
- kind: ServiceAccount
name: utils-admin
roleRef:
kind: ClusterRole
name: admin
apiGroup: rbac.authorization.k8s.io
In general, I think we can consider something like this, however I think we have to solve the bigger problem of how to avoid conflicts with cluster scoped resources in templates first.
from kiosk.
This make sense. Thanks
from kiosk.
Hi,
I have the same need but for a different use case. In my case, I would like con configure Ingress for a Service that is started as part of the template, which is namespaced resource, but of course I cannot have the same URL in different namespaces.
I guess I could give up on the idea of starting workloads as part of the TemplateInstance, as its intention seems to be for limiting the activity on the space rather than providing capabilities in the Space from scratch. Anyway, a Template that cannot use placeholders is a really weird template :)
from kiosk.
@LuisPiedra I see, yes I agree we should add capabilities in kiosk to parameterize a template. Our current idea is that we could add something like openshift does and add a parameters section to a template definition:
kind: Template
apiVersion: v1alpha1.tenancy.kiosk.sh
metadata:
name: my-template
resources:
manifests:
- kind: BuildConfig
apiVersion: v1
metadata:
name: cakephp-mysql-example
annotations:
description: Defines how to build the application
spec:
source:
type: Git
git:
uri: "${SOURCE_REPOSITORY_URL}"
ref: "${SOURCE_REPOSITORY_REF}"
contextDir: "${CONTEXT_DIR}"
- kind: DeploymentConfig
apiVersion: v1
metadata:
name: frontend
spec:
replicas: "${{REPLICA_COUNT}}"
parameters:
- name: SOURCE_REPOSITORY_URL
value: https://github.com/sclorg/cakephp-ex.git
required: true
- name: GITHUB_WEBHOOK_SECRET
validationRegEx: "[a-zA-Z0-9]{40}"
- name: REPLICA_COUNT
value: "2"
required: true
With that approach we could also add something like pre-defined parameters which could be namespace the template got initiated in and owner account name for example.
Then we would also add a parameters
section to TemplateInstance which would allow you to use these self created parameters. These additions should also solve your problem and will make kiosk templates finally a real template :).
from kiosk.
This is cool @FabianKramm
I finally addressed my issue by using Helm chart, as the namespace can be resolved in Helm template with {{ .Release.Namespace }}, but I'm sure templating directly in the Kiosk template will come handy at some point.
from kiosk.
Related Issues (20)
- Option to choose namespace destination for helm chart HOT 10
- Is redundant code?
- Account: Allow to apply custom label/annotation on namespace HOT 2
- kubens support HOT 5
- Access problem need help HOT 2
- Kiosk server port is not configurable HOT 1
- Delete Account doesn't delete the underline spaces HOT 2
- unable to retrieve the complete list of server APIs: tenancy.kiosk.sh/v1alpha1 HOT 2
- Kiosk restarted several times HOT 3
- Spaces can not properly be created by ArgoCD, resources show as OutOfSync HOT 6
- Hey is it possible/ how to use kiosk with saml2-based ADFS ? HOT 1
- Account spaceTemplate is not reconciled HOT 3
- Unsupport kubernetes server-side apply HOT 1
- Changing label in namespace doesn't update rolebinding
- Question: How to setup in existing cluster - Namespace migration HOT 3
- accountquotas resources cannot be edited after upgrade k8s to 1.22 HOT 2
- Unable to create template instance with parameters HOT 1
- Can map exists namespace in k8s cluster to new space? HOT 1
- can kiosk deploy's Replicas more than one? HOT 4
- Debug Mode to see failed rendered chart? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kiosk.