{"id":20155308,"url":"https://github.com/redhat-cop/project-initialize-operator","last_synced_at":"2025-04-09T22:11:22.217Z","repository":{"id":73504935,"uuid":"240596041","full_name":"redhat-cop/project-initialize-operator","owner":"redhat-cop","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-15T02:57:45.000Z","size":98,"stargazers_count":10,"open_issues_count":7,"forks_count":7,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-09T22:11:16.768Z","etag":null,"topics":["container-cop","k8s-operator"],"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/redhat-cop.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-14T20:48:30.000Z","updated_at":"2023-11-15T11:15:35.000Z","dependencies_parsed_at":"2023-12-15T03:47:51.290Z","dependency_job_id":"6b6a8257-b5c7-4ade-aebd-41f331a59b4c","html_url":"https://github.com/redhat-cop/project-initialize-operator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-cop%2Fproject-initialize-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-cop%2Fproject-initialize-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-cop%2Fproject-initialize-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-cop%2Fproject-initialize-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redhat-cop","download_url":"https://codeload.github.com/redhat-cop/project-initialize-operator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119294,"owners_count":21050755,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["container-cop","k8s-operator"],"created_at":"2024-11-13T23:31:30.310Z","updated_at":"2025-04-09T22:11:22.197Z","avatar_url":"https://github.com/redhat-cop.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Project Initialize Operator\n========================================\n\n[![Build Status](https://github.com/redhat-cop/project-initialize-operator/workflows/project-initialize-operator/badge.svg?branch=master)](https://github.com/redhat-cop/project-initialize-operator/actions?workflow=project-initialize-operator)\n [![Docker Repository on Quay](https://quay.io/repository/redhat-cop/project-initialize-operator/status \"Docker Repository on Quay\")](https://quay.io/repository/redhat-cop/project-initialize-operator)\n\n_This repository is currently undergoing active development. Functionality may be in flux_\n\n## Overview\nThis repository contains the Project Initialize Operator which provides functionality for creating new projects within OpenShift and triggering custom on-boarding processes, specifically around the GitOps solution [ArgoCD](https://argoproj.github.io/argo-cd/).\n\n\n### Install (OpenShift)\nThe operator will require `cluster-admin` permissions that can be applied using the resources provided in the deploy/ folder.\n\nCreate the expected namespace\n```\n$ oc new-project project-operator\n```\n\nAdd the `ProjectInitialize` CRD and resources to the cluster\n```\n$ oc apply -f deploy/service_account.yaml\n$ oc apply -f deploy/role.yaml\n$ oc apply -f deploy/role_binding.yaml\n```\n\n### Add ProjectInitialize CRD\n#### 4.X OCP\n```\n$ oc apply -f deploy/crds/redhatcop.redhat.io_projectinitializes_crd.yaml\n```\n#### 3.X OCP\n```\n$ oc apply -f deploy/crds/redhatcop.redhat.io_projectinitializes_crd_3x.yaml\n```\n\n### Add ProjectInitialize CRD\n#### 4.X OCP\n```\n$ oc apply -f deploy/crds/redhatcop.redhat.io_projectinitializequota_crd.yaml\n```\n#### 3.X OCP\n```\n$ oc apply -f deploy/crds/redhatcop.redhat.io_projectinitializequota_crd_3x.yaml\n```\n### Deploy Operator (OpenShift)\nRun the following command when ready to deploy the operator into cluster it will monitor\n\n```\n$ oc apply -f deploy/operator.yaml\n```\n\n### Namespace Labels/Annotations\nLabels and annotations can be added to the namespace that is generated through the operator by specifying the values within the `ProjectInitialize` CR.\n\n```\napiVersion: redhatcop.redhat.io/v1alpha1\nkind: ProjectInitialize\nmetadata:\n  name: example-projectinitialize\nspec:\n  team: test\n  env: dev\n  cluster: clusterA\n  displayName: \"Test Project\"\n  desc: \"A test project for showing the functionality of the Project Initialize Operator\"\n  quotaSize: small\n  namespaceDetails:\n    annotations:\n      testKey: testValue\n    labels:\n      testKey: testValue\n```\n\n### Adding Defined Quota Sizes to Cluster\nWhen the `quotaSize` attribute is defined in the `ProjectInitializeQuota` Custom Resource (CR) the operator will search for a cluster level `ProjectInitializeQuota` CR that defines a particular quota size. This can be used to define predetermined t-shirt sizes when creating new projects (small, medium, large, etc)\n\n```\napiVersion: redhatcop.redhat.io/v1alpha1\nkind: ProjectInitializeQuota\nmetadata:\n  name: small\nspec:\n  hard:\n    cpu: \"5\"\n    memory: \"10Gi\"\n    pods: \"10\"\n```\n\n\n## Example Workflow\nThe Project Initialize Operator will need to be running in the project-operator namespace before running the following example workflow.\n\n\n### Apply T-Shirt Size\nFirst start by applying the `ProjectInitializeQuota` CR that will be a global t-shirt size placeholder that the  initializer can reference when applying quotas to new projects.\n```\n$ oc apply -f deploy/examples/small_projectqouta_cr.yaml\n```\n\n### Apply Project Initializer\nApply the `ProjectInitialize` CR which contains details about the dev team name, cluster name, and a reference to the `ProjectInitializeQuota` which will specify the quota to assign the namespace. \n\nCreating a `ProjectInitialize` object will result in a new project (namespace) being created.\n\n```\n$ oc apply -f deploy/examples/basic_projectinit_cr.yaml\n```\n\nThe project name will be a derivation of the `team` and `env` specified in the `ProjectInitalize` object.  The result will be `${team}-${env}`.  For example\n\n```yaml\napiVersion: redhatcop.redhat.io/v1alpha1\nkind: ProjectInitialize\nmetadata:\n  name: phoenix-dev-projectinitialize\nspec:\n  team: phoenix\n  env: dev\n  cluster: us-west-2\n  displayName: \"Phoenix project for Dev environment\"\n  desc: \"a test project for showing the functionality of the project initialize operator\"\n  quotaSize: small\n  namespaceDetails:\n    annotations:\n      testkey: testValue\n    labels:\n      testkey: testValue\n```\n\nWill result in a namespace like this:\n\n```\n$ oc apply -f phoenix-dev.yaml\nprojectinitialize.redhatcop.redhat.io/phoenix-dev-projectinitialize created\n$ oc get projects phoenix-dev\nNAME          DISPLAY NAME                          STATUS\nphoenix-dev   Phoenix project for Dev environment   Active\n```\n\nExamining the YAML definition is instructive: \n\n```\n$ oc get projects phoenix-dev -o yaml\n```\n\n```yaml\napiVersion: project.openshift.io/v1\nkind: Project\nmetadata:\n  annotations:\n    openshift.io/description: a test project for showing the functionality of the\n      project initialize operator\n    openshift.io/display-name: Phoenix project for Dev environment\n    openshift.io/requester: system:serviceaccount:project-operator:project-initialize\n    openshift.io/sa.scc.mcs: s0:c24,c9\n    openshift.io/sa.scc.supplemental-groups: 1000570000/10000\n    openshift.io/sa.scc.uid-range: 1000570000/10000\n    testkey: testvalue\n  creationTimestamp: \"2020-10-01T19:07:20Z\"\n  labels:\n    app: phoenix\n    env: dev\n  name: phoenix-dev\n  resourceVersion: \"233538\"\n  selfLink: /apis/project.openshift.io/v1/projects/phoenix-dev\n  uid: c2ce8b0a-8354-4777-b7fb-fae08354ccb5\nspec:\n  finalizers:\n  - kubernetes\nstatus:\n  phase: Active\n```\n\n\n## Development\n\nFor help with development, see [docs/development.md](docs/development.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-cop%2Fproject-initialize-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredhat-cop%2Fproject-initialize-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-cop%2Fproject-initialize-operator/lists"}