Skip to content

Commit

Permalink
Add enableServiceLinks to PodSpec (#705)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha committed May 3, 2023
1 parent 4849d48 commit b0d8640
Show file tree
Hide file tree
Showing 48 changed files with 12,328 additions and 3,874 deletions.
4 changes: 2 additions & 2 deletions go.mod
Expand Up @@ -22,7 +22,7 @@ require (
kmodules.xyz/client-go v0.25.18
kmodules.xyz/custom-resources v0.25.1
kmodules.xyz/monitoring-agent-api v0.25.1
kubedb.dev/apimachinery v0.33.0
kubedb.dev/apimachinery v0.33.2-0.20230503123451-70ebcf524ed7
stash.appscode.dev/apimachinery v0.27.0
)

Expand Down Expand Up @@ -126,7 +126,7 @@ require (
k8s.io/utils v0.0.0-20221012122500-cfd413dd9e85 // indirect
kmodules.xyz/apiversion v0.2.0 // indirect
kmodules.xyz/objectstore-api v0.25.1-0.20221104003322-f0289b5b6ca2 // indirect
kmodules.xyz/offshoot-api v0.25.0 // indirect
kmodules.xyz/offshoot-api v0.25.3 // indirect
kmodules.xyz/prober v0.25.0 // indirect
sigs.k8s.io/controller-runtime v0.13.1 // indirect
sigs.k8s.io/gateway-api v0.4.3 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Expand Up @@ -1304,12 +1304,12 @@ kmodules.xyz/monitoring-agent-api v0.25.1 h1:E1H8U/vMfYQ8wevmJv6Lcj0Z4DF7cH3hZ2x
kmodules.xyz/monitoring-agent-api v0.25.1/go.mod h1:IphGzRWbuV00B3TLalcBs6+IlchSZVTwKDty+J3LLz4=
kmodules.xyz/objectstore-api v0.25.1-0.20221104003322-f0289b5b6ca2 h1:efc0glYeBw+ok5s5ZecKdB9zgnRo/IvsLlSaQUPQjZE=
kmodules.xyz/objectstore-api v0.25.1-0.20221104003322-f0289b5b6ca2/go.mod h1:X5aCkyU91p9TOn4jcWw0cfcJL0HCKd/Z6FJHdzKz1ZU=
kmodules.xyz/offshoot-api v0.25.0 h1:Svq9da/+sg5afOjpgo9vx2J/Lu90Mo0aFxkdQmgKnGI=
kmodules.xyz/offshoot-api v0.25.0/go.mod h1:ysEBn7LJuT3+s8ynAQA/OG0BSsJugXa6KGtDLMRjlKo=
kmodules.xyz/offshoot-api v0.25.3 h1:KOGzW+TRHJvZ/KauvVQfKHztHF3HTHQ0ibbCHB3sWRg=
kmodules.xyz/offshoot-api v0.25.3/go.mod h1:PUk4EuJFhhyQykCflHj7EgXcljGIqs9vi0IN0RpxtY4=
kmodules.xyz/prober v0.25.0 h1:R5uRLHJEvEtEoogj+vaTAob0Btph6+PX5IlS6hPh8PA=
kmodules.xyz/prober v0.25.0/go.mod h1:z4RTnjaajNQa/vPltsiOnO3xI716I/ziD2ac2Exm+1M=
kubedb.dev/apimachinery v0.33.0 h1:xf/IAl5VKI4DL5DbgXZ8Zn3dMsRlAvLT/qmdPl10nps=
kubedb.dev/apimachinery v0.33.0/go.mod h1:NeUOOmIS8E0TdDCSJcyYrbbs7wvebSXGO9ddredvgRs=
kubedb.dev/apimachinery v0.33.2-0.20230503123451-70ebcf524ed7 h1:v5dONAxkaDy9rBdvVpu1oX6hNijjdValKvMgalFQgGI=
kubedb.dev/apimachinery v0.33.2-0.20230503123451-70ebcf524ed7/go.mod h1:uanD/CoIJz9Zc+so9VvD4+f1KN6MH2CrPjeHcE2ybWE=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
Expand Down
7,064 changes: 4,716 additions & 2,348 deletions vendor/kmodules.xyz/offshoot-api/api/v1/generated.pb.go

Large diffs are not rendered by default.

414 changes: 324 additions & 90 deletions vendor/kmodules.xyz/offshoot-api/api/v1/generated.proto

Large diffs are not rendered by default.

653 changes: 554 additions & 99 deletions vendor/kmodules.xyz/offshoot-api/api/v1/openapi_generated.go

Large diffs are not rendered by default.

265 changes: 264 additions & 1 deletion vendor/kmodules.xyz/offshoot-api/api/v1/pvc.go
Expand Up @@ -106,7 +106,7 @@ type PersistentVolumeClaim struct {
Status core.PersistentVolumeClaimStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}

func (in *PersistentVolumeClaim) ToCorePVC() *core.PersistentVolumeClaim {
func (in *PersistentVolumeClaim) ToAPIObject() *core.PersistentVolumeClaim {
if in == nil {
return nil
}
Expand All @@ -123,3 +123,266 @@ func (in *PersistentVolumeClaim) ToCorePVC() *core.PersistentVolumeClaim {
Status: in.Status,
}
}

// PersistentVolumeClaimTemplate is used to produce
// PersistentVolumeClaim objects as part of an EphemeralVolumeSource.
type PersistentVolumeClaimTemplate struct {
// May contain labels and annotations that will be copied into the PVC
// when creating it. No other fields are allowed and will be rejected during
// validation.
//
// +optional
PartialObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

// The specification for the PersistentVolumeClaim. The entire content is
// copied unchanged into the PVC that gets created from this
// template. The same fields as in a PersistentVolumeClaim
// are also valid here.
Spec core.PersistentVolumeClaimSpec `json:"spec" protobuf:"bytes,2,name=spec"`
}

func (in *PersistentVolumeClaimTemplate) ToAPIObject() *core.PersistentVolumeClaimTemplate {
if in == nil {
return nil
}
return &core.PersistentVolumeClaimTemplate{
ObjectMeta: metav1.ObjectMeta{
Name: in.Name,
GenerateName: in.GenerateName,
Namespace: in.Namespace,
Labels: in.Labels,
Annotations: in.Annotations,
OwnerReferences: in.OwnerReferences,
},
Spec: in.Spec,
}
}

// Volume represents a named volume in a pod that may be accessed by any container in the pod.
type Volume struct {
// name of the volume.
// Must be a DNS_LABEL and unique within the pod.
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// volumeSource represents the location and type of the mounted volume.
// If not specified, the Volume is implied to be an EmptyDir.
// This implied behavior is deprecated and will be removed in a future version.
VolumeSource `json:",inline" protobuf:"bytes,2,opt,name=volumeSource"`
}

func (in *Volume) ToAPIObject() *core.Volume {
if in == nil {
return nil
}
return &core.Volume{
Name: in.Name,
VolumeSource: *in.VolumeSource.ToAPIObject(),
}
}

// Represents the source of a volume to mount.
// Only one of its members may be specified.
type VolumeSource struct {
// hostPath represents a pre-existing file or directory on the host
// machine that is directly exposed to the container. This is generally
// used for system agents or other privileged things that are allowed
// to see the host machine. Most containers will NOT need this.
// More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath
// ---
// TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not
// mount host directories as read/write.
// +optional
HostPath *core.HostPathVolumeSource `json:"hostPath,omitempty" protobuf:"bytes,1,opt,name=hostPath"`
// emptyDir represents a temporary directory that shares a pod's lifetime.
// More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir
// +optional
EmptyDir *core.EmptyDirVolumeSource `json:"emptyDir,omitempty" protobuf:"bytes,2,opt,name=emptyDir"`
// gcePersistentDisk represents a GCE Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod.
// More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk
// +optional
GCEPersistentDisk *core.GCEPersistentDiskVolumeSource `json:"gcePersistentDisk,omitempty" protobuf:"bytes,3,opt,name=gcePersistentDisk"`
// awsElasticBlockStore represents an AWS Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod.
// More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
// +optional
AWSElasticBlockStore *core.AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore,omitempty" protobuf:"bytes,4,opt,name=awsElasticBlockStore"`
// secret represents a secret that should populate this volume.
// More info: https://kubernetes.io/docs/concepts/storage/volumes#secret
// +optional
Secret *core.SecretVolumeSource `json:"secret,omitempty" protobuf:"bytes,6,opt,name=secret"`
// nfs represents an NFS mount on the host that shares a pod's lifetime
// More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs
// +optional
NFS *core.NFSVolumeSource `json:"nfs,omitempty" protobuf:"bytes,7,opt,name=nfs"`
// iscsi represents an ISCSI Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod.
// More info: https://examples.k8s.io/volumes/iscsi/README.md
// +optional
ISCSI *core.ISCSIVolumeSource `json:"iscsi,omitempty" protobuf:"bytes,8,opt,name=iscsi"`
// glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime.
// More info: https://examples.k8s.io/volumes/glusterfs/README.md
// +optional
Glusterfs *core.GlusterfsVolumeSource `json:"glusterfs,omitempty" protobuf:"bytes,9,opt,name=glusterfs"`
// persistentVolumeClaimVolumeSource represents a reference to a
// PersistentVolumeClaim in the same namespace.
// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims
// +optional
PersistentVolumeClaim *core.PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim,omitempty" protobuf:"bytes,10,opt,name=persistentVolumeClaim"`
// rbd represents a Rados Block Device mount on the host that shares a pod's lifetime.
// More info: https://examples.k8s.io/volumes/rbd/README.md
// +optional
RBD *core.RBDVolumeSource `json:"rbd,omitempty" protobuf:"bytes,11,opt,name=rbd"`
// flexVolume represents a generic volume resource that is
// provisioned/attached using an exec based plugin.
// +optional
FlexVolume *core.FlexVolumeSource `json:"flexVolume,omitempty" protobuf:"bytes,12,opt,name=flexVolume"`
// cinder represents a cinder volume attached and mounted on kubelets host machine.
// More info: https://examples.k8s.io/mysql-cinder-pd/README.md
// +optional
Cinder *core.CinderVolumeSource `json:"cinder,omitempty" protobuf:"bytes,13,opt,name=cinder"`
// cephFS represents a Ceph FS mount on the host that shares a pod's lifetime
// +optional
CephFS *core.CephFSVolumeSource `json:"cephfs,omitempty" protobuf:"bytes,14,opt,name=cephfs"`
// flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running
// +optional
Flocker *core.FlockerVolumeSource `json:"flocker,omitempty" protobuf:"bytes,15,opt,name=flocker"`
// downwardAPI represents downward API about the pod that should populate this volume
// +optional
DownwardAPI *core.DownwardAPIVolumeSource `json:"downwardAPI,omitempty" protobuf:"bytes,16,opt,name=downwardAPI"`
// fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.
// +optional
FC *core.FCVolumeSource `json:"fc,omitempty" protobuf:"bytes,17,opt,name=fc"`
// azureFile represents an Azure File Service mount on the host and bind mount to the pod.
// +optional
AzureFile *core.AzureFileVolumeSource `json:"azureFile,omitempty" protobuf:"bytes,18,opt,name=azureFile"`
// configMap represents a configMap that should populate this volume
// +optional
ConfigMap *core.ConfigMapVolumeSource `json:"configMap,omitempty" protobuf:"bytes,19,opt,name=configMap"`
// vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine
// +optional
VsphereVolume *core.VsphereVirtualDiskVolumeSource `json:"vsphereVolume,omitempty" protobuf:"bytes,20,opt,name=vsphereVolume"`
// quobyte represents a Quobyte mount on the host that shares a pod's lifetime
// +optional
Quobyte *core.QuobyteVolumeSource `json:"quobyte,omitempty" protobuf:"bytes,21,opt,name=quobyte"`
// azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.
// +optional
AzureDisk *core.AzureDiskVolumeSource `json:"azureDisk,omitempty" protobuf:"bytes,22,opt,name=azureDisk"`
// photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine
PhotonPersistentDisk *core.PhotonPersistentDiskVolumeSource `json:"photonPersistentDisk,omitempty" protobuf:"bytes,23,opt,name=photonPersistentDisk"`
// projected items for all in one resources secrets, configmaps, and downward API
Projected *core.ProjectedVolumeSource `json:"projected,omitempty" protobuf:"bytes,26,opt,name=projected"`
// portworxVolume represents a portworx volume attached and mounted on kubelets host machine
// +optional
PortworxVolume *core.PortworxVolumeSource `json:"portworxVolume,omitempty" protobuf:"bytes,24,opt,name=portworxVolume"`
// scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
ScaleIO *core.ScaleIOVolumeSource `json:"scaleIO,omitempty" protobuf:"bytes,25,opt,name=scaleIO"`
// storageOS represents a StorageOS volume attached and mounted on Kubernetes nodes.
// +optional
StorageOS *core.StorageOSVolumeSource `json:"storageos,omitempty" protobuf:"bytes,27,opt,name=storageos"`
// csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers (Beta feature).
// +optional
CSI *core.CSIVolumeSource `json:"csi,omitempty" protobuf:"bytes,28,opt,name=csi"`
// ephemeral represents a volume that is handled by a cluster storage driver.
// The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts,
// and deleted when the pod is removed.
//
// Use this if:
// a) the volume is only needed while the pod runs,
// b) features of normal volumes like restoring from snapshot or capacity
// tracking are needed,
// c) the storage driver is specified through a storage class, and
// d) the storage driver supports dynamic volume provisioning through
// a PersistentVolumeClaim (see EphemeralVolumeSource for more
// information on the connection between this volume type
// and PersistentVolumeClaim).
//
// Use PersistentVolumeClaim or one of the vendor-specific
// APIs for volumes that persist for longer than the lifecycle
// of an individual pod.
//
// Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to
// be used that way - see the documentation of the driver for
// more information.
//
// A pod can use both types of ephemeral volumes and
// persistent volumes at the same time.
//
// +optional
Ephemeral *EphemeralVolumeSource `json:"ephemeral,omitempty" protobuf:"bytes,29,opt,name=ephemeral"`
}

func (in *VolumeSource) ToAPIObject() *core.VolumeSource {
if in == nil {
return nil
}
return &core.VolumeSource{
HostPath: in.HostPath,
EmptyDir: in.EmptyDir,
GCEPersistentDisk: in.GCEPersistentDisk,
AWSElasticBlockStore: in.AWSElasticBlockStore,
Secret: in.Secret,
NFS: in.NFS,
ISCSI: in.ISCSI,
Glusterfs: in.Glusterfs,
PersistentVolumeClaim: in.PersistentVolumeClaim,
RBD: in.RBD,
FlexVolume: in.FlexVolume,
Cinder: in.Cinder,
CephFS: in.CephFS,
Flocker: in.Flocker,
DownwardAPI: in.DownwardAPI,
FC: in.FC,
AzureFile: in.AzureFile,
ConfigMap: in.ConfigMap,
VsphereVolume: in.VsphereVolume,
Quobyte: in.Quobyte,
AzureDisk: in.AzureDisk,
PhotonPersistentDisk: in.PhotonPersistentDisk,
Projected: in.Projected,
PortworxVolume: in.PortworxVolume,
ScaleIO: in.ScaleIO,
StorageOS: in.StorageOS,
CSI: in.CSI,
Ephemeral: in.Ephemeral.ToAPIObject(),
}
}

// Represents an ephemeral volume that is handled by a normal storage driver.
type EphemeralVolumeSource struct {
// Will be used to create a stand-alone PVC to provision the volume.
// The pod in which this EphemeralVolumeSource is embedded will be the
// owner of the PVC, i.e. the PVC will be deleted together with the
// pod. The name of the PVC will be `<pod name>-<volume name>` where
// `<volume name>` is the name from the `PodSpec.Volumes` array
// entry. Pod validation will reject the pod if the concatenated name
// is not valid for a PVC (for example, too long).
//
// An existing PVC with that name that is not owned by the pod
// will *not* be used for the pod to avoid using an unrelated
// volume by mistake. Starting the pod is then blocked until
// the unrelated PVC is removed. If such a pre-created PVC is
// meant to be used by the pod, the PVC has to updated with an
// owner reference to the pod once the pod exists. Normally
// this should not be necessary, but it may be useful when
// manually reconstructing a broken cluster.
//
// This field is read-only and no changes will be made by Kubernetes
// to the PVC after it has been created.
//
// Required, must not be nil.
VolumeClaimTemplate *PersistentVolumeClaimTemplate `json:"volumeClaimTemplate,omitempty" protobuf:"bytes,1,opt,name=volumeClaimTemplate"`

// ReadOnly is tombstoned to show why 2 is a reserved protobuf tag.
// ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,2,opt,name=readOnly"`
}

func (in *EphemeralVolumeSource) ToAPIObject() *core.EphemeralVolumeSource {
if in == nil {
return nil
}
return &core.EphemeralVolumeSource{
VolumeClaimTemplate: in.VolumeClaimTemplate.ToAPIObject(),
}
}

0 comments on commit b0d8640

Please sign in to comment.