Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Kubernetes recommended labels to resources #596

Merged
merged 10 commits into from
Feb 5, 2020

Conversation

Cottonglow
Copy link
Contributor

@Cottonglow Cottonglow commented Jan 31, 2020

The intent behind this PR is to open a discussion and decide on what labels we want to add, the values we want and which resources they should be on (It is recommended to apply the labels on every resource object - https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/).

I picked the labels that seemed reasonable to me and the values that made sense. (Eg app.kubernetes.io/instance doesn't feel like it would fit in and app.kubernetes.io/managed-by makes more sense for the helm charts)

Some concerns/questions:

  • I have is the version label as this is hardcoded into the yaml files. This will get annoying when releasing newer version. If anyone has a proposal, that would be great! This will be addressed in Automate update of KEDA version in the code and yaml files during each release #580
  • Also I hardcoded the version for now in the .go files as I am not familiar enough with Go to substitute it! Happy for anyone to add a commit to change this. Fixed
  • I've not been able to add a label to service/keda-operator-metrics as the operator-sdk doesn't let you pass in labels, so the other way of doing it, is to potentially update it with the labels you want. Although I haven't figured out how yet.

Checklist

  • A PR is opened to update the labels in the helm repository - Add recommended kubernetes labels to helm chart charts#21
  • Update Release Pipeline documentation
  • keda-operator-metrics-apiserver pod keeps failing for some reason - This seemed to have been something locally. Deleting and restoring files worked.
  • Add labels to service/keda-operator-metrics - I will leave this as is for now

Fixes #536

@msftclas
Copy link

msftclas commented Jan 31, 2020

CLA assistant check
All CLA requirements met.

@balchua
Copy link
Contributor

balchua commented Feb 1, 2020

@Cottonglow
For Go, there is a package version which you can use. You may want to import github.com/kedacore/keda/version and the use it like version.Version.

deploy/00-namespace.yaml Outdated Show resolved Hide resolved
pkg/controller/scaledobject/scaledobject_controller.go Outdated Show resolved Hide resolved
pkg/handler/scale_jobs.go Outdated Show resolved Hide resolved
@zroubalik
Copy link
Member

Would be great to add a script and Makefile target to change the version in these files before release, so we avoid manual work and possible typos/mistakes.

@balchua
Copy link
Contributor

balchua commented Feb 3, 2020

Using ldflags might help here.
Something like this in the Makefile

go build -ldflags="-X 'github.com/kedacore/keda/version.Version=$GIT_VERSION'" .

Makefile Outdated Show resolved Hide resolved
version/version.go Outdated Show resolved Hide resolved
@balchua
Copy link
Contributor

balchua commented Feb 4, 2020

GIT_VERSION is already defined in the Makefile, will it be usable? Instead of manually defining it?

@zroubalik
Copy link
Member

Would be great to add a script and Makefile target to change the version in these files before release, so we avoid manual work and possible typos/mistakes.

#580

@Cottonglow
Copy link
Contributor Author

Cottonglow commented Feb 4, 2020

@balchua GIT_VERSION outputs the commit hash for me, which I didn't think we would want, eg 373f40a

@Cottonglow
Copy link
Contributor Author

Would be great to add a script and Makefile target to change the version in these files before release, so we avoid manual work and possible typos/mistakes.
#580

@zroubalik I didn't realise there was a separate issue for this and completed most of the work to substitute the values in the .yaml files... I can open a separate PR for the .yaml ones but leave the version.go one in here? Happy to take it out too.

@zroubalik
Copy link
Member

@zroubalik I didn't realise there was a separate issue for this and completed most of the work to substitute the values in the .yaml files... I can open a separate PR for the .yaml ones but leave the version.go one in here? Happy to take it out too.

@Cottonglow that's fine, you can keep the things you have already done in this PR and if you are willing to work on the rest, you can open another PR with outstanding issues :) Thanks!

@Cottonglow Cottonglow changed the title WIP: Adding Kubernetes recommended labels to resources Adding Kubernetes recommended labels to resources Feb 5, 2020
@Cottonglow Cottonglow requested a review from zroubalik February 5, 2020 11:12
Copy link
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

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

LGTM

@tomkerkhove tomkerkhove merged commit 44fa696 into kedacore:master Feb 5, 2020
@tomkerkhove
Copy link
Member

Thanks @Cottonglow !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Supporting Kubernetes recommended labels
5 participants