{"id":15292909,"url":"https://github.com/ericogr/k8s-object-template-operator","last_synced_at":"2026-05-04T06:35:07.374Z","repository":{"id":57561165,"uuid":"288327461","full_name":"ericogr/k8s-object-template-operator","owner":"ericogr","description":"Kubernetes operator used to create Kubernetes objects based on templates specs and user namespaced parameters specs.","archived":false,"fork":false,"pushed_at":"2021-04-06T00:17:48.000Z","size":3946,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T12:35:43.008Z","etag":null,"topics":["controller","crd","k8s","kubebuilder","kubernetes","kubernetes-objects","object","operator","operators","template"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericogr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-18T01:45:05.000Z","updated_at":"2021-04-06T00:17:50.000Z","dependencies_parsed_at":"2022-09-01T11:51:46.568Z","dependency_job_id":null,"html_url":"https://github.com/ericogr/k8s-object-template-operator","commit_stats":null,"previous_names":["ericogr/k8s-object-template"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/ericogr/k8s-object-template-operator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericogr%2Fk8s-object-template-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericogr%2Fk8s-object-template-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericogr%2Fk8s-object-template-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericogr%2Fk8s-object-template-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericogr","download_url":"https://codeload.github.com/ericogr/k8s-object-template-operator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericogr%2Fk8s-object-template-operator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32597510,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"online","status_checked_at":"2026-05-04T02:00:06.625Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["controller","crd","k8s","kubebuilder","kubernetes","kubernetes-objects","object","operator","operators","template"],"created_at":"2024-09-30T16:31:38.001Z","updated_at":"2026-05-04T06:35:07.357Z","avatar_url":"https://github.com/ericogr.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# K8S Object Template Operator [![CircleCI](https://circleci.com/gh/ericogr/k8s-object-template-operator.svg?style=svg)](https://circleci.com/gh/ericogr/k8s-object-template-operator)\nThis operator can be used to create any kubernetes object dynamically. Build your own templates using Kubernetes specs and set parameters to create new objects based on it.\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"img/demo.git?raw=true\"/\u003e\u003c/p\u003e\n\n## Use case\nMany kubernetes clusters are shared among many applications and teams. Sometimes services are available within the cluster scope and teams can use it to create or configure services using kubernetes spec (such as ConfigMap, Secret, PrometheusRule, ExternalDNS, etc.). Some of these specs are too complex or contains some configurations that we do not want to expose. You can automate it's creation using this operator.\n\nThis operator can create kubernete objects based on templates specs and simple namespaced parameters. You can give permissions to user create parameters specs but forbid templates specs and created objects from developers or users using the default Kubernetes RBAC system.\n\n# Installation\nUse the file [specs/object-template-operator.yaml](specs/object-template-operator.yaml) to start deploy this operator with all permissions (dev/test mode). For production, see section about roles bellow.\n\n```sh\nkubectl apply -f https://raw.githubusercontent.com/ericogr/k8s-object-template-operator/master/specs/object-template-operator.yaml\n```\n\n## Additionals Kubernetes Roles\nThis operator should be allowed to create objects defined in templates. With default permission, it can create any object, but it can be a bit tricky. The ClusterRole ```k8s-ot-manager-role``` can be used to set permissions as needed.\n\nSee this example to add ConfigMap permission to this operator:\n\n```yaml\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  creationTimestamp: null\n  name: k8s-ot-manager-role\nrules:\n# \u003e\u003e HERE, ADDED CONFIGMAP PERMISSIONS\n- apiGroups:\n  - \"\"\n  resources:\n  - configmaps\n  verbs:\n  - create\n  - get\n  - list\n  - patch\n  - update\n# \u003c\u003c\n- apiGroups:\n  - template.k8s.ericogr.com.br\n  resources:\n  - objecttemplateparams\n  verbs:\n  - create\n  - delete\n  - get\n  - list\n  - patch\n  - update\n  - watch\n- apiGroups:\n  - template.k8s.ericogr.com.br\n  resources:\n  - objecttemplateparams/status\n  verbs:\n  - get\n  - patch\n  - update\n- apiGroups:\n  - template.k8s.ericogr.com.br\n  resources:\n  - objecttemplates\n  verbs:\n  - create\n  - delete\n  - get\n  - list\n  - patch\n  - update\n  - watch\n- apiGroups:\n  - template.k8s.ericogr.com.br\n  resources:\n  - objecttemplates/status\n  verbs:\n  - get\n  - patch\n  - update\n```\n# New Custom Resource Definitions (CRD's)\nYou have two new CRD's: [ObjectTemplate](config/crd/bases/template.k8s.ericogr.com.br_objecttemplates.yaml) and [ObjectTemplateParameters](config/crd/bases/template.k8s.ericogr.com.br_objecttemplateparams.yaml).\n\n**ObjectTemplate (non namespaced):** template used to create kubernetes objects at users namespaces (can be used by k8s admins)\n\n**ObjectTemplateParameters (namespaced):** parameters used to create objects in their namespace (can be used by k8s users/devs)\n\n# Templates (ObjectTemplate)\nUse templates to scaffold kubernetes objects. Users can set your own parameters to create new objects based on pre confired templates.\n\n## Template example\n\n```yaml\n---\napiVersion: template.k8s.ericogr.com.br/v1\nkind: ObjectTemplate\nmetadata:\n  name: objecttemplate-configmap-test\nspec:\n  description: ConfigMap test\n  parameters:\n  - name: name\n    default: Maria\n  - name: age\n  objects:\n  - kind: ConfigMap\n    apiVersion: v1\n    metadata:\n      labels:\n        label1: labelvalue1\n        label2: labelvalue2\n      annotations:\n        annotation1: annotationvalue1\n        annotation2: annotationvalue2\n    name: configmap-test\n    templateBody: |-\n      data:\n        name: '{{ .name }}'\n        age: '{{ .age }}'\n```\n\n## Basic Template Substitution System\nYou can use sintax like ```{{ .variable }}``` to replace parameters. Let's say you created a template parameter with name/value ```name: foo```. You can use ```{{ .name }}``` inside ```templateBody``` template to be replaced in runtime. If you need to scape braces, use ```{{\"{{anything}}\"}}```.\n\n### Library template functions (by Sprig)\nThere are many template functions library available to use. See some examples:\n\nRemove spaces, convert to lowercase and truncate to 5 chars:\n\n```template\n{{ .username | trim | lower | trunc 5 }}\n```\nConvert text to base64:\n\n```template\n{{ .password | b64enc }}\n```\n\nAdd 10 to age:\n\n```template\n{{ .age | add 10 }}\n```\n\n\u003e More information: http://masterminds.github.io/sprig/\n\n### System Runtime Variables\n\n|Name         |Description       |\n|-------------|------------------|\n|__namespace  |Current namespace |\n|__apiVersion |API Version       |\n|__kind       |The name of kind  |\n|__name       |Name of object    |\n\n# Parameters (ObjectTemplateParams)\nUsers can define your own parameters to create new objects based on templates in their namespace.\n\n## Parameters example\n\n```yaml\n---\napiVersion: template.k8s.ericogr.com.br/v1\nkind: ObjectTemplateParams\nmetadata:\n  name: objecttemplateparams-sample\n  namespace: default\nspec:\n  templates:\n  - name: objecttemplate-configmap-test\n    values:\n      name: foo\n      age: '32'\n ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericogr%2Fk8s-object-template-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericogr%2Fk8s-object-template-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericogr%2Fk8s-object-template-operator/lists"}