Skip to content

Commit

Permalink
add back json data
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Abro <[email protected]>
  • Loading branch information
AustinAbro321 committed Jul 30, 2024
1 parent da9ea48 commit e8a11ac
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 43 deletions.
81 changes: 40 additions & 41 deletions src/types/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,73 +59,72 @@ type GeneratedPKI struct {
// ZarfState is maintained as a secret in the Zarf namespace to track Zarf init data.
type ZarfState struct {
// Indicates if Zarf was initialized while deploying its own k8s cluster
ZarfAppliance bool `json:"zarfAppliance,omitempty"`
ZarfAppliance bool `json:"zarfAppliance"`
// K8s distribution of the cluster Zarf was deployed to
Distro string `json:"distro,omitempty"`
Distro string `json:"distro"`
// Machine architecture of the k8s node(s)
Architecture string `json:"architecture,omitempty"`
Architecture string `json:"architecture"`
// Default StorageClass value Zarf uses for variable templating
StorageClass string `json:"storageClass,omitempty"`
StorageClass string `json:"storageClass"`
// PKI certificate information for the agent pods Zarf manages
AgentTLS GeneratedPKI `json:"agentTLS,omitempty"`
AgentTLS GeneratedPKI `json:"agentTLS"`

// Information about the repository Zarf is configured to use
GitServer GitServerInfo `json:"gitServer,omitempty"`
GitServer GitServerInfo `json:"gitServer"`
// Information about the container registry Zarf is configured to use
RegistryInfo RegistryInfo `json:"registryInfo,omitempty"`
RegistryInfo RegistryInfo `json:"registryInfo"`
// Information about the artifact registry Zarf is configured to use
ArtifactServer ArtifactServerInfo `json:"artifactServer,omitempty"`
ArtifactServer ArtifactServerInfo `json:"artifactServer"`
}

// DeployedPackage contains information about a Zarf Package that has been deployed to a cluster
// This object is saved as the data of a k8s secret within the 'Zarf' namespace (not as part of the ZarfState secret).
type DeployedPackage struct {
Name string `json:"name,omitempty"`
Data ZarfPackage `json:"data,omitempty"`
CLIVersion string `json:"cliVersion,omitempty"`
Generation int `json:"generation,omitempty"`
DeployedComponents []DeployedComponent `json:"deployedComponents,omitempty"`
Name string `json:"name"`
Data ZarfPackage `json:"data"`
CLIVersion string `json:"cliVersion"`
Generation int `json:"generation"`
DeployedComponents []DeployedComponent `json:"deployedComponents"`
ComponentWebhooks map[string]map[string]Webhook `json:"componentWebhooks,omitempty"`
ConnectStrings ConnectStrings `json:"connectStrings,omitempty"`
}

// DeployedComponent contains information about a Zarf Package Component that has been deployed to a cluster.
type DeployedComponent struct {
Name string `json:"name,omitempty"`
InstalledCharts []InstalledChart `json:"installedCharts,omitempty"`
Status ComponentStatus `json:"status,omitempty"`
ObservedGeneration int `json:"observedGeneration,omitempty"`
Name string `json:"name"`
InstalledCharts []InstalledChart `json:"installedCharts"`
Status ComponentStatus `json:"status"`
ObservedGeneration int `json:"observedGeneration"`
}

// Webhook contains information about a Component Webhook operating on a Zarf package secret.
type Webhook struct {
Name string `json:"name,omitempty"`
Name string `json:"name"`
WaitDurationSeconds int `json:"waitDurationSeconds,omitempty"`
Status WebhookStatus `json:"status,omitempty"`
ObservedGeneration int `json:"observedGeneration,omitempty"`
Status WebhookStatus `json:"status"`
ObservedGeneration int `json:"observedGeneration"`
}

// InstalledChart contains information about a Helm Chart that has been deployed to a cluster.
type InstalledChart struct {
Namespace string `json:"namespace,omitempty"`
ChartName string `json:"chartName,omitempty"`
Namespace string `json:"namespace"`
ChartName string `json:"chartName"`
}

// GitServerInfo contains information Zarf uses to communicate with a git repository to push/pull repositories to.
type GitServerInfo struct {
// Username of a user with push access to the git repository
PushUsername string `json:"pushUsername,omitempty"`
PushUsername string `json:"pushUsername"`
// Password of a user with push access to the git repository
PushPassword string `json:"pushPassword,omitempty"`
PushPassword string `json:"pushPassword"`
// Username of a user with pull-only access to the git repository. If not provided for an external repository then the push-user is used
PullUsername string `json:"pullUsername,omitempty"`
PullUsername string `json:"pullUsername"`
// Password of a user with pull-only access to the git repository. If not provided for an external repository then the push-user is used
PullPassword string `json:"pullPassword,omitempty"`

PullPassword string `json:"pullPassword"`
// URL address of the git server
Address string `json:"address,omitempty"`
Address string `json:"address"`
// Indicates if we are using a git server that Zarf is directly managing
InternalServer bool `json:"internalServer,omitempty"`
InternalServer bool `json:"internalServer"`
}

// FillInEmptyValues sets every necessary value that's currently empty to a reasonable default
Expand Down Expand Up @@ -168,13 +167,13 @@ func (gs *GitServerInfo) FillInEmptyValues() error {
// ArtifactServerInfo contains information Zarf uses to communicate with a artifact registry to push/pull repositories to.
type ArtifactServerInfo struct {
// Username of a user with push access to the artifact registry
PushUsername string `json:"pushUsername,omitempty"`
PushUsername string `json:"pushUsername"`
// Password of a user with push access to the artifact registry
PushToken string `json:"pushToken,omitempty"`
PushToken string `json:"pushPassword"`
// URL address of the artifact registry
Address string `json:"address,omitempty"`
Address string `json:"address"`
// Indicates if we are using a artifact registry that Zarf is directly managing
InternalServer bool `json:"internalServer,omitempty"`
InternalServer bool `json:"internalServer"`
}

// FillInEmptyValues sets every necessary value that's currently empty to a reasonable default
Expand All @@ -194,21 +193,21 @@ func (as *ArtifactServerInfo) FillInEmptyValues() {
// RegistryInfo contains information Zarf uses to communicate with a container registry to push/pull images.
type RegistryInfo struct {
// Username of a user with push access to the registry
PushUsername string `json:"pushUsername,omitempty"`
PushUsername string `json:"pushUsername"`
// Password of a user with push access to the registry
PushPassword string `json:"pushPassword,omitempty"`
PushPassword string `json:"pushPassword"`
// Username of a user with pull-only access to the registry. If not provided for an external registry than the push-user is used
PullUsername string `json:"pullUsername,omitempty"`
PullUsername string `json:"pullUsername"`
// Password of a user with pull-only access to the registry. If not provided for an external registry than the push-user is used
PullPassword string `json:"pullPassword,omitempty"`
PullPassword string `json:"pullPassword"`
// URL address of the registry
Address string `json:"address,omitempty"`
Address string `json:"address"`
// Nodeport of the registry. Only needed if the registry is running inside the kubernetes cluster
NodePort int `json:"nodePort,omitempty"`
NodePort int `json:"nodePort"`
// Indicates if we are using a registry that Zarf is directly managing
InternalRegistry bool `json:"internalRegistry,omitempty"`
InternalRegistry bool `json:"internalRegistry"`
// Secret value that the registry was seeded with
Secret string `json:"secret,omitempty"`
Secret string `json:"secret"`
}

// FillInEmptyValues sets every necessary value not already set to a reasonable default
Expand Down
4 changes: 2 additions & 2 deletions src/types/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ type ZarfSplitPackageData struct {
// ConnectString contains information about a connection made with Zarf connect.
type ConnectString struct {
// Descriptive text that explains what the resource you would be connecting to is used for
Description string
Description string `json:"description"`
// URL path that gets appended to the k8s port-forward result
URL string
URL string `json:"url"`
}

// ConnectStrings is a map of connect names to connection information.
Expand Down

0 comments on commit e8a11ac

Please sign in to comment.