{"id":27380143,"url":"https://github.com/andreistefanciprian/cloud-storage-controller","last_synced_at":"2026-05-09T15:14:16.903Z","repository":{"id":287464447,"uuid":"964374160","full_name":"andreistefanciprian/cloud-storage-controller","owner":"andreistefanciprian","description":"A Kubernetes controller built with kubebuilder to manage Google Cloud Storage (GCS) buckets with a CloudBucket custom resource.","archived":false,"fork":false,"pushed_at":"2025-04-13T07:04:21.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T14:19:16.154Z","etag":null,"topics":["golang","google-cloud","kubebuilder","kubernetes"],"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/andreistefanciprian.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,"zenodo":null}},"created_at":"2025-04-11T05:47:19.000Z","updated_at":"2025-04-13T07:04:21.000Z","dependencies_parsed_at":"2025-04-11T22:22:21.637Z","dependency_job_id":"d7bd7356-d352-444a-b45d-cd24d1424a45","html_url":"https://github.com/andreistefanciprian/cloud-storage-controller","commit_stats":null,"previous_names":["andreistefanciprian/cloud-storage-controller"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreistefanciprian%2Fcloud-storage-controller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreistefanciprian%2Fcloud-storage-controller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreistefanciprian%2Fcloud-storage-controller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreistefanciprian%2Fcloud-storage-controller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreistefanciprian","download_url":"https://codeload.github.com/andreistefanciprian/cloud-storage-controller/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724658,"owners_count":21151566,"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":["golang","google-cloud","kubebuilder","kubernetes"],"created_at":"2025-04-13T14:19:16.556Z","updated_at":"2026-05-09T15:14:11.857Z","avatar_url":"https://github.com/andreistefanciprian.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n### README.md\n\n# Cloud Storage Controller\n\nA Kubernetes controller to manage Google Cloud Storage (GCS) buckets with a `CloudBucket` custom resource.\nRuns on GKE with Workload Identity for GCS access.\n\n```\napiVersion: mygroup.example.com/v1\nkind: CloudBucket\nmetadata:\n  name: my-bucket-1\nspec:\n  projectID: gcp-project-id\n  deletePolicy: Delete\n  location: asia\n  labels:\n    env: production\n    team: devops\n```\n\n## What It Does\n- Creates GCS buckets based on `CloudBucket` specs.\n- Recreates buckets if deleted outside Kubernetes.\n- Deletes buckets or leaves them based on `deletePolicy` (`Delete` or `Orphan`).\n\n## Quick Start\n\n```\n# Create a Google Cloud Service Account (GSA) named \"cloud-storage-controller\" in your GCP project\ngcloud iam service-accounts create cloud-storage-controller \\\n    --project=$GCP_PROJECT \\\n    --display-name=\"Cloud Storage Controller\"\n\n# Grant the GSA the \"storage.admin\" role to manage GCS buckets in the project\ngcloud projects add-iam-policy-binding $GCP_PROJECT \\\n    --member=\"serviceAccount:cloud-storage-controller@${GCP_PROJECT}.iam.gserviceaccount.com\" \\\n    --role=\"roles/storage.admin\"\n\n# Allow the KSA \"controller-manager\" in the \"cloud-storage-controller-system\" namespace\n# to impersonate the GSA (alternative namespace binding, if used)\ngcloud iam service-accounts add-iam-policy-binding \\\n    cloud-storage-controller@${GCP_PROJECT}.iam.gserviceaccount.com \\\n    --project=$GCP_PROJECT \\\n    --role=\"roles/iam.workloadIdentityUser\" \\\n    --member=\"serviceAccount:${GCP_PROJECT}.svc.id.goog[cloud-storage-controller-system/controller-manager]\"\n\n# Create a temporary JSON key for the GSA for local testing (e.g., with \"make run\")\ngcloud iam service-accounts keys create temp-sa-key.json \\\n    --iam-account=cloud-storage-controller@${GCP_PROJECT}.iam.gserviceaccount.com \\\n    --project=$GCP_PROJECT\n\n# Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the key file path\n# for local authentication with the GCS client\nexport GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/temp-sa-key.json\n\n# test from local laptop\nmake manifests                                               \nkubectl apply -f config/crd/bases/mygroup.example.com_cloudbuckets.yaml\nmake build\nmake run\nk apply -f config/samples/mygroup_v1_cloudbucket.yaml\nk delete -f config/samples/mygroup_v1_cloudbucket.yaml\nk get events -w -n default | grep cloudbucket\n\n# test in the cluster\nmake deploy\nk logs -l control-plane=controller-manager -f -n cloud-storage-controller-system\nk apply -f config/samples/mygroup_v1_cloudbucket.yaml\nk delete -f config/samples/mygroup_v1_cloudbucket.yaml\nk get events -w -n default | grep cloudbucket\n\n# Check prometheus metrics\ncontroller=`k get pods -n cloud-storage-controller-system --no-headers -l control-plane=controller-manager | awk '{print $1}'`\nk port-forward pod/$controller 8080:8080\nhttp://localhost:8080/metrics\n```\n\n## Other commands\n\n```\nkubebuilder init --domain example.com --license apache2 --repo github.com/andreistefanciprian/cloud-storage-controller --project-name cloud-storage-controller --owner \"Ciprian Andrei\"\n\nkubebuilder create api --group mygroup --version v1 --kind CloudBucket\n\nmake generate\nmake manifests\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreistefanciprian%2Fcloud-storage-controller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreistefanciprian%2Fcloud-storage-controller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreistefanciprian%2Fcloud-storage-controller/lists"}