{"id":20228496,"url":"https://github.com/64j0/fubernetes","last_synced_at":"2025-04-10T17:35:45.313Z","repository":{"id":45106247,"uuid":"434928613","full_name":"64J0/Fubernetes","owner":"64J0","description":"Kubernetes YAML generator with F#.","archived":false,"fork":false,"pushed_at":"2024-01-24T21:19:17.000Z","size":105,"stargazers_count":10,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T04:47:08.217Z","etag":null,"topics":["fsharp","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"F#","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/64J0.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":"2021-12-04T14:49:47.000Z","updated_at":"2024-11-22T18:29:56.000Z","dependencies_parsed_at":"2024-01-24T22:39:03.161Z","dependency_job_id":"e5532f16-ada0-428a-a850-d315244b0918","html_url":"https://github.com/64J0/Fubernetes","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/64J0%2FFubernetes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/64J0%2FFubernetes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/64J0%2FFubernetes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/64J0%2FFubernetes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/64J0","download_url":"https://codeload.github.com/64J0/Fubernetes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248262029,"owners_count":21074230,"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":["fsharp","kubernetes"],"created_at":"2024-11-14T07:30:48.557Z","updated_at":"2025-04-10T17:35:45.297Z","avatar_url":"https://github.com/64J0.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# F# Kubernetes YAML generator\n\n\u003e Still on development\n\nThis tool is being developed to solve the problem of dealing with YAML configuration files for Kubernetes, using a programatic solution. We chose to use F# as the main language due to its strong type system, which can help us find bugs/problems on our configuration files more easily and faster.\n\nThis project structure could be explained as:\n\n* `Fubernetes.Main/`: this folder have the main files of the project. Basically there is where all the necessary code lives.\n* `Fubernetes.UseLocal/`: this folder should be used to test the project locally. You could run the following command through the CLI to inspect the response: `dotnet run --project Fubernetes.UseLocal/`.\n* `Fubernetes.Test/`: this folder store the automated tests for the project.\n\n### Requisites:\n\n* .NET SDK 5.0.401\n\n## How does it work?\n\nWe have created pre-defined types to make it easier and less error-prone to create YAML Kubernetes files. See the [Program.fs](Fubernetes.UseLocal/Program.fs) file for examples, such as **defining opaque secrets**:\n\n```fsharp\n// Define the secret config necessary data, I.E.: the name, namespace, the labels (Option type) and the data\n// The data should be specified in plain text, later we do the encoding to base64 automatically\nlet opaqueSecret = \n    new Secret.OpaqueSecret(\n        { Name = \"Secret01\"\n          Namespace = \"default\"\n          Data = \n            [ (\"key1\", \"value1\") \n              (\"key2\", \"value2\")\n              (\"key3\", \"value3\") ] })\n\n// After defining the objects you want to create in the Kubernetes cluster just place them in a list\n// Remember to call their toYamlBuffer function that transforms their manifest into a string\nlet resourceList = \n    [ opaqueSecret.toYamlBuffer() ]\n\n// Define the output path using relative path\nlet outPath = \"./prod/application.yml\"\n\n// Create a record with both OutPath and the Resources you want to generate\nlet config: Configuration = \n    { OutPath = outPath\n      Resources = resourceList }\n\n// Finally, call this function to create the directory if it does not exist yet and create the YAML file\ncreateOutPathAndBuildYaml (config)\n```\n\n#### Running the program\n\n```bash\n$ dotnet run --project Fubernetes.UseLocal/\n```\n\n\nThe result after running this command will be a file called `application.yml`, with the following content inside:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-01\n  namespace: default\ntype: Opaque\ndata:\n  key1: dmFsdWUx\n  key2: dmFsdWUy\n  key3: dmFsdWUz\n```\n\n##### Then, apply this configuration by running\n\n```bash\n$ kubectl apply -f prod/test.secret.yml\n```\n\n## What we have mapped so far:\n\n\u003cdetails\u003e\n  \u003csummary\u003eConfigMap\u003c/summary\u003e\n  \n  - [x] ConfigMap\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eSecrets\u003c/summary\u003e\n  \n  - [x] OpaqueSecrets\n  - [ ] ServiceAccountToken\n  - [ ] DockerCfg\n  - [ ] DockerConfigJson\n  - [ ] BasicAuthentication\n  - [ ] SshAuth\n  - [ ] Tls\n  - [ ] BootstrapTokenData\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eServices\u003c/summary\u003e\n  \n  - [x] ClusterIP\n  - [x] NodePort\n  - [x] Headless\n  - [x] ExternalName\n  - [x] LoadBalancer\n\u003c/details\u003e\n\n## Automated tests:\n\nTo get more confident with this project we are using [Expecto](https://github.com/haf/expecto) to write unit tests. This tool is also written in F# and can be used for other kinds of tests as well: stress, regression or property based tests. For more information please consult the project documentation itself.\n\nTo run the tests locally you just need to run these commands on the terminal:\n\n```bash\n# restore paket\n$ dotnet tool restore\n\n# install the dependencies\n$ dotnet paket restore\n\n# run the tests\n$ dotnet run --project Fubernetes.Test/Test.fsproj\n```\n\n## Build the image and run the Docker container\n\n```bash\n# build the image\n$ docker build -t Fubernetes-main:latest -f Dockerfile .\n\n# run the image in a container\n$ docker run --name Fubernetes Fubernetes-main:latest\n# debug container structure\n# docker run -it --entrypoint \"bash\" Fubernetes-main:latest\n\n# running with docker-compose\n# TODO\n```\n\n## Automated tests coverage\n\nFor collecting the automated tests coverage we use dotnet tool: [dotnet-coverage](https://learn.microsoft.com/en-us/dotnet/core/additional-tools/dotnet-coverage).\n\n```bash\n$ dotnet tool restore\n\n$ dotnet dotnet-coverage collect -f \"xml\" \"dotnet run --project Fubernetes.Test/\"\n\n# and to visualize the report\n$ dotnet reportgenerator -reports:output.xml -targetdir:coveragereport\n```\n\nThere are many examples here: [link](https://github.com/microsoft/codecoverage/blob/main/samples/Calculator/README.md).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F64j0%2Ffubernetes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F64j0%2Ffubernetes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F64j0%2Ffubernetes/lists"}