{"id":18080814,"url":"https://github.com/gyorb/nginx-demo-op","last_synced_at":"2025-04-05T22:17:50.448Z","repository":{"id":98101466,"uuid":"559595712","full_name":"gyorb/nginx-demo-op","owner":"gyorb","description":null,"archived":false,"fork":false,"pushed_at":"2022-11-02T00:32:14.000Z","size":137,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-12T03:23:10.861Z","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/gyorb.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":"2022-10-30T15:52:19.000Z","updated_at":"2022-10-30T15:53:42.000Z","dependencies_parsed_at":"2023-04-05T21:01:17.232Z","dependency_job_id":null,"html_url":"https://github.com/gyorb/nginx-demo-op","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gyorb%2Fnginx-demo-op","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gyorb%2Fnginx-demo-op/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gyorb%2Fnginx-demo-op/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gyorb%2Fnginx-demo-op/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gyorb","download_url":"https://codeload.github.com/gyorb/nginx-demo-op/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406102,"owners_count":20933806,"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-31T13:10:05.784Z","updated_at":"2025-04-05T22:17:50.421Z","avatar_url":"https://github.com/gyorb.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nRepository for a simple kubernetes operator which manages\nnginx deployments where `replicas`, `host` and `image` values\ncan be configured.\nThe cert custom resource (cert-manager) for the configured host needs to be created manually.\n\n# Dev environment setup\n\nUse [asdf](https://asdf-vm.com/) to install the required tools.\n\n```sh\nasdf plugin add kind\nasdf plugin add golang\nasdf plugin add kubectl\nasdf plugin add skaffold\nasdf plugin add golangci-lint\nasdf plugin add trivy\nasdf plugin add kubebuilder\nasdf plugin add k9s\nasdf plugin add helm\n\nasdf install\n```\n\n# Deploy to a Kind cluster\n\n1. start local Kind cluster\n\n```sh\nmake cluster-up\n# use make cluster-down to stop the cluster\n```\n\n2. install nginx ingress controller, cert-manager and create selfsigned cert\n\n```sh\nmake ingress\n\nmake cert-manager\n\n# Create a selfsigned cert for the \"foo.bar\" DNS name\n# wait until cert-manager starts before creating it.\nmake cert\n```\n\n3. install NginxOp crd and the controller\n\n```sh\nmake manifests\nmake install\n\n# create an nginxop custom resource object\n# replicas: 1\n# host: \"foo.bar\"\n# image: \"nginx:latest\"\nmake crd\n\n# run the controller locally for testing\nmake run\n\n# Deploy controller (image from github) to the Kind cluster\n# Use the 'main' tag to test the latest non released image.\nIMG=ghcr.io/gyorb/nginx-demo-op:v0.0.1 make deploy\n\n# Load the locally built container image to a Kind cluster\n# and deploy the controller.\nmake load-image deploy\n```\n\n4. Check if the nginx pods are running.\n```sh\n# Get the created nginx pods.\nkubectl get pod --selector=nginx=nginx-op-sample\n```\n\n5. Edit the example custom resource.\n```sh\nkubectl edit nginxop -n default nginx-op-sample\n```\n\n4. Verify the connection and the certificates for the nginx pods.\n\n```sh\n# 404 page not found\ncurl -k localhost\n\n# nginx should respond wih the welcome page.\ncurl -k -H 'Host: foo.bar' https://localhost\n\n# check certificate\necho | openssl s_client -showcerts -servername foo.bar -connect localhost:443 2\u003e/dev/null | openssl x509 -inform pem -noout -text\n```\n\n# Kubebuilder\n\nKubebuilder was used to initialize the project.\n\n1. init project\n\n```sh\nkubebuilder init --domain my.domain --repo my.domain/nginxop\n```\n\n2. create api\n```sh\nkubebuilder create api --group nginxop --version v1 --kind NginxOp\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgyorb%2Fnginx-demo-op","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgyorb%2Fnginx-demo-op","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgyorb%2Fnginx-demo-op/lists"}