Skip to content

Commit

Permalink
Docker login before running e2e tests and use shorter names for metri…
Browse files Browse the repository at this point in the history
…cs traffic

Signed-off-by: Furkat Gofurov <furkat.gofurov@suse.com>
  • Loading branch information
furkatgofurov7 committed Nov 18, 2024
1 parent 47f04bd commit 9fa1af1
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 12 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
pull_request:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
test-e2e:
name: Run on Ubuntu
Expand All @@ -17,6 +20,13 @@ jobs:
with:
go-version: '~1.22'

- name: Docker login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Install the latest version of kind
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
Expand Down
2 changes: 1 addition & 1 deletion config/certmanager/certificate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
issuerRef:
kind: Issuer
name: selfsigned-issuer
secretName: capi-webhook-service-cert # this secret will not be prefixed, since it's not managed by kustomize
secretName: webhook-server-cert # this secret will not be prefixed, since it's not managed by kustomize
subject:
organizations:
- k8s-sig-cluster-lifecycle
2 changes: 1 addition & 1 deletion config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace: cluster-api-addon-provider-kubewarden-system
# "wordpress" becomes "alices-wordpress".
# Note that it should also match with the prefix (text before '-') of the namespace
# field above.
namePrefix: cluster-api-addon-provider-kubewarden-
namePrefix: capi-provider-kubewarden-

# Labels to add to all resources and selectors.
#labels:
Expand Down
2 changes: 1 addition & 1 deletion config/default/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ spec:
template:
spec:
containers:
- image: gcr.io/cluster-api-addon-provider-kubewarden-controller:main
- image: ghcr.io/caapkw/cluster-api-addon-provider-kubewarden:v0.0.1
name: manager
4 changes: 2 additions & 2 deletions config/default/metrics_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ kind: Service
metadata:
labels:
control-plane: controller-manager
app.kubernetes.io/name: cluster-api-addon-provider-kubewarden
app.kubernetes.io/name: capi-provider-kubewarden
app.kubernetes.io/managed-by: kustomize
name: controller-manager-metrics-service
name: ctrl-mgr-metrics-service
namespace: system
spec:
ports:
Expand Down
2 changes: 1 addition & 1 deletion config/network-policy/allow-metrics-traffic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
labels:
app.kubernetes.io/name: cluster-api-addon-provider-kubewarden
app.kubernetes.io/name: capi-provider-kubewarden
app.kubernetes.io/managed-by: kustomize
name: allow-metrics-traffic
namespace: system
Expand Down
4 changes: 2 additions & 2 deletions config/prometheus/monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ kind: ServiceMonitor
metadata:
labels:
control-plane: controller-manager
app.kubernetes.io/name: cluster-api-addon-provider-kubewarden
app.kubernetes.io/name: capi-provider-kubewarden
app.kubernetes.io/managed-by: kustomize
name: controller-manager-metrics-monitor
name: ctrl-mgr-metrics-monitor
namespace: system
spec:
endpoints:
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ import (
const namespace = "cluster-api-addon-provider-kubewarden-system"

// serviceAccountName created for the project
const serviceAccountName = "cluster-api-addon-provider-kubewarden-controller-manager"
const serviceAccountName = "capi-provider-kubewarden-ctrl-mgr"

// metricsServiceName is the name of the metrics service of the project
const metricsServiceName = "cluster-api-addon-provider-kubewarden-controller-manager-metrics-service"
const metricsServiceName = "capi-provider-kubewarden-ctrl-mgr-metrics-service"

// metricsRoleBindingName is the name of the RBAC that will be created to allow get the metrics data
const metricsRoleBindingName = "cluster-api-addon-provider-kubewarden-metrics-binding"
const metricsRoleBindingName = "capi-provider-kubewarden-metrics-binding"

var _ = Describe("Manager", Ordered, func() {
var controllerPodName string
Expand Down Expand Up @@ -166,7 +166,7 @@ var _ = Describe("Manager", Ordered, func() {
It("should ensure the metrics endpoint is serving metrics", func() {
By("creating a ClusterRoleBinding for the service account to allow access to metrics")
cmd := exec.Command("kubectl", "create", "clusterrolebinding", metricsRoleBindingName,
"--clusterrole=cluster-api-addon-provider-kubewarden-metrics-reader",
"--clusterrole=capi-provider-kubewarden-metrics-reader",
fmt.Sprintf("--serviceaccount=%s:%s", namespace, serviceAccountName),
)
_, err := utils.Run(cmd)
Expand Down

0 comments on commit 9fa1af1

Please sign in to comment.