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

apiVersion shouldn't be hardcoded - #5060

Merged
k8s-ci-robot merged 3 commits into
helm:masterfrom
DStorck:cronjob
Apr 17, 2018
Merged

k8s-ci-robot merged 3 commits into
helm:masterfrom
DStorck:cronjob

Conversation

@DStorck

@DStorck DStorck commented Apr 16, 2018

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
Cronjobs have different api versions for kubernetes versions < 1.8, so it shouldn't be hardcoded into the chart. This PR :

  • adds info to readme clarifying api version of cronjobs
  • adds cronjob.apiVersion to _helpers.tpl file to check k8s version before deploy

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 16, 2018
@k8s-ci-robot
k8s-ci-robot requested a review from gianrubio April 16, 2018 18:26

@mattfarina mattfarina left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/ok-to-test

Thanks for the PR. This almost looks good but we found an edge case where this could break in some environments.

{{- define "cronjob.apiVersion" -}}
{{- if semverCompare "< 1.8" .Capabilities.KubeVersion.GitVersion -}}
{{- print "batch/v2alpha1" }}
{{- else if semverCompare ">=1.8" .Capabilities.KubeVersion.GitVersion -}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add a -0 to the end of the comparison (e.g. >=1.8-0). This will cause the semver comparison to evaluate pre-releases. Unfortunately, some of the distros use pre-releases to specify their version which can cause comparison breakages. Pre-releases, as defined by semver, are prior to the release, lower in order, and may not satisfy the releases API which is why they are ignored by default.

You can find another PR that does this as an example at #4605

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks, done

@mattfarina

Copy link
Copy Markdown
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 16, 2018
@gianrubio

Copy link
Copy Markdown
Collaborator

Cronjobs have different api versions for kubernetes versions < 1.8, so it shouldn't be hardcoded into the chart. This PR :

We had this discussion before this PR was merged so that's why the cronjob api version was removed. Other than that PR looks good

/ok-to-test
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 17, 2018
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DStorck, gianrubio

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 17, 2018
@k8s-ci-robot
k8s-ci-robot merged commit 4a70cab into helm:master Apr 17, 2018
goruha added a commit to goruha/charts that referenced this pull request Apr 19, 2018
…into rabbitmq-workload-api-fix

* 'rabbitmq-workload-api-fix' of github.com:goruha/charts: (75 commits)
  [stable/odoo] Add carrodher as owner (helm#4856)
  [stable/jasperreports] Release 1.0.3 (helm#5107)
  Add doc about redis data only persistence (helm#4965)
  [sentry] add nodeSelector, affinity & tolerations (helm#4264)
  [stable/sonarqube] Adding support for Service annotations (helm#4060)
  [incubator/schema-registry] Updating GroupID, and moving to using kafka coordinator master election (helm#5019)
  quote boolean S3 environment variables (helm#5066)
  Fix graceful shutdown of brokers, more settings, version bump (helm#5082)
  apiVersion shouldn't be hardcoded (helm#5060)
  [stable/phabricator] Release 1.0.4 (helm#5068)
  [stable/testlink] Release 1.0.5 (helm#5050)
  [stable/redis] fixed a typo into NOTES (helm#5070)
  [etcd-operator] readiness/liveness checks for operator (helm#4609)
  Annotations and checksum (helm#5067)
  Add OWNERS file to schema-registry (helm#5054)
  [stable/mongodb-replicaset] Use security context on pod level (helm#5055)
  Typo fix in sonarqube/README.md (helm#5045)
  Typo fix in sonatype-nexus/README.md (helm#5042)
  [sonarqube] nodeSelector, affinity & tolerations. also separate resoruces for plugin pod (helm#4265)
  [stable/sonarqube] upgrade to LTS version (6.7.3) (helm#5029)
  ...
ichtar pushed a commit to Bestmile/charts that referenced this pull request May 15, 2018
* apiVersion shouldn't be hardcoded

* updated chart version

* fixed semver comparison
voron pushed a commit to dysnix/helm-charts that referenced this pull request Sep 5, 2018
* apiVersion shouldn't be hardcoded

* updated chart version

* fixed semver comparison

Signed-off-by: voron <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants