Skip to content

Commit

Permalink
Add k3k-kubelet image to the release workflow
Browse files Browse the repository at this point in the history
Signed-off-by: galal-hussein <[email protected]>
  • Loading branch information
galal-hussein committed Oct 15, 2024
1 parent f9ad4e1 commit 9492517
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 11 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,23 @@ jobs:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}

- name: Build container image
- name: Build controller image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: rancher/k3k:${{ github.ref_name }}
file: package/Dockerfile
platforms: linux/amd64

- name: Build Virtual Kubelet image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: rancher/k3k:k3k-kubelet
file: package/Dockerfile
platforms: linux/amd64



File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
"time"

certutil "github.com/rancher/dynamiclistener/cert"
"github.com/rancher/k3k/k3k-kubelet/pkg/config"
"github.com/rancher/k3k/k3k-kubelet/pkg/provider"
"github.com/rancher/k3k/pkg/apis/k3k.io/v1alpha1"
"github.com/rancher/k3k/pkg/controller/cluster/server/bootstrap"
"github.com/rancher/k3k/pkg/controller/kubeconfig"
"github.com/rancher/k3k/pkg/controller/util"
"github.com/rancher/k3k/virtual-kubelet/pkg/config"
"github.com/rancher/k3k/virtual-kubelet/pkg/provider"
"github.com/virtual-kubelet/virtual-kubelet/log"
"github.com/virtual-kubelet/virtual-kubelet/node"
"github.com/virtual-kubelet/virtual-kubelet/node/nodeutil"
Expand All @@ -30,14 +30,15 @@ import (
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
"k8s.io/client-go/util/retry"
ctrlruntimeclient "sigs.k8s.io/controller-runtime/pkg/client"
)

var (
Scheme = runtime.NewScheme()
backoff = wait.Backoff{
Steps: 5,
Duration: 20 * time.Second,
Duration: 5 * time.Second,
Factor: 2,
Jitter: 0.1,
}
Expand Down Expand Up @@ -176,8 +177,14 @@ func virtRestConfig(ctx context.Context, virtualConfigPath string, hostClient ct
return nil, err
}
endpoint := fmt.Sprintf("%s.%s", util.ServerSvcName(&cluster), util.ClusterNamespace(&cluster))
b, err := bootstrap.DecodedBootstrap(cluster.Spec.Token, endpoint)
if err != nil {
var b *bootstrap.ControlRuntimeBootstrap
if err := retry.OnError(backoff, func(err error) bool {
return err == nil
}, func() error {
var err error
b, err = bootstrap.DecodedBootstrap(cluster.Spec.Token, endpoint)
return err
}); err != nil {
return nil, fmt.Errorf("unable to decode bootstrap: %w", err)
}
adminCert, adminKey, err := kubeconfig.CreateClientCertKey(
Expand Down Expand Up @@ -226,14 +233,21 @@ func kubeconfigBytes(url string, serverCA, clientCert, clientKey []byte) ([]byte
}

func loadTLSConfig(ctx context.Context, hostClient ctrlruntimeclient.Client, clusterName, clusterNamespace, nodeName, ipStr string) (*tls.Config, error) {
var cluster v1alpha1.Cluster
var (
cluster v1alpha1.Cluster
b *bootstrap.ControlRuntimeBootstrap
)
if err := hostClient.Get(ctx, types.NamespacedName{Name: clusterName, Namespace: clusterNamespace}, &cluster); err != nil {
return nil, err
}

endpoint := fmt.Sprintf("%s.%s", util.ServerSvcName(&cluster), util.ClusterNamespace(&cluster))
b, err := bootstrap.DecodedBootstrap(cluster.Spec.Token, endpoint)
if err != nil {
if err := retry.OnError(backoff, func(err error) bool {
return err != nil
}, func() error {
var err error
b, err = bootstrap.DecodedBootstrap(cluster.Spec.Token, endpoint)
return err
}); err != nil {
return nil, fmt.Errorf("unable to decode bootstrap: %w", err)
}
altNames := certutil.AltNames{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pkg/controller/cluster/agent/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

const (
virtualKubeletImage = "husseingalal/k3k:k3k-kubelet"
virtualKubeletImage = "rancher/k3k:k3k-kubelet"
)

type SharedAgent struct {
Expand Down

0 comments on commit 9492517

Please sign in to comment.