Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

introduce incubator/drone #821

Closed
wants to merge 3 commits into from
Closed

Conversation

bacongobbler
Copy link
Member

@bacongobbler bacongobbler commented Mar 20, 2017

This is a re-write of #353, focusing on chart extensibility. This has not been tested on a kubernetes cluster just yet, just PR'ing this effort for other users' enjoyment.

TODO:

  • rewrite README.md, documenting a basic setup guide
  • add ingress resource to the chart

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 20, 2017
@k8s-ci-robot
Copy link
Contributor

Hi @bacongobbler. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with @k8s-bot ok to test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@bacongobbler bacongobbler mentioned this pull request Mar 20, 2017
3 tasks
@jackzampolin
Copy link
Contributor

@bacongobbler Might want to add an optional ingress to enable giving it a FQDN. I have a good example of this over in the chronograf chart. Makes it easy to hook into something like nginx-ingress

@bacongobbler
Copy link
Member Author

Good point. I forgot to add that to the TODO list, but that is certainly on the radar. 👍

@@ -0,0 +1,17 @@
1. Get your Drone URL by running:

{{- if contains "NodePort" .Values.serviceType }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

serviceType should be: service.type

NOTE: It may take a few minutes for the LoadBalancer IP to be available.
Watch the status with: 'kubectl get svc -w {{ template "fullname" . }}'
{{- else if contains "ClusterIP" .Values.serviceType }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think the label selector is supposed to be:

"app={{ template "fullname" . }}-server"

@seanknox seanknox removed their assignment Mar 23, 2017
# Drone server configuration. Values in here get injected as environment variables.
# See http://readme.drone.io/admin/installation-reference#server-options for a list of possible values.
env:
DRONE_DEBUG: "false"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found that I must at least add the following to get the default sqlite db driver to work:

DRONE_DATABASE_DATASOURCE: drone.sqlite

Otherwise drone-server fails to find/ping the database for some reason and crashloops. It could probably work with the default datasource (/var/lib/drone/drone.sqlite) if this chart created a volume, empty or persistent, mounted to /var/lib/drone.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section should also include some commented out environment variables for git service setup, or at least a note that without a git service configured drone-server will fail to start.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

port: {{ .Values.service.http.externalPort }}
targetPort: {{ .Values.service.http.internalPort }}
selector:
app: {{ template "fullname" . }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selector needs to be app: {{ template "fullname" . }}-server, and the same change should probably be made for service name: and app: label.

@ipedrazas
Copy link
Contributor

Setting up drone has a few parts:

  • Creating the version control webhook (GitHub, Gitlab, etc...)
  • Creating DNS entry for that callback (hence the comment about using an Ingress Controller)
  • Creating drone server using the oauth2 data

As it is, his chart doesn't work. I think it's important to have a minimal chart that works out of the box.

@bacongobbler
Copy link
Member Author

Yes, I have been busy with other things... our company recently announced we were getting acquired by Microsoft so needless to say I've been super busy for the last bit :) hope to get back to a regular schedule soon so I can get back to this.

@ipedrazas
Copy link
Contributor

@bacongobbler I have modified your chart to include the Ingress and the github envvars to be able to set up a simple example. @lachie83 told me to look at it and ... well, if you want my bits & bobs I can send you a PR

@prydonius
Copy link
Member

@bacongobbler gentle ping - hope you're able to pick this up again!

@bacongobbler
Copy link
Member Author

Hi! yes actually today would be a perfect day to pick this back up again. Thank you for the ping. :)

@seanknox
Copy link
Contributor

Yay! I'm excited for this one.

@bacongobbler
Copy link
Member Author

rebased on top of master and addressed all comments.

@bacongobbler
Copy link
Member Author

bacongobbler commented May 18, 2017

things to note since I last worked on this:

  • ingress is now a feature flag
  • sqlite is on by default, and WILL be lost on pod restart. This also means that the drone server is not horizontally scalable as each drone server instance has its own sqlite database. This is intentional, and admins are expected to extend the chart if they need mysql/postgres (or a PR would be nice)
  • README was slightly vamped to demonstrate how to install this chart

@bacongobbler bacongobbler changed the title [wip] introduce incubator/drone introduce incubator/drone May 18, 2017
- http://readme.drone.io/
maintainers:
- name: Matthew Fisher
email: mfisher@deis.com
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Can you change your name to your github handle? Recent thing we started doing.
  • Change your email address


Alternatively, a YAML file that specifies the values for the parameters can be provided while
installing the chart. For example,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A quick note about the limitations with the default DB and scaling would be helpful.

key: secret
{{ range $key, $value := .Values.server.env }}
- name: {{ $key }}
value: {{ $value | quote }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this pattern for quickly iterating over the values. Also like that the ENV vars are the defined with the caps case you'd expect in the values file itself.

@seanknox
Copy link
Contributor

This looks great @bacongobbler. I'll try out the chart later and let you know how it goes.

@seanknox
Copy link
Contributor

@k8s-bot ok to test

resources:
{{ toYaml .Values.agent.resources | indent 10 }}
volumeMounts:
# Enables Docker in Docker
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought, the way I've done this before (with Jenkins) is to run docker:dind in the same pod and set DOCKER_HOST in the other container to tcp://localhost:2375. IMO this is a much cleaner way of getting docker in docker on k8s.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you run docker-in-docker on GKE though? I thought you'd need elevated privs to run something like docker in a pod.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the docker-in-docker container does need to be run as privileged. In my experience GKE allows this though, however other platforms may not and it will probably need to be called out in the README.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I'll go ahead and do that. I'm on vacation atm but I'll be back next week :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, yeah I thought you were - what are you doing on GitHub ;)?

@prydonius prydonius removed the stale label Jun 1, 2017
- "agent"
env:
- name: DRONE_SERVER
value: ws://{{ template "fullname" . }}/ws/broker
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be ws://{{ template "fullname" . }}.{{ .Release.Namespace }}:{{ .Values.service.http.externalPort }}/ws/broker?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the agent and server are in the same namespace (which they are), you can omit the namespace.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duh! So used to filling in addresses this way. 🙈

@seanknox
Copy link
Contributor

@bacongobbler server pod failed to start when I tried:

$ k get po
NAME                                                          READY     STATUS             RESTARTS   AGE
kindred-seal-nginx-ingress-controller-2980483938-jc3rl        1/1       Running            0          1h
kindred-seal-nginx-ingress-default-backend-1014810329-n4rbf   1/1       Running            0          1h
nonplussed-poodle-drone-agent-1570746251-jws7v                1/1       Running            0          6s
nonplussed-poodle-drone-server-3022101740-d11rx               0/1       CrashLoopBackOff   1          6s

$ k logs nonplussed-poodle-drone-server-3022101740-d11rx
time="2017-06-10T06:53:11Z" level=error msg="sql: unknown driver \"sqlite\" (forgotten import?)"
time="2017-06-10T06:53:11Z" level=fatal msg="database connection failed"

@seanknox
Copy link
Contributor

Hey @bacongobbler, in case you weren't aware @ipedrazas put together a drone chart too, maybe useful for inspiration: https://github.com/kubecamp/drone-chart

@viglesiasce
Copy link
Contributor

Ping @bacongobbler

- path: /
backend:
serviceName: {{ template "fullname" . }}
servicePort: {{ .values.service.http.externalPort }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here (.values -> .Values)

enabled: false
# enable TLS via kube-lego
tls: false
hostname: drone.example.com
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to add ingress.annotations here....

@bacongobbler
Copy link
Member Author

Couple of fixes done, as well as I changed the drone server to communicate with a docker-in-docker container running in the same pod as opposed to mounting the host socket from Kubernetes.

@bacongobbler
Copy link
Member Author

Only problem now is to document that the administrator needs to change some fields in values.yaml in order for drone to actually work. As it stands right now doing a bare install of drone will fail because no git repo is set up by default.

><> k get po
NAME                                  READY     STATUS             RESTARTS   AGE
drone-drone-agent-1938756360-wkn0n    2/2       Running            0          7m
drone-drone-server-3036973459-wk462   0/1       CrashLoopBackOff   5          7m
><> k logs drone-drone-server-3036973459-wk462
time="2017-07-06T16:57:32Z" level=fatal msg="version control system not configured"

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jul 6, 2017

@bacongobbler: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
Jenkins Charts e2e 440e9d64298741253a06058c68dc871fd65aa32a link @k8s-bot e2e test this

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@bacongobbler
Copy link
Member Author

bacongobbler commented Jul 6, 2017

I've added incubator/gogs as a dependency so it'll pass CI, but it appears that gogs has some issues of its own.

><> k get po
NAME                                  READY     STATUS             RESTARTS   AGE
drone-drone-agent-3224441707-nk2x1    2/2       Running            0          3m
drone-drone-server-1297665661-xhb5c   1/1       Running            0          3m
drone-gogs-3707191466-33w69           0/1       CrashLoopBackOff   4          3m
drone-postgresql-565161641-354rh      1/1       Running            0          3m
><> k logs drone-gogs-3707191466-33w69
init:socat  | Will not try to create socat links as requested
Jul  6 17:27:46 syslogd started: BusyBox v1.25.1
Jul  6 17:27:46 sshd[24]: Server listening on :: port 22.
Jul  6 17:27:46 sshd[24]: Server listening on 0.0.0.0 port 22.

I simply don't have the time to work on this PR any more since we're no longer using drone internally. If anyone wants to take on this effort further, please let me know.

@gtaylor
Copy link
Collaborator

gtaylor commented Jul 6, 2017

Whoa, I'm not sure I'd want to pull gogs in within the Drone releases we'll be creating during installation. gogs should be explicitly installed and managed in its own release. Accidentally nuking your gogs setup by removing Drone would be not great.

I assume this was meant to be an ease of use change, but I'd rather set the URL/API tokens like the other providers.

@bacongobbler
Copy link
Member Author

bacongobbler commented Jul 6, 2017

It's both an ease of use change + a way to get around how CI expects every chart to work out of the box with helm install. You can't install drone without pointing at something, so I chose something local. It's still the same experience needed to switch to github/bitbucket as before, just that there's something in the first place. With github and bitbucket you need to do some external setup with developer applications. It's not something that you can just say "hey, use github out of the box, please" without doing some setup on github's end.

If you don't like the direction of this PR, please feel free to take it over!

@mgoodness
Copy link
Contributor

Closing as stale.

@mgoodness mgoodness closed this Sep 10, 2017
@christian-roggia christian-roggia mentioned this pull request Oct 29, 2017
9 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
changes needed cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.