Skip to content

Commit 536f6c4

Browse files
Move to cert-manager.io/v1; bump dependencies (#1)
Signed-off-by: Sam Foo <foos@vmware.com>
1 parent bf167d8 commit 536f6c4

File tree

8 files changed

+908
-359
lines changed

8 files changed

+908
-359
lines changed

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: build
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
goreleaser:
9+
runs-on: ubuntu-latest
10+
steps:
11+
-
12+
name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
-
17+
name: Set up Go
18+
uses: actions/setup-go@v2
19+
with:
20+
go-version: 1.16
21+
-
22+
name: Run GoReleaser
23+
uses: goreleaser/goreleaser-action@v2
24+
with:
25+
version: latest
26+
args: release --rm-dist
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@
1010

1111
# Output of the go coverage tool, specifically when used with LiteIDE
1212
*.out
13+
14+
.idea/

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ PLUGIN_NAME=octant-certificates.certmanager.k8s.io
33
ifdef XDG_CONFIG_HOME
44
OCTANT_PLUGINSTUB_DIR ?= ${XDG_CONFIG_HOME}/octant/plugins
55
# Determine in on windows
6-
else ifeq ($(OS),Windows_NT)
6+
else ifeq ($(OS),Windows_NT)
77
OCTANT_PLUGINSTUB_DIR ?= ${LOCALAPPDATA}/octant/plugins
88
else
99
OCTANT_PLUGINSTUB_DIR ?= ${HOME}/.config/octant/plugins
1010
endif
1111

1212
build:
13-
@go build -mod=vendor -o $(PLUGIN_NAME)
13+
@go build -o $(PLUGIN_NAME)
1414

1515
install: build
1616
@echo Installing to $(OCTANT_PLUGINSTUB_DIR)/$(PLUGIN_NAME)
1717
@mkdir -p $(OCTANT_PLUGINSTUB_DIR)
18-
@cp $(PLUGIN_NAME) $(OCTANT_PLUGINSTUB_DIR)/$(PLUGIN_NAME)
18+
@cp $(PLUGIN_NAME) $(OCTANT_PLUGINSTUB_DIR)/$(PLUGIN_NAME)

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Octant cert-manager Plugin
2+
3+
An Octant plugin for [cert-manager](https://cert-manager.io/) used to demo plugin functionality.
4+
5+
This plugin shows the DNS names for a given certificate.
6+
7+
![](./cert.png)
8+
9+
## Requirements
10+
11+
- Octant 0.19.0+
12+
- Currently supports `cert-manager.io/v1`
13+
14+
## Installation
15+
16+
Go 1.16+ is required.
17+
18+
```
19+
make install
20+
```
21+
22+
This will compile the plugin and automatically move the binary to Octant's plugin path.
23+

cert.png

81.1 KB
Loading

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module github.com/wwitzel3/octant-certificates.certmanager.k8s.io
22

3-
go 1.13
3+
go 1.16
44

55
require (
6-
github.com/jetstack/cert-manager v0.10.0
7-
github.com/pkg/errors v0.8.1
8-
github.com/vmware/octant v0.7.0
9-
k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719
6+
github.com/jetstack/cert-manager v1.3.1
7+
github.com/pkg/errors v0.9.1
8+
github.com/vmware-tanzu/octant v0.19.0
9+
k8s.io/apimachinery v0.19.4
1010
)
1111

12-
replace k8s.io/client-go => k8s.io/client-go v0.0.0-20190620085101-78d2af792bab
12+
replace k8s.io/client-go => k8s.io/client-go v0.19.3

go.sum

Lines changed: 834 additions & 338 deletions
Large diffs are not rendered by default.

main.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ package main
88
import (
99
"log"
1010

11-
certv1alpha1 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha1"
11+
certv1 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1"
1212
"github.com/pkg/errors"
1313
"k8s.io/apimachinery/pkg/runtime"
1414
"k8s.io/apimachinery/pkg/runtime/schema"
1515

16-
"github.com/vmware/octant/pkg/plugin"
17-
"github.com/vmware/octant/pkg/plugin/service"
18-
"github.com/vmware/octant/pkg/store"
19-
"github.com/vmware/octant/pkg/view/component"
16+
"github.com/vmware-tanzu/octant/pkg/plugin"
17+
"github.com/vmware-tanzu/octant/pkg/plugin/service"
18+
"github.com/vmware-tanzu/octant/pkg/store"
19+
"github.com/vmware-tanzu/octant/pkg/view/component"
2020
)
2121

2222
var pluginName = "certificates.certmanager.k8s.io"
@@ -26,10 +26,10 @@ func main() {
2626
// Remove the prefix from the go logger since Octant will print logs with timestamps.
2727
log.SetPrefix("")
2828

29-
// This plugin is interested in Pods
30-
certGVK := schema.GroupVersionKind{Group: "certmanager.k8s.io", Version: "v1alpha1", Kind: "Certificate"}
29+
// This plugin is interested in certificates
30+
certGVK := schema.GroupVersionKind{Group: "cert-manager.io", Version: "v1", Kind: "Certificate"}
3131

32-
// Tell Octant to call this plugin when printing configuration or tabs for Pods
32+
// Tell Octant to call this plugin when printing configuration for certificates
3333
capabilities := &plugin.Capabilities{
3434
SupportsPrinterConfig: []schema.GroupVersionKind{certGVK},
3535
IsModule: false,
@@ -63,17 +63,17 @@ func handlePrint(request *service.PrintRequest) (plugin.PrintResponse, error) {
6363
if err != nil {
6464
return plugin.PrintResponse{}, err
6565
}
66-
u, found, err := request.DashboardClient.Get(request.Context(), key)
66+
u, err := request.DashboardClient.Get(request.Context(), key)
6767
if err != nil {
6868
return plugin.PrintResponse{}, err
6969
}
7070

7171
// The plugin can check if the object it requested exists.
72-
if !found {
72+
if u == nil {
7373
return plugin.PrintResponse{}, errors.New("object doesn't exist")
7474
}
7575

76-
var cert certv1alpha1.Certificate
76+
var cert certv1.Certificate
7777
err = runtime.DefaultUnstructuredConverter.FromUnstructured(u.UnstructuredContent(), &cert)
7878
if err != nil {
7979
return plugin.PrintResponse{}, err
@@ -87,7 +87,7 @@ func handlePrint(request *service.PrintRequest) (plugin.PrintResponse, error) {
8787
dnsNameComp = component.NewText(dnsname)
8888
dnsNameList = append(dnsNameList, dnsNameComp)
8989
}
90-
config = append(config, component.SummarySection{Header: "DNS Names", Content: component.NewList("", dnsNameList)})
90+
config = append(config, component.SummarySection{Header: "DNS Names", Content: component.NewList(component.TitleFromString(""), dnsNameList)})
9191
// When printing an object, you can create multiple types of content. In this
9292
// example, the plugin is:
9393
//

0 commit comments

Comments
 (0)