Skip to content

Commit

Permalink
Cloud Run API v1
Browse files Browse the repository at this point in the history
  • Loading branch information
drillbits authored and kelseyhightower committed Jul 9, 2020
1 parent 4efc458 commit b90eea9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
8 changes: 5 additions & 3 deletions konfig.go
Expand Up @@ -56,7 +56,7 @@ const (
UnknownRuntime = RuntimeEnvironment("unknown")
)

const runEndpoint = "https://us-central1-run.googleapis.com/apis/serving.knative.dev/v1alpha1/%s"
const runEndpoint = "https://us-central1-run.googleapis.com/apis/serving.knative.dev/v1/%s"

var (
projectName = "konfig"
Expand Down Expand Up @@ -302,8 +302,10 @@ func getCloudRunEnvironmentVariables() (map[string]string, error) {
}

environmentVariables := make(map[string]string)
for _, env := range s.Spec.RunLatest.Configuration.RevisionTemplate.Spec.Container.Env {
environmentVariables[env.Name] = env.Value
for _, container := range s.Spec.RevisionTemplate.Spec.Containers {
for _, env := range container.Env {
environmentVariables[env.Name] = env.Value
}
}

return environmentVariables, nil
Expand Down
12 changes: 2 additions & 10 deletions service.go
Expand Up @@ -9,23 +9,15 @@ type Service struct {
}

type ServiceSpec struct {
RunLatest RunLatest `json:"runLatest,omitempty"`
}

type RunLatest struct {
Configuration Configuration `json:"configuration,omitempty"`
}

type Configuration struct {
RevisionTemplate RevisionTemplate `json:"revisionTemplate"`
RevisionTemplate RevisionTemplate `json:"template,omitempty"`
}

type RevisionTemplate struct {
Spec RevisionSpec `json:"spec,omitempty"`
}

type RevisionSpec struct {
Container Container `json:"container"`
Containers []Container `json:"containers"`
}

type Container struct {
Expand Down

0 comments on commit b90eea9

Please sign in to comment.