Skip to content

Conversation

@rhamilto
Copy link
Member

@rhamilto rhamilto commented Jun 20, 2019

Fixes #1678
Resolves https://jira.coreos.com/browse/CONSOLE-1528

Screen Shot 2019-06-20 at 11 29 43 AM

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: consoleloglinks.console.openshift.io
  annotations:
    displayName: ConsoleLogLinks
    description: Extension for customizing OpenShift web console pod log links
spec:
  scope: Cluster
  group: console.openshift.io
  versions:
  - name: v1
    served: true
    storage: true
  names:
    plural: consoleloglinks
    singular: consoleloglink
    kind: ConsoleLogLink
    listKind: ConsoleLogLinkList
  additionalPrinterColumns:
  - name: Text
    type: string
    JSONPath: .spec.text
  - name: HrefTemplate
    type: string
    JSONPath: .spec.hrefTemplate
  - name: Age
    type: date
    JSONPath: .metadata.creationTimestamp
  subresources:
    status: {}
  validation:
    openAPIV3Schema:
      properties:
        spec:
          type: object
          description: Represents console pod log link customizations spec
          required:
          - text
          - hrefTemplate
          properties:
            text:
              type: string
              description: Text of the link
            hrefTemplate:
              type: string
              description: Absolute secure URL including name or id, container, and namespace variables for the pod log link (must use https).  e.g., https://example.com/logs?name=\${name}&container=\${container}&namespace=\${namespace}
              pattern: '^https://'
            namespaceFilter:
              type: string
              description: Regular expression used to restrict a log link to a matching namespace

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 20, 2019
@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 20, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhamilto

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 20, 2019
@spadgett
Copy link
Member

/cc @jcantrill

@spadgett spadgett added this to the v4.2 milestone Jun 20, 2019
@benjaminapetersen
Copy link
Contributor

Are we settled on the name consolepodloglinks?
If so, I should update the list in this PR: openshift/origin#23231
(probably will just be a follow-on since we already have the PR approved to merge)

@rhamilto rhamilto force-pushed the console-1528 branch 3 times, most recently from 3297748 to 3467776 Compare June 24, 2019 14:17
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 24, 2019
Copy link
Member

Choose a reason for hiding this comment

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

Better to use the link resource UID for the key if we can

Copy link
Member

Choose a reason for hiding this comment

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

If we can't find a way to prevent code execution with _.template, we could fall back to...

template
  .replace('${name}', encodeURIComponent(resource.metadata.name))
  .replace('${container}', encodeURIComponent(containerName))
  // ...

Copy link
Member

Choose a reason for hiding this comment

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

Use k8sGet or Firehose

@spadgett spadgett removed this from the v4.2 milestone Jun 25, 2019
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 25, 2019
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 2, 2019
@rhamilto rhamilto changed the title [WIP] Add ConsolePodLogLink CRD to enable custom pod log links [WIP] Add ConsoleLogLink CRD to enable custom log links Jul 2, 2019
if (namespaceFilter && namespace.search(namespaceFilter) === -1) {
return null;
}
const compiled = _.attempt(() => _.template(hrefTemplate));
Copy link
Member Author

Choose a reason for hiding this comment

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

Adding @spadgett's comment back after code changes:

If we can't find a way to prevent code execution with _.template, we could fall back to...

template
  .replace('${name}', encodeURIComponent(resource.metadata.name))
  .replace('${container}', encodeURIComponent(containerName))
  // ...

@openshift-ci-robot
Copy link
Contributor

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

Test name Commit Details Rerun command
ci/prow/frontend a9d674e link /test frontend

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.

Details

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pod Log Links Extension

4 participants