Skip to content

Commit

Permalink
add dsa support
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoQuote committed Sep 19, 2023
1 parent f62340a commit 191f0db
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 30 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ name: Docker

on:
push:
branches: [ master ]
branches: [ "master" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ master ]
branches: [ "master" ]

env:
# Use docker.io for Docker Hub if empty
Expand All @@ -33,16 +33,15 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@main
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1
with:
cosign-release: 'v1.13.1'

cosign-release: 'v2.1.1'

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
Expand Down Expand Up @@ -70,12 +69,15 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@965c6a410d446a30e95d35052c67d6eded60dad6
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max


# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
Expand All @@ -85,7 +87,9 @@ jobs:
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
COSIGN_EXPERIMENTAL: "true"
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: cosign sign ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
5 changes: 3 additions & 2 deletions cmd/qcloud-exporter/qcloud_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"github.com/prometheus/client_golang/prometheus/collectors"
"net/http"
"os"
"time"
Expand All @@ -28,8 +29,8 @@ func newHandler(cred common.CredentialIface, c *config.TencentConfig,
exporterMetricsRegistry := prometheus.NewRegistry()
if includeExporterMetrics {
exporterMetricsRegistry.MustRegister(
prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}),
prometheus.NewGoCollector(),
collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}),
collectors.NewGoCollector(),
)
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.334
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.334
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cmq v1.0.334
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.634
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.750
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.334
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.413
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc v1.0.334
Expand Down
20 changes: 4 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,6 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tencentcloud/tencentcloud-sdk-go v1.0.485 h1:l1xeZUO2ddcouOpxO7dhkXcmcYembuCG5EZ6O+Cox/o=
github.com/tencentcloud/tencentcloud-sdk-go v1.0.528 h1:6HidDboNfqxPVD6/hSgK4vcw3B/sNLHi8ysAAj70Bsc=
github.com/tencentcloud/tencentcloud-sdk-go v1.0.532 h1:8AmaxcmnFwH5HTcmE9suGsI2CROtiVkNQvot64Y+gv0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cbs v1.0.334 h1:GijOjoDBcWXtra6hmzpj4IXOahWmsTE3bwpOcp5VBDw=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cbs v1.0.334/go.mod h1:PTp058qpOV//RukBVdYQT962rZg71lIt6eHLK1zdvEc=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb v1.0.413 h1:6cQPfHc3I1pKUj23csRd9P/xxUPcnGRLRK2e5NGqtzc=
Expand All @@ -231,20 +228,13 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cmq v1.0.334/go.mod h1:
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.194/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.413/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.430/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.437 h1:Qa0q6mhOkQ/0RoAqOheJAzPFksAf3jsjOZVt4FGcvyQ=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.437/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.479 h1:3kwDb6p1J3LxmwnNgSSEheemPffo+vMewoDzKysYdig=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.479/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.528 h1:ECUVFkluily8Cr0VHzcKmC0M7PLNqEOkoKoS5DukSmA=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.528/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.531 h1:E8vq0WQBjB3jjtCK3u5DPrWGqlgyQUvQ19EkgBob1A8=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.531/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.534 h1:ZsJCXIZO2KfmEsrVN6a75VncTuaSkD4PNd1iXZ1I8BU=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.534/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.576 h1:6L4MeAnCk1NkuKoSfJvNPxqOrXq/HG9FqV3jl6i5t+w=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.576/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.634 h1:xSW5zhVEl+Lp7gJ9Bah1XUAzpGdLB1JrcFmJ+r16RJw=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.634/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.750 h1:zATJQLrw+i0NRosWvoAZ4FM+GbloqovVJGxLCdcjr/w=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.750/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.334 h1:ulfSODMy8rpKa8MfnTIPbe5HyOArnlB4RJ1qmpj09to=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.334/go.mod h1:AqyM/ZZMD7q5mHBqNY9YImbSpEpoEe7E/vrTbUWX+po=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.413 h1:MomwSkFrSLB16s51Yu1h4JO+p3Pzc1yesIj+oNwAVM0=
Expand All @@ -253,16 +243,14 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc v1.0.334 h1:inkOmQwx
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc v1.0.334/go.mod h1:5WGSrlIZJOhwIqPjjafb6vzrPEZieSHPhPMjjGPXOSU=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dcdb v1.0.334 h1:Xxe889sr1FVhUPPFdZC4Z5IyJObgnGh0ELe+MJH17Mo=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dcdb v1.0.334/go.mod h1:uvcrduqH3pPyyZoZyEX0WXlXIR554ys3ctSsKoeJp64=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dts v1.0.479 h1:Tuo8zLhHaO+AxHlk7WOYGs6j/3bfD3FMNB3fWAgIxWM=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dts v1.0.479/go.mod h1:CNPxkXeOC/vOmu9a/yaxp+2immIjDL/WsGC/H2rcWQA=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dts v1.0.531 h1:U0diLtuiEK8RDjfEh7X/BKetd+OppXWvoCW3CFJCMKE=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dts v1.0.531/go.mod h1:Mwk3VuBuWg6d2JtT5pKXKfNKxYRH1mrWquMcTVZQ7gc=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ecdn v1.0.750 h1:yzja0ZT7+yciVCEgmy7Zsx8lEjTWXtU6KZL+uHuVUXE=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ecdn v1.0.750/go.mod h1:S6u2ljeAetJAa/lFQVQZAvVJWJSNK7V5e6QPqj4LqA0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/es v1.0.334 h1:oXOMQ2EmNjqMfpShQeCrWS5QH2MwrAhJfd0rLJOxccE=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/es v1.0.334/go.mod h1:UegCt4vv9jAlzpgDu31ZJTuRP5T2BTV8w+jZBTsZIzg=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap v1.0.528 h1:CS8HIQNpfYQogrPR/WEFdVNJX6GIOwDyBzn1IHMb46g=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap v1.0.528/go.mod h1:J+xFyeGmSCp0x4tXPu5mlAhg2BAYQPIy3fQ4afy26tI=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap v1.0.534 h1:E/ccMQB7Il/U6Da5jrS4YUxpEZhVatageVdny+xAoMk=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap v1.0.534/go.mod h1:MNvt4sQeoetKfp8y3Y1iKv4aR+P7Z5khZX5QXG31ULA=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.194/go.mod h1:yrBKWhChnDqNz1xuXdSbWXG56XawEq0G5j1lg4VwBD4=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/lighthouse v1.0.334 h1:druwbDkTAvVwEGW4nHVuTuOX0bjk1CtLUDiC3r4gmgY=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/lighthouse v1.0.334/go.mod h1:r8txjlw4DjLDZFOpnPC/hOFHr1VckZc0jjBK6XIFLP0=
Expand Down
9 changes: 9 additions & 0 deletions pkg/collector/handler_dsa.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package collector

const (
DsaNamespace = "QCE/DSA"
)

func init() {
registerHandler(DsaNamespace, defaultHandlerEnabled, NewCdnHandler)
}
4 changes: 2 additions & 2 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package config

import (
"fmt"
"io/ioutil"
"os"
"strings"

Expand Down Expand Up @@ -70,6 +69,7 @@ var (
"lb_private": "QCE/LB_PRIVATE",
"waf": "QCE/WAF",
"cfs": "QCE/CFS",
"dsa": "QCE/DSA",
}

SupportStatisticsTypes = map[string]bool{
Expand Down Expand Up @@ -157,7 +157,7 @@ func NewConfig() *TencentConfig {

func (c *TencentConfig) LoadFile(filename string) error {
c.Filename = filename
content, err := ioutil.ReadFile(c.Filename)
content, err := os.ReadFile(c.Filename)
if err != nil {
return err
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/instance/repository_dsa.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package instance

func init() {
registerRepository("QCE/DSA", NewCdnTcInstanceRepository)
}

0 comments on commit 191f0db

Please sign in to comment.