-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supervisor Namespace #749
Closed
Closed
Supervisor Namespace #749
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
e72d16c
WIP - TP Supervisor Namespace
Didainius 29aa0ee
WIP
Didainius ae0d341
WIP
Didainius bee592d
WIP
Didainius 5a60eba
WIP
Didainius 51eb057
WIP
Didainius 2131721
WIP
Didainius 6cc3f5c
WIP
Didainius c417dc7
Add project, review
Didainius ce90638
WIP
Didainius 39d44fa
Add missing context
Didainius db263ef
WIP
Didainius d7610ca
Test, docs
Didainius c23d873
Simplify wait
Didainius 9d9c18b
Self review, changelog
Didainius 3eea87c
Fix typo in changelog
Didainius e1ff81f
make testcci
Didainius ba72464
Skip test, when no CCI config is present
Didainius c377b0d
Self review, test
Didainius 45a76f5
staticheck
Didainius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
* New types package `ccitypes` for CCI related types [GH-749] | ||
* New method to get `CciClient` - `VCDClient.GetCciClient` [GH-749] | ||
* `CciClient` low level API interaction methods `IsSupported`, `GetCciUrl`, `PostItemAsync`, `PostItemSync`, `GetItem`, `DeleteItem` [GH-749] | ||
* `CciClient.GetKubeConfig` method for retrieving KubeConfig [GH-749] | ||
* Types `SupervisorNamespace` and `ccitypes.SupervisorNamespace` with methods | ||
`CciClient.CreateSupervisorNamespace`, `CciClient.GetSupervisorNamespaceByName` and | ||
`SupervisorNamespace.Delete` [GH-749] |
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,14 @@ | ||
package ccitypes | ||
|
||
const ( | ||
SupervisorNamespaceKind = "SupervisorNamespace" | ||
ProjectKind = "Project" | ||
InfrastructureCciAPI = "infrastructure.cci.vmware.com" | ||
ProjectCciAPI = "project.cci.vmware.com" | ||
ApiVersion = "v1alpha1" | ||
|
||
SupervisorNamespacesURL = "/apis/infrastructure.cci.vmware.com/v1alpha1/namespaces/%s/supervisornamespaces" | ||
SupervisorProjectsURL = "/apis/project.cci.vmware.com/v1alpha1/projects" | ||
|
||
CciKubernetesSubpath = "%s://%s/cci/kubernetes" | ||
) |
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,124 @@ | ||
package ccitypes | ||
|
||
import ( | ||
"fmt" | ||
|
||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// CciEntityStatus is a container with empty interface to track status of entity | ||
type CciEntityStatus struct { | ||
v1.TypeMeta `json:",inline"` | ||
v1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec any `json:"spec,omitempty"` | ||
Status CciStatus `json:"status,omitempty"` | ||
} | ||
|
||
type CciStatus struct { | ||
Phase string `json:"phase,omitempty"` | ||
Conditions []CciStatusConditions `json:"conditions,omitempty"` | ||
} | ||
|
||
type CciStatusConditions struct { | ||
Message string `json:"message,omitempty"` | ||
Reason string `json:"reason,omitempty"` | ||
Severity string `json:"severity,omitempty"` | ||
Status string `json:"status,omitempty"` | ||
Type string `json:"type,omitempty"` | ||
} | ||
|
||
// CciApiError is a structure that matches error interface and is able to const | ||
type CciApiError struct { | ||
APIVersion string `json:"apiVersion"` | ||
Code int `json:"code"` | ||
Kind string `json:"kind"` | ||
Message string `json:"message"` | ||
v1.ObjectMeta `json:"metadata,omitempty"` | ||
Reason string `json:"reason"` | ||
Status string `json:"status"` | ||
} | ||
|
||
// Error unwraps the CciApiError to human readable error message | ||
func (cciApiError CciApiError) Error() string { | ||
return fmt.Sprintf("error %d: reason: %s, message: %s, status: %s", | ||
cciApiError.Code, cciApiError.Reason, cciApiError.Message, cciApiError.Status) | ||
} | ||
|
||
// SupervisorNamespace definition | ||
type SupervisorNamespace struct { | ||
v1.TypeMeta `json:",inline"` | ||
v1.ObjectMeta `json:"metadata,omitempty"` | ||
Spec SupervisorNamespaceSpec `json:"spec,omitempty"` | ||
Status *SupervisorNamespaceStatus `json:"status,omitempty"` | ||
} | ||
|
||
type SupervisorNamespaceSpec struct { | ||
ClassName string `json:"className,omitempty"` | ||
Description string `json:"description,omitempty"` | ||
InitialClassConfigOverrides SupervisorNamespaceSpecInitialClassConfigOverrides `json:"initialClassConfigOverrides,omitempty"` | ||
RegionName string `json:"regionName,omitempty"` | ||
VpcName string `json:"vpcName,omitempty"` | ||
} | ||
|
||
type SupervisorNamespaceSpecInitialClassConfigOverrides struct { | ||
StorageClasses []SupervisorNamespaceSpecInitialClassConfigOverridesStorageClass `json:"storageClasses,omitempty"` | ||
Zones []SupervisorNamespaceSpecInitialClassConfigOverridesZone `json:"zones,omitempty"` | ||
} | ||
type SupervisorNamespaceSpecInitialClassConfigOverridesStorageClass struct { | ||
LimitMiB int64 `json:"limitMiB"` | ||
Name string `json:"name"` | ||
} | ||
|
||
type SupervisorNamespaceSpecInitialClassConfigOverridesZone struct { | ||
CpuLimitMHz int64 `json:"cpuLimitMHz"` | ||
CpuReservationMHz int64 `json:"cpuReservationMHz"` | ||
MemoryLimitMiB int64 `json:"memoryLimitMiB"` | ||
MemoryReservationMiB int64 `json:"memoryReservationMiB"` | ||
Name string `json:"name"` | ||
} | ||
|
||
type SupervisorNamespaceStatus struct { | ||
Conditions []SupervisorNamespaceStatusConditions `json:"conditions,omitempty"` | ||
NamespaceEndpointURL string `json:"namespaceEndpointURL,omitempty"` | ||
Phase string `json:"phase,omitempty"` | ||
StorageClasses []SupervisorNamespaceStatusStorageClasses `json:"storageClasses,omitempty"` | ||
VMClasses []SupervisorNamespaceStatusVMClasses `json:"vmClasses,omitempty"` | ||
Zones []SupervisorNamespaceStatusZones `json:"zones,omitempty"` | ||
} | ||
|
||
type SupervisorNamespaceStatusConditions struct { | ||
Message string `json:"message,omitempty"` | ||
Reason string `json:"reason,omitempty"` | ||
Severity string `json:"severity,omitempty"` | ||
Status string `json:"status,omitempty"` | ||
Type string `json:"type,omitempty"` | ||
} | ||
|
||
type SupervisorNamespaceStatusStorageClasses struct { | ||
LimitMiB int64 `json:"limitMiB,omitempty"` | ||
Name string `json:"name,omitempty"` | ||
} | ||
|
||
type SupervisorNamespaceStatusVMClasses struct { | ||
Name string `json:"name,omitempty"` | ||
} | ||
|
||
type SupervisorNamespaceStatusZones struct { | ||
CpuLimitMHz int64 `json:"cpuLimitMHz,omitempty"` | ||
CpuReservationMHz int64 `json:"cpuReservationMHz,omitempty"` | ||
MemoryLimitMiB int64 `json:"memoryLimitMiB,omitempty"` | ||
MemoryReservationMiB int64 `json:"memoryReservationMiB,omitempty"` | ||
Name string `json:"name,omitempty"` | ||
} | ||
|
||
type Project struct { | ||
v1.TypeMeta `json:",inline"` | ||
v1.ObjectMeta `json:"metadata,omitempty"` | ||
Spec ProjectSpec `json:"spec,omitempty"` | ||
Status *CciStatus `json:"status,omitempty"` | ||
} | ||
|
||
type ProjectSpec struct { | ||
Description string `json:"description,omitempty"` | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed once #748 is merged