forked from harness/harness
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [CDE-94]: Adding orchestration to start, stop and delete Gitspa…
…ces. (harness#2159) * Addressing review comments. * feat: [CDE-94]: Rebasing PR. Adding StartResponse to store container orchestration start response. Refactoring provisioner to clean the method params. * feat: [CDE-94]: Using ports returned by the container orchestrator * feat: [CDE-94]: Adding orchestrtion to start, stop and delete Gitspaces.
- Loading branch information
1 parent
b10fa3e
commit 34df7cf
Showing
10 changed files
with
372 additions
and
60 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
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,23 @@ | ||
// Copyright 2023 Harness, 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. | ||
|
||
package container | ||
|
||
import "github.com/harness/gitness/types/enum" | ||
|
||
type StartResponse struct { | ||
ContainerID string | ||
ContainerName string | ||
PortsUsed map[enum.IDEType]string | ||
} |
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,45 @@ | ||
// Copyright 2023 Harness, 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. | ||
|
||
package orchestrator | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/harness/gitness/types" | ||
) | ||
|
||
type Orchestrator interface { | ||
// StartGitspace is responsible for all the operations necessary to create the Gitspace container. It fetches the | ||
// devcontainer.json from the code repo, provisions infra using the infra provisioner and setting up the Gitspace | ||
// through the container orchestrator. | ||
StartGitspace( | ||
ctx context.Context, | ||
gitspaceConfig *types.GitspaceConfig, | ||
) (*types.GitspaceInstance, error) | ||
|
||
// StopGitspace is responsible for stopping a running Gitspace. It stops the Gitspace container and unprovisions | ||
// all the infra resources which are not required to restart the Gitspace. | ||
StopGitspace( | ||
ctx context.Context, | ||
gitspaceConfig *types.GitspaceConfig, | ||
) (*types.GitspaceInstance, error) | ||
|
||
// DeleteGitspace is responsible for deleting a Gitspace. It stops the Gitspace container and unprovisions | ||
// all the infra resources. | ||
DeleteGitspace( | ||
ctx context.Context, | ||
gitspaceConfig *types.GitspaceConfig, | ||
) (*types.GitspaceInstance, error) | ||
} |
Oops, something went wrong.