asyncstorage

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Copyright (c) 2019-2021 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2019-2021 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2019-2021 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2019-2021 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2019-2021 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2019-2021 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2019-2021 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2019-2021 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2019-2021 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var NotReadyError = errors.New("async storage component is not ready")

Functions

func ExtractSSHKeyPairFromSecret

func ExtractSSHKeyPairFromSecret(secret *corev1.Secret) (public, private []byte, err error)

func GetAsyncSidecar

func GetAsyncSidecar(sshVolumeName string, volumes []corev1.Volume) *corev1.Container

GetAsyncSidecar gets the definition for the async storage sidecar. Within this sidecar, all provided volumes are mounted to `/volume.Name`, and the sshVolume is mounted to /etc/ssh/private as read-only.

Note: in the current implementation, the image used for the async sidecar only syncs from ${CHE_PROJECTS_ROOT}

func GetOrCreateSSHConfig

func GetOrCreateSSHConfig(workspace *dw.DevWorkspace, clusterAPI wsprovision.ClusterAPI) (*corev1.Secret, *corev1.ConfigMap, error)

GetOrCreateSSHConfig returns the secret and configmap used for the asynchronous deployment. The Secret is generated per-workspace and should be mounted to the asynchronous storage sync sidecar. The ConfigMap is per-namespace and stores authorized_keys for each workspace that is expected to use asynchronous storage; it should be mounted in the asynchronous storage sync deployment.

If the k8s objects do not exist, an SSH keypair is generated and a secret and configmap are created on the cluster. This function works on two streams:

  1. If the async storage SSH secret for the given workspace does not exist on the cluster, an SSH keypair are generated, a Secret is synced to the cluster and the corresponding authorized key is added to the ConfigMap
  2. If the async storage SSH secret exists, its content is read, and the ConfigMap is verified to contain the corresponding public key in authorized_keys.

In both cases, if the ConfigMap does not exist, it is created.

Returns NotReadyError if changes were made to the cluster.

func GetSSHKeyPair

func GetSSHKeyPair() (public, private []byte, err error)

GetSSHKeyPair returns a pair of SSH keys. The public key is formatted for inclusion in an ssh authorized_keys file, and the private key is pem-formatted.

func GetSSHSidecarSecretName

func GetSSHSidecarSecretName(workspaceId string) string

func GetVolumeFromSecret

func GetVolumeFromSecret(secret *corev1.Secret) *corev1.Volume

func GetWorkspaceSyncDeploymentCluster

func GetWorkspaceSyncDeploymentCluster(namespace string, clusterAPI wsprovision.ClusterAPI) (*appsv1.Deployment, error)

func SyncWorkspaceSyncDeploymentToCluster

func SyncWorkspaceSyncDeploymentToCluster(namespace string, sshConfigMap *corev1.ConfigMap, storage *corev1.PersistentVolumeClaim, clusterAPI wsprovision.ClusterAPI) (*appsv1.Deployment, error)

func SyncWorkspaceSyncServiceToCluster

func SyncWorkspaceSyncServiceToCluster(asyncDeploy *appsv1.Deployment, api wsprovision.ClusterAPI) (*corev1.Service, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL