-
Notifications
You must be signed in to change notification settings - Fork 9
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 #87 from srl-labs/feat/image-pull-cr
feat: ImageRequest cr instead of http request
- Loading branch information
Showing
43 changed files
with
2,356 additions
and
501 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package v1alpha1 | ||
|
||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
// +genclient | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// ImageRequest is an object that represents a request (from a launcher pod) to pull an image on a | ||
// given kubernetes node such that the image can be "pulled through" into the launcher docker | ||
// daemon. | ||
// +k8s:openapi-gen=true | ||
type ImageRequest struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec ImageRequestSpec `json:"spec,omitempty"` | ||
Status ImageRequestStatus `json:"status,omitempty"` | ||
} | ||
|
||
// ImageRequestSpec is the spec for a Config resource. | ||
type ImageRequestSpec struct { | ||
// TopologyName is the name of the topology requesting the image. | ||
TopologyName string `json:"topologyName"` | ||
// TopologyNodeName is the name of the node in the topology (i.e. the router name in a | ||
// containerlab topology) that the image is being requested for. | ||
TopologyNodeName string `json:"topologyNodeName"` | ||
// KubernetesNode is the node where the launcher pod is running and where the image should be | ||
// pulled too. | ||
KubernetesNode string `json:"kubernetesNode"` | ||
// RequestedImage is the image that the launcher pod wants the controller to get pulled onto | ||
// the specified node. | ||
RequestedImage string `json:"requestedImage"` | ||
// RequestedImagePullSecrets is a list of configured pull secrets to set in the pull pod spec. | ||
// +listType=set | ||
// +optional | ||
RequestedImagePullSecrets []string `json:"requestedImagePullSecrets"` | ||
} | ||
|
||
// ImageRequestStatus is the status for a ImageRequest resource. | ||
type ImageRequestStatus struct { | ||
// Accepted indicates that the ImageRequest controller has seen this image request and is going | ||
// to process it. This can be useful to let the requesting pod know that "yep, this is in the | ||
// works, and i can go watch the cri images on this node now". | ||
Accepted bool `json:"accepted"` | ||
// Complete indicates that the ImageRequest controller has seen that the puller pod has done its | ||
// job and that the image has been pulled onto the requested node. | ||
Complete bool `json:"complete"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// ImageRequestList is a list of ImageRequest objects. | ||
type ImageRequestList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
|
||
Items []ImageRequest `json:"items"` | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
89 changes: 89 additions & 0 deletions
89
assets/crd/clabernetes.containerlab.dev_imagerequests.yaml
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,89 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.13.0 | ||
name: imagerequests.clabernetes.containerlab.dev | ||
spec: | ||
group: clabernetes.containerlab.dev | ||
names: | ||
kind: ImageRequest | ||
listKind: ImageRequestList | ||
plural: imagerequests | ||
singular: imagerequest | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: ImageRequest is an object that represents a request (from a launcher | ||
pod) to pull an image on a given kubernetes node such that the image can | ||
be "pulled through" into the launcher docker daemon. | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: ImageRequestSpec is the spec for a Config resource. | ||
properties: | ||
kubernetesNode: | ||
description: KubernetesNode is the node where the launcher pod is | ||
running and where the image should be pulled too. | ||
type: string | ||
requestedImage: | ||
description: RequestedImage is the image that the launcher pod wants | ||
the controller to get pulled onto the specified node. | ||
type: string | ||
requestedImagePullSecrets: | ||
description: RequestedImagePullSecrets is a list of configured pull | ||
secrets to set in the pull pod spec. | ||
items: | ||
type: string | ||
type: array | ||
x-kubernetes-list-type: set | ||
topologyName: | ||
description: TopologyName is the name of the topology requesting the | ||
image. | ||
type: string | ||
topologyNodeName: | ||
description: TopologyNodeName is the name of the node in the topology | ||
(i.e. the router name in a containerlab topology) that the image | ||
is being requested for. | ||
type: string | ||
required: | ||
- kubernetesNode | ||
- requestedImage | ||
- topologyName | ||
- topologyNodeName | ||
type: object | ||
status: | ||
description: ImageRequestStatus is the status for a ImageRequest resource. | ||
properties: | ||
accepted: | ||
description: Accepted indicates that the ImageRequest controller has | ||
seen this image request and is going to process it. This can be | ||
useful to let the requesting pod know that "yep, this is in the | ||
works, and i can go watch the cri images on this node now". | ||
type: boolean | ||
complete: | ||
description: Complete indicates that the ImageRequest controller has | ||
seen that the puller pod has done its job and that the image has | ||
been pulled onto the requested node. | ||
type: boolean | ||
required: | ||
- accepted | ||
- complete | ||
type: object | ||
type: object | ||
served: true | ||
storage: true |
89 changes: 89 additions & 0 deletions
89
charts/clabernetes/crds/clabernetes.containerlab.dev_imagerequests.yaml
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,89 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.13.0 | ||
name: imagerequests.clabernetes.containerlab.dev | ||
spec: | ||
group: clabernetes.containerlab.dev | ||
names: | ||
kind: ImageRequest | ||
listKind: ImageRequestList | ||
plural: imagerequests | ||
singular: imagerequest | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: ImageRequest is an object that represents a request (from a launcher | ||
pod) to pull an image on a given kubernetes node such that the image can | ||
be "pulled through" into the launcher docker daemon. | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: ImageRequestSpec is the spec for a Config resource. | ||
properties: | ||
kubernetesNode: | ||
description: KubernetesNode is the node where the launcher pod is | ||
running and where the image should be pulled too. | ||
type: string | ||
requestedImage: | ||
description: RequestedImage is the image that the launcher pod wants | ||
the controller to get pulled onto the specified node. | ||
type: string | ||
requestedImagePullSecrets: | ||
description: RequestedImagePullSecrets is a list of configured pull | ||
secrets to set in the pull pod spec. | ||
items: | ||
type: string | ||
type: array | ||
x-kubernetes-list-type: set | ||
topologyName: | ||
description: TopologyName is the name of the topology requesting the | ||
image. | ||
type: string | ||
topologyNodeName: | ||
description: TopologyNodeName is the name of the node in the topology | ||
(i.e. the router name in a containerlab topology) that the image | ||
is being requested for. | ||
type: string | ||
required: | ||
- kubernetesNode | ||
- requestedImage | ||
- topologyName | ||
- topologyNodeName | ||
type: object | ||
status: | ||
description: ImageRequestStatus is the status for a ImageRequest resource. | ||
properties: | ||
accepted: | ||
description: Accepted indicates that the ImageRequest controller has | ||
seen this image request and is going to process it. This can be | ||
useful to let the requesting pod know that "yep, this is in the | ||
works, and i can go watch the cri images on this node now". | ||
type: boolean | ||
complete: | ||
description: Complete indicates that the ImageRequest controller has | ||
seen that the puller pod has done its job and that the image has | ||
been pulled onto the requested node. | ||
type: boolean | ||
required: | ||
- accepted | ||
- complete | ||
type: object | ||
type: object | ||
served: true | ||
storage: true |
Oops, something went wrong.