{"id":15629606,"url":"https://github.com/pyaillet/etendre-k8s","last_synced_at":"2025-03-29T18:15:16.940Z","repository":{"id":68828395,"uuid":"172995386","full_name":"pyaillet/etendre-k8s","owner":"pyaillet","description":null,"archived":false,"fork":false,"pushed_at":"2019-03-28T13:38:11.000Z","size":875,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-04T19:14:33.643Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/pyaillet.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":"2019-02-27T21:46:27.000Z","updated_at":"2019-03-28T13:38:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"e9e692c2-a0c1-4f92-9148-23da644192f8","html_url":"https://github.com/pyaillet/etendre-k8s","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/pyaillet%2Fetendre-k8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyaillet%2Fetendre-k8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyaillet%2Fetendre-k8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyaillet%2Fetendre-k8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyaillet","download_url":"https://codeload.github.com/pyaillet/etendre-k8s/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246223323,"owners_count":20743168,"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":[],"created_at":"2024-10-03T10:27:45.568Z","updated_at":"2025-03-29T18:15:16.923Z","avatar_url":"https://github.com/pyaillet.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# How to use\n\n## Install the operator framework sdk\n\nFor the beginning just follow [these\nsteps](https://github.com/operator-framework/operator-sdk#quick-start) of the\nofficial doc.\n\nOr execute `01_setup.sh`\n\n## Initialize the a new operator\n\n```shell\n#!/usr/bin/env sh\n\n# Create a new giphy-operator project\noperator-sdk new giphy-operator\ncd giphy-operator\n\n# Add a new API for the custom resource AppGiphy\noperator-sdk add api --api-version=app.zenika.com/v1alpha1 --kind=AppGiphy\n\n# Add a new controller that watches for AppGiphy\noperator-sdk add controller --api-version=app.zenika.com/v1alpha1 --kind=AppGiphy\n\n# Build and push the app-operator image to a public registry\noperator-sdk build pyaillet/giphy-operator\n```\n\nOr execute `02_init_operator.sh`\n\nAfter this step you should have a functional build\n\n## Modify the CRD to add your properties\n\nEdit the file `pkg/apis/app/v1alpha1/appgiphy_types.go`\nFind the lines:\n```go\ntype AppGiphySpec struct {\n  // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster\n```\n\nInsert this line after the previous ones to specify the tag used for this\nparticular AppGiphy:\n```go\n  Tag string `json:\"tag\"`\n```\n\nAs stated in the code comment, launch the command to generate the code\nrelative to this type in the `giphy-operator` dir:\n```shell\noperator-sdk generate k8s\n```\n\n## Modify the controller to adapt resource creation\n\ncopy the controller example : \n```shell\ncp operator-example/appgiphy_controller.go giphy-operator/pkg/controller/appgiphy/appgiphy_controller.go\n```\n\n## Rebuild and push the operator\n\n```shell\noperator-sdk build pyaillet/giphy-operator:0.1\ndocker push pyaillet/giphy-operator:0.1\n```\n\n## Deployment\n\n- Replace the image name in the deployment descriptor `deploy/operator.yaml`\n  with your image:\n\n```yaml\ncontainers:\n  - name: giphy-operator\n    # Replace this with the built image name\n    image: pyaillet/giphy-operator:0.1\n```\n\n- And add the following env var to inject giphy api key:\n\n```yaml\n- name: GIPHY_API_KEY\n  value: {{GIPHY_API_KEY}}\n```\n\n- Deploy the _Operator_ and other needed resources\n\n```shell\nkubectl apply -f deploy/crds/app_v1alpha1_appgiphy_crd.yaml\n```\n\nDefine the GIPHY_API_KEY:\n```shell\nsed -i \"s/{{GIPHY_API_KEY}}/$GIPHY_API_KEY/\" deploy/operator.yaml\n```\n\nOn MacOS do:\n```shell\nsed -i \"\" \"s/{{GIPHY_API_KEY}}/$GIPHY_API_KEY/\" deploy/operator.yaml\n```\n\n```shell\nkubectl apply -f deploy/\n```\n\n- Verify that the _CRD_ has been created\n\n```shell\n$ kubectl get crd\nNAME                        CREATED AT\nappgiphies.app.zenika.com   2019-02-27T22:23:02Z\n```\n\n- Create a new Custom Resource\n\n```shell\nkubectl apply -f - \u003c\u003cEOF\napiVersion: app.zenika.com/v1alpha1\nkind: AppGiphy\nmetadata:\n  name: example-appgiphy\nspec:\n  tag: dog\n```\n\n- Verify that a new _Pod_ corresponding to your CR is being created:\n\n```shell\n$ kubectl get po -l app=example-appgiphy\nNAME                   READY     STATUS    RESTARTS   AGE\nexample-appgiphy-pod   1/1       Running   0          100s\n```\n\nTest that's working:\n\n```shell\n$ kubectl port-forward \u003cPOD_NAME\u003e 8080\n```\n\nOpen your browser to [http://localhost:8080](http://localhost:8080)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyaillet%2Fetendre-k8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyaillet%2Fetendre-k8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyaillet%2Fetendre-k8s/lists"}