This repository was archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from dhiltgen/registry_example
Fix ConfigMap glitches and doc registry caching
- Loading branch information
Showing
11 changed files
with
375 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Example buildkitd.toml configuration for a local insecure registry | ||
# Initialize buildkit with: | ||
# | ||
# kubectl buildkit create --config ./local-registry-buildkitd.toml | ||
debug = false | ||
[worker.containerd] | ||
namespace = "k8s.io" | ||
[registry."registry:5000"] | ||
http = true | ||
insecure = true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Example for running a local registry in your cluster to use for caching purposes | ||
# | ||
# Note: this will not be visible to the underlying container runtime, so you won't | ||
# be able to run images in the cluster from this registry, but you can use it | ||
# as a cache for a multi-node cluster to speed up builds so every builder has access | ||
# to the same cached content | ||
|
||
# TODO explore a variant of this for Host networking, binding to localhost on port 5000 | ||
# and see if that's viable for a local dev registry pattern | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: registry | ||
labels: | ||
app: registry | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: registry | ||
template: | ||
metadata: | ||
labels: | ||
app: registry | ||
spec: | ||
containers: | ||
- name: registry | ||
image: docker.io/registry | ||
ports: | ||
- containerPort: 5000 | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: registry | ||
spec: | ||
type: ClusterIP | ||
selector: | ||
app: registry | ||
ports: | ||
- protocol: TCP | ||
port: 5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (C) 2020 VMware, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package common | ||
|
||
import ( | ||
"k8s.io/cli-runtime/pkg/genericclioptions" | ||
"k8s.io/client-go/kubernetes" | ||
) | ||
|
||
// GetKubeClientset retrieves the clientset and namespace | ||
func GetKubeClientset() (*kubernetes.Clientset, string, error) { | ||
configFlags := genericclioptions.NewConfigFlags(true) | ||
clientConfig := configFlags.ToRawKubeConfigLoader() | ||
ns, _, err := clientConfig.Namespace() | ||
if err != nil { | ||
return nil, "", err | ||
} | ||
restClientConfig, err := clientConfig.ClientConfig() | ||
if err != nil { | ||
return nil, "", err | ||
} | ||
clientset, err := kubernetes.NewForConfig(restClientConfig) | ||
return clientset, ns, err | ||
} |
Oops, something went wrong.